/* ==========================================================================
   蓝莓赛事中心 · 选人台 — 2026-11-09 unified edition
   One design system with the archive: 奇拉比 and 晚安姐姐 palettes.
   ========================================================================== */

:root,
html[data-theme="host"] {
  color-scheme: dark;
  --bg: #171411; --bg-2: #1c1815; --paper: #211e1b; --surface: #2a2621; --surface-2: #332e28;
  --ink: #fffaf0; --muted: #c8bdb0; --dim: #8f8579; --line: #4a4038; --line-soft: #3a322b;
  --accent: #ffce4d; --accent-ink: #241c0c; --accent-text: #f3c75a; --accent-2: #ff7417;
  --accent-soft: rgb(255 206 77 / .13);
  --team-a: #ff6b57; --team-a-soft: rgb(255 107 87 / .14);
  --team-b: #5aa2ff; --team-b-soft: rgb(90 162 255 / .14);
  --good: #9fe0a8; --bad: #ff8a80; --warn: #ffcf70;
  --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 18px 40px -28px rgb(0 0 0 / .8);
  --shadow-lg: 0 30px 80px -30px rgb(0 0 0 / .85);
  --art-tint: linear-gradient(180deg, rgb(23 20 17 / .35), rgb(23 20 17 / .92));
}
html[data-theme="wanan"] {
  color-scheme: dark;
  --bg: #081523; --bg-2: #0b1a2b; --paper: #102334; --surface: #142c40; --surface-2: #19354b;
  --ink: #f1eee5; --muted: #a9bdcc; --dim: #7690a3; --line: #2c4a61; --line-soft: #1f3a50;
  --accent: #efd08a; --accent-ink: #1a1508; --accent-text: #efd08a; --accent-2: #edbd70;
  --accent-soft: rgb(239 208 138 / .13);
  --team-a: #ff8f7f; --team-a-soft: rgb(255 143 127 / .14);
  --team-b: #83d7ec; --team-b-soft: rgb(131 215 236 / .14);
  --good: #93ded5; --bad: #ff8f86; --warn: #f2c879;
  --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 18px 40px -28px rgb(0 0 0 / .8);
  --shadow-lg: 0 30px 80px -30px rgb(0 0 0 / .85);
  --art-tint: linear-gradient(180deg, rgb(8 21 35 / .35), rgb(8 21 35 / .94));
}

:root {
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", STSong, SimSun, serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --num: "SF Pro Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --r-lg: 18px; --r: 14px; --r-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 64px;
  --gutter: clamp(16px, 3vw, 36px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: radial-gradient(1200px 600px at 85% -10%, var(--accent-soft), transparent 60%), var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { display: block; max-width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); }
.team-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; vertical-align: middle; margin-right: 6px; }
.team-dot.a { background: var(--team-a); box-shadow: 0 0 0 3px var(--team-a-soft); }
.team-dot.b { background: var(--team-b); box-shadow: 0 0 0 3px var(--team-b-soft); }

/* ---------- Buttons ---------- */
.btn, .button-primary, .portal-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 11px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .2s, border-color .2s, transform .2s var(--ease), filter .2s, box-shadow .2s; }
.btn:hover:not(:disabled), .portal-button:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary, .button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -14px var(--accent); }
.btn-primary:hover:not(:disabled), .button-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 13px; }
.btn-a { background: var(--team-a); border-color: var(--team-a); color: #fff; }
.btn-b { background: var(--team-b); border-color: var(--team-b); color: #0b1422; }
.btn:disabled, .button-primary:disabled { opacity: .45; box-shadow: none; filter: none; }

/* Segmented controls & chips */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--ink) 3%, transparent); flex-wrap: nowrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 0 12px; min-height: 32px; border-radius: 9px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.seg button.side-a.active { background: var(--team-a-soft); box-shadow: inset 0 0 0 1px var(--team-a); }
.seg button.side-b.active { background: var(--team-b-soft); box-shadow: inset 0 0 0 1px var(--team-b); }
.seg-lg button { min-height: 38px; padding: 0 16px; font-size: 14px; }
.seg b { color: var(--accent-text); font-weight: 600; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.chip button { border: 0; background: transparent; width: 24px; height: 24px; border-radius: 50%; color: var(--muted); }
.chip button:hover { background: var(--accent-soft); color: var(--ink); }

/* Badges */
.badge, .portal-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); background: color-mix(in srgb, var(--bg) 60%, transparent); white-space: nowrap; }
.badge::before, .portal-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.open, .portal-badge.open, .portal-badge.approved, .badge.approved { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.badge.playing, .portal-badge.playing { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.badge.pending-match, .portal-badge.pending-match, .portal-badge.pending, .badge.pending { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.portal-badge.rejected, .badge.rejected { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.badge.completed, .portal-badge.completed, .badge.closed, .portal-badge.closed { color: var(--dim); }

/* Forms */
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, .field > label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; }
.field-help { font-size: 12px; color: var(--dim); }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 55%, var(--paper)); color: var(--ink); font-size: 16px; transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); padding: 0; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.password-control { position: relative; display: block; }
.password-control input { padding-right: 66px; }
.password-toggle { position: absolute; right: 5px; top: 5px; bottom: 5px; border: 0; border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; }
.portal-form-error { padding: 10px 13px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.bo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bo-input { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--bg) 55%, var(--paper)); overflow: hidden; }
.bo-input span { padding: 0 4px 0 13px; color: var(--accent-text); font-weight: 700; font-family: var(--num); }
.bo-input input { border: 0; width: 70px; box-shadow: none; background: transparent; font-family: var(--num); font-weight: 600; }
.bo-target { color: var(--accent-text); font-weight: 600; font-size: 13px; }

/* Cards & sections */
.card { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; font-weight: 700; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head span { color: var(--dim); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; flex-wrap: wrap; }
.section-title h2 { font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: .04em; }
.section-title > span { color: var(--dim); font-size: 13px; }
.section-title .btn { margin-left: auto; }
.empty-state { text-align: center; padding: 48px 20px; border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.empty-state h2 { font-family: var(--serif); color: var(--ink); font-size: 20px; }
.empty-mark { font-size: 26px; color: var(--accent-text); }
.empty, .none { color: var(--dim); font-size: 14px; }
.empty { grid-column: 1 / -1; text-align: center; padding: 40px 0; }

/* ---------- Site header (shared with the archive) ---------- */
.site-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 22px; min-height: var(--header-h); padding: 0 var(--gutter); background: color-mix(in srgb, var(--bg) 84%, transparent); -webkit-backdrop-filter: saturate(1.2) blur(14px); backdrop-filter: saturate(1.2) blur(14px); border-bottom: 1px solid var(--line-soft); }
.site-brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.site-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); font-size: 20px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.site-name { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: .08em; display: inline-flex; align-items: baseline; gap: 8px; }
.site-name small { font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: .06em; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { position: relative; padding: 8px 13px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; transition: color .2s, background .2s; }
.site-nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.site-nav a.active { color: var(--ink); background: var(--accent-soft); }
.site-nav a.active::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: -13px; height: 2px; border-radius: 2px; background: var(--accent); }
.site-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.site-link { color: var(--muted); font-weight: 600; font-size: 14px; }
.site-link:hover { color: var(--ink); }
.site-caption { color: var(--dim); font-size: 13px; }
.theme-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; transition: border-color .2s, color .2s; }
.theme-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.theme-ico { color: var(--accent-text); font-size: 14px; }
.site-user { display: flex; align-items: center; gap: 10px; }
.site-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-family: var(--serif); font-weight: 700; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.site-user-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.site-user-link { color: var(--muted); font-size: 13px; }
.site-user-link:hover { color: var(--ink); }
.password-required .site-tools .theme-btn { display: inline-flex; }
.connection { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 18%, transparent); animation: pulse 2.4s infinite; }
.connection.offline i { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 18%, transparent); }
.role-tag { padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- Page shell ---------- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.portal-scroll, .home-page-shell > .card, .home-page-shell > .foot-note { width: min(1280px, 100%); margin: 0 auto; padding: 0 var(--gutter); }
.home-page-shell > .card { padding: 26px; width: min(1280px - 2 * 36px, calc(100% - 2 * var(--gutter))); }
.page-title { width: min(1280px, 100%); margin: 0 auto; padding: 34px var(--gutter) 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.page-title h1 { font-family: var(--serif); font-size: clamp(28px, 3vw, 38px); font-weight: 700; letter-spacing: .05em; line-height: 1.2; margin-top: 6px; }
.page-sub { color: var(--muted); margin-top: 8px; }
.portal-page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.portal-sync { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); font-size: 13px; }
.portal-sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.portal-sync.offline i { background: var(--warn); }
.portal-scroll { padding-bottom: 64px; }
.title-stat { color: var(--muted); font-size: 14px; }
.title-stat b { font-family: var(--num); font-size: 26px; font-weight: 500; color: var(--accent-text); margin-right: 6px; }
.page-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 12px; padding: 22px var(--gutter); color: var(--dim); font-size: 13px; border-top: 1px solid var(--line-soft); }
.foot-note { color: var(--dim); font-size: 13px; padding: 18px 0 40px !important; display: flex; align-items: center; gap: 8px; }
.tiny-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.stats-info { text-decoration: underline dotted; cursor: help; }

/* Boot / toast / dialogs */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: var(--muted); }
.boot h1 { font-family: var(--serif); color: var(--ink); font-size: 26px; letter-spacing: .08em; }
.brand-symbol { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 28px; animation: pulse 2s infinite; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: min(520px, calc(100% - 32px)); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); transition: opacity .25s, transform .3s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); color: #fff; }
body.room-page .toast { bottom: 104px; }
dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 24px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog[open] { animation: dialog-in .28s var(--ease); }
dialog::backdrop { background: rgb(6 5 8 / .6); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialog-top h2 { font-family: var(--serif); font-size: 21px; font-weight: 700; }
.dialog-top button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 18px; }
.dialog-intro { color: var(--muted); margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
dialog form { display: grid; gap: 16px; }
.auth-submit { width: 100%; }
.invite-row { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.invite-row label { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { font-size: 13px; }
.invite-link button { flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-weight: 600; font-size: 13px; }
.invite-hint { color: var(--dim); font-size: 13px; margin-top: 6px; }
.managed-match-info { display: grid; gap: 0; margin: 0 0 18px; }
.managed-match-info div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.managed-match-info dt { color: var(--muted); }
.managed-match-info dd { margin: 0; font-weight: 600; text-align: right; }
.managed-view-button { width: 100%; }
.versus-pick { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.swap-sides { min-height: 44px; font-size: 18px; }
.portal-inline-note { color: var(--muted); font-size: 13px; padding: 10px 13px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.capacity-error { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.schedule-rule-footnote { color: var(--dim); font-size: 12px; }

/* ---------- Auth ---------- */
.auth-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; max-width: 980px; margin: 8px auto 0; border-radius: 22px; overflow: hidden; border: 1px solid var(--line-soft); box-shadow: var(--shadow-lg); background: var(--paper); }
.auth-layout.single { grid-template-columns: 1fr; max-width: 520px; }
.auth-art { position: relative; padding: 44px 40px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; min-height: 440px; background: var(--art-tint), url("/art/shinobi-arena-v1.jpg") center / cover; }
.auth-art h2 { font-family: var(--serif); font-size: clamp(26px, 3vw, 36px); font-weight: 700; line-height: 1.3; letter-spacing: .04em; }
.auth-art p:last-child { color: var(--muted); font-size: 14px; }
.auth-card { padding: 40px; display: grid; gap: 14px; align-content: center; }
.auth-card > h2 { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.auth-card > p { color: var(--muted); }
.auth-card form { display: grid; gap: 16px; margin-top: 6px; }
.auth-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 22px; }
.auth-switch, .account-access-note { color: var(--muted); font-size: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.auth-switch a { color: var(--accent-text); font-weight: 600; margin-left: 6px; }
.portal-compact .page-title { text-align: center; justify-content: center; }
.portal-compact .page-title > div:first-child { display: none; }
.guest-entry { margin-top: clamp(0px, 3vh, 36px); }
.guest-intro { min-height: 410px; }
.guest-intro h1 { font: 700 clamp(32px, 3.6vw, 52px)/1.2 var(--serif); }
.guest-intro p { line-height: 1.6; }
.guest-options { gap: 24px; }
.guest-options section + section { border-top: 1px solid var(--line-soft); padding-top: 22px; }
.guest-options h2 { font: 700 21px/1.4 var(--serif); }
.guest-options p { color: var(--muted); line-height: 1.65; margin: 6px 0 14px; }
.guest-options .btn { width: 100%; }
.guest-archive-nav .nav-sep { display: none; }

/* ---------- Event center ---------- */
.archive-band { position: relative; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; padding: 30px 32px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line-soft); background: linear-gradient(90deg, var(--paper) 30%, color-mix(in srgb, var(--paper) 55%, transparent)), url("/art/shinobi-arena-v1.jpg") right center / cover; box-shadow: var(--shadow); }
.archive-band h2 { font-family: var(--serif); font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: .04em; margin: 8px 0; }
.archive-band p:last-child { color: var(--muted); }
.archive-band-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.archive-band-links a { display: grid; gap: 2px; padding: 16px; border-radius: 14px; background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--line-soft); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: border-color .2s, transform .25s var(--ease); }
.archive-band-links a:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); transform: translateY(-2px); }
.archive-band-links b { font-family: var(--num); font-size: 26px; font-weight: 500; color: var(--accent-text); }
.archive-band-links span { color: var(--muted); font-size: 13px; }
.event-grid, .match-grid, .registration-grid, .review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.event-card { display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden; background: var(--paper); border: 1px solid var(--line-soft); box-shadow: var(--shadow); transition: transform .28s var(--ease), border-color .28s, box-shadow .28s; }
.event-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow-lg); }
.event-art { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 120px; padding: 14px 16px; background: var(--art-tint), url("/art/shinobi-arena-v1.jpg") center 40% / cover; }
.event-art .badge { position: absolute; top: 12px; left: 14px; }
.event-art-title { font-family: var(--serif); font-size: 15px; color: var(--muted); letter-spacing: .1em; }
.event-card-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; }
.event-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.event-card-title h2 { font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.35; }
.event-description { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.event-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; }
.event-stats b { font-family: var(--num); font-size: 18px; font-weight: 600; color: var(--ink); margin-right: 4px; }
.event-owner { margin-left: auto; color: var(--dim); }
.event-card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.event-detail { display: grid; grid-template-columns: 260px 1fr; gap: 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line-soft); background: var(--paper); box-shadow: var(--shadow); }
.event-detail-art { min-height: 180px; padding: 16px; background: var(--art-tint), url("/art/shinobi-arena-v1.jpg") center / cover; }
.event-detail-copy { padding: 24px; display: grid; gap: 10px; align-content: start; }
.event-detail-copy h2 { font-size: 16px; }
.event-detail-copy p { color: var(--muted); white-space: pre-wrap; }
.application-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 18px 22px; border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); flex-wrap: wrap; }
.application-panel h2 { font-size: 17px; }
.application-panel p { color: var(--muted); margin-top: 4px; }
.application-panel.closed { background: transparent; border-color: var(--line-soft); }
.match-group { margin-bottom: 22px; }
.match-group-title { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.match-group-title span { font-family: var(--num); padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); font-size: 12px; }
.match-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-soft); box-shadow: var(--shadow); transition: border-color .25s, transform .25s var(--ease); }
.match-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.match-card.is-live { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(180deg, var(--accent-soft), transparent 60%), var(--paper); }
.match-card.is-finished { opacity: .92; }
.match-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.match-card-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-card-sides { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.match-player { display: flex; align-items: center; gap: 4px; min-width: 0; }
.match-player strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-player.b { justify-content: flex-end; flex-direction: row-reverse; }
.match-player.b .team-dot { margin: 0 0 0 6px; }
.match-player small { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); margin: 0 4px; }
.match-card-score { display: flex; align-items: baseline; gap: 6px; font-family: var(--num); }
.match-card-score b { font-size: 30px; font-weight: 500; color: var(--muted); line-height: 1; }
.match-card-score b.lead { color: var(--ink); }
.match-card-score span { color: var(--dim); }
.match-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.match-card-meta { color: var(--dim); font-size: 13px; }
.match-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.match-card-actions .btn { min-height: 38px; }
.match-review-note { font-size: 12px; color: var(--warn); }
.portal-unassigned { color: var(--dim); font-size: 13px; }
.spotlight { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 26px 28px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(110deg, var(--paper) 35%, color-mix(in srgb, var(--paper) 70%, transparent)), url("/art/shinobi-arena-v1.jpg") right center / cover; box-shadow: var(--shadow-lg); flex-wrap: wrap; margin-bottom: 18px; }
.spotlight h2 { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 32px); font-weight: 700; margin: 8px 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spotlight h2 b { font-family: var(--num); font-weight: 500; color: var(--accent-text); padding: 0 8px; }
.spotlight p:last-child { color: var(--muted); font-size: 14px; }
.my-archive-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin-bottom: 18px; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--paper); transition: border-color .2s; }
.my-archive-link:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.my-archive-link span { display: grid; }
.my-archive-link small { color: var(--muted); }
.my-archive-link b { color: var(--accent-text); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; border: 0; background: transparent; padding: 12px 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button span { font-family: var(--num); font-size: 12px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); margin-left: 4px; }
.tabs button.active { color: var(--ink); }
.tabs button.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.registration-card, .review-card { display: grid; gap: 12px; padding: 18px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-soft); }
.registration-head, .review-card-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.registration-head h2 { font-size: 17px; }
.review-card-head > div { flex: 1; min-width: 0; }
.review-card-head h3 { font-size: 16px; }
.review-card-head span:not(.site-avatar):not(.portal-badge) { color: var(--dim); font-size: 13px; }
.review-card.pending { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.review-note { color: var(--muted); font-size: 14px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.review-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 13px; }
.review-card-bottom div { display: flex; gap: 8px; }

/* Admin */
.admin-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.portal-select-event { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 560px; }
.portal-select-event span { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.admin-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.admin-step { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--paper); text-align: left; transition: border-color .2s, background .2s; }
.admin-step:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.admin-step strong { display: block; font-size: 14px; }
.admin-step small { color: var(--dim); font-size: 12px; }
.admin-step-no { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; font-family: var(--num); font-weight: 600; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--muted); }
.admin-step.is-done .admin-step-no { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.admin-step.is-todo .admin-step-no { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.admin-step.is-todo small { color: var(--warn); }
.admin-step.is-live .admin-step-no { background: var(--accent-soft); color: var(--accent-text); animation: pulse 2.4s infinite; }
.admin-step.active { border-color: var(--accent); background: var(--accent-soft); }
.admin-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.admin-overview-card { display: grid; gap: 12px; align-content: start; }
.admin-description p { color: var(--muted); white-space: pre-wrap; }
.portal-metrics { display: flex; gap: 26px; }
.portal-metrics span { display: grid; color: var(--muted); font-size: 13px; }
.portal-metrics b { font-family: var(--num); font-size: 32px; font-weight: 500; color: var(--accent-text); line-height: 1.2; }
.schedule-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-soft); margin-bottom: 18px; flex-wrap: wrap; }
.schedule-intro h2 { font-size: 17px; }
.schedule-intro p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- Create-room page (public draft tool) ---------- */
.create-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.field-wide { grid-column: span 3; }
.rule-line { margin: 18px 0 0; padding: 12px 14px; border-radius: 11px; background: var(--accent-soft); color: var(--ink); font-size: 14px; }
.advanced { margin-top: 18px; border: 1px solid var(--line-soft); border-radius: var(--r); }
.advanced summary { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "＋"; color: var(--muted); }
.advanced[open] summary::after { content: "－"; }
.advanced-body { display: grid; gap: 14px; padding: 0 16px 16px; }
.home-catalog-scroll { max-height: 520px; overflow: auto; padding-right: 4px; }
.create-foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.create-foot p { color: var(--muted); font-size: 14px; max-width: 560px; }
.create-foot strong { color: var(--ink); }
.error-card { width: min(640px, calc(100% - 32px)); margin: 60px auto; display: grid; gap: 12px; justify-items: start; }
.error-card h1 { font-family: var(--serif); font-size: 26px; }
.error-card p { color: var(--muted); }

/* ---------- Ninja library ---------- */
.lib-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lib-search { position: relative; flex: 1 1 260px; min-width: 0; display: flex; align-items: center; }
.lib-search input { padding-left: 38px; padding-right: 40px; }
.lib-search-icon { position: absolute; left: 13px; color: var(--dim); font-size: 17px; pointer-events: none; }
.lib-kbd { position: absolute; right: 10px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--dim); font: 12px var(--num); }
.lib-search input:focus + .lib-kbd { opacity: 0; }
.lib-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-check { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; min-height: 38px; border-radius: 12px; border: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.lib-check:has(input:checked) { color: var(--ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.lib-count { color: var(--dim); font-size: 13px; margin-left: auto; white-space: nowrap; }
.ninja-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; padding: 14px 0 4px; }
.ninja { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 9px; border-radius: 13px; border: 1px solid var(--line-soft); background: var(--paper); text-align: left; transition: transform .2s var(--ease), border-color .2s, background .2s, box-shadow .2s; content-visibility: auto; contain-intrinsic-size: 112px 170px; }
.ninja:hover:not(:disabled) { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); }
.ninja-art { position: relative; display: block; aspect-ratio: 1; border-radius: 9px; overflow: hidden; background: radial-gradient(circle at 50% 35%, var(--surface-2), var(--surface)); }
.ninja-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease); }
.ninja:hover:not(:disabled) .ninja-art img { transform: scale(1.05); }
.ninja-grade { position: absolute; left: 5px; top: 5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; display: grid; place-items: center; font: 700 11px/1 var(--num); background: rgb(0 0 0 / .62); color: #fff; }
.ninja-grade.g-S { background: linear-gradient(135deg, #f6c453, #e08a2a); color: #2a1a05; }
.ninja-grade.g-A { background: linear-gradient(135deg, #b48cff, #7d5ad8); }
.ninja-grade.g-B { background: linear-gradient(135deg, #5ab0ff, #2f74d0); }
.ninja-legend { position: absolute; right: 5px; top: 5px; padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; background: linear-gradient(135deg, #ffe39a, #f0a640); color: #3a2405; }
.ninja-pick { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--num); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--paper); }
.ninja-name { font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.ninja-meta { display: flex; justify-content: space-between; gap: 4px; color: var(--dim); font-size: 11.5px; font-family: var(--num); }
.ninja-meta.blocked { color: var(--bad); font-family: var(--sans); }
.ninja.is-chosen { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.ninja.is-used .ninja-art img { filter: grayscale(1) brightness(.55); }
.ninja.is-used { opacity: .6; }
.ninja:disabled:not(.is-chosen):not(.is-used) { opacity: .88; }
.ninja.is-used .ninja-name { color: var(--muted); }
.list-footer { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px 0 8px; color: var(--dim); font-size: 13px; }

/* ---------- Room ---------- */
body.room-page { overflow: hidden; }
.room-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.room-shell .site-header { position: relative; }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px var(--gutter) 10px; flex-wrap: wrap; }
.room-title h1 { font-family: var(--serif); font-size: clamp(18px, 1.8vw, 24px); font-weight: 700; letter-spacing: .04em; line-height: 1.3; }
.room-title .kicker { margin-bottom: 2px; }
.room-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.room-chips span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 600; }
.room-chips .legacy-rule-tag { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

.arena { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; padding: 0 var(--gutter); align-items: stretch; }
.team { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-soft); box-shadow: var(--shadow); min-width: 0; transition: border-color .25s, box-shadow .25s; }
.team::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: var(--r-lg) 0 0 var(--r-lg); }
.team-a::before { background: var(--team-a); }
.team-b::before { background: var(--team-b); left: auto; right: 0; border-radius: 0 var(--r-lg) var(--r-lg) 0; }
.team-a.is-active { border-color: color-mix(in srgb, var(--team-a) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--team-a) 30%, transparent), var(--shadow); background: linear-gradient(180deg, var(--team-a-soft), transparent 70%), var(--paper); }
.team-b.is-active { border-color: color-mix(in srgb, var(--team-b) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--team-b) 30%, transparent), var(--shadow); background: linear-gradient(180deg, var(--team-b-soft), transparent 70%), var(--paper); }
.team-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-b .team-head { flex-direction: row-reverse; text-align: right; }
.team-flag { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.team-a .team-flag { background: var(--team-a); box-shadow: 0 0 0 4px var(--team-a-soft); }
.team-b .team-flag { background: var(--team-b); box-shadow: 0 0 0 4px var(--team-b-soft); }
.team-id { display: grid; min-width: 0; line-height: 1.25; }
.team-name { font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-id small { color: var(--muted); font-size: 12px; }
.team-state { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line-soft); color: var(--muted); }
.team-b .team-state { margin-left: 0; margin-right: auto; }
.team-state.is-picking { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.team-state.is-locked { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.team-toggle { display: none; flex: none; white-space: nowrap; border: 1px solid var(--line-soft); background: transparent; border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.team-slots { display: grid; grid-template-columns: repeat(var(--slots), minmax(0, 132px)); gap: 10px; justify-content: start; }
.team-b .team-slots { justify-content: end; }
.slot { position: relative; aspect-ratio: 1 / 1.18; border-radius: 13px; border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 40%, var(--surface)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; min-width: 0; padding: 0; color: var(--muted); }
.slot-no { position: absolute; left: 6px; top: 5px; z-index: 2; font: 700 11px/1 var(--num); padding: 3px 6px; border-radius: 6px; background: rgb(0 0 0 / .55); color: #fff; }
.slot.is-empty .slot-no, .slot.is-hidden .slot-no { background: transparent; color: var(--dim); }
.slot-plus { font-size: 26px; line-height: 1; color: var(--dim); font-weight: 300; }
.slot-hint { font-size: 12px; color: var(--dim); max-width: calc(100% - 8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-q { font: 600 30px var(--num); color: var(--dim); }
.slot.is-empty { border-style: dashed; }
.slot.is-selectable { cursor: pointer; transition: border-color .2s, background .2s; }
.slot.is-selectable:hover { border-color: var(--accent); }
.slot.is-next { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.slot.is-next .slot-plus, .slot.is-next .slot-hint { color: var(--accent-text); }
.slot.is-target { border: 2px solid var(--accent); background: var(--accent-soft); animation: target 1.6s var(--ease) infinite; }
.slot.is-target .slot-plus, .slot.is-target .slot-hint { color: var(--accent-text); }
@keyframes target { 50% { box-shadow: 0 0 0 5px var(--accent-soft); } }
.slot.is-filled { justify-content: flex-end; border-color: var(--line); animation: pop .35s var(--ease); }
@keyframes pop { from { transform: scale(.94); opacity: .4; } }
.slot-art { position: absolute; inset: 0; }
.slot-art img { width: 100%; height: 100%; object-fit: cover; }
.slot.is-filled::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgb(0 0 0 / .82)); }
.slot-name { position: relative; z-index: 2; width: 100%; padding: 0 6px 7px; font-size: 12px; font-weight: 600; color: #fff; text-align: center; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-remove { position: absolute; right: 5px; top: 5px; z-index: 3; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .62); color: #fff; font-size: 15px; opacity: .85; }
.slot-remove:hover { background: var(--bad); opacity: 1; }
.team-a .slot.is-filled { box-shadow: inset 0 -3px 0 var(--team-a); }
.team-b .slot.is-filled { box-shadow: inset 0 -3px 0 var(--team-b); }
.team-foot { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 12px; }
.team-b .team-foot { flex-direction: row-reverse; }

.scoreboard { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 150px; padding: 12px 18px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-soft); box-shadow: var(--shadow); text-align: center; }
.score-game { color: var(--muted); font-size: 13px; font-weight: 600; }
.score-nums { display: flex; align-items: baseline; gap: 10px; font-family: var(--num); line-height: 1; }
.score-nums b { font-size: 52px; font-weight: 500; letter-spacing: -.02em; }
.score-nums .score-a { color: var(--team-a); }
.score-nums .score-b { color: var(--team-b); }
.score-nums i { font-style: normal; color: var(--dim); font-size: 30px; }
.score-phase { padding: 3px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.score-phase.phase-playing { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.score-phase.phase-finished { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); }
.score-target { color: var(--dim); font-size: 11.5px; }

.room-notice { display: flex; align-items: center; gap: 10px; margin: 12px var(--gutter) 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--muted); font-size: 14px; }
.room-notice .notice-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.notice-more { flex: none; align-self: center; border: 1px solid var(--line-soft); background: transparent; color: var(--accent-text); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.notice-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.room-notice.is-conflict { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--ink); }
.room-notice.is-conflict .notice-dot { background: var(--bad); }
.room-tabs { display: flex; gap: 4px; padding: 6px var(--gutter) 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; flex: none; }
.room-tabs button { position: relative; border: 0; background: transparent; padding: 11px 15px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.room-tabs button small { font-family: var(--num); font-size: 11px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); margin-left: 5px; }
.room-tabs button.active { color: var(--ink); }
.room-tabs button.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.room-workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.workspace-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px var(--gutter) 24px; overscroll-behavior: contain; }
.library { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--gutter) 10px; flex-wrap: wrap; }
.library-head h2 { font-size: 17px; font-weight: 700; display: inline; margin-right: 10px; }
.sort-label { color: var(--dim); font-size: 12px; cursor: help; }
.library-tip { color: var(--dim); font-size: 13px; }
.library .lib-toolbar { padding: 0 var(--gutter) 2px; }
.library-scroll { padding-top: 0; }
.action-dock { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px var(--gutter); padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.dock-summary { display: grid; gap: 2px; min-width: 0; }
.dock-summary strong { font-size: 15px; display: flex; align-items: center; }
.dock-summary strong b { font-family: var(--num); font-size: 20px; color: var(--accent-text); margin: 0 4px; }
.dock-summary > span { color: var(--dim); font-size: 13px; }
.dock-meter { width: 160px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; margin-top: 4px; }
.dock-meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .35s var(--ease); }
.dock-actions { display: flex; gap: 10px; flex: none; }

/* Referee desk */
.desk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 1200px; }
.desk-flow { grid-column: 1 / -1; display: grid; gap: 14px; }
.desk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.desk-head h2 { font-family: var(--serif); font-size: 22px; margin-top: 4px; }
.flow { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; counter-reset: none; }
.flow li { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line-soft); color: var(--dim); font-size: 14px; font-weight: 600; }
.flow li span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 700 12px var(--num); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.flow li.is-done { color: var(--muted); }
.flow li.is-done span { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.flow li.is-current { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.flow li.is-current span { background: var(--accent); color: var(--accent-ink); }
.desk-locks, .desk-score, .desk-rules { display: grid; gap: 12px; align-content: start; }
.lock-row { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.lock-row strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock-row > span:last-child { color: var(--dim); font-size: 13px; }
.lock-row.is-locked > span:last-child { color: var(--good); font-weight: 600; }
.desk-scoreline { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.desk-scoreline strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-scoreline b { font: 500 28px var(--num); color: var(--accent-text); padding: 0 6px; }
.desk-rules dl { margin: 0; display: grid; }
.desk-rules dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.desk-rules dt { color: var(--muted); }
.desk-rules dd { margin: 0; font-weight: 600; text-align: right; }

/* Used / history / log */
.used-card, .history-card, .log-card { margin-bottom: 16px; max-width: 1200px; }
.used-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.used-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.mini-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { position: relative; width: 44px; height: 44px; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line-soft); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini-game { position: absolute; right: 0; bottom: 0; padding: 0 4px; border-radius: 6px 0 0 0; font: 700 10px/1.5 var(--num); background: rgb(0 0 0 / .7); color: #fff; }
.used-a .mini { box-shadow: inset 0 -2px 0 var(--team-a); }
.used-b .mini { box-shadow: inset 0 -2px 0 var(--team-b); }
.history-list { display: grid; gap: 10px; }
.history-item { padding: 12px 14px; border-radius: 13px; border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--ink) 2%, transparent); }
.history-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.history-winner { font-size: 13px; font-weight: 700; color: var(--muted); }
.history-winner.a { color: var(--team-a); }
.history-winner.b { color: var(--team-b); }
.history-lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.history-side { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.history-side.is-winner.side-a { background: var(--team-a-soft); }
.history-side.is-winner.side-b { background: var(--team-b-soft); }
.history-team { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty-record { padding: 20px 0; }
.log-card summary { display: flex; justify-content: space-between; cursor: pointer; font-weight: 700; list-style: none; }
.log-card summary::-webkit-details-marker { display: none; }
.log-card summary span:last-child { color: var(--dim); font-weight: 500; font-size: 13px; }
.log-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 0; max-height: 360px; overflow: auto; }
.log-list li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.log-list time { color: var(--dim); font-family: var(--num); flex: none; }

/* ---------- Broadcast (主视角) ---------- */
body.broadcast { overflow: auto; }
body.broadcast .room-shell { height: auto; min-height: 100vh; overflow: visible; }
body.broadcast .site-header .site-nav { display: none; }
body.broadcast .room-head { justify-content: center; text-align: center; padding-top: 22px; }
body.broadcast .room-title h1 { font-size: clamp(24px, 2.6vw, 36px); }
body.broadcast .room-chips { justify-content: center; width: 100%; }
body.broadcast .arena { gap: 20px; padding-top: 6px; }
body.broadcast .team { padding: 20px 22px; }
body.broadcast .team-name { font-size: clamp(22px, 2.2vw, 32px); }
body.broadcast .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 190px)); gap: 14px; }
body.broadcast .slot-name { font-size: 15px; }
body.broadcast .scoreboard { min-width: 220px; }
body.broadcast .score-nums b { font-size: clamp(64px, 7vw, 104px); }
body.broadcast .room-notice { justify-content: center; }
.broadcast-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px var(--gutter) 0; }
.broadcast-footer { display: flex; justify-content: space-between; padding: 18px var(--gutter) 24px; color: var(--dim); font-size: 13px; }

/* ---------- Server status (owner only) ---------- */
.server-status { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--r-lg); border: 1px solid var(--line-soft); background: var(--paper); box-shadow: var(--shadow); --status: var(--muted); }
.server-status.is-ok { --status: var(--good); }
.server-status.is-warn { --status: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line-soft)); }
.server-status.is-alert { --status: var(--bad); border-color: color-mix(in srgb, var(--bad) 60%, var(--line-soft)); background: linear-gradient(0deg, color-mix(in srgb, var(--bad) 9%, transparent), transparent), var(--paper); }
.server-status-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.server-status-head strong { font-size: 15px; }
.server-summary { color: var(--ink); font-size: 13px; }
.server-meta { margin-left: auto; color: var(--dim); font-size: 12.5px; }
.server-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--status); box-shadow: 0 0 0 4px color-mix(in srgb, var(--status) 18%, transparent); }
.server-checks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.server-check { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
.server-check strong { color: var(--ink); white-space: nowrap; }
.server-check span:last-child { overflow-wrap: anywhere; }
.server-check.is-ok { --status: var(--good); }
.server-check.is-warn { --status: var(--warn); }
.server-check.is-alert { --status: var(--bad); }
.server-check .server-dot { width: 7px; height: 7px; box-shadow: none; transform: translateY(-1px); }
.server-last { margin: 8px 0 0; color: var(--dim); font-size: 12.5px; overflow-wrap: anywhere; }
.server-all { margin-top: 8px; }
.server-all summary { cursor: pointer; color: var(--dim); font-size: 12.5px; }
@media (max-width: 760px) {
  .server-meta { margin-left: 0; width: 100%; }
  .server-check { grid-template-columns: auto minmax(0, 1fr); }
  .server-check span:last-child { grid-column: 2; }
}

/* ---------- Large screens ---------- */
@media (min-width: 1500px) {
  .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 150px)); }
  .ninja-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); }
}

/* ---------- Tablet ---------- */
@media (max-width: 1080px) {
  .site-header { gap: 14px; }
  .site-user-link { display: none; }
  .admin-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-steps .overview { grid-column: 1 / -1; }
  .archive-band { grid-template-columns: 1fr; }
  .create-grid { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: span 2; }
  .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 1fr)); }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  :root { --header-h: 56px; --gutter: 16px; }
  body { font-size: 14px; }
  .site-header { flex-wrap: wrap; gap: 0 10px; padding-top: 6px; padding-bottom: 0; }
  .site-brand { min-height: 44px; }
  .site-name small { display: none; }
  .site-nav { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 4px 12px 6px; border-top: 1px solid var(--line-soft); }
  .site-nav a { padding: 8px 11px; font-size: 13px; }
  .site-nav a.active::after { bottom: -6px; }
  .site-tools { gap: 6px; }
  .site-user-name { display: none; }
  .theme-btn { padding: 0 10px; }
  .page-title { padding-top: 22px; padding-bottom: 16px; }
  .page-title h1 { font-size: 26px; }
  .portal-page-actions { width: 100%; justify-content: space-between; }
  .archive-band { padding: 20px; }
  .archive-band-links b { font-size: 21px; }
  .archive-band-links a { padding: 12px; }
  .event-grid, .match-grid, .registration-grid, .review-grid { grid-template-columns: 1fr; }
  .event-detail { grid-template-columns: 1fr; }
  .event-detail-art { min-height: 110px; }
  .auth-layout { grid-template-columns: 1fr; border-radius: 18px; }
  .auth-art { min-height: 0; padding: 24px; }
  .auth-art h2 { font-size: 22px; }
  .auth-card { padding: 24px; }
  .admin-steps { grid-template-columns: 1fr 1fr; }
  .admin-overview-grid { grid-template-columns: 1fr; }
  .admin-bar, .portal-select-event { flex-direction: column; align-items: stretch; }
  .spotlight { padding: 20px; }
  .spotlight .btn { width: 100%; }
  .match-card-actions { width: 100%; }
  .match-card-actions .btn { flex: 1; }
  .versus-pick { grid-template-columns: 1fr; }
  .swap-sides { justify-self: center; }
  .create-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .create-foot .btn { width: 100%; }
  .home-page-shell > .card { padding: 18px; }

  /* Library: three per row, filters scroll sideways */
  .lib-toolbar { gap: 8px; }
  .lib-search { flex-basis: 100%; }
  .lib-kbd { display: none; }
  .lib-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .lib-count { display: none; }
  .ninja-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ninja { padding: 5px 5px 8px; }
  .ninja-name { font-size: 14px; }
  .ninja-meta { font-size: 12px; }
  .ninja-meta span:last-child:not(:first-child) { display: none; }

  /* Room: own team full width, opponent condensed, score at the side */
  .room-head { padding: 8px 16px 6px; }
  .room-title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .room-chips span { font-size: 11px; padding: 2px 8px; }
  .arena { grid-template-columns: minmax(0, 1fr) 78px; grid-template-rows: auto auto; gap: 8px; padding: 0 16px; }
  .arena .team-a { grid-column: 1; grid-row: 1; }
  .arena .team-b { grid-column: 1; grid-row: 2; }
  .arena .scoreboard { grid-column: 2; grid-row: 1 / span 2; min-width: 0; padding: 8px 4px; }
  .score-nums { flex-direction: column; gap: 0; align-items: center; }
  .score-nums b { font-size: 34px; }
  .score-nums i { font-size: 16px; line-height: .8; }
  .score-target { display: none; }
  .score-game, .score-phase { font-size: 11px; }
  .score-phase { padding: 2px 7px; }
  .team { padding: 10px 12px; gap: 8px; }
  .team-b .team-head { flex-direction: row; text-align: left; }
  .team-b .team-state { margin-left: auto; margin-right: 0; }
  .team-b::before { left: 0; right: auto; border-radius: var(--r-lg) 0 0 var(--r-lg); }
  .team-b .team-slots { justify-content: start; }
  .team-b .team-foot { flex-direction: row; }
  .team-name { font-size: 15px; }
  .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 76px)); gap: 7px; }
  .slot { border-radius: 10px; }
  .slot-name { font-size: 11px; padding-bottom: 5px; }
  .slot-hint { font-size: 11px; }
  .slot-plus { font-size: 20px; }
  .team-foot { display: none; }
  .team-toggle { display: inline-block; }
  .team.is-secondary .team-slots { grid-template-columns: repeat(var(--slots), 38px); gap: 5px; }
  .team.is-secondary .slot { aspect-ratio: 1; border-radius: 8px; }
  .team.is-secondary .slot-name, .team.is-secondary .slot-hint, .team.is-secondary .slot-plus, .team.is-secondary .slot-remove { display: none; }
  .team.is-secondary .slot-no { font-size: 9px; padding: 2px 4px; left: 2px; top: 2px; }
  .team.is-secondary .slot-q { font-size: 16px; }
  body.opponent-expanded .team.is-secondary .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 76px)); gap: 7px; }
  body.opponent-expanded .team.is-secondary .slot { aspect-ratio: 1 / 1.18; }
  body.opponent-expanded .team.is-secondary .slot-name { display: block; }
  .team.is-secondary .team-head { gap: 8px; }
  .team.is-secondary { padding: 8px 12px; }
  .team.is-secondary .team-head { flex-wrap: nowrap; }
  .team.is-secondary .team-head + .team-slots { margin-top: -2px; }
  .room-notice { margin: 8px 16px 0; padding: 8px 12px; font-size: 13px; }
  .room-tabs { padding: 2px 12px 0; }
  .room-tabs button { padding: 10px 12px; flex: 1; }
  .library-head { padding: 10px 16px 8px; }
  .library-tip, .sort-label { display: none; }
  .library .lib-toolbar { padding: 0 16px; }
  .workspace-scroll { padding: 10px 16px 20px; }
  .action-dock { padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .dock-meter { width: 110px; }
  .dock-summary > span:not(.dock-meter) { font-size: 12px; }
  .dock-actions .btn-lg { min-height: 46px; padding: 0 18px; font-size: 15px; }
  .dock-actions .btn-a, .dock-actions .btn-b { padding: 0 12px; }
  .desk { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr 1fr; }
  .used-teams, .history-lineups, .broadcast-lower { grid-template-columns: 1fr; }
  body.broadcast .arena { grid-template-columns: minmax(0, 1fr) 90px; }
  body.broadcast .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 1fr)); }
  body.broadcast .score-nums b { font-size: 44px; }
  body.broadcast .arena .scoreboard { min-width: 0; }
  .toast { bottom: 18px; }
  body.room-page .toast { bottom: 92px; }
}

@media (max-width: 360px) {
  .ninja-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ninja-name { font-size: 13px; }
  .site-tools .btn-sm { padding: 0 9px; }
}

/* ---------- Phone & landscape-phone room (11-09 mobile fix) ----------
   The fixed-height desktop room left 30px for the library at 320×700 and none in
   landscape. Here the whole page scrolls, search stays on top, the dock stays fixed
   and the page reserves its height (--dock-h, measured in app.js). */
@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) {
  body.room-page:not(.broadcast) { overflow: visible; }
  body.room-page:not(.broadcast) .room-shell { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; padding-bottom: calc(var(--dock-h, 76px) + 12px); }
  body.room-page:not(.broadcast) .room-workspace,
  body.room-page:not(.broadcast) .library { flex: none; display: block; min-height: 0; }
  body.room-page:not(.broadcast) .workspace-scroll { flex: none; min-height: 0; overflow: visible; overscroll-behavior: auto; }
  body.room-page:not(.broadcast) .action-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; }
  body.room-page:not(.broadcast) .library .lib-toolbar { position: sticky; top: 0; z-index: 20; padding-top: 8px; padding-bottom: 8px; background: color-mix(in srgb, var(--bg) 94%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  body.room-page:not(.broadcast) .toast { bottom: calc(var(--dock-h, 76px) + 14px); }
  .room-title { min-width: 0; max-width: 100%; }
  .room-notice { align-items: flex-start; }
  .room-notice .notice-dot { margin-top: 7px; }
  .room-notice .notice-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; line-height: 1.5; }
  .room-notice.is-open .notice-text { display: block; -webkit-line-clamp: unset; line-clamp: none; }
}
@media (max-width: 760px) {
  /* Score becomes one strip above the teams so both teams get the full width. */
  body.room-page:not(.broadcast) .arena { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  body.room-page:not(.broadcast) .arena .scoreboard { grid-column: 1; grid-row: 1; flex-direction: row; justify-content: space-between; gap: 8px; padding: 6px 14px; }
  body.room-page:not(.broadcast) .arena .team-a { grid-column: 1; grid-row: 2; }
  body.room-page:not(.broadcast) .arena .team-b { grid-column: 1; grid-row: 3; }
  body.room-page:not(.broadcast) .score-nums { flex-direction: row; align-items: baseline; gap: 6px; }
  body.room-page:not(.broadcast) .score-nums b { font-size: 28px; }
  body.room-page:not(.broadcast) .score-nums i { font-size: 18px; line-height: 1; }
  body.room-page:not(.broadcast) .score-target { display: inline; }
  .notice-more { padding: 2px 9px; }
}
@media (max-width: 360px) {
  body.room-page:not(.broadcast) .score-target { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  /* Landscape phones: denser library, search and filters on one row, slimmer dock. */
  body.room-page .ninja-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  body.room-page .lib-toolbar { flex-wrap: nowrap; }
  body.room-page .lib-search { flex: 1 1 200px; min-width: 160px; }
  body.room-page .lib-filters { width: auto; flex: 0 1 auto; min-width: 0; }
  body.room-page .action-dock { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  body.room-page .dock-actions .btn-lg { min-height: 42px; }
}
@media (orientation: landscape) and (max-height: 500px) and (min-width: 761px) {
  .room-head { padding-top: 8px; padding-bottom: 6px; }
  .team { padding: 10px 12px; gap: 8px; }
  .team-slots { grid-template-columns: repeat(var(--slots), minmax(0, 76px)); gap: 8px; }
  .team-foot { display: none; }
  .scoreboard { min-width: 120px; padding: 8px 12px; }
  .score-nums b { font-size: 38px; }
  .room-notice { margin-top: 8px; padding: 8px 12px; font-size: 13px; }
  .action-dock { padding-top: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- 完赛核对 · 发布到档案馆 · 年度榜试算（站长） ---- */
.admin-site-tabs { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.admin-site-tabs .btn.active { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent-text); }
.match-review-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.match-review-note a { color: var(--accent-text); font-weight: 600; }
.rv-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; margin-bottom: 16px; flex-wrap: wrap; }
.rv-summary h2, .rv-summary h3 { font-size: 18px; margin: 2px 0 4px; }
.rv-summary.is-published { border-color: color-mix(in srgb, var(--good) 45%, var(--line-soft)); }
.rv-summary-actions { display: grid; gap: 8px; justify-items: end; max-width: 460px; }
.rv-summary-actions .portal-inline-note { text-align: right; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.rv-card { display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-soft); min-width: 0; }
.rv-card.is-ready { border-color: color-mix(in srgb, var(--good) 50%, var(--line-soft)); }
.rv-card.is-blocked { border-color: color-mix(in srgb, var(--bad) 60%, var(--line-soft)); background: color-mix(in srgb, var(--bad) 7%, var(--paper)); }
.rv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rv-sides { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.rv-sides .rv-player:last-child { text-align: right; }
.rv-player { display: grid; min-width: 0; }
.rv-player strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-player small { font-size: 13px; color: var(--muted); }
.rv-score { font-family: var(--num); font-size: 26px; font-weight: 500; color: var(--accent-text); }
.rv-bad { color: var(--bad); }
.rv-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 0; }
.rv-checks .is-ok { color: var(--good); }
.rv-checks .is-bad { color: var(--bad); font-weight: 600; }
.rv-issues { margin: 0; padding: 10px 12px 10px 28px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); font-size: 14px; display: grid; gap: 6px; }
.rv-issues li { line-height: 1.5; }
.rv-issues .btn { margin-left: 6px; }
.rv-games summary { cursor: pointer; font-size: 14px; color: var(--accent-text); font-weight: 600; }
.rv-games ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.rv-games li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; }
.rv-game-no { color: var(--dim); }
.rv-winner { color: var(--good); font-weight: 600; white-space: nowrap; }
.rv-lineup { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.rv-lineup.is-win .rv-ninja { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.rv-ninja { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 13px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-ninja.is-unknown { color: var(--bad); border-color: var(--bad); }
.rv-reference { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line); display: grid; gap: 4px; font-size: 14px; }
.rv-reference .muted { font-size: 13px; }
.rv-medals, .rv-pick { border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 14px; margin: 0; display: grid; gap: 6px; }
.rv-medals legend, .rv-pick legend { font-size: 14px; color: var(--muted); padding: 0 6px; }
.rv-pick { max-height: 220px; overflow: auto; }
.rv-check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.rv-warn { color: var(--warn); }
.rv-editions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-bottom: 16px; }
.rv-edition { display: grid; gap: 6px; padding: 14px 16px; text-decoration: none; color: inherit; }
.rv-edition strong { font-size: 18px; }
.rv-edition small { font-size: 13px; color: var(--muted); }
.rv-edition.is-active { border-color: color-mix(in srgb, var(--good) 50%, var(--line-soft)); }
.rv-edition.is-rolled_back, .rv-edition.is-revoked { opacity: .75; }
.rv-trial { display: grid; gap: 12px; padding: 16px 18px; }
.rv-trial-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.rv-trial-head h3 { font-size: 18px; margin: 2px 0 4px; }
.rv-table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
.rv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rv-table th, .rv-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: middle; }
.rv-table thead th { font-size: 13px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--paper); }
.rv-table tbody th { font-weight: 600; }
.rv-table tr.is-new th, .rv-table tr.is-qualified th { color: var(--good); }
.rv-table tr.is-dropped th { color: var(--bad); }
.rv-rank { font-family: var(--num); font-size: 16px; }
.rv-rank small, .rv-pair small { display: block; font-size: 13px; color: var(--dim); font-family: inherit; }
.rv-pair b { font-family: var(--num); font-weight: 500; }
.rv-up { color: var(--good); font-weight: 600; }
.rv-down { color: var(--bad); font-weight: 600; }
.rv-same { color: var(--dim); }
.rv-audit td:last-child { white-space: normal; min-width: 260px; }
@media (max-width: 720px) {
  .admin-site-tabs { margin-left: 0; }
  .rv-summary-actions { justify-items: stretch; }
  .rv-summary-actions .portal-inline-note { text-align: left; }
  .rv-games li { grid-template-columns: 1fr; gap: 4px; }
  .rv-score { font-size: 22px; }
}

/* FX_LAYER_BEGIN */
/* ==========================================================================
   蓝莓赛事中心 · 动效与交互层（2026-11-10）
   只加不改：进场与滚动动效、进度条生长、全站搜索面板、选手/忍者悬停小卡、
   本页目录与回到顶部、主题切换过渡，以及按钮、卡片、表格的手感精修。
   颜色全部取四套主题的变量；数据与选人逻辑零改动。
   源文件 fx-src/fx.css，由 scripts/build-fx.py 写入 web/styles.css 末尾。
   ========================================================================== */

:root {
  --fx-ease: cubic-bezier(.22, .9, .24, 1);
  --fx-glow: color-mix(in srgb, var(--accent) 55%, transparent);
  --fx-hair: color-mix(in srgb, var(--accent) 38%, var(--line));
}

/* ---------- 质感：细颗粒、选区、滚动条 ---------- */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.room-page::after { display: none; }
::selection { background: color-mix(in srgb, var(--accent) 38%, transparent); color: var(--ink); }
html { scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
h1, h2, h3 { text-wrap: balance; }
.a2-table td, .a2-stat strong, .a2-index, .portal-metrics b, .match-card-score { font-variant-numeric: tabular-nums; }

/* ---------- 视觉精修 ---------- */
:root { --fx-m1: #ffd257; --fx-m2: #cfd6e2; --fx-m3: #e39b6b; }
/* 环境光：右上主色之外，左上再补一片暖光 */
body { background: radial-gradient(900px 520px at 6% -10%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 62%), radial-gradient(1200px 600px at 85% -10%, var(--accent-soft), transparent 60%), var(--bg); }
/* 栏目标题前的金色竖线 */
.a2-head h2, .section-title h2 { position: relative; padding-left: 16px; }
.a2-head h2::before, .section-title h2::before { content: ""; position: absolute; left: 0; top: .22em; bottom: .22em; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); box-shadow: 0 0 14px var(--fx-glow); }
/* 数字牌：一角微光，数字带一点金 */
:root .a2-stat { background-image: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 48%); }
:root .a2-stat strong { font-size: 28px; background: linear-gradient(180deg, var(--ink) 35%, color-mix(in srgb, var(--accent) 70%, var(--ink))); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* 当前栏目 */
.site-nav a.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent), 0 8px 20px -12px var(--fx-glow); }
/* 前三名：金、银、铜 */
:root [data-fx-medal="1"] { color: var(--fx-m1); text-shadow: 0 0 18px color-mix(in srgb, var(--fx-m1) 55%, transparent); }
:root [data-fx-medal="2"] { color: var(--fx-m2); }
:root [data-fx-medal="3"] { color: var(--fx-m3); }
.card:has(> [data-fx-medal="1"]), .card:has(> * > [data-fx-medal="1"]) { border-color: color-mix(in srgb, var(--fx-m1) 55%, var(--line-soft)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--fx-m1) 18%, transparent), 0 24px 50px -34px var(--fx-m1); }
.card:has(> [data-fx-medal="2"]), .card:has(> * > [data-fx-medal="2"]) { border-color: color-mix(in srgb, var(--fx-m2) 45%, var(--line-soft)); }
.card:has(> [data-fx-medal="3"]), .card:has(> * > [data-fx-medal="3"]) { border-color: color-mix(in srgb, var(--fx-m3) 45%, var(--line-soft)); }

/* ---------- 进场与滚动出现 ---------- */
.fx-wait { opacity: 0; transform: translate3d(0, 22px, 0); }
.fx-in { animation: fx-rise .72s var(--fx-ease) both; animation-delay: var(--fx-d, 0ms); }
@keyframes fx-rise { from { opacity: 0; transform: translate3d(0, 22px, 0); } to { opacity: 1; transform: none; } }

/* 进度条从零长出来 */
.fx-bar-wait { transform: scaleX(0) !important; transform-origin: 0 50%; }
.fx-bar-in { transform-origin: 0 50%; animation: fx-grow 1.05s var(--fx-ease) both; animation-delay: var(--fx-d, 0ms); }
@keyframes fx-grow { from { transform: scaleX(0); } to { transform: none; } }

/* 五维画像展开 */
.fx-radar-wait { opacity: 0; }
.fx-radar-in { transform-box: fill-box; transform-origin: 50% 50%; animation: fx-radar 1s var(--fx-ease) both; }
@keyframes fx-radar { from { opacity: 0; transform: scale(.35); } to { opacity: 1; transform: none; } }

/* ---------- 顶栏 ---------- */
.site-header { transition: box-shadow .3s, background-color .3s; }
.site-header.fx-scrolled { box-shadow: 0 14px 34px -22px rgb(0 0 0 / .75); }
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transform: scaleX(var(--fx-scroll, 0)); transform-origin: 0 50%; opacity: .9;
}
.room-shell .site-header::after { display: none; }
.site-mark { transition: transform .6s var(--fx-ease), box-shadow .3s; }
.site-brand:hover .site-mark { transform: rotate(90deg) scale(1.06); box-shadow: inset 0 0 0 1px var(--fx-glow), 0 0 22px -6px var(--fx-glow); }
.site-nav a { transition: color .2s, background-color .2s; }

/* 顶部细进度线：换页时走一下 */
.fx-topbar { position: fixed; left: 0; top: 0; z-index: 90; height: 2px; width: 100%; pointer-events: none; opacity: 0; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); box-shadow: 0 0 12px var(--fx-glow); }
.fx-topbar.run { opacity: 1; transform: scaleX(.82); transition: transform 2.4s cubic-bezier(.1, .7, .2, 1); }
.fx-topbar.done { opacity: 0; transform: scaleX(1); transition: transform .22s ease-out, opacity .35s .18s; }

/* 搜索入口 */
.fx-cmd-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 3%, transparent); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .2s, color .2s, background-color .2s; }
.fx-cmd-btn:hover { color: var(--ink); border-color: var(--fx-hair); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.fx-cmd-btn svg { width: 14px; height: 14px; flex: none; }
.fx-cmd-btn kbd { font: 600 11px/1 var(--num); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--dim); background: var(--bg); }
@media (max-width: 1180px) { .fx-cmd-btn { padding: 0 10px; } .fx-cmd-btn span, .fx-cmd-btn kbd { display: none; } }

/* ---------- 按钮与卡片手感 ---------- */
.btn, .button-primary, .portal-button { transition: background-color .2s, border-color .2s, color .2s, transform .18s var(--fx-ease), filter .2s, box-shadow .25s; }
.btn:active:not(:disabled), .portal-button:active, .button-primary:active { transform: translateY(1px) scale(.975); }
.btn-primary, .button-primary { background-image: linear-gradient(180deg, rgb(255 255 255 / .22), rgb(255 255 255 / 0) 55%); }
.btn-primary:hover:not(:disabled), .button-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -14px var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-primary:active:not(:disabled), .button-primary:active { transform: translateY(1px) scale(.975); }

a.card, .event-card, .match-card, .a2-stat, .admin-step { transition: transform .32s var(--fx-ease), border-color .28s, box-shadow .32s, background-color .28s; }
@media (hover: hover) {
  a.card:hover, .event-card:hover { transform: translateY(-3px); border-color: var(--fx-hair); box-shadow: var(--shadow), 0 22px 46px -30px var(--fx-glow); }
  .a2-stat:hover { border-color: var(--fx-hair); }
  a.card:hover .a2-avatar, a.card:hover .a2-portrait { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
  .a2-table tbody tr { transition: background-color .16s; }
  .a2-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
}
.a2-avatar, .a2-portrait { transition: box-shadow .25s; }
/* 跟着鼠标走的一小片光 */
.fx-spot { background-image: radial-gradient(380px circle at var(--fx-x, 50%) var(--fx-y, 0%), color-mix(in srgb, var(--accent) 11%, transparent), transparent 62%); }

/* 进度条末端一点亮 */
:root .a2-meter-track i, :root .a2-wl-track i { background-image: linear-gradient(90deg, transparent calc(100% - 26px), rgb(255 255 255 / .34)), var(--a2-win, linear-gradient(90deg, var(--accent-2), var(--accent))); }

/* 标题下的金线 */
.a2-head h2, .section-title h2 { scroll-margin-top: calc(var(--header-h) + 18px); }
.a2-head, .section-title { scroll-margin-top: calc(var(--header-h) + 18px); }

/* 档案馆首页大图：进场时一道光扫过 */
.a2-home-hero::after, .a2-dossier-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgb(255 255 255 / .09) 50%, transparent 62%);
  transform: translateX(-120%);
}
.a2-home-hero.fx-in::after, .a2-dossier-hero.fx-in::after, .a2-home-hero.fx-swept::after, .a2-dossier-hero.fx-swept::after { animation: fx-sweep 1.5s .35s var(--fx-ease) both; }
@keyframes fx-sweep { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
.a2-home-hero h1 em { background: linear-gradient(100deg, var(--accent-text), color-mix(in srgb, var(--accent) 60%, #fff) 45%, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* 登录页大图缓慢呼吸 */
.auth-art { overflow: hidden; isolation: isolate; }
.auth-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: inherit; animation: fx-breathe 26s ease-in-out infinite alternate; }
@keyframes fx-breathe { from { transform: scale(1); } to { transform: scale(1.08) translate3d(-1%, -1%, 0); } }

/* 载入中的星标 */
.boot .brand-symbol, .a2-loading .brand-symbol { display: inline-block; animation: fx-star 1.6s var(--fx-ease) infinite; }
@keyframes fx-star { 0% { transform: rotate(0) scale(.9); opacity: .55; } 50% { transform: rotate(90deg) scale(1.12); opacity: 1; } 100% { transform: rotate(180deg) scale(.9); opacity: .55; } }

/* 弹窗背景虚化 */
dialog::backdrop { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }

/* ---------- 全站搜索面板 ---------- */
.fx-cmd { width: min(640px, calc(100vw - 24px)); max-height: min(640px, calc(100dvh - 80px)); margin: 9vh auto auto; padding: 0; border: 1px solid var(--fx-hair); border-radius: 18px; background: color-mix(in srgb, var(--paper) 94%, transparent); color: var(--ink); box-shadow: var(--shadow-lg), 0 0 80px -30px var(--fx-glow); overflow: hidden; -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); }
.fx-cmd[open] { display: flex; flex-direction: column; animation: fx-cmd-in .26s var(--fx-ease); }
.fx-cmd::backdrop { background: rgb(0 0 0 / .5); animation: fx-fade .2s; }
@keyframes fx-cmd-in { from { opacity: 0; transform: translateY(-12px) scale(.975); } }
@keyframes fx-fade { from { opacity: 0; } }
.fx-cmd-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.fx-cmd-top svg { width: 18px; height: 18px; color: var(--accent-text); flex: none; }
.fx-cmd-top input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; padding: 4px 0; box-shadow: none; }
.fx-cmd-top input::placeholder { color: var(--dim); }
.fx-cmd-top button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 7px; font: 600 12px/1 var(--num); padding: 5px 8px; cursor: pointer; }
.fx-cmd-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.fx-cmd-group { padding: 10px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--dim); }
.fx-cmd-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; cursor: pointer; min-height: 50px; }
.fx-cmd-item[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent); }
.fx-cmd-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent-text); font-family: var(--serif); font-weight: 700; font-size: 15px; }
.fx-cmd-ico.sq { border-radius: 9px; }
.fx-cmd-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fx-cmd-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.fx-cmd-main b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-cmd-main b mark { background: none; color: var(--accent-text); }
.fx-cmd-main small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-cmd-side { flex: none; color: var(--accent-text); font: 600 14px var(--num); font-variant-numeric: tabular-nums; }
.fx-cmd-empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 15px; }
.fx-cmd-foot { display: flex; gap: 16px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 12.5px; }
.fx-cmd-foot kbd { font: 600 11px/1 var(--num); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line); margin-right: 5px; color: var(--muted); }
.fx-cmd-foot span:last-child { margin-left: auto; }
@media (max-width: 640px) {
  .fx-cmd { margin-top: 10px; max-height: calc(100dvh - 20px); border-radius: 16px; }
  .fx-cmd-foot { display: none; }
  .fx-cmd-top input { font-size: 16px; }
}

/* ---------- 悬停小卡 ---------- */
.fx-peek { position: fixed; z-index: 80; left: 0; top: 0; width: 272px; padding: 14px; border-radius: 16px; border: 1px solid var(--fx-hair); background: color-mix(in srgb, var(--paper) 95%, transparent); color: var(--ink); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); pointer-events: none; opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .16s, transform .22s var(--fx-ease); display: grid; gap: 10px; }
.fx-peek.show { opacity: 1; transform: none; }
.fx-peek-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.fx-peek-top .fx-cmd-ico { width: 46px; height: 46px; font-size: 19px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.fx-peek-top div { min-width: 0; display: grid; gap: 2px; }
.fx-peek-top b { font-family: var(--serif); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-peek-top small { color: var(--accent-text); font-size: 13px; font-weight: 600; }
.fx-peek-rate { display: flex; align-items: baseline; gap: 8px; }
.fx-peek-rate b { font: 700 26px/1 var(--num); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.fx-peek-rate span { color: var(--muted); font-size: 13px; }
.fx-peek-bar { display: block; height: 6px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--bad) 22%, var(--line-soft)); }
.fx-peek-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.fx-peek-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.fx-peek-facts b { color: var(--ink); font-family: var(--num); margin-right: 3px; }

/* ---------- 右下角：本页目录与回到顶部 ---------- */
.fx-dock { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 45; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .25s, transform .3s var(--fx-ease); }
.fx-dock.show { opacity: 1; transform: none; pointer-events: auto; }
.fx-dock-row { display: flex; gap: 8px; }
.fx-dock button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 42px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 90%, transparent); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: border-color .2s, transform .2s var(--fx-ease), color .2s; }
.fx-dock button:hover { border-color: var(--fx-hair); color: var(--accent-text); transform: translateY(-2px); }
.fx-dock button[hidden] { display: none; }
.fx-toc { list-style: none; margin: 0; padding: 8px; width: 232px; max-height: min(56vh, 420px); overflow-y: auto; border-radius: 16px; border: 1px solid var(--fx-hair); background: color-mix(in srgb, var(--paper) 96%, transparent); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.fx-toc[hidden] { display: none; }
.fx-toc li { padding: 9px 12px; border-radius: 10px; font-size: 14px; color: var(--muted); cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.fx-toc li i { font: 600 12px var(--num); color: var(--dim); font-style: normal; }
.fx-toc li:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.fx-toc li.on { color: var(--accent-text); background: var(--accent-soft); }
body.room-page .fx-dock, body.room-page .fx-topbar { display: none; }

/* ---------- 主题切换：从按钮处圆形展开 ---------- */
html.fx-theme-vt::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
html.fx-theme-vt::view-transition-new(root) { animation: fx-theme .7s var(--fx-ease) both; mix-blend-mode: normal; }
@keyframes fx-theme { from { clip-path: circle(0 at var(--fx-tx, 90%) var(--fx-ty, 0%)); } to { clip-path: circle(150vmax at var(--fx-tx, 90%) var(--fx-ty, 0%)); } }

/* ---------- 少动效、打印 ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-wait, .fx-bar-wait, .fx-radar-wait { opacity: 1 !important; transform: none !important; }
  .fx-in, .fx-bar-in, .fx-radar-in, .auth-art::before, .a2-home-hero::after, .a2-dossier-hero::after { animation: none !important; }
}
@media print {
  .fx-wait, .fx-bar-wait, .fx-radar-wait { opacity: 1 !important; transform: none !important; }
  .fx-dock, .fx-topbar, .fx-peek, .fx-cmd-btn, body::after { display: none !important; }
}
/* FX_LAYER_END */
