/* ============================================================
 * 中華職棒版 — 自給自足樣式（不依賴籃球 style.css）
 * 配色：海軍藍 × 中華紅 × 米白
 * ============================================================ */
:root {
  --bg: #0c1730; --bg-card: #15233f; --bg-soft: #1d2d4e; --border: #2c3c5e;
  --text: #eef2fb; --muted: #95a2bd;
  --accent: #d4232e; --accent-2: #ff6b70; --accent-d: #8f1820;
  --gold: #e7c873; --gold-2: #f3dd9a; --good: #3ba55d;
  --radius: 14px; --radius-sm: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* 修正：display:flex/block 會蓋掉 hidden 屬性 */
html, body { margin: 0; padding: 0; }
body {
  font-family: "Fira Sans", system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: radial-gradient(900px 520px at 50% -10%, rgba(212,35,46,.12), transparent 70%), var(--bg);
  color: var(--text); line-height: 1.5; min-height: 100vh;
}
.muted { color: var(--muted); } .small { font-size: .85rem; }
.accent { color: var(--accent-2); } .gold { color: var(--gold); }
a { color: var(--accent-2); }

/* 按鈕 */
.btn { border: 0; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-weight: 700; font-size: 1rem; padding: .75rem 1.4rem; color: #fff; transition: filter .15s, transform .05s; }
.btn:active { transform: translateY(1px); }

/* 開場 Lottie 載入動畫 overlay */
.splash { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 42%, #16284f, #0a1226 72%); transition: opacity .55s ease; }
.splash.hide { opacity: 0; pointer-events: none; }
.splash-anim { width: clamp(150px, 42vw, 240px); height: clamp(150px, 42vw, 240px); opacity: 0; transform: scale(.9); transition: opacity .45s ease, transform .45s ease; }
.splash-anim.in { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .splash-anim { transition: opacity .2s; transform: none; } }

/* 結算「蓄力」overlay */
.calc-overlay { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; background: radial-gradient(circle at 50% 42%, #16284f, #0a1226 72%); opacity: 0; transition: opacity .35s ease; }
.calc-overlay.show { opacity: 1; }
.calc-anim { width: clamp(120px, 34vw, 180px); height: clamp(120px, 34vw, 180px); }
.calc-text { color: var(--gold); font-weight: 800; font-size: 1.15rem; letter-spacing: 1px; animation: calcPulse 1.1s ease-in-out infinite; }
@keyframes calcPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* 結算頁分段揭曉 */
@keyframes revealUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gradePop { 0% { opacity: 0; transform: scale(.4); } 60% { transform: scale(1.18); } 100% { opacity: 1; transform: scale(1); } }
#screen-result.reveal .mode-badge { animation: revealUp .4s ease both; }
#screen-result.reveal .proj-label { animation: revealUp .4s ease both .1s; }
#screen-result.reveal .record { animation: revealUp .4s ease both .15s; }
#screen-result.reveal .grade-line { animation: gradePop .55s cubic-bezier(.2,.8,.3,1.4) both 1s; }
#screen-result.reveal .rsra-line { animation: revealUp .45s ease both 1.2s; }
#screen-result.reveal .result-actions { animation: revealUp .45s ease both 1.5s; }
#screen-result.reveal #resultRoster > * { animation: revealUp .4s ease both; }   /* 每列 delay 由 JS 設 */

/* 完美 120-0 彩帶 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9500; overflow: hidden; }
.confetti i { position: absolute; top: -16px; height: 14px; border-radius: 2px; opacity: .95; animation-name: confettiFall; animation-timing-function: linear; animation-fill-mode: both; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(108vh) rotate(900deg); opacity: .7; } }

@media (prefers-reduced-motion: reduce) {
  #screen-result.reveal .mode-badge, #screen-result.reveal .proj-label, #screen-result.reveal .record,
  #screen-result.reveal .grade-line, #screen-result.reveal .rsra-line, #screen-result.reveal .result-actions,
  #screen-result.reveal #resultRoster > * { animation: none; }
  .calc-text { animation: none; }
}

/* CTA 按鈕外框脈動發亮（吸引點擊）：模式按鈕、SPIN、下一回合 */
@keyframes ctaGlowRed { 0%, 100% { box-shadow: 0 0 0 0 rgba(212,35,46,0); } 50% { box-shadow: 0 0 16px 3px rgba(212,35,46,.6); } }
@keyframes ctaGlowGold { 0%, 100% { box-shadow: 0 0 0 0 rgba(231,200,115,0); } 50% { box-shadow: 0 0 16px 3px rgba(231,200,115,.55); } }
.mode-card .btn-primary, #spinBtn { animation: ctaGlowRed 1.7s ease-in-out infinite; }
.mode-card .btn-gold, #nextRoundBtn { animation: ctaGlowGold 1.7s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .mode-card .btn-primary, .mode-card .btn-gold, #spinBtn, #nextRoundBtn { animation: none; } }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-d)); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #3a2a00; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg-soft); }
.icon-btn, .skip-btn { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: .45rem .7rem; cursor: pointer; font-family: inherit; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.skip-btn:disabled { opacity: .35; cursor: not-allowed; }
.skip-btn:not(:disabled):hover { border-color: var(--accent); color: var(--accent-2); }
/* 還能重選（球隊/賽季）時，外框金色脈動提示可按 */
.skip-btn.attn { border-color: var(--gold); color: var(--gold); animation: skipGlow 1.4s ease-in-out infinite; }
@keyframes skipGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(231,200,115,.5); } 50% { box-shadow: 0 0 0 5px rgba(231,200,115,0); } }
@media (prefers-reduced-motion: reduce) { .skip-btn.attn { animation: none; } }
.search { width: 100%; padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font-family: inherit; font-size: .95rem; }

/* 頂部欄 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: .6rem 3.6rem .6rem 1rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(10,18,38,.92); backdrop-filter: blur(6px); z-index: 20; }
.brand { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.logo-badge { background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #fff; font-weight: 800; font-style: italic; padding: .15rem .55rem; border-radius: 8px; border: 1px solid rgba(231,200,115,.5); }
.home-logo-btn { background: none; border: none; padding: 0; cursor: pointer; display: flex; align-items: center; line-height: 0; }
.home-logo-btn img { height: 38px; width: auto; border-radius: 8px; transition: transform .15s ease, filter .15s ease; }
.home-logo-btn:hover img { transform: scale(1.06); filter: drop-shadow(0 2px 8px rgba(212,35,46,.5)); }
.music-toggle { position: fixed; top: .7rem; right: .7rem; z-index: 70; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: rgba(10,18,38,.85); backdrop-filter: blur(6px); color: var(--text); font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,.35); transition: border-color .15s ease, transform .15s ease; }
.music-toggle:hover { transform: scale(1.08); }
.music-toggle.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(231,200,115,.3), 0 2px 10px rgba(0,0,0,.35); }
body.modal-open .music-toggle { display: none; }   /* 開戰績圖時不擋關閉鈕 */
.round-label { font-weight: 600; color: var(--muted); white-space: nowrap; }
.topbar-right { display: flex; gap: .4rem; }

/* 畫面 */
.screen { padding: 1rem; }
.hero { text-align: center; max-width: 720px; margin: 1.5rem auto .5rem; }
.big-num { font-size: 3.6rem; font-weight: 800; font-style: italic; letter-spacing: -1px; line-height: 1; background: linear-gradient(135deg, #ff5a5f, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 4px 24px rgba(212,35,46,.25); margin-bottom: .5rem; }
.hero-logo { width: 210px; max-width: 56%; height: auto; display: block; margin: 0 auto .6rem; border-radius: 24px; filter: drop-shadow(0 10px 30px rgba(212,35,46,.35)); }
.title { font-size: clamp(2.1rem, 6vw, 3.5rem); font-weight: 800; line-height: 1.22; letter-spacing: .5px; margin: .8rem 0 .6rem; text-shadow: 0 2px 20px rgba(0,0,0,.4); }
.title .accent { background: linear-gradient(135deg, #ff6b70, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; padding: 0 .05em; }
/* 主標：120-0 中職夢幻隊 — 大、單行不換行（字級隨寬度縮放） */
.brand-title { font-size: clamp(1.7rem, 8.4vw, 3.7rem); font-weight: 800; white-space: nowrap; line-height: 1.08; letter-spacing: 0; margin: .5rem 0 .35rem; padding: 0 .3rem; text-shadow: 0 3px 22px rgba(0,0,0,.45); }
.brand-title .accent { background: linear-gradient(135deg, #ff6b70, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; font-style: italic; }
.subtitle { font-size: clamp(1.05rem, 3.6vw, 1.6rem); font-weight: 700; color: var(--text); margin: .2rem auto .5rem; }
.subtitle .accent { color: var(--accent-2); }
.slogan { font-size: clamp(.95rem, 2.4vw, 1.15rem); } .slogan-sub { margin: .4rem auto; max-width: 640px; }
.hero { padding-top: 1.5rem; }
.hero-note { font-size: .85rem; color: var(--gold); background: var(--bg-card); display: inline-block; padding: .4rem .8rem; border-radius: 8px; border: 1px solid var(--border); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 720px; margin: 1.2rem auto; }
.mode-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; text-align: center; }
.mode-name { margin: .2rem 0 .4rem; }
.mode-card .btn { margin-top: .7rem; width: 100%; }
/* 重點數據徽章 */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; max-width: 720px; margin: .4rem auto 1.4rem; }
.hstat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem .5rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.hstat-ico { font-size: 1.4rem; line-height: 1; margin-bottom: .15rem; }
.hstat b { font-size: 1.35rem; font-weight: 800; color: var(--gold); font-style: italic; line-height: 1.05; }
.hstat span { font-size: .72rem; color: var(--muted); }

/* 玩法 3 步驟 */
.steps { max-width: 720px; margin: 0 auto 1.2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem 1.1rem; }
.steps-title { margin: 0 0 .8rem; text-align: center; }
.steps-row { display: flex; align-items: stretch; justify-content: center; gap: .5rem; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
.step p { margin: 0; font-weight: 600; font-size: .92rem; }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.step-arrow { display: flex; align-items: center; color: var(--gold); font-weight: 800; font-size: 1.2rem; }
.steps-note { text-align: center; margin: .9rem 0 0; }

.browse-link-wrap { text-align: center; margin: 0 auto 1.2rem; }
.browse-link { display: inline-block; color: var(--gold); font-weight: 700; text-decoration: none; font-size: .95rem; padding: .5rem .9rem; border: 1px solid rgba(231,200,115,.4); border-radius: 999px; transition: background .15s ease, border-color .15s ease; }
.browse-link:hover { background: rgba(231,200,115,.12); border-color: var(--gold); }

/* ===== 球員名鑑 browse.html ===== */
.browse-screen { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.browse-controls { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; margin-bottom: .7rem; }
.bc-field { display: flex; flex-direction: column; gap: .25rem; font-size: .76rem; color: var(--muted); }
.bc-field select, .bc-field input { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: .5rem .6rem; font-family: inherit; font-size: .92rem; min-width: 130px; }
.bc-search input { min-width: 160px; }
.bc-toggle { display: flex; gap: .3rem; }
.bc-toggle .bk { background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: .5rem .9rem; font-size: .9rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.bc-toggle .bk.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.browse-meta { color: var(--muted); font-size: .82rem; margin-bottom: .5rem; }
.browse-table-wrap { overflow: auto; max-height: 74vh; border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.browse-table { border-collapse: collapse; width: 100%; font-size: .86rem; white-space: nowrap; }
.browse-table th { position: sticky; top: 0; z-index: 1; background: #122144; color: var(--text); font-weight: 700; padding: .6rem .7rem; text-align: left; cursor: pointer; user-select: none; border-bottom: 2px solid var(--border); }
.browse-table th.num { text-align: right; }
.browse-table th:hover { color: var(--accent-2); }
.browse-table th.sorted { color: var(--gold); }
.browse-table td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); }
.browse-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.browse-table tbody tr:hover { background: rgba(255,255,255,.04); }
.browse-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
/* 球員欄固定在左：往右捲時仍看得到是誰 */
.browse-table th:first-child, .browse-table td:first-child { position: sticky; left: 0; border-right: 1px solid var(--border); }
.browse-table td:first-child { background: #0c1631; z-index: 2; }
.browse-table tbody tr:nth-child(even) td:first-child { background: #101d3e; }
.browse-table tbody tr:hover td:first-child { background: #17243f; }
.browse-table th:first-child { background: #122144; z-index: 3; }
.bt-imp { font-size: .66em; color: var(--gold); border: 1px solid rgba(231,200,115,.5); border-radius: 4px; padding: 0 .25em; vertical-align: middle; }
.bt-en { font-size: .72em; color: var(--muted); font-style: italic; }
.browse-note { margin: .8rem 0 2rem; line-height: 1.6; }
.skip-btn[href], .home-logo-btn[href] { text-decoration: none; display: inline-flex; align-items: center; }

/* 評級說明 */
.grades { max-width: 720px; margin: 0 auto 1.2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.grades-title { margin: 0 0 .8rem; text-align: center; }
.grades-row { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.grade-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .75rem; font-size: .86rem; }
.grade-chip b { font-weight: 800; font-style: italic; font-size: 1.05rem; }
.grades-note { text-align: center; margin: .9rem 0 0; line-height: 1.6; }

/* 收錄/資料/版權（折疊） */
.info-fold { max-width: 720px; margin: 0 auto 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .3rem 1.2rem; }
.info-fold > summary { cursor: pointer; font-weight: 700; padding: .7rem 0; list-style: none; color: var(--text); }
.info-fold > summary::-webkit-details-marker { display: none; }
.info-fold > summary::after { content: " ▾"; color: var(--muted); }
.info-fold[open] > summary::after { content: " ▴"; }
.info-fold[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: .6rem; }
.info-fold p { margin: .5rem 0; line-height: 1.6; }
.info-fold p:last-child { margin-bottom: .8rem; }

.site-footer { max-width: 680px; margin: 1.8rem auto 2.2rem; padding-top: 1.2rem; border-top: 1px solid var(--border); text-align: center; }
.contact-invite { font-size: .9rem; color: var(--text); line-height: 1.8; margin: 0 0 1rem; }
.contact-invite a { color: var(--gold); font-weight: 700; text-decoration: none; word-break: break-all; }
.contact-invite a:hover { text-decoration: underline; }
.footnote { color: var(--muted); font-size: .75rem; line-height: 1.7; margin: 0 auto .85rem; max-width: 620px; }
.foot-meta { color: var(--muted); font-size: .72rem; opacity: .7; letter-spacing: .4px; margin: 0; }
.foot-meta .ver { opacity: .9; }

/* ---------- 選秀 ---------- */
.draft-wrap { max-width: 760px; margin: 0 auto; padding: 1.2rem 1rem 5rem; }
.reels { display: flex; gap: 1rem; justify-content: center; }
.reel { width: 180px; background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; text-align: center; min-height: 118px; display: flex; flex-direction: column; justify-content: center; }
.reel-team { border-color: var(--accent); }
.reel-era { border-color: var(--gold); }
.reel-cap { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.reel-team .reel-cap { color: var(--accent-2); } .reel-era .reel-cap { color: var(--gold); }
/* 固定 2 行高度，避免抽動時球隊名長短不一造成放大縮小 */
.reel-val { font-size: 1.35rem; font-weight: 800; line-height: 1.15; height: 3.1rem; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.spin-zone { text-align: center; margin: 1.2rem 0; }
.spin-btn { font-size: 1.3rem; letter-spacing: 2px; padding: .7rem 2.5rem; }
.combo-label { text-align: center; font-weight: 700; color: var(--gold); margin: .3rem 0; }
.need-hint { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; margin: .5rem auto .9rem; max-width: 680px; }
.nh-seg { background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: .35rem .85rem; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.nh-seg i { color: var(--muted); font-style: normal; font-weight: 600; margin-right: .35rem; font-size: .86em; }
.nh-seg b { margin: 0 .12rem; }
.nh-seg.cur { border-color: var(--accent); }
.nh-warn { background: rgba(212,35,46,.18); border: 1px solid var(--accent); color: var(--accent-2); border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; font-weight: 800; white-space: nowrap; animation: warnFlash 1.1s ease-in-out infinite; }
@keyframes warnFlash {
  0%, 100% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(212,35,46,0); }
  50% { border-color: #ff8a8e; box-shadow: 0 0 0 4px rgba(212,35,46,.4); }
}

/* 陣容卡 */
.roster-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.rc-sec { font-weight: 800; margin: .2rem 0 .6rem; color: var(--gold); letter-spacing: .5px; }
.rc-sec.pit { margin-top: 1rem; }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.slot { position: static; border-radius: var(--radius-sm); padding: .5rem .4rem; text-align: center; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; background: var(--bg-soft); border: 1.5px solid var(--border); transition: .12s; }
.slot-pos { font-size: .72rem; color: var(--muted); }
.slot-name { font-size: .9rem; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-sub { font-size: .62rem; color: var(--muted); }
.slot.fillable { border-style: dashed; border-color: var(--accent); cursor: pointer; }
.slot.fillable:hover { background: rgba(212,35,46,.14); transform: translateY(-1px); }
.slot.fillable .slot-name { color: var(--accent-2); font-weight: 800; }
.slot.locked { opacity: .38; }
.slot.filled { background: linear-gradient(160deg, rgba(96,165,250,.30), rgba(96,165,250,.10)); border-color: #60a5fa; }
.slot.filled.this-round { cursor: pointer; }
.slot.filled.this-round:hover { border-color: #93c5fd; }
.slot.filled.this-round .slot-pos::after { content: " ✕"; color: #93c5fd; font-weight: 800; }
.slot.eligible { cursor: pointer; border-color: var(--gold); background: linear-gradient(160deg, rgba(231,200,115,.30), rgba(231,200,115,.08)); animation: eligGlow 1.1s ease-in-out infinite; }
.slot.eligible .slot-name { color: var(--gold); font-weight: 800; }
.slot.eligible .slot-name::after { content: " ＋"; }
@keyframes eligGlow { 0%,100% { box-shadow: 0 0 0 2px rgba(231,200,115,.3), 0 0 8px rgba(231,200,115,.3); } 50% { box-shadow: 0 0 0 3px rgba(231,200,115,.55), 0 0 18px rgba(231,200,115,.6); } }
#nextRoundBtn { min-width: 220px; }

/* 選人面板 */
.picker { position: fixed; inset: 0; z-index: 50; background: rgba(6,12,26,.78); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .picker { align-items: center; } }
.picker-inner { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px 16px 0 0; width: 100%; max-width: 640px; max-height: 82vh; display: flex; flex-direction: column; padding: 1rem; }
@media (min-width: 640px) { .picker-inner { border-radius: 16px; } }
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; gap: .5rem; }
.pk-title { font-weight: 800; font-size: 1.1rem; } .pk-title b { color: var(--accent-2); }
#pickerClose { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; flex: none; }
#pickerSearch { margin-bottom: .6rem; }
#pickerList { overflow-y: auto; }
.empty { padding: 1.4rem; text-align: center; }

/* 球員列 */
.player-list { display: block; }
.player-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid transparent; margin-bottom: .4rem; cursor: pointer; }
.player-row:hover { border-color: var(--accent); }
.player-row.selected { border-color: var(--gold); background: rgba(231,200,115,.18); box-shadow: 0 0 0 1px rgba(231,200,115,.55); }
.pr-main { flex: 1; min-width: 0; }
.pr-name { font-weight: 700; }
.pr-en { font-size: .72rem; color: var(--muted); font-style: italic; margin-top: 1px; }
.rr-en { font-size: .72rem; color: var(--muted); font-style: italic; font-weight: 400; }
.pr-sub { font-size: .75rem; color: var(--muted); }
.pr-stats { display: flex; gap: .5rem; }
.pr-stat { text-align: center; min-width: 2.3em; }
.pr-stat b { display: block; font-size: .9rem; }
.pr-stat span { font-size: .58rem; color: var(--muted); }
.pr-import { font-size: .66em; color: var(--gold); margin-left: .4em; font-weight: 700; border: 1px solid rgba(231,200,115,.5); border-radius: 4px; padding: 0 .25em; vertical-align: middle; }

/* 結算 */
.mode-badge { text-align: center; color: var(--muted); margin-top: 1rem; }
.proj-label { text-align: center; color: var(--gold); font-weight: 600; margin-top: .5rem; }
.record { font-size: 4rem; font-weight: 800; font-style: italic; text-align: center; line-height: 1.1; background: linear-gradient(135deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.grade-line { text-align: center; font-size: 1.1rem; }
.grade-line .g { font-weight: 800; font-size: 1.4rem; margin-right: .3rem; }
.rsra-line { text-align: center; color: var(--muted); margin: .5rem 0 1.2rem; }
.rsra-line b { color: var(--text); }
.result-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.result-roster { max-width: 560px; margin: 1.2rem auto 0; text-align: left; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.rr-sec { font-weight: 800; margin: .8rem 0 .3rem; color: var(--gold); }
.rr-sec:first-child { margin-top: 0; }
.rr-row { display: grid; grid-template-columns: 2.8em minmax(0,1fr) 7em; grid-template-areas: "pos name team" "pos stat team"; column-gap: .5rem; row-gap: .1rem; align-items: center; padding: .42rem 0; border-top: 1px solid var(--border); }
.rr-pos { grid-area: pos; align-self: center; font-weight: 700; color: var(--muted); font-size: .76rem; line-height: 1.15; }
.rr-name { grid-area: name; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-stat { grid-area: stat; color: var(--muted); font-size: .74rem; line-height: 1.25; }
.rr-stat i { font-style: normal; font-size: .82em; opacity: .65; margin: 0 .3em 0 .1em; }
.team-chip { grid-area: team; justify-self: end; align-self: center; width: 100%; text-align: center; font-size: .66rem; font-weight: 700; padding: .2rem .25rem; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-s { color: #ffd24a; } .tier-ap { color: #ff7a7f; } .tier-a { color: var(--accent-2); }
.tier-b { color: #6fb0ff; } .tier-c { color: var(--muted); } .tier-d { color: #7a8499; }

/* 戰績圖預覽 modal */
.img-modal { position: fixed; inset: 0; z-index: 60; background: rgba(6,12,26,.82); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.img-modal-inner { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 460px; max-height: 92vh; display: flex; flex-direction: column; align-items: center; padding: 1.1rem 1rem 1.2rem; gap: .7rem; overflow: hidden; }
.img-modal-title { font-weight: 800; font-size: 1.05rem; color: var(--gold); }
.img-close { position: absolute; top: .6rem; right: .6rem; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; z-index: 1; }
.img-wrap { width: 100%; overflow-y: auto; border-radius: 12px; border: 1px solid var(--border); background: #0a1226; }
.share-img-preview { display: block; width: 100%; height: auto; }
.img-hint { text-align: center; margin: 0; }
#shareImgDownload { width: 100%; text-align: center; }

/* ===================== 選秀版面 v2（球場/兩排 + 列表） ===================== */
.action-bar { display: flex; justify-content: center; gap: .6rem; margin: 1rem 0 .7rem; }
.action-bar .spin-btn { font-size: 1.2rem; letter-spacing: 2px; padding: .7rem 2.4rem; }
#nextRoundBtn { min-width: 200px; }
.draft-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: .6rem; }
.stage { min-width: 0; }
.stage-bar { display: none; align-items: center; justify-content: space-between; margin-bottom: .5rem; font-weight: 700; }
.mini-btn { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: .3rem .7rem; font-size: .82rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.mini-btn.attn { border-color: var(--gold); color: var(--gold); animation: attnPulse 1s ease-in-out infinite; }
@keyframes attnPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(231,200,115,.5); } 50% { box-shadow: 0 0 0 6px rgba(231,200,115,0); } }
/* 注意：#rosterBody.collapsed 只在手機(≤819)生效，桌機球場永遠顯示 */
/* 預設(手機)＝兩排；桌機＝球場 */
.field-view { display: none; }
.rows-view { display: block; }

/* 空格佔位（虛線） */
.slot:not(.filled) { border-style: dashed; opacity: .9; }
.slot:not(.filled) .slot-name { color: var(--muted); }
.slot.filled.this-round { cursor: pointer; }
.slot.filled.this-round .slot-pos::after { content: " ✕"; color: var(--accent-2); font-weight: 800; }
/* 一般格子（兩排/牛棚）：只做光環，避免 transform 衝突 */
.slot.pulse { animation: pulse .45s ease; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(96,165,250,.6); } 100% { box-shadow: 0 0 0 12px rgba(96,165,250,0); } }
/* 球場守位：scale 時保留置中 translate，避免放置瞬間框框跳位 */
.slot.fld.pulse { animation: pulseFld .45s ease; }
@keyframes pulseFld {
  0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(96,165,250,.6); }
  50% { transform: translate(-50%, -50%) scale(1.07); }
  100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 12px rgba(96,165,250,0); }
}

/* 手機兩排 */
.srow { margin-bottom: .6rem; }
.srow-lab { display: block; font-weight: 800; color: var(--gold); margin-bottom: .35rem; font-size: .9rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-row .slot { min-height: 48px; flex: 1 1 28%; min-width: 78px; }

/* 球場（桌機） */
.field { position: relative; width: 100%; aspect-ratio: 1 / 0.9; border-radius: 16px; overflow: hidden;
  background: radial-gradient(125% 115% at 50% 8%, #2f7d4f 0%, #246340 48%, #1b4a30 100%); border: 1px solid var(--border); }
/* 內野鑽石（真正方形→旋轉，置中於 50%/54%，不會被拉歪） */
.field::before { content: ""; position: absolute; left: 50%; top: 54%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(#caa46a, #b58e54); border: 3px solid rgba(255,255,255,.45); border-radius: 8px; }
.mound { position: absolute; left: 50%; top: 54%; width: 26px; height: 26px; transform: translate(-50%, -50%); background: #b58e54; border: 2px solid rgba(255,255,255,.45); border-radius: 50%; z-index: 1; }
.slot.fld { position: absolute; width: 84px; min-height: 48px; transform: translate(-50%, -50%); z-index: 3;
  background: rgba(10,18,38,.88); backdrop-filter: blur(2px); }
.slot.fld.dh { background: rgba(231,200,115,.2); border-color: var(--gold); }
.bullpen { margin-top: .7rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: .6rem; }
.bullpen-cap { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.bullpen-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; }
.bullpen-row .slot { min-height: 50px; }

/* 列表面板 */
.pick-panel { min-width: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .55rem; }
.chip { background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); border-radius: 999px;
  padding: .3rem .7rem; font-size: .82rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip-break { display: none; }
/* 電腦版：投手組強制換到第二行；手機維持自然換行 */
@media (min-width: 820px) { .chip-break { display: block; flex-basis: 100%; height: 0; margin: 0; } }
.panel-controls { display: flex; gap: .5rem; margin-bottom: .55rem; }
.panel-controls .search { flex: 1; }
.sort { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: .5rem .6rem; font-family: inherit; }
.player-list { max-height: 60vh; overflow-y: auto; }
.player-row.disabled { opacity: .32; pointer-events: none; }

@media (min-width: 820px) {
  .draft-wrap { max-width: 1080px; }
  .draft-layout { grid-template-columns: minmax(380px, 1.1fr) minmax(330px, 400px); align-items: start; }
  .field-view { display: block; }
  .rows-view { display: none; }
  .pick-panel { position: sticky; top: 70px; }
  .player-list { max-height: 64vh; }
}

@media (max-width: 819px) {
  /* 手機：陣容變「置底工具列」，點展開成底部抽屜 */
  .stage-bar { display: flex; position: sticky; top: 0; background: var(--bg-card); padding: .3rem 0 .5rem; }
  .stage { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    background: var(--bg-card); border-top: 2px solid var(--accent); border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 26px rgba(0,0,0,.55); padding: .55rem .9rem env(safe-area-inset-bottom, .6rem); max-height: 76vh; overflow-y: auto; }
  #rosterBody.collapsed { display: none; }
  .draft-wrap { padding-bottom: 70px; }
}
@media (max-width: 600px) {
  .big-num { font-size: 2.7rem; } .title { font-size: 1.6rem; } .record { font-size: 3rem; }
  .mode-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .steps-row { flex-direction: column; align-items: stretch; gap: .5rem; }
  .step { flex-direction: row; justify-content: flex-start; text-align: left; gap: .6rem; }
  .step-arrow { transform: rotate(90deg); justify-content: center; }
  .reel { width: 44%; }
  .chip-row .slot { min-height: 44px; }

  /* header 緊湊：避免按鈕換行、回合字被蓋、與浮動音樂鈕重疊 */
  .topbar { padding: .5rem 3rem .5rem .6rem; }
  .brand { gap: .4rem; flex: 1 1 auto; min-width: 0; }
  .home-logo-btn img { height: 30px; }
  .round-label { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { flex: none; gap: .3rem; }
  .skip-btn, .icon-btn { padding: .38rem .5rem; font-size: .76rem; }
  .music-toggle { width: 38px; height: 38px; top: .5rem; right: .5rem; font-size: 1rem; }

  /* 球員列：手機改上下堆疊，名字才不會被擠成直書 */
  .player-row { flex-wrap: wrap; }
  .pr-main { flex: 1 1 100%; min-width: 0; }
  .pr-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pr-stats { flex: 1 1 100%; width: 100%; justify-content: space-between; margin-top: .35rem; gap: .35rem; }
}
