:root {
  --bg: #071219;
  --bg2: #0d2230;
  --panel: #102a37;
  --line: #1d3d4c;
  --ink: #e8f1f4;
  --muted: #8fa9b5;
  --gold: #f2c14e;
  --coral: #e2603f;
  --teal: #4fd1c5;
  --card: #f7f2e6;
  --card-ink: #16222b;
  --red: #c63b3b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #123042 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 12px 24px;
  min-height: 100vh;
}

header {
  width: 100%; max-width: 760px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 4px 10px;
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(7,18,25,.96), rgba(7,18,25,.72) 70%, transparent);
  backdrop-filter: blur(6px);
}

.brand { font-size: 17px; font-weight: 700; letter-spacing: .08em; color: var(--gold); }
.brand small { display: block; font-size: 10px; letter-spacing: .18em; color: var(--muted); font-weight: 500; margin-top: 2px; }

.hud { display: flex; gap: 6px; }
.stat {
  min-width: 44px; text-align: center; padding: 4px 8px;
  background: rgba(16,42,55,.72); border: 1px solid var(--line); border-radius: 10px;
}
.stat b { display: block; font-size: 15px; line-height: 1.2; }
.stat small { font-size: 10px; color: var(--muted); letter-spacing: .04em; }

main { width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 12px; }

.bar { background: rgba(16,42,55,.55); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.bar .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bar .row b { color: var(--ink); font-size: 15px; }
.track { height: 7px; background: #08202b; border-radius: 99px; margin-top: 8px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .35s ease; }
.boss { margin-top: 8px; font-size: 12px; color: var(--coral); letter-spacing: .02em; }
.boss:empty { display: none; }

.sigils { display: flex; gap: 8px; }
.sigil {
  flex: 1; min-height: 54px; padding: 7px 8px;
  background: rgba(16,42,55,.6); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.sigil b { font-size: 12px; color: var(--gold); }
.sigil small { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.sigil.empty { border-style: dashed; opacity: .45; }
.sigil.empty b { color: var(--muted); }

.table { padding: 16px 0 6px; }
.hand { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 104px; }

.card {
  width: 64px; height: 92px; border: 0; border-radius: 9px; cursor: pointer;
  background: var(--card); color: var(--card-ink);
  box-shadow: 0 4px 0 #b9b09a, 0 8px 18px rgba(0,0,0,.38);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  padding: 6px 8px; transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.card .r { font-size: 19px; font-weight: 700; line-height: 1; }
.card .s { font-size: 26px; align-self: flex-end; line-height: 1; }
.card.red { color: var(--red); }
.card:hover { transform: translateY(-4px); }
.card.sel { transform: translateY(-14px); box-shadow: 0 4px 0 #c9a13a, 0 0 0 3px var(--gold), 0 12px 22px rgba(0,0,0,.45); }
.card.debuff { filter: grayscale(1) brightness(.72); }

.last { min-height: 20px; margin-top: 12px; text-align: center; font-size: 12.5px; color: var(--muted); }
.last:not(:empty) { color: var(--teal); }

.controls { display: flex; gap: 8px; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 11px 14px; transition: transform .1s ease, opacity .15s ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .38; cursor: not-allowed; }
button.primary { background: linear-gradient(180deg, var(--gold), #d8a733); color: #221a05; border-color: #b98f22; flex: 2; }
button.ghost { background: transparent; color: var(--muted); }
.controls button:not(.primary) { flex: 1; }
kbd { font: inherit; font-size: 10px; opacity: .55; margin-left: 4px; }

.overlay {
  position: fixed; inset: 0; z-index: 20; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(4,10,14,.72); backdrop-filter: blur(5px);
}
.overlay.on { display: flex; }
.panel {
  width: 100%; max-width: 420px; padding: 20px;
  background: linear-gradient(180deg, #10303f, #0c2431);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.panel h2 { margin: 0 0 4px; font-size: 18px; color: var(--gold); letter-spacing: .05em; }
.panel .sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.panel .sub b { color: var(--ink); }

.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 10px;
}
.item .it { flex: 1; min-width: 0; }
.item b { display: block; font-size: 13.5px; }
.item small { font-size: 11.5px; color: var(--muted); }
.item button { padding: 7px 12px; background: var(--gold); color: #221a05; border-color: #b98f22; font-size: 13px; }
.item.tide { border-color: #2c5a6b; }
.item.tide b { color: var(--teal); }
.item.sold { opacity: .35; }

.panel-actions { display: flex; gap: 8px; }
.panel-actions button { flex: 1; }

@media (max-width: 480px) {
  .card { width: 52px; height: 76px; padding: 5px 6px; }
  .card .r { font-size: 16px; }
  .card .s { font-size: 20px; }
  .hud { gap: 4px; }
  .stat { min-width: 38px; padding: 3px 6px; }
  .stat b { font-size: 13px; }
  .sigils { gap: 5px; }
  .sigil { padding: 5px 6px; min-height: 48px; }
  .sigil b { font-size: 11px; }
  .sigil small { font-size: 9.5px; }
}

.preview {
  min-height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--muted); letter-spacing: .02em;
  border: 1px dashed var(--line); border-radius: 10px; padding: 6px 10px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.preview.lit { color: var(--gold); border-color: var(--gold); background: rgba(242,193,78,.08); }

.card { position: relative; }
.card .bonus {
  position: absolute; top: 4px; right: 5px; font-size: 9px; font-weight: 700;
  color: #7a5a00; background: rgba(242,193,78,.55); border-radius: 4px; padding: 0 3px;
}
.notice { margin: 0 0 12px; font-size: 12px; color: var(--teal); min-height: 16px; }
.item.tide b { color: var(--teal); }
.item.pack b { color: #c3a6ff; }

/* ---- 品牌区 / 印章 / 主题切换 ---- */
.brand { display: flex; align-items: center; gap: 8px; }
.seal {
  width: 26px; height: 26px; display: grid; place-items: center; flex: none;
  background: var(--gold); color: #fff8ef; border-radius: 6px;
  font-size: 15px; font-weight: 700; line-height: 1;
}
.bt { display: flex; flex-direction: column; }
.bt b { font-size: 16px; font-weight: 700; letter-spacing: .1em; color: var(--gold); line-height: 1.2; }
.bt small { font-size: 9.5px; letter-spacing: .18em; color: var(--muted); font-weight: 500; }
.theme-link {
  font-size: 11px; color: var(--muted); text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 99px; padding: 4px 9px; flex: none;
}
.theme-link:hover { color: var(--gold); border-color: var(--gold); }

/* ---- 国风壳：宣纸 + 朱砂 + 宋体 ---- */
.theme-gujiang body {
  background:
    radial-gradient(1100px 560px at 50% -8%, #faf4e6 0%, transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", serif;
}
.theme-gujiang header {
  background: linear-gradient(180deg, rgba(239,228,208,.97), rgba(239,228,208,.72) 70%, transparent);
}
.theme-gujiang .stat { background: rgba(255,251,241,.82); }
.theme-gujiang .bar { background: rgba(255,251,241,.72); }
.theme-gujiang .sigil { background: rgba(255,251,241,.78); }
.theme-gujiang .track { background: #ddcbaa; }
.theme-gujiang .card {
  border: 1px solid #e6d8bc;
  box-shadow: 0 3px 0 #cdbb98, 0 8px 16px rgba(90,70,40,.16);
}
.theme-gujiang .card .s { font-family: "Songti SC", "STSong", serif; font-weight: 600; }
.theme-gujiang .card.sel { box-shadow: 0 3px 0 #b58b52, 0 0 0 2px var(--gold), 0 12px 22px rgba(90,70,40,.2); }
.theme-gujiang button.primary {
  background: linear-gradient(180deg, #b5432f, #8e3226);
  color: #fff8ef; border-color: #6f261c;
}
.theme-gujiang .overlay { background: rgba(46,34,20,.42); }
.theme-gujiang .panel {
  background: linear-gradient(180deg, #fdf8ec, #f3e9d5);
  border-color: #d9c8a6;
}
.theme-gujiang .item { background: rgba(255,255,255,.5); }
.theme-gujiang .item button { background: var(--gold); color: #fff8ef; border-color: #7d2b21; }
.theme-gujiang .preview { border-color: #cdb896; }
.theme-gujiang .preview.lit { border-color: var(--gold); background: rgba(168,50,45,.07); }
.theme-gujiang .seal { box-shadow: 0 1px 0 #7d2b21; }

@media (max-width: 480px) {
  .bt b { font-size: 14px; letter-spacing: .06em; }
  .seal { width: 22px; height: 22px; font-size: 13px; }
  .theme-link { padding: 3px 7px; font-size: 10px; }
}
