@import url('https://fonts.googleapis.com/css?family=Itim:700|Itim:400');

@font-face {
  font-family: "Gen Jyuu Gothic Web";
  src: url("../fonts/GenJyuuGothic-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: #ebf1f2;
  --panel: #ffffff;
  --panel-soft: #dce8e9;
  --panel-muted: #f4f8f8;
  --line: #a6c4c8;
  --line-soft: #cbdadd;
  --text: #070a0b;
  --muted: #3f4766;
  --muted-strong: #18242a;
  --accent: #7676aa;
  --accent-soft: #eeedf8;
  --amber: #a45a00;
  --amber-soft: #fff5e1;
  --amber-line: #d2a13d;
  --green: #248a3d;
  --green-soft: #ecf8ee;
  --status-green: #187a4b;
  --status-green-soft: #e6f6ee;
  --shadow: 0 8px 24px rgba(7, 10, 11, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #070a0b;
  --panel: #0b1114;
  --panel-soft: #11181a;
  --panel-muted: #0f1517;
  --line: #3f4766;
  --line-soft: #252b3d;
  --text: #ebf1f2;
  --muted: #a6c4c8;
  --muted-strong: #d6e3e4;
  --accent: #7676aa;
  --accent-soft: rgba(118, 118, 170, 0.18);
  --amber: #ffb340;
  --amber-soft: rgba(255, 179, 64, 0.12);
  --amber-line: #80672e;
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.12);
  --status-green: #55c98b;
  --status-green-soft: #19392c;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: "Itim", "Gen Jyuu Gothic Web", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .entry-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-shell { width: min(1320px, 100%); margin: 0 auto; padding: 0 24px 44px; }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line-soft); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #1d1d1f; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .7px; }
.brand small, .brand strong { display: block; }
.brand small { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .8px; line-height: 1.2; }
.brand strong { font-size: 17px; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.back-link, .theme-toggle, .reset-button { min-height: 35px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted-strong); text-decoration: none; font-size: 12px; }
.back-link { display: inline-flex; align-items: center; }
.back-link:hover, .theme-toggle:hover, .reset-button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
.theme-toggle span:first-child { font-size: 17px; line-height: 1; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 30px; padding: 42px 0 30px; }
.kicker { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .8px; line-height: 1.2; }
.hero h1, .section-heading h2, .group-heading h2 { margin: 0; letter-spacing: 0; }
.hero h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 700; line-height: 1.08; }
.hero-copy > p:last-child { max-width: 700px; margin: 14px 0 0; color: var(--muted); }
.summary { display: flex; gap: 8px; }
.summary-item { min-width: 96px; padding: 14px 15px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); }
.summary-item strong, .summary-item span { display: block; }
.summary-item strong { font-size: 24px; line-height: 1.1; }
.summary-item span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.control-panel { display: grid; grid-template-columns: minmax(280px, 1fr) 220px auto; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.search-field, .select-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.search-field { position: relative; justify-content: center; }
.search-field > span { position: absolute; left: 12px; top: 29px; color: var(--muted); font-size: 20px; transform: translateY(-50%); pointer-events: none; }
.search-field input, .select-field select { width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-muted); color: var(--text); }
.search-field input { padding: 0 12px 0 38px; }
.select-field span { color: var(--muted); font-size: 11px; }
.select-field select { padding: 0 10px; }
.reset-button { min-height: 43px; }

.team-section { padding: 34px 0 23px; }
.section-heading, .group-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.section-heading h2 { font-size: 22px; }
.muted, .group-heading > strong { color: var(--muted); font-size: 12px; font-weight: 500; }
.position-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 13px 1px 3px; scrollbar-width: thin; }
.position-tab { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted-strong); font-size: 13px; white-space: nowrap; }
.position-tab > span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.position-tab small { color: var(--muted); font-size: 11px; }
.position-tab:hover, .position-tab.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.person-group { padding-top: 16px; }
.group-heading { padding: 0 1px 11px; border-bottom: 1px solid var(--line-soft); }
.group-heading h2 { font-size: 25px; line-height: 1.1; }
.group-heading span { color: var(--muted); font-size: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding-top: 14px; }
.entry-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 4px 15px rgba(0,0,0,.04); transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.entry-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.card-art { display: grid; place-items: center; min-height: 176px; overflow: hidden; background: var(--panel-soft); }
.card-art img { display: block; width: auto; max-width: 100%; height: 194px; margin: 0 auto; object-fit: contain; object-position: 50% 50%; }
.art-fallback { display: grid; place-items: center; align-content: center; gap: 5px; width: 100%; min-height: 176px; padding: 20px; color: var(--muted); text-align: center; }
.art-fallback strong { color: var(--text); font-size: 32px; }
.art-fallback span { color: var(--accent); font-size: 15px; }
.art-fallback small { font-size: 11px; }
.entry-body { display: flex; flex: 1; flex-direction: column; gap: 11px; padding: 15px; }
.entry-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.entry-heading h3 { margin: 0; font-size: 20px; line-height: 1.2; }
.entry-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.concept-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1px solid var(--amber); border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 11px; white-space: nowrap; }
.entry-subline, .entry-levels { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.entry-effects { display: grid; gap: 7px; }
.entry-effect-row { display: grid; gap: 2px; padding: 9px 10px; border-left: 3px solid var(--accent); background: var(--panel-soft); }
.entry-effect-row small { color: var(--muted); font-size: 10px; }
$1

.entry-effect-row.formation-effect {
  border: 1px solid var(--amber-line);
  border-left-width: 3px;
  background: var(--amber-soft);
}

.entry-effect-row.formation-effect small {
  color: var(--amber);
  font-weight: 700;
}

.entry-effect-row.formation-effect strong {
  color: var(--text);
}
.entry-effect-row.popup-entry-effect { border: 1px solid var(--amber-line); border-left-width: 3px; background: var(--amber-soft); }
.entry-effect-row.popup-entry-effect small { color: var(--amber); font-weight: 700; }
.entry-effect-row.popup-entry-effect strong { color: var(--text); }
.open-detail { width: 100%; min-height: 38px; margin-top: auto; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--accent); font-size: 13px; text-align: center; }
.open-detail:hover { background: var(--accent-soft); }
.open-detail span { margin-left: 6px; }
.back-to-top { position: fixed; right: 22px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7)); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s ease, transform .18s ease, color .18s ease; }
.back-to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { color: var(--text); }
.back-to-top span { font-size: 23px; line-height: 1; }

.loading-state, .empty-state { display: grid; place-items: center; min-height: 230px; color: var(--muted); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--text); font-size: 17px; }
.empty-state span { margin-top: 5px; font-size: 13px; }
.spinner { width: 25px; height: 25px; margin-bottom: 8px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.site-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }

.detail-dialog { position: fixed; inset: 0; width: min(980px, calc(100% - 30px)); max-height: calc(100% - 30px); margin: auto; padding: 0; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); box-shadow: 0 25px 80px rgba(0,0,0,.28); }
.detail-dialog::backdrop { background: rgba(0,0,0,.56); backdrop-filter: blur(3px); }
.dialog-frame { position: relative; max-height: calc(100vh - 30px); overflow: auto; padding: 24px; }
.detail-return-hint { --return-lift: 0px; position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 8; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: transparent; color: var(--text); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7)); opacity: 0; transform: translate(-50%, calc(12px + var(--return-lift))) scale(.82); pointer-events: none; transition: opacity .12s ease, transform .12s cubic-bezier(.22, .8, .32, 1), color .15s ease; }
.detail-return-hint.is-visible { opacity: 1; transform: translate(-50%, var(--return-lift)) scale(1); }
.detail-return-hint.is-ready { background: transparent; color: var(--text); animation: detail-return-ready .38s cubic-bezier(.2, .85, .3, 1.25); }
.detail-return-hint span { font-size: 23px; line-height: 1; }
@keyframes detail-return-ready { 0% { transform: translate(-50%, var(--return-lift)) scale(1); } 55% { transform: translate(-50%, var(--return-lift)) scale(1.18); } 100% { transform: translate(-50%, var(--return-lift)) scale(1.08); } }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 35px; height: 35px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(20, 20, 22, .72); color: var(--muted-strong); font-size: 0; line-height: 0; text-align: center; }
.dialog-close::before, .dialog-close::after { content: ""; position: absolute; width: 17px; height: 2px; border-radius: 999px; background: currentColor; }
.dialog-close::before { transform: rotate(45deg); }
.dialog-close::after { transform: rotate(-45deg); }
.dialog-close:hover { border-color: var(--accent); color: var(--accent); }
.detail-top { display: grid; grid-template-columns: minmax(210px, 300px) minmax(0, 1fr); align-items: stretch; gap: 24px; }
.detail-art { position: relative; display: grid; place-items: center; min-height: 420px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-soft); }
.detail-art img { display: block; width: auto; max-width: 100%; height: 420px; margin: 0 auto; object-fit: contain; object-position: 50% 50%; }
.detail-art .art-fallback { min-height: 420px; }
.detail-summary { align-self: center; text-align: center; }
.detail-summary h2 { margin: 0; font-size: 34px; line-height: 1.12; }
.detail-summary > p:not(.kicker):not(.detail-note) { margin: 9px 0 0; color: var(--muted); }
.detail-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 16px; }
.detail-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; }
.detail-summary .popup-skill { width: min(420px, 100%); margin: 20px auto 0; border: 1px solid var(--amber-line); border-top-width: 3px; border-radius: 8px; }
.grade-tabs { display: flex; justify-content: center; gap: 8px; padding: 22px 0 15px; border-bottom: 1px solid var(--line-soft); }
.grade-tab { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted-strong); font-size: 13px; }
.grade-tab.is-active, .grade-tab:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.detail-view { width: min(900px, 100%); margin: 0 auto; text-align: center; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 18px; }
.detail-section { min-width: 0; padding: 15px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-muted); text-align: center; }
.section-title { display: flex; align-items: center; justify-content: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); font-size: 17px; font-weight: 650; }
.section-title strong { color: var(--accent); font-size: 12px; }
.detail-description { margin: 13px 0; color: var(--muted-strong); font-size: 13px; text-align: center; white-space: pre-line; }
.effect-list, .support-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.effect-chip, .support-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.support-list { margin-top: 10px; }
.support-chip { border-color: var(--line); background: var(--panel); color: var(--muted-strong); }
.empty-effect, .unavailable { color: var(--muted); font-size: 12px; }
.unavailable { padding: 12px; border-top: 3px solid var(--amber); background: var(--amber-soft); text-align: center; }
.popup-skill { display: grid; justify-items: center; gap: 5px; margin-top: 16px; padding: 12px; border-top: 3px solid var(--amber); background: var(--amber-soft); text-align: center; }
.popup-skill .detail-label { color: var(--amber); font-size: 12px; font-weight: 700; }
.popup-skill strong { font-size: 13px; font-weight: 600; }
.popup-skill small { color: var(--muted); font-size: 11px; }

:root[data-theme="dark"] .brand-mark { background: #f5f5f7; color: #1d1d1f; }
:root[data-theme="dark"] .entry-card:hover { box-shadow: 0 12px 30px rgba(0,0,0,.28); }

@media (max-width: 1000px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-panel { grid-template-columns: minmax(0, 1fr) 180px auto; }
}
@media (max-width: 700px) {
  .site-shell { padding: 0 14px 30px; }
  .topbar { min-height: 65px; }
  .brand strong { font-size: 16px; }
  .back-link { display: inline-flex; padding: 0 9px; font-size: 11px; }
  .hero { grid-template-columns: 1fr; gap: 18px; padding: 28px 0 22px; }
  .hero h1 { font-size: 34px; }
  .summary { justify-content: stretch; }
  .summary-item { flex: 1 1 0; min-width: 0; padding: 11px; }
  .summary-item strong { font-size: 20px; }
  .control-panel { grid-template-columns: minmax(0, 1fr) auto; }
  .search-field { grid-column: 1 / -1; }
  .reset-button { min-width: 0; }
  .card-grid { grid-template-columns: 1fr; }
  .card-art, .card-art img, .art-fallback { min-height: 142px; height: 158px; }
  .entry-body { padding: 14px; }
  .detail-dialog { width: calc(100% - 12px); max-height: calc(100% - 12px); }
  .dialog-frame { max-height: calc(100vh - 12px); padding: 14px; }
  .detail-top { grid-template-columns: 1fr; gap: 16px; }
  .detail-art, .detail-art img, .detail-art .art-fallback { min-height: 390px; height: 390px; }
  .detail-summary { text-align: center; }
  .detail-summary h2 { font-size: 28px; }
  .detail-tags { justify-content: center; }
  .grade-tabs { justify-content: center; flex-wrap: wrap; }
  .detail-grid { grid-template-columns: 1fr; }
  .back-to-top { right: 14px; width: 42px; height: 42px; }
}
@media (max-width: 420px) {
  .theme-toggle { padding: 0 9px; }
  #themeLabel { display: none; }
  .hero h1 { font-size: 31px; }
  .card-art, .card-art img, .art-fallback { min-height: 170px; height: 190px; }
  .entry-heading h3 { font-size: 18px; }
}

/* Align the search icon to the input itself and share the encyclopedia header rhythm. */
.search-field > span { top: 50%; left: 12px; display: grid; place-items: center; width: 20px; height: 20px; line-height: 1; transform: translateY(-50%); }
.search-field input, .select-field select { line-height: 1.2; }
.reset-button { display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.topbar-actions > .topbar-note, .topbar-actions > .back-link, .topbar-actions > .theme-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; line-height: 1.2; vertical-align: middle; }
.topbar-note { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.data-status { gap: 7px; color: var(--muted); }
.data-status > i { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--status-green); box-shadow: 0 0 0 4px var(--status-green-soft); }

/* Use the shared brand image in the header and favicon. */
.brand-mark { overflow: hidden; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.topbar-actions { gap: 12px; }
.topbar-actions .back-link, .topbar-actions .theme-toggle { min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--accent); font-size: 12px; }
.topbar-actions .theme-toggle { border-radius: 999px; color: var(--muted-strong); }
.topbar-actions .back-link:hover, .topbar-actions .theme-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

@media (max-width: 760px) {
  .topbar-note { display: none; }
}

/* Match the larger desktop reading scale used by the player index. */
@media (min-width: 1101px) and (pointer: fine) {
  body { font-size: 16px; }
  .site-shell { width: min(1600px, 100%); padding: 0 28px 58px; }
  .topbar { min-height: 82px; gap: 24px; }
  .brand { gap: 13px; }
  .brand-mark { width: 48px; height: 48px; border-radius: 12px; font-size: 13px; }
  .brand small { font-size: 11px; }
  .brand strong { font-size: 19px; }
  .topbar-actions { gap: 12px; }
  .topbar-actions .back-link, .topbar-actions .theme-toggle { min-height: 36px; padding: 0 13px; font-size: 13px; }
  .topbar-note { min-height: 36px; font-size: 13px; }

  .hero { gap: 40px; padding: 54px 0 36px; }
  .kicker { font-size: 12px; }
  .hero h1 { font-size: 48px; line-height: 1.16; }
  .hero-copy > p:last-child { max-width: 820px; margin-top: 17px; font-size: 17px; }
  .summary { gap: 10px; }
  .summary-item { min-width: 116px; padding: 17px 18px; }
  .summary-item strong { font-size: 28px; }
  .summary-item span { font-size: 13px; }

  .control-panel { grid-template-columns: minmax(360px, 1fr) 260px auto; gap: 14px; padding: 18px; }
  .search-field, .select-field { gap: 6px; }
  .search-field input, .select-field select, .reset-button { min-height: 48px; font-size: 16px; }
  .search-field input { padding-left: 42px; }
  .search-field > span { left: 14px; font-size: 22px; }
  .select-field span { font-size: 12px; }
  .select-field select { padding: 0 12px; }

  .team-section { padding: 42px 0 28px; }
  .section-heading h2 { font-size: 26px; }
  .muted, .group-heading > strong { font-size: 13px; }
  .position-tabs { gap: 10px; padding-top: 16px; }
  .position-tab { min-height: 42px; padding: 0 15px; font-size: 14px; }
  .position-tab small { font-size: 12px; }
  .person-group { padding-top: 22px; }
  .group-heading { padding-bottom: 14px; }
  .group-heading h2 { font-size: 30px; }
  .group-heading span { font-size: 13px; }
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding-top: 18px; }
  .card-art { min-height: 230px; }
  .card-art img { height: 250px; }
  .art-fallback { min-height: 230px; }
  .art-fallback strong { font-size: 36px; }
  .entry-body { gap: 14px; padding: 20px; }
  .entry-heading h3 { font-size: 22px; }
  .entry-heading p { font-size: 13px; }
  .concept-tag { min-height: 27px; padding: 0 9px; font-size: 12px; }
  .entry-subline, .entry-levels { font-size: 13px; }
  .entry-effects { gap: 8px; }
  .entry-effect-row { padding: 11px 12px; }
  .entry-effect-row small { font-size: 11px; }
  .entry-effect-row strong { font-size: 14px; }
  .open-detail { min-height: 44px; font-size: 15px; }

  .detail-dialog { width: min(1120px, calc(100% - 48px)); max-height: calc(100% - 48px); }
  .dialog-frame { max-height: calc(100vh - 48px); padding: 30px; }
  .detail-top { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 30px; }
  .detail-art, .detail-art .art-fallback { min-height: 500px; }
  .detail-art img { height: 500px; }
  .detail-summary h2 { font-size: 40px; }
  .detail-description { font-size: 15px; }
  .section-title { font-size: 19px; }
  .detail-description { font-size: 15px; }
  .effect-chip, .support-chip { min-height: 32px; font-size: 13px; }
}

/* Keep the mobile page headers aligned across the three tools. */
@media (max-width: 700px) {
  .topbar {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 12px 0;
  }
  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
  }
  .topbar-note {
    display: inline-flex;
    min-width: 0;
    overflow: hidden;
    justify-content: flex-start;
  }
  .topbar-note > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions > .back-link,
  .topbar-actions > .theme-toggle {
    min-width: 0;
    min-height: 34px;
    padding: 0 9px;
    font-size: 11px;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .topbar-actions {
    grid-template-columns: 1fr 1fr;
  }
  .topbar-note {
    grid-column: 1 / -1;
  }
  .topbar-actions > .back-link,
  .topbar-actions > .theme-toggle {
    width: 100%;
  }
}

/* Match the player detail view's desktop scale while keeping the mobile view centered. */
@media (min-width: 761px) {
  .detail-dialog {
    width: min(1280px, calc(100% - 48px));
    max-height: calc(100% - 48px);
  }
  .detail-dialog .dialog-frame {
    max-height: calc(100vh - 48px);
    padding: 32px 38px;
  }
  .detail-top {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 32px;
  }
  .detail-art, .detail-art img, .detail-art .art-fallback {
    min-height: 500px;
    height: 500px;
  }
  .detail-summary h2 { font-size: 40px; }
  .detail-summary > p:not(.kicker):not(.detail-note) { font-size: 16px; }
  .section-title { font-size: 20px; }
  .detail-description { font-size: 15px; }
  .effect-chip, .support-chip { min-height: 32px; font-size: 13px; }
}

@media (max-width: 760px) {
  .detail-section { padding: 14px; }
  .section-title { font-size: 18px; }
  .detail-description { font-size: 14px; }
}

/* Keep the player and cheerleader search controls on the same visual rhythm. */
.search-field { justify-content: flex-end; }
.search-field > span {
  top: 50%;
  left: 13px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
  font-size: 23px;
  line-height: 1;
  transform: translateY(-50%) rotate(-20deg);
}
.search-field input,
.select-field select,
.reset-button {
  box-sizing: border-box;
  height: 46px;
  min-height: 46px;
  font: inherit;
  line-height: 1.35;
}
.search-field input,
.select-field select {
  border-radius: 10px;
  background: var(--panel);
}
.search-field input { padding: 0 13px 0 46px; }
.select-field select { padding: 0 10px; }
.reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 10px;
  background: var(--panel);
}

@media (min-width: 1101px) and (pointer: fine) {
  .search-field input,
  .select-field select,
  .reset-button {
    height: 52px;
    min-height: 52px;
  }
}

@media (max-width: 760px) {
  .search-field input,
  .select-field select,
  .reset-button {
    height: 43px;
    min-height: 43px;
  }
  .search-field input { padding-left: 46px; }
  .search-field > span { left: 12px; }
  .reset-button { padding: 0 11px; }
}

/* Match the player index header, summary cards, and control sizing. */
.site-shell { padding-bottom: 38px; }
.topbar { min-height: 72px; }
.hero { gap: 32px; padding: 32px 0 26px; }
.hero-copy .kicker { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .6px; line-height: 1.2; }
.hero h1 { margin-bottom: 8px; font-size: 38px; line-height: 1.16; }
.hero-copy > p:last-child { max-width: 770px; margin: 0; color: var(--muted-strong); }
.summary { gap: 8px; }
.summary-item { min-width: 105px; padding: 11px 13px; }
.summary-item strong { font-size: 21px; line-height: 1.1; }
.summary-item span { margin-top: 3px; font-size: 11px; }
.control-panel { padding: 16px; }
.search-field input, .select-field select, .reset-button { min-height: 46px; border-radius: 10px; }
.search-field input { background: var(--panel); }
.select-field select { background: var(--panel-soft); }

@media (min-width: 1101px) and (pointer: fine) {
  .site-shell { width: min(1600px, 100%); padding: 0 28px 58px; }
  .topbar { min-height: 82px; }
  .hero { gap: 42px; padding: 42px 0 34px; }
  .hero-copy .kicker { margin-bottom: 2px; }
  .hero h1 { font-size: 48px; line-height: 1.16; }
  .hero-copy > p:last-child { max-width: 820px; margin: 0; font-size: 17px; }
  .summary { gap: 8px; }
  .summary-item { min-width: 105px; padding: 11px 13px; }
  .summary-item strong { font-size: 21px; }
  .summary-item span { margin-top: 3px; font-size: 11px; }
  .control-panel { padding: 18px; }
  .search-field input, .select-field select, .reset-button { min-height: 52px; font-size: 16px; }
}

@media (max-width: 760px) {
  .site-shell { padding: 0 14px 28px; }
  .topbar { min-height: 65px; }
  .hero { gap: 18px; padding: 23px 0 18px; }
  .hero h1 { margin-bottom: 8px; font-size: 28px; }
  .hero-copy .kicker { margin-bottom: 2px; }
  .summary { justify-content: flex-start; }
  .summary-item { flex: 1 1 90px; min-width: 0; padding: 11px 13px; }
  .summary-item strong { font-size: 21px; }
  .control-panel { padding: 11px; }
  .search-field input, .select-field select, .reset-button { min-height: 43px; }
}

/* Final shared brand lockup: same size and rhythm on desktop and mobile. */
.brand { gap: 13px; }
.brand-mark { width: 48px; height: 48px; border-radius: 12px; }
.brand > span:not(.brand-mark) { display: grid; gap: 2px; min-width: 0; }
.brand small, .brand strong { display: block; margin: 0; }
.brand small { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; line-height: 1.2; }
.brand strong { font-size: 19px; font-weight: 650; line-height: 1.1; }

/* Keep the whole top row aligned when moving between the three pages. */
@media (min-width: 761px) {
  .topbar { min-height: 82px; gap: 24px; border-bottom-color: var(--line-soft); }
  .topbar-actions { gap: 12px; }
  .topbar-actions > .topbar-note,
  .topbar-actions > .back-link,
  .topbar-actions > .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto;
    height: 36px;
    min-height: 36px;
    line-height: 1.2;
    vertical-align: middle;
  }
  .topbar-actions > .back-link,
  .topbar-actions > .theme-toggle { padding: 0 13px; }
}

@media (max-width: 760px) {
  .topbar-actions { gap: 8px; }
  .topbar-actions > .back-link,
  .topbar-actions > .theme-toggle {
    box-sizing: border-box;
    height: 34px;
    min-height: 34px;
    padding: 0 9px;
    line-height: 1.2;
  }
}

/* Final shared header rhythm across all three pages. */
.topbar-actions > .topbar-note,
.topbar-actions > .back-link,
.topbar-actions > .theme-toggle {
  box-sizing: border-box;
  align-items: center;
  line-height: 1.2;
}
.topbar-actions > .theme-toggle { gap: 6px; }
.topbar-actions > .theme-toggle > span:first-child {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
}

@media (max-width: 760px) {
  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .topbar-actions > .topbar-note {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    justify-content: flex-start;
  }
  .topbar-actions > .topbar-note > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions > .back-link,
  .topbar-actions > .theme-toggle {
    width: 100%;
    min-width: 0;
    height: 34px;
    min-height: 34px;
    padding: 0 4px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Keep the data-status text scale identical across all three pages. */
.topbar-actions > .data-status {
  font-size: 13px;
  line-height: 1.25;
}

@media (max-width: 760px) {
  .topbar-actions > .data-status { font-size: 12px; }
}

/* Keep the mobile header inside the viewport with a small front buffer. */
@media (max-width: 760px) {
  .topbar-actions > .data-status {
    padding-inline-start: 8px;
  }
  .site-shell {
    width: 100%;
    max-width: none;
    padding-inline: 12px;
  }
  .topbar,
  .brand,
  .topbar-actions {
    width: 100%;
    min-width: 0;
  }
  .brand > span:last-child,
  .topbar-note {
    min-width: 0;
    overflow: hidden;
  }
  .brand small,
  .brand strong,
  .topbar-note > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Keep all positions in the original full-width groups; compact only a specific position filter. */
@media (min-width: 761px) {
  .results-section.is-position-filtered {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    align-items: stretch;
    gap: 28px 18px;
  }

  .results-section.is-position-filtered .person-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-top: 0;
  }

  .results-section.is-position-filtered .card-grid {
    flex: 1;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    grid-auto-rows: 1fr;
  }

  .results-section.is-position-filtered .entry-card {
    height: 100%;
  }

  .results-section:not(.is-position-filtered) {
    display: block;
  }

  .results-section:not(.is-position-filtered) .person-group {
    padding-top: 22px;
  }

  .results-section:not(.is-position-filtered) .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 18px;
    padding-top: 18px;
  }

  .results-section:not(.is-position-filtered) .entry-card {
    height: 100%;
  }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .results-section.is-position-filtered { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

  .results-section:not(.is-position-filtered) .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
    padding-top: 14px;
  }
}

@media (max-width: 700px) {
  .results-section.is-position-filtered {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .results-section.is-position-filtered .person-group { padding-top: 0; }
  .results-section.is-position-filtered .card-grid { grid-template-columns: minmax(0, 1fr); }

  .results-section:not(.is-position-filtered) {
    display: block;
  }

  .results-section:not(.is-position-filtered) .person-group { padding-top: 22px; }
  .results-section:not(.is-position-filtered) .card-grid { grid-template-columns: minmax(0, 1fr); }
  .results-section:not(.is-position-filtered) .card-grid { align-items: stretch; }
  .results-section:not(.is-position-filtered) .entry-card { height: 100%; }
}

/* Realtime Colors preview layer: green-gray surfaces with Itim Latin text. */
::selection { background: var(--accent); color: var(--text); }
.topbar { border-bottom-color: var(--line); }
.brand-mark { border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); }
.control-panel, .summary-item, .entry-card, .detail-dialog, .detail-section {
  border-color: var(--line-soft);
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(3, 10, 14, .22);
}
.search-field input, .select-field select, .reset-button, .grade-tab,
.position-tab, .support-chip { border-color: var(--line); background: var(--panel-muted); }
.search-field:focus-within, .select-field select:focus, .reset-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-field input::placeholder { color: var(--muted); }
.card-art, .detail-art { background: var(--panel-soft); }
.entry-effect-row { background: var(--panel-soft); }
.entry-effect-row.is-skill { border-left-color: var(--muted); }
.entry-effect-row.is-support { border-left-color: var(--accent); }
.entry-effect-row.is-stage { border-left-color: var(--amber); }
.entry-card:hover, .position-tab:hover, .position-tab.is-selected,
.grade-tab.is-selected, .detail-button:hover { border-color: var(--accent); }
.detail-dialog::backdrop { background: rgba(4, 10, 14, .72); backdrop-filter: blur(5px); }
