:root {
    --mhr-col: 320px;
    --mhr-low: #1cdce9;
    --mhr-high: #fb6d00;
    --mhr-master: #ddb500;
    --mhr-active: #2e9e3a;
    --mhr-max: #e69500;
}
:root[data-theme="light"] { --mhr-low: #0a8f99; --mhr-master: #9a7b00; }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) { --mhr-low: #0a8f99; --mhr-master: #9a7b00; }
}
.mhr-platform { height: 12px; width: auto; margin-right: 6px; vertical-align: middle; }
.mhr-card-main.mhr-weapon-main { flex: 1 1 260px; }
.mhr-sheet-row.wa-btn-danger, .mhr-sheet-row.wa-btn-danger .wa-row-title { color: var(--wa-danger); }

.mhr-icon { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; flex: none; }
.mhr-icon-sm { width: 16px; height: 16px; object-fit: contain; vertical-align: middle; flex: none; }
.mhr-icon-lg { width: 40px; height: 40px; object-fit: contain; flex: none; }
.mhr-icon-xl { width: 56px; height: 56px; object-fit: contain; flex: none; }

:root[data-theme="light"] .mhr-tint { filter: brightness(0); }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .mhr-tint { filter: brightness(0); }
}

.mhr-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--mhr-col)), 1fr)); margin: 8px 0 12px; }
.mhr-card { display: flex; flex-direction: column; gap: 6px; background: var(--wa-surface); border: 1px solid var(--wa-border); border-radius: var(--wa-radius); padding: 10px 12px; color: var(--wa-text); text-decoration: none; min-width: 0; position: relative; }
a.mhr-card:hover, .mhr-card[data-choose]:hover { border-color: var(--wa-accent); cursor: pointer; }
.mhr-card[hidden] { display: none; }
.mhr-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mhr-card-title { font-weight: 600; overflow-wrap: anywhere; }
.mhr-card-sub { font-size: .85rem; color: var(--wa-muted); overflow-wrap: anywhere; }
.mhr-card-main { flex: 1; min-width: 0; }
.mhr-card-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mhr-card p { margin: 0; font-size: .9rem; }
.mhr-done { opacity: .65; }
.mhr-done .mhr-card-title { text-decoration: line-through; }

.mhr-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; align-items: center; }
.mhr-stats > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.mhr-label { color: var(--wa-muted); font-size: .8rem; }
.mhr-slots { display: inline-flex; gap: 2px; align-items: center; }
.mhr-slots img { width: 18px; height: 18px; }
.mhr-plus { color: var(--mhr-active); }
.mhr-minus { color: var(--wa-danger); }
.mhr-max { color: var(--mhr-max); font-weight: 600; }
.mhr-rank-low { color: var(--mhr-low); }
.mhr-rank-high { color: var(--mhr-high); }
.mhr-rank-master { color: var(--mhr-master); }
.mhr-ext-red { color: #ff0000; font-weight: 600; }
.mhr-ext-white { color: var(--wa-text); font-weight: 600; }
.mhr-ext-orange { color: #ffa500; font-weight: 600; }
.mhr-ext-green { color: #008000; font-weight: 600; }
.mhr-ext-unknown { color: #a9a9a9; font-weight: 600; }

.mhr-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; cursor: pointer; user-select: none; }
.mhr-toggle input { width: 18px; height: 18px; accent-color: var(--wa-accent); cursor: pointer; margin: 0; }

.mhr-group { margin: 10px 0; }
.mhr-group-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--wa-surface-2); border: 1px solid var(--wa-border); border-radius: var(--wa-radius); font-weight: 600; }
.mhr-group-head .mhr-toggle { margin-left: auto; font-weight: 400; }
.mhr-group-head img { width: 24px; height: 24px; object-fit: contain; }

.mhr-summary { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-around; gap: 12px; flex-wrap: wrap; padding: 8px 12px; margin: 12px 0; background: var(--wa-surface-2); border: 1px solid var(--wa-border); border-radius: var(--wa-radius); font-size: .9rem; font-variant-numeric: tabular-nums; }
.mhr-summary > span { display: inline-flex; align-items: center; gap: 6px; }

.mhr-sharp { display: flex; height: 10px; min-width: 120px; width: 100%; background: #070000; border: 1px solid #070000; border-radius: 2px; overflow: hidden; cursor: pointer; }
.mhr-sharp span { display: block; height: 100%; }
.mhr-sharp .mhr-sharp-hc { box-shadow: inset 0 3px 0 #a8f0ec; }

.mhr-dialog { max-width: min(94vw, 640px) !important; max-height: 90vh; overflow: auto; }
.mhr-dialog-wide { max-width: min(96vw, 1000px) !important; }
.mhr-dialog-title { margin: 0 0 12px; font-size: 1.15rem; }
.mhr-chooser-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: -20px; background: var(--wa-surface); padding-top: 4px; z-index: 2; }
.mhr-chooser-head .mhr-dialog-title { margin: 0; }
.mhr-end { justify-content: flex-end; }
.mhr-sheet { max-height: 60vh; overflow: auto; }
.mhr-sheet-row { width: 100%; border: 0; border-bottom: 1px solid var(--wa-border); background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.mhr-sheet-row:hover { background: var(--wa-surface-2); }

.mhr-settings-section { margin: 16px 0 6px; font-weight: 600; color: var(--wa-muted); border-bottom: 1px solid var(--wa-border); padding-bottom: 4px; }
.mhr-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 16px; }
.mhr-segment { display: inline-flex; border: 1px solid var(--wa-border); border-radius: 8px; overflow: hidden; }
.mhr-segment label { padding: 6px 12px; cursor: pointer; font-size: .9rem; }
.mhr-segment input { display: none; }
.mhr-segment input:checked + span { color: var(--wa-accent-fg); font-weight: 700; }
.mhr-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; flex-wrap: wrap; }

.mhr-table td, .mhr-table th { white-space: nowrap; }
.mhr-table td.mhr-wrap { white-space: normal; }
.mhr-table img { width: 20px !important; height: 20px !important; }
th.mhr-sortable { cursor: pointer; user-select: none; }
th.mhr-sortable[data-dir="asc"]::after { content: " ▲"; font-size: .7em; }
th.mhr-sortable[data-dir="desc"]::after { content: " ▼"; font-size: .7em; }
.mhr-tables { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.mhr-tables .wa-table-wrap { margin: 0; }

.mhr-crowns { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 8px 0; }
.mhr-crown-col { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.mhr-crown-stack { display: flex; flex-direction: column; gap: 4px; align-items: center; min-width: 20px; }

.mhr-hero-images { display: flex; gap: 12px; flex-wrap: wrap; }
.mhr-hero-images figure { margin: 0; text-align: center; }
.mhr-hero-images img { width: 160px; height: 160px; object-fit: contain; background: var(--wa-surface-2); border-radius: var(--wa-radius); }
.mhr-big-image { max-width: 100%; height: auto; display: block; margin: 0 auto; background: var(--wa-surface-2); border-radius: var(--wa-radius); }

.mhr-mats { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.mhr-mat { display: flex; align-items: center; gap: 8px; color: var(--wa-text); text-decoration: none; padding: 2px 0; }
.mhr-mat .mhr-amount { margin-left: auto; color: var(--wa-muted); font-variant-numeric: tabular-nums; }

.mhr-builder { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
.mhr-builder .wa-card { margin: 0; }
.mhr-slot { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--wa-border); border-radius: 8px; background: var(--wa-surface-2); cursor: pointer; margin: 6px 0; width: 100%; font: inherit; color: inherit; text-align: left; }
.mhr-slot:hover { border-color: var(--wa-accent); }
.mhr-slot .mhr-card-main { min-width: 0; }
.mhr-slot-empty { color: var(--wa-muted); }
.mhr-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mhr-switch-skill { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--wa-border); border-radius: 6px; cursor: pointer; background: var(--wa-surface); font: inherit; color: inherit; width: 100%; text-align: left; }
.mhr-switch-skill .mhr-num { font-weight: 700; min-width: 1.2em; }
.mhr-actionbar { position: sticky; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 10px; margin-top: 12px; background: var(--wa-surface); border: 1px solid var(--wa-border); border-radius: var(--wa-radius); box-shadow: var(--wa-shadow); }
.mhr-skill-level { display: inline-flex; align-items: center; gap: 6px; }
.mhr-skill-level button { min-width: 34px; padding: 4px 8px; }
.mhr-warning { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--wa-warning) 18%, transparent); color: var(--wa-text); }
.mhr-result-grid { display: grid; gap: 4px 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.mhr-inline { display: inline-flex; align-items: center; gap: 6px; }
.mhr-stepper { display: inline-flex; align-items: center; gap: 4px; }
.mhr-stepper input { width: 64px; text-align: center; }
.mhr-stepper button { min-width: 32px; padding: 4px 8px; }
.mhr-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.mhr-tab-links { margin-top: 0; }
.mhr-error-tint { filter: brightness(0) saturate(100%) invert(14%) sepia(90%) saturate(4000%) hue-rotate(350deg); }
.mhr-indeterminate { width: 40% !important; animation: mhr-indeterminate 1.2s ease-in-out infinite; }
@keyframes mhr-indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
