/* CAUSTICA — 暗场光学主题（游戏页独立视觉身份，不跟站身浅色走） */

:root {
  --bg: #05070d;
  --ink: #e8f2ff;
  --soft: #8ea6c4;
  --line: rgba(140, 190, 240, 0.16);
  --glass: rgba(10, 18, 32, 0.72);
  --accent: #7fd4ff;
  --r: #ff3b52;
  --g: #35ff8a;
  --b: #4d7cff;
  --w: #dff2ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

.eyebrow {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--soft); font-weight: 600;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

/* ---------------------------------------------------------------- 覆盖层 */

.ov {
  position: fixed; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(10, 26, 48, .55), rgba(3, 5, 10, .92));
  overflow-y: auto;
}
.ov.show { display: flex; }

.pnl {
  width: min(560px, 100%);
  padding: 26px 24px;
  border-radius: 20px;
  animation: rise .28s ease;
}
.pnl.wide { width: min(880px, 100%); }
.pnl.center { text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.mark {
  font-size: 46px; line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(127, 212, 255, .7);
  margin-bottom: 10px;
}

.logo {
  margin: 6px 0 2px;
  font-size: clamp(34px, 8vw, 54px);
  letter-spacing: .14em;
  font-weight: 800;
  background: linear-gradient(100deg, #ff6b7d, #ffd76b 32%, #5fffb0 58%, #7fd4ff 78%, #c79bff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.zh-title {
  margin: 0 0 12px; letter-spacing: .5em; font-size: 15px;
  color: var(--soft); text-indent: .5em;
}

.tagline {
  margin: 0 auto 18px; max-width: 42ch;
  color: var(--soft); font-size: 14px; line-height: 1.7;
}

.pnl-title {
  margin: 0 0 16px; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pnl-sub { margin: 10px 0 0; font-size: 12.5px; color: var(--soft); }
.pnl-sub.accent { color: var(--accent); }

/* ---------------------------------------------------------------- 按钮 */

button { font: inherit; cursor: pointer; }

.b-pri, .b-sec {
  border-radius: 12px; padding: 13px 20px;
  font-weight: 700; font-size: 15px;
  border: 1px solid transparent;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.b-pri {
  width: 100%;
  background: linear-gradient(100deg, #2a6fff, #7fd4ff);
  color: #04121f;
  box-shadow: 0 10px 30px rgba(60, 150, 255, .28);
}
.b-sec {
  background: rgba(120, 180, 240, .1);
  border-color: var(--line);
  color: var(--ink);
}
.b-sec.sm { padding: 8px 14px; font-size: 13px; }
.b-pri:hover, .b-sec:hover { transform: translateY(-1px); filter: brightness(1.12); }
.b-pri:active, .b-sec:active { transform: translateY(1px); }

.row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.row > button { flex: 1 1 140px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(120, 180, 240, .12);
  border: 1px solid var(--line); color: var(--ink);
  font-size: 20px; line-height: 1;
}

.text-link { color: var(--accent); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.howto {
  margin: 18px 0 0; padding: 14px 16px; list-style: none;
  text-align: left; border-radius: 12px;
  background: rgba(10, 22, 40, .5); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.9; color: var(--soft);
}

.meta-row {
  margin-top: 16px; display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 12px; color: var(--soft); flex-wrap: wrap;
}
.meta-dot { opacity: .4; }
.meta-row b { color: var(--accent); }

/* ---------------------------------------------------------------- HUD */

.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 12;
  display: flex; gap: 8px; padding: 10px;
  align-items: flex-start; pointer-events: none;
}
.hud > * { pointer-events: auto; padding: 8px 12px; }

.hud-l { display: flex; align-items: center; gap: 10px; }
.hud-title { display: flex; flex-direction: column; line-height: 1.25; }
.hud-title strong { font-size: 15px; }

.hud-c { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.cores { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.core-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 12px/1 ui-monospace, monospace;
  padding: 6px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  color: var(--soft);
  transition: all .2s ease;
}
.core-chip i {
  width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; opacity: .45;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
}
.core-chip.ch-R { color: var(--r); }
.core-chip.ch-G { color: var(--g); }
.core-chip.ch-B { color: var(--b); }
.core-chip.ch-W { color: var(--w); }
.core-chip.on {
  background: rgba(255, 255, 255, .1);
  border-color: currentColor;
}
.core-chip.on i { opacity: 1; box-shadow: 0 0 12px currentColor; }

.hud-r { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.hud-r strong { font: 800 16px/1 ui-monospace, monospace; }
.hud-r i { font-style: normal; font-size: 11px; color: var(--soft); }
.sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }

.teach {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: 66px; z-index: 11; margin: 0;
  max-width: min(560px, 90vw);
  padding: 8px 14px; border-radius: 999px;
  background: rgba(8, 16, 30, .66);
  border: 1px solid var(--line);
  font-size: 12.5px; color: var(--soft); text-align: center;
  backdrop-filter: blur(8px);
}

.controls {
  /* 站点弹幕输入条占着底部正中，所以这里靠左下，避免互相盖住 */
  position: fixed; left: 12px; bottom: 14px;
  z-index: 12; display: flex; gap: 8px; align-items: center;
  padding: 8px 12px;
}
.hint-text { font-size: 12px; color: var(--soft); }

.topright {
  /* HUD 右栏在顶部，所以这两个开关放右下 */
  position: fixed; right: 12px; bottom: 14px; z-index: 30;
  display: flex; gap: 6px;
}
.chip {
  padding: 6px 10px; border-radius: 999px;
  background: rgba(10, 18, 32, .7); border: 1px solid var(--line);
  color: var(--soft); font-size: 11.5px; font-weight: 600;
  backdrop-filter: blur(8px);
}

/* ---------------------------------------------------------------- 章节 / 关卡 */

.chapter-list { display: grid; gap: 18px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.chapter header h3 { margin: 0 0 2px; font-size: 15px; }
.chapter header p { margin: 0 0 10px; font-size: 12px; color: var(--soft); }
.chapter.locked { opacity: .45; }

.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.lv-cell {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 10px; border-radius: 12px; text-align: left;
  background: rgba(120, 180, 240, .07);
  border: 1px solid var(--line); color: var(--ink);
  transition: all .14s ease;
}
.lv-cell:hover:not(:disabled) { background: rgba(120, 180, 240, .16); transform: translateY(-2px); }
.lv-cell.done { border-color: rgba(127, 212, 255, .5); }
.lv-cell.locked { opacity: .4; cursor: not-allowed; }
.lv-id { font: 800 11px/1 ui-monospace, monospace; color: var(--accent); }
.lv-name { font-size: 13px; font-weight: 600; }
.lv-stars { font-size: 11px; color: #ffd76b; letter-spacing: 2px; }

/* ---------------------------------------------------------------- 商店 / 图鉴 */

#shopBody h4 { margin: 14px 0 8px; font-size: 13px; color: var(--soft); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.shop-card {
  display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
  padding: 10px; border-radius: 12px; text-align: left;
  background: rgba(120, 180, 240, .07);
  border: 1px solid var(--line); color: var(--ink);
}
.shop-card.on { border-color: var(--accent); background: rgba(127, 212, 255, .14); }
.shop-card .sw {
  width: 100%; height: 26px; border-radius: 8px;
  background: linear-gradient(120deg, var(--a), var(--b));
}
.shop-card b { font-size: 13px; }
.shop-card i { font-style: normal; font-size: 11px; color: var(--soft); }
.dust-tag { font-size: 12px; font-weight: 600; color: var(--soft); }
.dust-tag b { color: var(--accent); }

.codex { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.codex-item {
  padding: 11px 13px; border-radius: 12px;
  background: rgba(10, 22, 40, .5); border: 1px solid var(--line);
}
.codex-item.unseen { opacity: .45; }
.codex-item b { font-size: 14px; }
.codex-en { font-size: 11px; color: var(--soft); margin-left: 8px; }
.codex-item p { margin: 5px 0 0; font-size: 12.5px; color: var(--soft); line-height: 1.7; }
.codex-foot { font-size: 12px; color: var(--soft); line-height: 1.8; margin-top: 6px; }
.codex-foot b { color: var(--accent); }

/* ---------------------------------------------------------------- 结算 */

.stars { font-size: 30px; letter-spacing: 10px; color: rgba(255, 215, 107, .22); margin: 6px 0 12px; }
.stars .star.on { color: #ffd76b; text-shadow: 0 0 18px rgba(255, 215, 107, .7); }

.res-detail { text-align: left; display: grid; gap: 6px; margin-bottom: 14px; }
.res-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 12px; border-radius: 10px;
  background: rgba(10, 22, 40, .5); border: 1px solid var(--line);
  font-size: 13px;
}
.res-row span { color: var(--soft); min-width: 42px; }
.res-row b { font: 800 15px/1 ui-monospace, monospace; }
.res-row i { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--soft); }

.submit-row { display: flex; gap: 8px; margin: 12px 0 6px; }
.text-input {
  flex: 1; padding: 11px 13px; border-radius: 11px;
  background: rgba(10, 22, 40, .7); border: 1px solid var(--line);
  color: var(--ink); font: inherit; font-size: 14px;
}
.soft { font-size: 12px; color: var(--soft); min-height: 16px; }

.board-card {
  margin-top: 12px; padding: 12px; border-radius: 12px; text-align: left;
  background: rgba(10, 22, 40, .5); border: 1px solid var(--line);
}
.card-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); margin-bottom: 8px; }
.board-list { display: grid; gap: 5px; }
.board-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.board-rank { color: var(--accent); font-weight: 700; }
.board-name { font-weight: 600; }
.board-meta { font-size: 10.5px; color: var(--soft); }
.board-score { font: 800 13px/1 ui-monospace, monospace; }
.board-empty { font-size: 12px; color: var(--soft); }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  z-index: 40; padding: 10px 16px; border-radius: 999px;
  background: rgba(8, 16, 30, .9); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  backdrop-filter: blur(10px);
  max-width: 84vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- 移动端 */

@media (max-width: 720px) {
  .hide-mobile { display: none; }
  .controls { left: 10px; bottom: 10px; }
  .topright { right: 10px; bottom: 10px; }
  .hud { flex-wrap: wrap; }
  .hud-c { order: 3; flex-basis: 100%; }
  .hud-r { font-size: 12.5px; }
  .hud-r strong { font-size: 14px; }
  .teach { top: 118px; font-size: 12px; }
  .pnl { padding: 20px 16px; }
  .lv-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
