/* 版面規格照 App 的樣稿（docs/ui-guide.md）：近黑底、圓角 24 的灰面板、暗金眉標、板塊標題在面板上方 */
:root {
  --bg: #050506; --surface: #131314; --surface2: #1c1c1e; --surface3: #29292c; --border: #232325; --border2: #35353a;
  --text: #f5f5f7; --strong: #fff; --dim: #9a9aa1; --muted: #5f5f66;
  --gold: #d6b673; --gold-dim: #8a744a; --pos: #30d981; --neg: #ff6e66; --blue: #5aa9ff;
  --radius: 24px; --gap: 24px; --pad: 24px; --margin: 40px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Pretendard", "PingFang TC", "Noto Sans TC", "Noto Sans KR", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/20px var(--font); min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); font-variant-numeric: tabular-nums; }
body::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 620px; z-index: -1; pointer-events: none; background: radial-gradient(80% 100% at 60% -20%, rgba(120, 12, 34, .5), rgba(60, 6, 18, .2) 50%, transparent 78%); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
svg { display: block; }

/* 外殼：桌面是左側浮動側邊欄＋頂部工具列（頁面自己的分段控制放在工具列）；手機是頂列＋底部分頁 */
.shell { min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: calc(12px + env(safe-area-inset-top)) var(--margin) 12px; background: linear-gradient(rgba(5,5,6,.9), rgba(5,5,6,.45)); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.brand img { border-radius: 7px; }
.brand b { color: var(--gold); }
.toolbar-seg { min-width: 0; }
.toolbar-seg .seg { margin: 0; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.pill { height: 36px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border2); font-weight: 600; font-size: 13px; }
.pill:hover { background: var(--surface3); }
.pill.gold { background: var(--gold); color: #1a1405; border-color: var(--gold); }
.side { display: none; }
.sidelink { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; border-radius: 12px; color: var(--dim); font-size: 14px; font-weight: 500; }
.sidelink svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidelink:hover { background: rgba(255,255,255,.04); }
.sidelink[aria-current="page"] { background: var(--surface3); color: var(--strong); font-weight: 600; }
.sidelink[aria-current="page"] svg { color: var(--gold); }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(19,19,20,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--border); }
.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--dim); font-size: 11px; font-weight: 600; }
.bottom a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom a[aria-current="page"] { color: var(--gold); }

main { max-width: 1240px; margin: 0 auto; padding: 8px var(--margin) 40px; outline: none; }
h1 { font-size: 28px; line-height: 34px; margin: 4px 0 16px; color: var(--strong); letter-spacing: -.01em; font-weight: 700; }
h2 { display: block; font-size: 17px; line-height: 24px; margin: var(--gap) 0 16px; color: var(--strong); font-weight: 600; }
h2 small { margin-left: 10px; font-size: 12px; font-weight: 400; color: var(--dim); }
.eyebrow { color: var(--gold); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.cap { color: var(--dim); font-size: 12px; line-height: 16px; margin: 8px 4px 0; }
.card { background: var(--surface); border-radius: var(--radius); padding: var(--pad); }
.card.flush { padding: 8px var(--pad); }
.cols { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.note { color: var(--dim); font-size: 13px; padding: 4px; }
.err { color: var(--neg); }
.stale { display: inline-block; margin-bottom: 12px; padding: 3px 12px; border-radius: 999px; background: var(--surface2); color: var(--dim); font-size: 12px; }

/* 分段控制（膠囊）*/
.seg { display: inline-flex; max-width: 100%; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border2); margin: 0 0 var(--gap); overflow-x: auto; scrollbar-width: none; }
.seg button { white-space: nowrap; padding: 7px 18px; border-radius: 999px; color: var(--dim); font-weight: 500; font-size: 14px; }
.seg button[aria-pressed="true"] { background: #f2f2f4; color: #0b0b0c; font-weight: 600; }

.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.grow { flex: 1; min-width: 0; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim { color: var(--dim); } .muted { color: var(--muted); } .strong { color: var(--strong); font-weight: 600; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .gold { color: var(--gold); }
.right { text-align: right; }
.logo { width: 28px; height: 28px; object-fit: contain; flex: none; }
.logo.lg { width: 64px; height: 64px; }
.logo.xl { width: 44px; height: 44px; }
.logo.ph { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface3); color: var(--dim); font-size: 10px; font-weight: 700; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface2); color: var(--dim); font-size: 12px; font-weight: 600; }
.chip.gold { color: var(--gold); border: 1px solid var(--gold-dim); background: none; }
.chip.live { color: var(--neg); border: 1px solid var(--neg); background: none; }
.rank { width: 22px; color: var(--muted); font-weight: 700; text-align: center; }
.spark { width: 64px; height: 24px; flex: none; }
.spark polyline { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark.up polyline { stroke: var(--pos); } .spark.down polyline { stroke: var(--neg); } .spark.flat polyline { stroke: var(--dim); }

/* 主視覺：眉標、大標題、陣容照片（背後一片暗紅光暈，跟 App 一樣）*/
.hero { position: relative; isolation: isolate; display: grid; gap: 20px; padding: 28px 0 8px; }
.hero::before { content: ""; position: absolute; z-index: -1; pointer-events: none; inset: -160px -60px 0 -60px; background: radial-gradient(48% 62% at 62% 34%, rgba(158, 14, 40, .78), rgba(96, 8, 26, .42) 52%, transparent 78%); }
.hero .left { display: grid; gap: 16px; align-content: start; }
.hero .title { display: flex; align-items: center; gap: 18px; }
.hero .title .logo { width: auto; height: 48px; max-width: 110px; }
.hero .title h1 { font-size: 48px; line-height: 58px; margin: 0; font-weight: 700; }
.hero .sub { color: #c9c9ce; font-size: 15px; line-height: 20px; }
.hero .sub .dim { font-size: 15px; }
.hl { display: flex; flex-wrap: wrap; gap: 8px 40px; margin-top: 4px; }
.hl .k b { display: block; font-size: 28px; line-height: 36px; font-weight: 600; color: var(--strong); }
.hl .k span { color: var(--dim); font-size: 13px; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 40px; }
.keys .k b { display: block; font-size: 28px; line-height: 36px; font-weight: 600; color: var(--strong); }
.keys .k span { color: var(--dim); font-size: 12px; }
.lnrow { display: flex; justify-content: center; align-items: flex-end; margin-top: 8px; }
.lnrow a { flex: 1 1 0; min-width: 0; max-width: 300px; display: flex; flex-direction: column; align-items: center; margin: 0 -4.5%; }
.lnrow .ph { width: 100%; aspect-ratio: 1 / 1.08; display: flex; align-items: flex-end; justify-content: center; -webkit-mask-image: linear-gradient(#000 76%, transparent); mask-image: linear-gradient(#000 76%, transparent); }
.lnrow img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.lnrow a:nth-child(3) { z-index: 2; transform: scale(1.1); transform-origin: bottom center; }
.lnrow a:nth-child(2), .lnrow a:nth-child(4) { z-index: 1; transform: scale(1.06); transform-origin: bottom center; }
.lnrow .nm { margin-top: 10px; font-weight: 600; font-size: 16px; color: var(--strong); text-align: center; }
.lnrow .rl { color: var(--dim); font-size: 13px; text-align: center; }
.changes2 { display: grid; gap: 24px 40px; grid-template-columns: 1fr; }
.chg h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.chg .row { min-height: 48px; }
.staff3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.staff3 > div { padding: 18px 12px; text-align: center; border-left: 1px solid var(--border); }
.staff3 > div:first-child { border-left: 0; }
.next-mini { background: var(--surface); border-radius: 18px; padding: 14px; max-width: 220px; font-size: 12px; line-height: 18px; }
.next-mini .t { font-weight: 600; color: var(--strong); font-size: 13px; }
.vs { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: center; padding: 8px 0; }
.vs .team { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--strong); }
.vs .mid { flex: none; min-width: 120px; }
.countdown { font-size: 30px; line-height: 38px; font-weight: 700; color: var(--strong); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface2); border-radius: 16px; padding: 14px 16px; }
.tile .k { color: var(--dim); font-size: 12px; } .tile .v { font-size: 24px; line-height: 32px; font-weight: 600; color: var(--strong); }
.day { margin: var(--gap) 4px 12px; color: var(--dim); font-size: 13px; font-weight: 600; }
.match { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.match:first-child { border-top: 0; }
.match .teams { display: flex; align-items: center; gap: 10px; min-width: 0; }
.match .teams .t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.star { color: var(--muted); font-size: 20px; padding: 6px; line-height: 1; }
.star[aria-pressed="true"] { color: var(--gold); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { color: var(--dim); font-weight: 400; font-size: 12px; text-align: left; padding: 6px 8px; }
table.t td { padding: 12px 8px; border-top: 1px solid var(--border); }
table.t td.n, table.t th.n { text-align: right; }
.champs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.champ { width: 36px; height: 36px; border-radius: 50%; background: var(--surface3); flex: none; }
.cchip { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; }
form.add { display: grid; gap: 8px; margin-top: 12px; }
input[type="text"], input[type="url"] { width: 100%; height: 40px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--border2); background: var(--surface2); color: var(--text); font: inherit; }

/* 選手 */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.pcard { position: relative; display: flex; flex-direction: column; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 16px 12px 18px; overflow: hidden; }
.pcard:hover { background: var(--surface2); }
.pcard .ph { width: 100%; max-width: 200px; aspect-ratio: 1 / 1.05; -webkit-mask-image: linear-gradient(#000 76%, transparent); mask-image: linear-gradient(#000 76%, transparent); }
.pcard .ph img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.pcard .nm { font-size: 20px; line-height: 26px; font-weight: 600; color: var(--strong); margin-top: 8px; }
.phero { display: grid; gap: 16px; position: relative; padding-top: 12px; }
.phero h1 { font-size: 56px; line-height: 64px; margin: 4px 0 0; }
.phero .photo { width: min(100%, 420px); aspect-ratio: 1 / 1.1; justify-self: center; -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
.phero .photo img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.radar { width: 100%; max-width: 360px; justify-self: center; }
.radar .grid-l { fill: none; stroke: var(--border2); stroke-width: 1; }
.radar .med { fill: none; stroke: var(--dim); stroke-width: 1; stroke-dasharray: 3 3; }
.radar .val { fill: rgba(214,182,115,.2); stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.radar text { fill: var(--dim); font-size: 11px; font-family: var(--font); }
.contract { display: flex; align-items: center; gap: 10px; }
.perf { display: grid; gap: 4px 32px; grid-template-columns: 1fr; }
.pr { padding: 14px 0; }
.pr .l { display: flex; justify-content: space-between; align-items: baseline; }
.pr .l b { font-size: 26px; line-height: 32px; font-weight: 600; color: var(--strong); }
.pr .bar { width: 100%; height: 6px; margin-top: 8px; }
.bar .track { fill: var(--surface3); }
.bar .fill { fill: var(--dim); } .bar .fill.good { fill: var(--pos); }
.bar .mid { fill: var(--border2); }
.back { color: var(--dim); font-weight: 500; display: inline-block; margin: 8px 0; }

.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
dialog { max-width: min(640px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; border: 1px solid var(--border2); border-radius: 28px; background: #101012; color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }
.dlg-h h2 { margin: 0; font-size: 19px; }
.x { width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border2); font-size: 18px; }
.steps { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 10px; padding: 5px 0; }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #1a1405; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.dev { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 14px 16px; margin-top: 12px; }
.dev.here { border-color: var(--gold-dim); }
.dev h3 { margin: 0 0 4px; font-size: 16px; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 16px; background: var(--gold); color: #1a1405; font-weight: 700; text-align: center; }
.btn.sub { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 40; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 999px; background: var(--surface3); border: 1px solid var(--border2); font-size: 14px; }
canvas.preview { width: 100%; height: auto; border-radius: 16px; margin: 14px 0 10px; background: #000; }
.gap { height: 16px; }
.flush0 { margin: 0; }
img.broken { visibility: hidden; }

@media (max-width: 899px) {
  :root { --margin: 16px; --pad: 18px; --gap: 20px; }
  .hero .title h1 { font-size: 44px; line-height: 52px; }
  .hero .title .logo { height: 40px; }
  .phero h1 { font-size: 44px; line-height: 52px; }
  .lnrow a { margin: 0 -6%; }
  .toolbar-seg { display: none; }
  .brand.compact { display: flex; }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 240px; }
  .bottom { display: none; }
  .brand.compact { display: none; }
  .side { position: fixed; z-index: 30; left: 10px; top: 10px; bottom: 10px; width: 210px; display: flex; flex-direction: column; gap: 14px; padding: 18px 12px; border-radius: 24px; background: rgba(19,19,20,.92); border: 1px solid var(--border); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .side .brand { padding: 4px 8px 10px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid var(--border); color: var(--dim); font-size: 12px; line-height: 18px; }
  .hero { grid-template-columns: 250px 1fr; align-items: start; gap: 16px 12px; }
  .hero .left { align-self: start; display: grid; gap: 20px; align-content: start; }
  .changes2 { grid-template-columns: 1fr 1fr; }
  .cols.two { grid-template-columns: 1fr 1fr; }
  .phero { grid-template-columns: 1.1fr 1fr 1fr; align-items: center; }
  .phero .photo { width: 100%; }
  .perf { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: no-preference) { .card, .tile, .pcard { transition: background .2s; } }
.chg-n { width: 38%; flex: none; }
.chg-r { width: 28%; flex: none; }

/* 主視覺的一排人：照 App 樣稿（中心間距＝1，寬度 1.8／2.0／2.31 倍，後排壓暗，最下面淡出），名字在下面 */
.lineup { container-type: inline-size; width: 100%; }
.stage { position: relative; height: 42.4cqw; -webkit-mask-image: linear-gradient(#000 84%, transparent); mask-image: linear-gradient(#000 84%, transparent); }
.ln { position: absolute; bottom: 0; transform: translateX(-50%); }
.ln img { display: block; width: 100%; height: auto; }
.ln[data-i="0"] { left: 10cqw; width: 36cqw; } .ln[data-i="1"] { left: 30cqw; width: 40cqw; } .ln[data-i="2"] { left: 50cqw; width: 46.2cqw; }
.ln[data-i="3"] { left: 70cqw; width: 40cqw; } .ln[data-i="4"] { left: 90cqw; width: 36cqw; }
.z1 { z-index: 1; } .z2 { z-index: 2; } .z5 { z-index: 5; }
.b66 img { filter: brightness(.66); } .b82 img { filter: brightness(.82); }
.names { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 8px; }
.names a { text-align: center; min-width: 0; }
.names .nm { font-weight: 600; font-size: 15px; line-height: 20px; color: var(--strong); }
.names .rl { color: var(--dim); font-size: 12px; line-height: 16px; }

/* 側邊欄分組標題、工具列右側按鈕 */
.side-label { padding: 12px 14px 4px; font-size: 12px; font-weight: 600; color: var(--dim); }
.side-foot .pill { width: 100%; justify-content: center; margin-bottom: 10px; }
.round { width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border2); display: inline-flex; align-items: center; justify-content: center; }
.round:hover, .pill.lang:hover { background: var(--surface3); }
.round svg { width: 17px; height: 17px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill.lang svg { width: 13px; height: 13px; margin-left: 6px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.top-actions { align-items: center; }
.langopt { width: 100%; text-align: left; }
#qres { margin-top: 4px; }
@media (min-width: 900px) { .compact-only { display: none !important; } }
@media (max-width: 899px) { .pill.lang { display: none; } .side-foot { display: none; } }

.sb { color: var(--blue); } .sr { color: #ff6e66; }
a.match.rec:hover { background: rgba(255,255,255,.03); }
.phero.compact { grid-template-columns: 1fr; padding-bottom: 8px; }
.phero.compact h1 { font-size: 40px; line-height: 48px; }
