.ace-main { max-width: var(--bashin-shell-width); margin: 0 auto; padding: 0 var(--bashin-page-gutter) 24px; }
.tool-header__meta { max-width: calc(50% - 170px); font-size: .78rem; line-height: 1.5; color: var(--bashin-muted); }
.controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 14px; border: 1px solid var(--bashin-border); background: var(--bashin-panel); border-radius: var(--bashin-panel-radius); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.field > span { font-size: .72rem; color: var(--bashin-muted); font-weight: 600; }
.field select, .field input { width: 100%; min-height: 38px; background: var(--bashin-control-bg); color: var(--bashin-text); border: 1px solid var(--bashin-border); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .84rem; }
.field select option { background: var(--bashin-bg); }
.search-field { flex: 1; min-width: 190px; }
.toggle { display: flex; align-items: center; gap: 8px; min-height: 38px; font-size: .8rem; cursor: pointer; }
.toggle input { width: 17px; height: 17px; accent-color: var(--bashin-accent); }
.ranking-intro { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 18px; color: var(--bashin-muted); font-size: .78rem; padding: 6px 2px; }
.ranking-intro p { margin: 10px 0; }
.ranking-intro { align-items: center; }
.ace-row { border: 1px solid var(--bashin-border); background: var(--bashin-panel); border-radius: 10px; margin-bottom: 6px; overflow: hidden; }
.ace-row > summary { padding: 9px 14px; cursor: pointer; list-style: none; }
.ace-row > summary::-webkit-details-marker { display: none; }
.ace-row > summary:hover { background: rgba(148,163,184,.055); }
.ace-row[open] { border-color: var(--bashin-accent-border); }
.uma { display: flex; align-items: center; gap: 12px; min-width: 0; }
.uma img { width: 54px; height: 59px; object-fit: contain; flex-shrink: 0; }
.uma-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; font-weight: 600; line-height: 1.4; }
.style { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--style-color); background: color-mix(in srgb, var(--style-color) 15%, transparent); font-size: .8rem; font-weight: 600; color: var(--bashin-text); }
.style img { width: 20px; height: 20px; }
.style-NIGE { --style-color: #1882ef; }
.style-SEN { --style-color: #31be21; }
.style-SASI { --style-color: #f7ba00; }
.style-OI { --style-color: #e77118; }
.ace-row > summary > .total { text-align: left; }
.aptitudes { display: flex; gap: 10px; }
.aptitude { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.aptitude small { color: var(--bashin-muted); font-size: .59rem; }
.aptitude strong { color: #f5cb6e; font-size: .87rem; }
.aptitude .grade-A { color: #ea580c; }
.aptitude .grade-B { color: #ec4899; }
.aptitude .grade-C { color: #4ade80; }
.aptitude .grade-D { color: #38bdf8; }
.aptitude .grade-E { color: #c084fc; }
.aptitude .grade-F { color: #8b5cf6; }
.aptitude .grade-G { color: #94a3b8; }
.metric { text-align: right; font-size: .88rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.total { color: var(--bashin-skill-value); font-size: 1.13rem; }
.negative { color: #fda4af; }
.events-off { color: var(--bashin-muted); }
.chevron { color: var(--bashin-muted); transition: transform .15s; }
.ace-row[open] .chevron { transform: rotate(180deg); }
.kit-detail { border-top: 1px solid var(--bashin-border); padding: 14px 18px 16px 58px; }
.kit-groups { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.kit-group h3 { margin: 0 0 10px; font-size: .75rem; color: var(--bashin-muted); font-weight: 600; }
.skill-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.skill-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; box-sizing: border-box; padding: 6px 9px; border: 1px solid var(--bashin-skill-pill-border); border-radius: var(--bashin-skill-pill-radius); background: var(--bashin-skill-pill-bg); color: var(--bashin-text); text-decoration: none; font-size: .78rem; font-weight: 500; line-height: 1.3; }
.skill-pill img { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
.skill-pill > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.costume-name { display: block; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; color: var(--bashin-muted); font-size: .73rem; font-weight: 400; }
.skill-pill.unique { border-color: #42b4b780; color: #a5f3fc; }
.skill-pill.gold { border-color: #b6944280; color: #fde68a; }
.skill-pill.inactive { opacity: .55; }
a.skill-pill { transition: filter 140ms ease; }
a.skill-pill:hover { filter: brightness(1.12); }
.skill-dialog { position: fixed; z-index: 1000; display: flex; flex-direction: column; width: min(760px, calc(100vw - 16px)); height: min(680px, calc(100dvh - 16px)); max-height: calc(100dvh - 16px); box-sizing: border-box; padding: 0; overflow: hidden; border: 1px solid var(--bashin-border); border-radius: 12px; background: var(--bashin-bg); color: var(--bashin-text); box-shadow: 0 16px 48px #0009; }
.skill-dialog[hidden] { display: none; }
.skill-dialog.is-loading { opacity: 0; pointer-events: none; }
.skill-dialog iframe { flex: 1; min-height: 0; width: 100%; border: 0; }
.skill-dialog [hidden] { display: none; }
#skillFallback { margin: 0; padding: 16px; line-height: 1.6; overflow: auto; overscroll-behavior: contain; }
.kit-note { margin: 12px 0 0; font-size: .75rem; line-height: 1.6; color: var(--bashin-muted); }
.kit-note a, .tool-about a { color: var(--bashin-accent); }
.recovery-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--bashin-border); }
.recovery-plan h4 { margin: 0 0 10px; color: var(--bashin-text); font-size: .8rem; font-weight: 600; }
.recovery-plan strong { color: var(--bashin-skill-value); font-weight: 600; }
.conditional-recovery { color: #f5cb6e; }
.kit-group:has(.recovery-plan) { grid-column: 1 / -1; }
.recovery-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 18px; padding: 12px 0; }
.recovery-row + .recovery-row { border-top: 1px solid var(--bashin-border); }
.recovery-row h4 { margin: 6px 0 0; }
.recovery-row h4 .muted { display: block; font-size: .7rem; font-weight: 400; margin-top: 4px; }
.recovery-row .kit-note { margin-top: 6px; }
.recovery-row > div > .kit-note:first-child { margin-top: 3px; }
.recovery-conditional { margin-top: 8px; font-size: .75rem; color: var(--bashin-muted); }
.recovery-conditional > summary { cursor: pointer; }
.recovery-pool { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; }
.recovery-option { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; }
.recovery-option .conditional-recovery { font-size: .68rem; }
.recovery-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin: 12px 0 0; }
.recovery-stats dt { color: var(--bashin-muted); font-size: .7rem; }
.recovery-stats dd { margin: 4px 0 2px; color: var(--bashin-text); font-size: .85rem; font-weight: 600; }
.recovery-stats small { color: var(--bashin-muted); font-size: .65rem; }
@media (max-width: 650px) {
    .recovery-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .recovery-row h4 .muted { display: inline; }
}
.tool-about { font-size: .8rem; line-height: 1.7; }
.method-body a { color: var(--bashin-accent); }
.methodology { margin-top: 20px; border: 1px solid var(--bashin-border); border-radius: 10px; padding: 14px; color: #cbd5e1; font-size: .8rem; line-height: 1.7; }
.methodology > summary { cursor: pointer; font-weight: 600; }
.method-body p { margin: 12px 0; }
.settings-table { border-collapse: collapse; max-width: 650px; width: 100%; font-variant-numeric: tabular-nums; font-size: .77rem; }
.settings-table th, .settings-table td { text-align: right; border-bottom: 1px solid var(--bashin-border); padding: 6px; }
.settings-table th:first-child, .settings-table td:first-child { text-align: left; }
.muted { color: var(--bashin-muted); }
.empty { padding: 40px 18px; text-align: center; border: 1px dashed var(--bashin-border); border-radius: 10px; color: var(--bashin-muted); }
.error { color: #fda4af; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--bashin-accent); outline-offset: 3px; }
@media (max-width: 1100px) {
    .tool-header { flex-direction: column; gap: 8px; padding: 10px 4px; margin-bottom: 8px; }
    .tool-header__meta { position: static; width: auto; max-width: none; text-align: center; font-size: .78rem; }
}
@media (max-width: 1000px) {
    .controls .toggle { flex: 1; }
}
@media (max-width: 760px) {
    .controls { gap: 10px; padding: 12px; }
    .field { min-width: 0; flex: 1 1 42%; }
    .search-field { flex-basis: 100%; }
    .controls .toggle { flex: 1 1 100%; min-height: 30px; }
    .ace-row > summary { display: grid; align-items: center; grid-template-columns: 78px minmax(0,1fr) 75px 12px; row-gap: 10px; padding: 10px; }
    .uma { grid-column: 2 / 4; grid-row: 1; gap: 8px; }
    .uma img { width: 42px; height: 47px; }
    .uma-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
    .total { grid-column: 1; grid-row: 1; font-size: 1.08rem; }
    .chevron { grid-column: 4; grid-row: 1; }
    .style { grid-column: 1; grid-row: 2; align-self: center; }
    .aptitudes { grid-column: 2; grid-row: 2; margin-left: 0; justify-content: center; gap: 8px; }
    .core-metric, .event-metric { grid-column: 3; grid-row: 2; font-size: .7rem; }
    .core-metric { align-self: start; }
    .event-metric { align-self: end; padding-top: 17px; }
    .core-metric::before { content: 'Core '; color: var(--bashin-muted); font-weight: 400; }
    .event-metric::before { content: 'Events '; color: var(--bashin-muted); font-weight: 400; }
    .kit-detail { padding: 12px; }
    .kit-groups { grid-template-columns: 1fr; gap: 14px; }
    .ranking-intro { font-size: .72rem; }
    .ranking-intro p { margin: 6px 0; }
}

/* Keep ranking order left-to-right; expanded kits have their own full-width row. */
#ranking { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 10px; align-items: start; }
.ace-row { margin: 0; }
.ace-row[open], .empty { grid-column: 1 / -1; }
.ace-row > summary { display: grid; align-items: center; grid-template-columns: 78px minmax(0, 1fr) auto 12px; gap: 10px 8px; padding: 12px; }
.uma { grid-area: 1 / 2 / 2 / 4; gap: 8px; }
.uma img { width: 42px; height: 47px; }
.uma-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.total { grid-area: 1 / 1; font-size: 1.12rem; }
.total::before { content: 'Mean bashin'; display: block; color: var(--bashin-muted); font-size: .6rem; font-weight: 400; margin-bottom: 3px; }
.chevron { grid-area: 1 / 4; }
.style { grid-area: 2 / 1; align-self: center; }
.aptitudes { grid-area: 2 / 2; margin-left: 0; justify-content: start; gap: 10px; }
.core-metric, .event-metric { grid-area: 2 / 3; font-size: .7rem; }
.core-metric { align-self: start; }
.event-metric { align-self: end; padding-top: 17px; }
.core-metric::before { content: 'Core '; color: var(--bashin-muted); font-weight: 400; }
.event-metric::before { content: 'Events '; color: var(--bashin-muted); font-weight: 400; }
.ace-row[open] > summary { max-width: 550px; }
.kit-detail { padding: 14px; }

/* Match the Visualizer's score-dependent green scale and subtle glow. */
.bashin-value { display: inline-block; color: var(--mean-text, var(--bashin-skill-value)); text-shadow: 0 0 12px color-mix(in srgb, var(--mean-text, var(--bashin-skill-value)) 22%, transparent); }
