/* ============ 中国队冲击2026世界杯 · 深色体育风 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0d1117;
  --bg2: #161c26;
  --card: #1c2430;
  --line: #2a3442;
  --red: #e0342f;
  --gold: #f2c14e;
  --text: #e8edf4;
  --dim: #96a0ad;
  --good: #3fb968;
  --bad: #e0342f;
}
html, body { height: 100%; }

/* 细滚动条，贴合深色主题 */
* { scrollbar-width: thin; scrollbar-color: #2a3442 transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2a3442; border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: #46536a; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- 开始界面 ---------- */
#start-screen {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: radial-gradient(ellipse at 50% -20%, #2a1215 0%, var(--bg) 60%);
  overflow-y: auto;
}
#start-screen.show { display: flex; }
.start-inner { margin: auto; max-width: 720px; padding: 48px 20px; text-align: center; }
.start-badge {
  display: inline-block; border: 1px solid var(--gold); color: var(--gold);
  padding: 4px 14px; border-radius: 20px; font-size: 12px; letter-spacing: 2px; margin-bottom: 18px;
}
#start-screen h1 { font-size: 44px; line-height: 1.15; letter-spacing: 4px; }
#start-screen h1 span { display: block; color: var(--red); text-shadow: 0 0 30px rgba(224,52,47,.5); }
.start-sub { color: var(--dim); margin: 18px 0 14px; line-height: 1.8; }
/* 三步秒懂条 */
.start-steps {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin: 0 0 10px;
}
.start-steps span {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 7px 16px; font-size: 13.5px; white-space: nowrap;
}
.start-steps i { color: var(--gold); font-style: normal; font-size: 14px; }
.start-plain { color: #6b7480; font-size: 12.5px; margin-bottom: 26px; letter-spacing: 1px; }
.tag-rec {
  display: inline-block; background: var(--red); color: #fff; font-size: 10.5px;
  padding: 2px 8px; border-radius: 10px; vertical-align: 3px; font-weight: 400; letter-spacing: 1px;
}
.style-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.style-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 14px; cursor: pointer; text-align: left; transition: all .18s;
}
.style-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.style-card h3 { font-size: 16px; margin-bottom: 8px; }
.style-card p { font-size: 12.5px; color: var(--dim); line-height: 1.6; }
#continue-slot { margin-bottom: 14px; }
#daily-slot { margin-bottom: 24px; }
.continue-btn.daily { border-color: rgba(242,193,78,.55); color: var(--gold); }
.continue-btn.daily:hover { border-color: var(--gold); }

/* 挑战剧本入口 */
.scen-title { margin: 30px 0 12px; color: var(--gold); font-size: 14px; letter-spacing: 2px; }
.scen-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scen-card {
  background: linear-gradient(135deg, #26191c, var(--card)); border: 1px solid #4a2f33;
  border-radius: 12px; padding: 14px 12px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 6px; transition: all .18s;
}
.scen-card:hover { border-color: var(--red); transform: translateY(-3px); }
.scen-card b { font-size: 14.5px; }
.scen-card small { color: var(--dim); font-size: 12px; line-height: 1.5; }

/* ---------- 主界面 ---------- */
#app { display: none; height: 100%; flex-direction: column; }
#app.show { display: flex; }

#hud {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: var(--bg2); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.hud-left { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.hud-logo { font-size: 18px; }
.hud-bars { display: flex; gap: 12px; flex: 1; min-width: 0; flex-wrap: wrap; }
.hud-bar { display: flex; align-items: center; gap: 5px; min-width: 90px; flex: 1; max-width: 150px; }
.bar-icon { font-size: 12px; }
.bar-label { font-size: 11px; color: var(--dim); white-space: nowrap; }
#hud-prep { font-size: 11px; color: var(--gold); white-space: nowrap; cursor: help; }
.bar-track { flex: 1; height: 7px; background: #0a0e14; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); border-radius: 4px; transition: width .5s; }
.bar-num { font-size: 11px; color: var(--dim); min-width: 20px; text-align: right; }
.hud-bar.danger .bar-fill { background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.hud-right { display: flex; gap: 6px; }
.hud-right button {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; font-size: 15px;
}
.hud-right button:hover { border-color: var(--gold); }

/* ---------- 信息流 ---------- */
#feed {
  flex: 1; overflow-y: auto; padding: 18px 14px 40px;
  max-width: 780px; width: 100%; margin: 0 auto;
}
.msg { margin-bottom: 14px; animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

/* 选项按钮渐次浮现，避免一次性砸出一屏内容 */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.choices .choice-btn, .choices .free-wrap {
  opacity: 0; animation: riseIn .45s ease forwards; animation-delay: var(--d, 0ms);
}

.msg.chapter {
  text-align: center; margin: 30px 0 20px; color: var(--gold);
  font-weight: 700; font-size: 17px; letter-spacing: 2px;
  display: flex; align-items: center; gap: 14px;
}
.msg.chapter::before, .msg.chapter::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line)); }
.msg.chapter::after { background: linear-gradient(90deg, var(--line), transparent); }

.msg.narrative {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; line-height: 1.9; font-size: 15px;
}
.msg.narrative[title] { cursor: pointer; }
.cursor { color: var(--gold); animation: pulse .8s infinite; }
.hl-name { color: var(--gold); font-weight: 600; }
.hl-time { color: #6ec6ff; font-style: normal; font-weight: 600; }

/* 技术统计卡 */
.msg.stats {
  background: #10151d; border: 1px dashed #3a4656; border-radius: 12px; padding: 12px 18px;
  font-size: 13px;
}
.stat-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; padding: 5px 0;
  border-top: 1px solid #1c2430; align-items: center;
}
.stat-row:first-of-type { border-top: none; }
.stat-row span:first-child { text-align: right; font-family: ui-monospace, monospace; color: var(--gold); }
.stat-row span:last-child { text-align: left; font-family: ui-monospace, monospace; }
.stat-label { color: var(--dim); font-size: 12px; min-width: 60px; text-align: center; }
.stat-teams span { color: var(--dim) !important; font-size: 12px; font-family: inherit !important; }

.msg.system { color: var(--gold); font-size: 14px; padding: 4px 6px; }
.msg.effect {
  background: rgba(242,193,78,.07); border-left: 3px solid var(--gold);
  padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 13.5px; line-height: 1.7; color: #d6dde6;
}
.msg.player {
  background: var(--red); color: #fff; border-radius: 14px 14px 3px 14px;
  padding: 10px 16px; margin-left: auto; max-width: 80%; width: fit-content; font-size: 14px;
}
.msg.event-card {
  background: linear-gradient(135deg, #26191c, #1c2430); border: 1px solid #4a2f33;
  border-radius: 12px; padding: 16px 18px; line-height: 1.8;
}
.ev-title { color: var(--red); font-weight: 700; margin-bottom: 8px; font-size: 15px; }

/* 掷骰卡 */
.msg.dice {
  background: #10151d; border: 1px dashed #3a4656; border-radius: 12px; padding: 12px 16px;
  font-size: 13px;
}
/* 判定复盘：剧情之后的机制说明，视觉弱化 */
.msg.dice.recap { opacity: .75; font-size: 12px; padding: 9px 14px; }
.msg.dice.recap:hover { opacity: 1; }
.dice-title { color: var(--dim); font-size: 12px; margin-bottom: 8px; letter-spacing: 1px; }
.dice-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-top: 1px solid #1c2430;
}
.dice-row:first-of-type { border-top: none; }
.dr-label { min-width: 90px; color: var(--dim); }
.dr-dice { flex: 1; font-family: ui-monospace, monospace; }
.dr-dice em { color: var(--gold); font-style: normal; }
.dr-dice b { color: var(--dim); font-weight: 400; }
.dr-result { font-weight: 700; }
.dice-row.good .dr-result { color: var(--good); }
.dice-row.bad .dr-result { color: var(--bad); }

/* 进球庆祝横幅 */
.msg.goal-banner {
  background: linear-gradient(90deg, transparent, rgba(224,52,47,.85) 18%, rgba(242,193,78,.9) 50%, rgba(224,52,47,.85) 82%, transparent);
  color: #fff; text-align: center; font-weight: 900; font-size: 20px; letter-spacing: 2px;
  padding: 14px 10px; border-radius: 10px; text-shadow: 0 2px 8px rgba(0,0,0,.55);
  animation: goalFlash .9s ease;
}
@keyframes goalFlash {
  0% { opacity: 0; transform: scale(.7); }
  45% { opacity: 1; transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* 新手提示 */
.msg.tip {
  border: 1px dashed rgba(242,193,78,.45); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: #c9b57e; line-height: 1.7;
  background: rgba(242,193,78,.05);
}

/* 掷骰动效：判定行滚入 */
.msg.dice .dice-row { animation: rollIn .45s ease both; }
.msg.dice .dice-row:nth-child(3) { animation-delay: .12s; }
.msg.dice .dice-row:nth-child(4) { animation-delay: .24s; }
@keyframes rollIn {
  from { opacity: 0; transform: translateX(-10px) rotate(-1.5deg); }
  to { opacity: 1; transform: none; }
}

/* 比分卡 */
.msg.score { text-align: center; }
.score-line {
  display: inline-flex; align-items: center; gap: 18px;
  background: var(--bg2); border: 1px solid var(--gold); border-radius: 12px;
  padding: 10px 26px; font-size: 16px;
}
.score-num { font-size: 30px; font-weight: 800; color: var(--gold); font-family: ui-monospace, monospace; }

/* 选项 */
.msg.choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px 16px; text-align: left; font-size: 14px;
  transition: all .15s; display: flex; flex-direction: column; gap: 3px;
}
.choice-btn small { color: var(--dim); font-size: 12px; }
.choice-btn:hover:not(:disabled) { border-color: var(--red); background: #232b38; }
.choices.done { display: none; }
.free-wrap { display: flex; gap: 8px; margin-top: 2px; }
.free-input {
  flex: 1; background: #10151d; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 11px 14px; font-size: 14px; font-family: inherit; outline: none;
}
.free-input:focus { border-color: var(--gold); }
.free-send {
  background: var(--gold); color: #1a1408; border: none; border-radius: 10px;
  padding: 0 20px; font-weight: 700; font-size: 14px;
}
.free-send:hover { filter: brightness(1.1); }

.msg.continue { text-align: center; }
.continue-btn {
  background: var(--red); color: #fff; border: none; border-radius: 24px;
  padding: 11px 34px; font-size: 15px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 4px 16px rgba(224,52,47,.35); transition: all .15s;
}
.continue-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(224,52,47,.5); }

/* 战报海报弹层 */
.poster-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.82);
  display: flex; backdrop-filter: blur(6px); animation: fadeUp .25s ease;
}
.poster-box { margin: auto; text-align: center; padding: 16px; max-width: 92vw; }
.poster-box img {
  max-height: 72vh; max-width: 88vw; border-radius: 14px;
  box-shadow: 0 20px 80px rgba(0,0,0,.7); border: 1px solid #3a4656;
}
.poster-hint { color: var(--dim); font-size: 13px; margin: 14px 0; }
.poster-btns { display: flex; gap: 12px; justify-content: center; }
.poster-btns a { text-decoration: none; display: inline-block; }
.continue-btn.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  box-shadow: none;
}
.continue-btn.ghost:hover { border-color: var(--gold); }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.end-share { color: var(--dim); font-size: 12.5px; margin-top: 16px; }
.start-footer { margin-top: 34px; font-size: 11.5px; color: #4a525c; }

/* 结局卡 */
.msg.ending-card {
  background: linear-gradient(160deg, #1e1a10, #16181c); border: 1px solid var(--gold);
  border-radius: 14px; padding: 28px 22px; text-align: center;
}
.end-tier { font-size: 64px; font-weight: 900; text-shadow: 0 0 40px currentColor; }
.end-title { font-size: 20px; font-weight: 700; margin: 8px 0 18px; letter-spacing: 2px; }
.end-stats { text-align: left; max-width: 380px; margin: 0 auto 20px; }
.end-nums { color: var(--dim); font-size: 13px; text-align: center; margin-top: 12px; }

/* ---------- 侧栏 ---------- */
#side-panel {
  position: fixed; top: 0; right: -340px; width: 330px; height: 100%;
  background: var(--bg2); border-left: 1px solid var(--line); z-index: 40;
  transition: right .25s; padding: 14px; overflow-y: auto;
}
#side-panel.open { right: 0; box-shadow: -10px 0 40px rgba(0,0,0,.5); }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.side-head button { background: none; border: none; color: var(--dim); font-size: 16px; }
#side-panel h4 { margin: 16px 0 8px; font-size: 13px; color: var(--gold); }
#side-panel h4 small { color: var(--dim); font-weight: 400; }
#tbl-group { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#tbl-group th, #tbl-group td { padding: 5px 6px; text-align: left; border-bottom: 1px solid var(--line); }
#tbl-group th { color: var(--dim); font-weight: 400; }
#tbl-group tr.me td { color: var(--gold); font-weight: 700; }
#tbl-group tr.q td:first-child { border-left: 2px solid var(--good); }
#tbl-group tr.maybe td:first-child { border-left: 2px solid var(--gold); }
.squad-row {
  display: grid; grid-template-columns: 60px 44px 24px 1fr; gap: 6px; align-items: center;
  font-size: 12px; padding: 4px 0; border-bottom: 1px solid #1c2430; color: var(--text);
}
.squad-row span { color: var(--dim); }
.squad-row small { color: #6b7480; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.squad-row.injured, .squad-row.suspended { opacity: .45; }
.squad-row.hot b { color: var(--gold); }
/* 名场面图鉴 */
#moments-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moment-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 6px; text-align: center; display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; opacity: .38; cursor: help;
}
.moment-card span { font-size: 22px; }
.moment-card.on { opacity: 1; border-color: rgba(242,193,78,.5); }
.moment-card.on b { color: var(--gold); }
.end-pct { text-align: center; color: var(--gold); font-size: 14px; margin-top: 10px; }

.hist-row { font-size: 13px; padding: 5px 8px; border-radius: 6px; margin-bottom: 4px; background: var(--card); }
.hist-row.win { border-left: 3px solid var(--good); }
.hist-row.draw { border-left: 3px solid var(--gold); }
.hist-row.loss { border-left: 3px solid var(--bad); }

.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--gold); color: var(--text);
  padding: 10px 22px; border-radius: 24px; z-index: 70; font-size: 13.5px;
  animation: fadeUp .3s ease;
}

/* ---------- 触屏与移动端 ---------- */
/* 按压反馈 */
.choice-btn:active { transform: scale(.985); background: #262f3d; }
.continue-btn:active { transform: scale(.96); }
.hud-right button:active { transform: scale(.92); }
/* 触屏设备无 hover：判定复盘常显完整不透明度 */
@media (hover: none) {
  .msg.dice.recap { opacity: 1; }
}
/* 刘海屏安全区 */
#hud { padding-top: calc(10px + env(safe-area-inset-top)); }
#feed { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

@media (max-width: 700px) {
  #start-screen h1 { font-size: 34px; }
  .style-select { grid-template-columns: 1fr; }
  .scen-select { grid-template-columns: 1fr; }
  .hud-left { display: none; }
  .hud-bar { min-width: 64px; gap: 4px; }
  .bar-num { min-width: 17px; font-size: 10px; }
  #side-panel { width: 86vw; right: -88vw; }
  #feed { padding: 12px 10px 30px; }
  /* iOS 输入框 font-size ≥16px 防止聚焦时页面自动放大 */
  .free-input { font-size: 16px; }
  .msg.narrative { padding: 14px 14px; font-size: 14.5px; }
  .choice-btn { padding: 12px 13px; }
  .poster-box img { max-height: 64vh; }
}
