/* 德州扑克修炼手册 — 墨绿牌桌 + 金色点缀，移动端优先 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --felt: #14532d;
  --felt-deep: #0b3d20;
  --gold: #d4af37;
  --gold-soft: #e8cf7a;
  --ink: #0d1117;
  --card-bg: #1c2430;
  --line: #2c3644;
  --text: #e8edf3;
  --muted: #93a1b3;
  --green: #2ea36b;
  --red: #e05252;
}
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* 顶栏 */
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(11, 61, 32, .85);
  border-bottom: 1px solid rgba(212, 175, 55, .25);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
#backBtn { visibility: hidden; background: none; border: none; color: var(--gold-soft); font-size: 15px; cursor: pointer; padding: 4px 6px; }
#topTitle { flex: 1; text-align: center; font-weight: 700; letter-spacing: 1px; color: var(--gold-soft); font-size: 15px; }
#xpChip { font-size: 12px; color: var(--muted); white-space: nowrap; }
#view { flex: 1; padding: 18px 16px 40px; }

/* 通用按钮 */
button { font-family: inherit; }
.primary {
  background: linear-gradient(160deg, var(--gold), #b8942a);
  color: #201a05; border: none; border-radius: 12px;
  padding: 13px 22px; font-size: 16px; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 14px rgba(212, 175, 55, .25);
}
.primary:active { transform: scale(.97); }
.primary.big { width: 100%; padding: 15px; font-size: 17px; }
.ghost {
  background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 20px; font-size: 15px; cursor: pointer; width: 100%;
}
.ghost:active { background: #232d3b; }
.link { background: none; border: none; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; padding: 8px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .primary { flex: 1; }
.row .ghost { flex: 1; width: auto; }

/* 首页 */
.home { text-align: center; padding-top: 12px; }
.logo { font-size: 44px; letter-spacing: 6px; }
.logo, .logo * { color: var(--gold); }
.home h1 { font-size: 26px; margin: 6px 0 4px; color: var(--gold-soft); letter-spacing: 2px; }
.subtitle { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 18px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.stat-row b { color: var(--gold-soft); font-size: 18px; }
.stat-row.small { font-size: 12px; margin-top: 8px; }
.xpbar { height: 8px; background: #0f141c; border-radius: 6px; margin-top: 10px; overflow: hidden; }
.xpfill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: 6px; transition: width .5s; }
.home .ghost { margin-top: 10px; }
.badge { display: inline-block; background: var(--red); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 8px; margin-left: 6px; }
.tip { color: var(--muted); font-size: 12px; margin-top: 22px; line-height: 1.7; }
.grad { background: rgba(212,175,55,.12); border: 1px solid var(--gold); color: var(--gold-soft); border-radius: 14px; padding: 20px; font-size: 15px; line-height: 1.8; margin-bottom: 14px; }

/* 关卡地图 */
.chapter { margin-bottom: 26px; }
.ch-title { font-size: 17px; font-weight: 700; color: var(--gold-soft); }
.ch-desc { font-size: 12px; color: var(--muted); margin: 2px 0 12px; }
.lv-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lv-node {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; text-align: left; cursor: pointer; color: var(--text);
}
.lv-node:active { background: #232d3b; }
.lv-node.locked { opacity: .45; cursor: default; }
.lv-stars { font-size: 13px; letter-spacing: 2px; height: 20px; }
.lv-stars i { font-style: normal; color: #3a4657; }
.lv-stars i.lit { color: var(--gold); }
.lv-name { font-weight: 700; font-size: 15px; margin: 2px 0; }
.lv-sub { font-size: 11px; color: var(--muted); line-height: 1.5; }
.map-footer { text-align: center; margin-top: 10px; }

/* 教学页 */
.lesson-tag { font-size: 12px; color: var(--muted); }
.lesson h2 { color: var(--gold-soft); margin: 4px 0 14px; font-size: 22px; }
.lesson-card { background: var(--card-bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.lesson-h3 { font-weight: 700; font-size: 16px; margin-bottom: 10px; color: var(--gold-soft); }
.lesson-text { font-size: 15px; line-height: 1.9; color: var(--text); }
.diagram { margin-top: 14px; }
.dots { text-align: center; margin: 14px 0; }
.dots i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3a4657; margin: 0 4px; }
.dots i.cur { background: var(--gold); }
.lesson .row { justify-content: center; }
.lesson > .link { display: block; margin: 8px auto 0; }

/* 牌桌 */
.table-wrap { position: relative; width: 100%; aspect-ratio: 10 / 8; margin: 6px 0 2px; }
.felt {
  position: absolute; left: 7%; right: 7%; top: 13%; bottom: 13%;
  background: radial-gradient(ellipse at 50% 42%, #1a6b3c 0%, var(--felt) 45%, var(--felt-deep) 100%);
  border-radius: 50%;
  border: 5px solid #3d2b16;
  box-shadow: inset 0 0 30px rgba(0,0,0,.5), 0 6px 18px rgba(0,0,0,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.felt-center { color: rgba(232, 207, 122, .7); font-weight: 700; letter-spacing: 3px; }
.pot { color: var(--gold-soft); font-size: 13px; font-weight: 700; background: rgba(0,0,0,.35); border-radius: 12px; padding: 2px 12px; }
.board { display: flex; gap: 4px; min-height: 44px; align-items: center; }
.seat { position: absolute; transform: translate(-50%, -50%); text-align: center; z-index: 2; min-width: 56px; }
.seat-pos { font-size: 11px; font-weight: 700; color: #cfe3d6; background: rgba(9, 26, 17, .8); border: 1px solid #2c4a38; border-radius: 8px; padding: 2px 7px; display: inline-block; }
.seat.hero .seat-pos { background: var(--gold); color: #201a05; border-color: var(--gold); }
.seat.focus .seat-pos { border-color: var(--red); color: #ffb3b3; }
.seat.folded { opacity: .35; }
.seat-act { font-size: 10px; color: var(--gold-soft); margin-top: 2px; background: rgba(0,0,0,.45); border-radius: 8px; padding: 1px 6px; display: inline-block; max-width: 110px; }
.seat-note { font-size: 9px; color: var(--muted); margin-top: 2px; max-width: 92px; }
.seat-cards { display: flex; gap: 2px; justify-content: center; margin-bottom: 3px; }
.table-wrap.demo .felt { pointer-events: none; }

/* 扑克牌 */
.card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 40px; height: 56px; border-radius: 7px;
  background: linear-gradient(165deg, #ffffff, #e8e8e8);
  box-shadow: 0 2px 5px rgba(0,0,0,.4);
  font-weight: 800; line-height: 1.05;
}
.card b { font-size: 17px; }
.card i { font-style: normal; font-size: 15px; }
.card.sm { width: 28px; height: 40px; border-radius: 5px; }
.card.sm b { font-size: 12px; }
.card.sm i { font-size: 11px; }
.card.s { color: #1d2733; }
.card.h { color: #d42f2f; }
.card.d { color: #1e6fd9; }
.card.c { color: #1f8a4c; }
.card.back {
  background: repeating-linear-gradient(45deg, #274472, #274472 4px, #1c3358 4px, #1c3358 8px);
  border: 2px solid #e8e8e8;
}

/* 比牌/手牌视图 */
.cmp { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.cmp-hand { background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; text-align: center; }
.cmp-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cmp-cards { display: flex; gap: 4px; }
.hole-view { text-align: center; }
.hv-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.hv-row .card { margin: 0 2px; }
.board-label { font-size: 12px; color: var(--muted); background: rgba(0,0,0,.3); padding: 2px 10px; border-radius: 10px; }

/* 起手牌矩阵 */
.grid-wrap { overflow-x: auto; }
.hgrid { border-collapse: collapse; margin: 0 auto; }
.hgrid td {
  width: 7.4%; min-width: 24px; padding: 3px 0; text-align: center;
  font-size: 9px; font-weight: 700; color: #7e8ea3;
  background: #202a37; border: 1px solid #141b25;
}
.hgrid td.on { background: #2e7d32; color: #fff; }
.hgrid td.pair { color: #c9b46a; }
.hgrid td.on.pair { background: #3d9143; color: #fff; }
.grid-legend { text-align: center; font-size: 11px; color: var(--muted); margin-top: 8px; }
.grid-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #202a37; vertical-align: -2px; margin: 0 4px 0 10px; }
.grid-legend .lg.on { background: #2e7d32; }

/* 答题 */
.q-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.q-lv { color: var(--gold-soft); font-weight: 700; }
.streak { color: #ff9f43; font-weight: 700; }
.qbar { height: 5px; background: #0f141c; border-radius: 4px; margin: 8px 0 14px; overflow: hidden; }
.qfill { height: 100%; background: var(--gold); border-radius: 4px; transition: width .3s; }
.q-body { margin-bottom: 6px; }
.q-prompt { font-size: 17px; font-weight: 700; line-height: 1.6; margin: 12px 0 16px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  background: var(--card-bg); border: 2px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 14px 16px; font-size: 16px; text-align: left;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.opt:active { background: #232d3b; }
.opt.cards-opt { display: flex; justify-content: center; gap: 6px; padding: 10px; }
.opt.right { border-color: var(--green); background: rgba(46, 163, 107, .18); }
.opt.wrong { border-color: var(--red); background: rgba(224, 82, 82, .15); }
.opt:disabled { cursor: default; opacity: .85; }
.opt.right:disabled, .opt.wrong:disabled { opacity: 1; }

/* 解析卡片 */
.expl { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.expl.show { max-height: 480px; }
.expl-card { border-radius: 14px; padding: 16px; margin-top: 14px; border: 1px solid; }
.expl-card.ok { background: rgba(46, 163, 107, .12); border-color: var(--green); }
.expl-card.no { background: rgba(224, 82, 82, .10); border-color: var(--red); }
.expl-head { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.expl-card.ok .expl-head { color: #6fdc9f; }
.expl-card.no .expl-head { color: #ff9b9b; }
.expl-body { font-size: 14px; line-height: 1.85; color: var(--text); margin-bottom: 14px; }
.expl-card .primary { width: 100%; }

/* 结算 */
.result { text-align: center; padding-top: 8px; }
.big-stars { font-size: 46px; letter-spacing: 10px; margin-bottom: 6px; }
.big-stars i { font-style: normal; color: #3a4657; }
.big-stars i.lit { color: var(--gold); text-shadow: 0 0 18px rgba(212, 175, 55, .6); animation: pop .5s; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.result h2 { color: var(--gold-soft); font-size: 21px; }
.acc { color: var(--muted); margin: 6px 0 12px; font-size: 14px; }
.msg { font-size: 16px; line-height: 1.8; margin-bottom: 10px; }
.xp-gain { color: var(--gold-soft); font-weight: 700; margin-bottom: 16px; }
.summary { background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 13px; line-height: 1.8; text-align: left; margin-bottom: 16px; color: var(--muted); }
.summary b { color: var(--gold-soft); }
.recap { text-align: left; margin-bottom: 16px; }
.recap-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.recap-item { background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.recap-q { font-size: 13px; line-height: 1.6; }
.recap-a { font-size: 12px; color: #6fdc9f; margin-top: 4px; }
.result .row { justify-content: center; }

/* 错题本 */
.wrongbook h2 { color: var(--gold-soft); margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.wb-list { margin-bottom: 16px; }
.wb-item { background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; position: relative; }
.wb-meta { font-size: 11px; color: var(--gold-soft); margin-bottom: 4px; }
.wb-q { font-size: 14px; line-height: 1.6; padding-right: 44px; }
.wb-del { position: absolute; right: 6px; top: 8px; font-size: 12px; }

@media (min-width: 561px) {
  #view { padding-top: 26px; }
}
