/* ============================================================
   THAWWORK · 化冰 — main.css
   表现纪律（02 文档）：
   · 常驻 HUD ≤5 元素；事件类提示一律浮层、自动退场
   · 深色棚内 + 冰的青蓝是唯一主角色；暖色只给"人"（灯、火、评委）
   · 文字层级三档：kicker / body / whisper
   ============================================================ */

:root {
  --bg: #0b1520;
  --bg-2: #101f2e;
  --ink: #dceaf4;
  --ink-dim: #8fa8ba;
  --ink-faint: #5a7184;
  --ice: #bfe8ff;
  --ice-deep: #6fc4e8;
  --warm: #e8b46f;
  --warn: #e88f6f;
  --line: rgba(191, 232, 255, .14);
  --card: rgba(13, 26, 39, .86);
  --radius: 14px;
  --font: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-ui: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-user-select: none;
  user-select: none;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }

/* ── 融钟（顶中） ─────────────────────────────── */
.clock {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  width: 76px; height: 76px; pointer-events: none;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,.5));
}
.clock__ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock__track { fill: none; stroke: var(--line); stroke-width: 3; }
.clock__arc {
  fill: none; stroke: var(--ice-deep); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 188.5; transition: stroke .4s;
}
.clock.low .clock__arc { stroke: var(--warn); }
.clock__num {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; line-height: 1.05;
}
.clock__num b { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--ink); }
.clock__num i { font-style: normal; font-size: 9px; letter-spacing: 2px; color: var(--ink-faint); }

.phase-tag {
  position: fixed; top: 20px; left: 50%; transform: translateX(52px);
  font-family: var(--font); font-size: 12px; letter-spacing: 6px;
  color: var(--ink-dim); pointer-events: none; padding-top: 26px;
}

/* ── 刀刷轮盘（左） ───────────────────────────── */
.tools {
  position: fixed; left: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px; z-index: 5;
}
.tool {
  display: flex; align-items: center; gap: 9px;
  width: 172px; padding: 7px 11px;
  background: rgba(10, 20, 30, .55); border: 1px solid transparent; border-radius: 10px;
  color: var(--ink-dim); cursor: pointer; text-align: left;
  font-family: var(--font-ui); font-size: 12px;
  transition: background .15s, border-color .15s, color .15s;
  backdrop-filter: blur(6px);
}
.tool:hover { background: rgba(20, 36, 50, .7); color: var(--ink); }
.tool.on {
  background: rgba(111, 196, 232, .13); border-color: rgba(111, 196, 232, .45); color: var(--ice);
}
.tool .k {
  width: 18px; height: 18px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); border-radius: 5px;
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
}
.tool.on .k { border-color: rgba(111,196,232,.5); color: var(--ice); }
.tool .n { flex: 1; }
.tool .g { font-size: 10px; color: var(--ink-faint); }

/* ── 操作条（底） ─────────────────────────────── */
.actions {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 5;
}
.btn {
  padding: 9px 18px; border-radius: 999px;
  background: rgba(13, 26, 39, .8); border: 1px solid var(--line);
  color: var(--ink); font-size: 13px; letter-spacing: 2px; cursor: pointer;
  font-family: var(--font-ui); backdrop-filter: blur(8px);
  transition: all .18s;
}
.btn:hover:not(:disabled) { border-color: rgba(191,232,255,.4); background: rgba(20,38,54,.9); }
.btn:disabled { opacity: .35; cursor: default; }
.btn--primary {
  background: linear-gradient(135deg, rgba(111,196,232,.28), rgba(111,196,232,.12));
  border-color: rgba(111,196,232,.55); color: var(--ice);
}
.btn--primary:hover:not(:disabled) { background: rgba(111,196,232,.24); }
.brush {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: rgba(13, 26, 39, .8); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(8px);
}
.brush__icon { color: var(--ice-deep); font-size: 13px; }
.brush input[type=range] { width: 110px; accent-color: var(--ice-deep); }
.brush b { font-family: var(--mono); font-size: 12px; color: var(--ink); min-width: 22px; text-align: right; }
.brush i { font-style: normal; font-size: 10px; color: var(--ink-faint); }

/* ── 系统按钮（右上） ─────────────────────────── */
/* z-index 45：高于商店遮罩（40）——刷新后回到商店页，载入存档/进雕棚都必须点得到系统栏 */
.sysbar { position: fixed; top: 16px; right: 16px; display: flex; gap: 6px; z-index: 45; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(13, 26, 39, .7); border: 1px solid var(--line);
  color: var(--ink-dim); font-size: 14px; cursor: pointer; backdrop-filter: blur(6px);
  transition: all .15s;
}
.icon-btn:hover { color: var(--ice); border-color: rgba(191,232,255,.35); }

/* ── 浮动提示 ─────────────────────────────────── */
.toast {
  position: fixed; top: 108px; left: 50%; transform: translateX(-50%);
  padding: 10px 22px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-family: var(--font); font-size: 14px; letter-spacing: 1px; color: var(--ink);
  pointer-events: none; z-index: 20; backdrop-filter: blur(8px);
  animation: toastIn .3s ease, toastOut .5s ease 2.6s forwards;
}
.toast.warn { border-color: rgba(232,143,111,.5); color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -8px); } }

/* ── 教学卡 ───────────────────────────────────── */
.tutor {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(5, 10, 16, .55); z-index: 30; backdrop-filter: blur(3px);
}
.tutor__card {
  width: min(420px, calc(100vw - 48px)); padding: 30px 34px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  animation: cardIn .4s ease;
}
.tutor__card h3 { font-family: var(--font); font-size: 19px; letter-spacing: 3px; margin-bottom: 12px; color: var(--ice); }
.tutor__card p { font-size: 13.5px; line-height: 1.9; color: var(--ink-dim); margin-bottom: 20px; white-space: pre-line; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } }

/* ── 结算 ─────────────────────────────────────── */
.settle {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(5, 10, 16, .6); z-index: 25; backdrop-filter: blur(4px);
}
.settle__card {
  width: min(560px, calc(100vw - 40px)); max-height: calc(100vh - 60px); overflow: auto;
  padding: 32px 38px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  animation: cardIn .5s ease;
}
.settle__kicker { font-size: 11px; letter-spacing: 4px; color: var(--ink-faint); margin-bottom: 8px; }
.settle__kicker b { color: var(--warm); font-family: var(--mono); }
.settle__rank {
  font-family: var(--font); font-size: 40px; letter-spacing: 10px; margin-bottom: 6px;
  background: linear-gradient(180deg, #eaf7ff, #7cc7e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.settle__line { font-family: var(--font); font-size: 13.5px; color: var(--ink-dim); margin-bottom: 18px; }
.settle__score { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 20px; margin-bottom: 20px; text-align: left; }
.settle__score .row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px;
}
.settle__score .row i { font-style: normal; color: var(--ink-faint); }
.settle__score .row b { font-family: var(--mono); color: var(--ink); font-weight: 600; }
.settle__score .row.total { border-bottom: none; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.settle__score .row.total b { font-size: 17px; color: var(--ice); }
.settle__actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.settle__share img { width: 150px; border-radius: 10px; border: 1px solid var(--line); display: block; margin: 0 auto; }

/* ── 档案 ─────────────────────────────────────── */
.gallery {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(5, 10, 16, .6); z-index: 46; backdrop-filter: blur(4px);
}
.gallery__card {
  width: min(640px, calc(100vw - 40px)); max-height: calc(100vh - 80px); overflow: auto;
  padding: 26px 30px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.gallery__card h3 { font-family: var(--font); letter-spacing: 3px; margin-bottom: 16px; }
.gallery__card h3 i { font-style: normal; font-size: 11px; color: var(--ink-faint); letter-spacing: 1px; margin-left: 10px; }
.gallery__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.g-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: rgba(10,20,30,.5); }
.g-card img { width: 100%; display: block; aspect-ratio: 9/16; object-fit: cover; }
.g-card .m { padding: 7px 9px; font-size: 10.5px; color: var(--ink-dim); display: flex; justify-content: space-between; }
.g-card .m b { font-family: var(--mono); color: var(--ice); }
.gallery__empty { padding: 30px 0; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ── 存档 ─────────────────────────────────────── */
/* z-index 50：必须高于商店遮罩（40）——刷新后回到商店页正是要载入存档的时刻 */
.savepanel {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(5, 10, 16, .6); z-index: 50; backdrop-filter: blur(4px);
}
.savepanel__card {
  width: min(460px, calc(100vw - 40px)); max-height: calc(100vh - 80px); overflow: auto;
  padding: 26px 30px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.savepanel__card h3 { font-family: var(--font); letter-spacing: 3px; margin-bottom: 16px; }
.savepanel__card h3 i { font-style: normal; font-size: 11px; color: var(--ink-faint); letter-spacing: 1px; margin-left: 10px; }
.savepanel__slots { display: grid; gap: 10px; margin-bottom: 16px; }
.savepanel__slot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(10,20,30,.5);
}
.savepanel__slot .s {
  font-family: var(--mono); color: var(--ice); font-size: 13px;
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px; flex: none;
}
.savepanel__slot .i { flex: 1; font-size: 12px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savepanel__slot .btn { padding: 5px 12px; font-size: 12px; }
.savepanel__files { display: flex; gap: 10px; margin-bottom: 12px; }
.savepanel__files .btn { flex: 1; }
.savepanel__hint { font-size: 11px; color: var(--ink-faint); line-height: 1.7; margin-bottom: 14px; }
.savepanel__hint strong { color: var(--ink-dim); font-weight: 600; }

/* 联机雕棚（复用 savepanel 骨架） */
.netrow { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.netrow label { flex: none; width: 48px; font-size: 12px; color: var(--ink-dim); }
.netrow input {
  flex: 1; padding: 7px 10px; font-size: 13px; font-family: var(--mono);
  background: rgba(10,20,30,.5); border: 1px solid var(--line); border-radius: 8px; color: var(--ink);
}
.netrow input:focus { outline: none; border-color: var(--ice); }
.shop__net { margin: 14px 0 4px; display: flex; }
.shop__net .btn { width: 100%; }
.btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-dim); }
.btn--ghost:hover { border-color: var(--ice); color: var(--ice); }

/* 联机房码徽标（进棚后常驻——顶部中央是融钟，徽标挂在钟下方让位） */
.netbadge {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  z-index: 45; cursor: pointer; user-select: none;
}
.netbadge .code { font-family: var(--mono); font-size: 15px; letter-spacing: 3px; color: var(--ice); font-weight: 600; }
.netbadge .cnt { font-size: 11px; color: var(--ink-dim); }
.netbadge:hover { border-color: var(--ice); }

/* ── 开局选冰 ─────────────────────────────────── */
.shop {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 50% 30%, rgba(111,196,232,.07), transparent 60%), rgba(7, 13, 20, .82);
  z-index: 40; backdrop-filter: blur(5px);
}
.shop__card { text-align: center; padding: 20px; max-width: 660px; animation: cardIn .6s ease; }
.shop__kicker { font-size: 11px; letter-spacing: 6px; color: var(--ink-faint); margin-bottom: 14px; }
.shop__title { font-family: var(--font); font-size: 52px; letter-spacing: 22px; text-indent: 22px; color: var(--ink); }
.shop__title span {
  display: block; font-family: var(--mono); font-size: 12px; letter-spacing: 10px; text-indent: 10px;
  color: var(--ice-deep); margin-top: 6px;
}
.shop__sub { font-family: var(--font); font-size: 14px; line-height: 2; color: var(--ink-dim); margin: 18px 0 26px; }
.shop__ices { display: flex; gap: 12px; justify-content: center; margin-bottom: 22px; flex-wrap: wrap; }
.ice {
  width: 176px; padding: 16px 14px 14px; text-align: left; cursor: pointer;
  background: rgba(13, 26, 39, .7); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); font-family: var(--font-ui); transition: all .2s;
}
.ice:hover { transform: translateY(-3px); border-color: rgba(191,232,255,.4); }
.ice--rec { border-color: rgba(111,196,232,.5); background: rgba(111,196,232,.08); }
.ice b { display: block; font-size: 14px; letter-spacing: 2px; margin-bottom: 7px; color: var(--ice); }
.ice i { display: block; font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); margin-bottom: 7px; }
.ice span { font-size: 11px; color: var(--ink-faint); line-height: 1.5; }
.shop__opts { display: flex; gap: 16px; justify-content: center; align-items: center; margin-bottom: 18px; font-size: 12px; color: var(--ink-dim); }
.shop__opts .optCheck { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.shop__opts .optCheck input { accent-color: #6fc4e8; cursor: pointer; }
.shop__opts select {
  margin-left: 8px; padding: 4px 10px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); font-size: 12px;
}
.shop__hint { font-size: 11px; letter-spacing: 1px; color: var(--ink-faint); }

/* ── 通用 ─────────────────────────────────────── */
@media (max-width: 760px) {
  .tools { flex-direction: row; flex-wrap: wrap; width: auto; top: auto; bottom: 74px; left: 10px; right: 10px; transform: none; }
  .tool { width: auto; padding: 6px 9px; }
  .tool .n { font-size: 11px; }
  .brush input[type=range] { width: 70px; }
  .actions { flex-wrap: wrap; justify-content: center; width: calc(100vw - 20px); }
}
