/* 烬与霜 — 界面样式。舞台固定 16:9，所有尺寸用 em，随舞台等比缩放（1em = 舞台宽度 / 80）。 */
:root {
  --fire-1: #fff6c2; --fire-2: #ffc24a; --fire-3: #ff7a1f; --fire-4: #d23a0c;
  --ice-1: #ffffff; --ice-2: #c9f4ff; --ice-3: #63ceff; --ice-4: #2a8fe6;
  --void: #b05cff; --gold: #ffd84a;
  --ink: #eef2ff; --ink-2: #b4bee8; --ink-3: #7c87b8;
  --glass: rgba(12, 14, 38, .66); --line: rgba(170, 185, 255, .22);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #04050d; color: var(--ink); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
body { display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 40%, #0d1130 0%, #04050d 70%); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 1.75em; height: 1.75em; padding: 0 .4em; margin: 0 .12em;
  border-radius: .42em; font: 700 .86em/1 var(--font); color: var(--ink);
  background: linear-gradient(180deg, rgba(92, 100, 168, .9), rgba(46, 51, 104, .95));
  border: 1px solid rgba(190, 200, 255, .35); box-shadow: 0 .14em 0 rgba(6, 8, 28, .9), inset 0 1px 0 rgba(255, 255, 255, .22); }
.ic { width: 1.25em; height: 1.25em; flex: none; display: block; }

#stage { position: relative; width: 1280px; height: 720px; font-size: 16px; overflow: hidden; background: #0a0d22;
  box-shadow: 0 0 0 1px rgba(170, 185, 255, .07), 0 2em 6em rgba(0, 0, 0, .65); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fade { position: absolute; inset: 0; background: #04050d; opacity: 0; pointer-events: none; transition: opacity .22s ease; z-index: 50; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- 按钮 ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-width: 13.5em; height: 3.1em; padding: 0 1.7em; border-radius: 1.55em; white-space: nowrap;
  font-size: 1.06em; font-weight: 700; letter-spacing: .14em; color: var(--ink);
  border: 1px solid rgba(175, 190, 255, .3);
  background: linear-gradient(180deg, rgba(74, 82, 148, .86), rgba(34, 38, 86, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 .4em 1.2em rgba(0, 0, 12, .5);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.16); }
.btn:active { transform: translateY(1px) scale(.985); filter: brightness(.95); }
.btn.primary { color: #3d1503; border-color: rgba(255, 236, 170, .75); text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  background: linear-gradient(180deg, #ffe07a 0%, #ffab38 52%, #f4701d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), inset 0 -.25em .5em rgba(190, 60, 0, .35), 0 .45em 1.6em rgba(255, 122, 31, .42); }
.btn:focus-visible, .ib:focus-visible, .card:focus-visible, .link:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.ib { display: inline-flex; align-items: center; justify-content: center; width: 2.35em; height: 2.35em; border-radius: 50%;
  color: var(--ink); background: var(--glass); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); transition: transform .12s ease, filter .12s ease, background .12s ease; }
.ib:hover { filter: brightness(1.3); transform: translateY(-1px); }
.ib:active { transform: scale(.94); }
.ib.tg { position: relative; }
.ib.tg.off { color: var(--ink-3); }
.ib.tg.off::after { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; border-radius: 2px; background: #ff7f9c; transform: rotate(-45deg); box-shadow: 0 0 0 1.5px rgba(12, 14, 38, .9); }
.link { margin-top: 1.1em; font-size: .92em; font-weight: 600; letter-spacing: .1em; color: var(--ink-2); border-bottom: 1px solid transparent; padding: .2em .1em; }
.link:hover { color: var(--ink); border-bottom-color: rgba(255, 255, 255, .5); }
.pill { display: inline-flex; align-items: center; gap: .5em; height: 2.2em; padding: 0 .95em; border-radius: 1.1em;
  background: var(--glass); border: 1px solid var(--line); font-weight: 700; font-size: .95em; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 0; right: 0; top: 0; height: 3em; padding: 0 .9em; display: flex; align-items: center; justify-content: space-between; pointer-events: none; z-index: 5; }
.hud > div { display: flex; align-items: center; gap: .55em; pointer-events: auto; }
.hud .hud-c { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.hud .lvl { padding-left: .3em; gap: .6em; letter-spacing: .08em; }
.hud .lvl b { display: inline-flex; align-items: center; justify-content: center; width: 1.7em; height: 1.7em; border-radius: 50%; font-size: .95em;
  color: #3d1503; background: linear-gradient(180deg, #ffe07a, #ff9a2e); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6); }
.hud .time { min-width: 6.2em; justify-content: center; letter-spacing: .06em; font-size: 1.02em; }
.hud .time .ic { color: var(--ink-2); width: 1.1em; height: 1.1em; }
.hud .gem { padding-left: .5em; gap: .3em; min-width: 4.6em; }
.hud .gem canvas { width: 1.5em; height: 1.5em; }
.hud .gem.fire { border-color: rgba(255, 150, 60, .4); }
.hud .gem.ice { border-color: rgba(99, 206, 255, .4); }
.hud .gem.full { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 .9em rgba(255, 216, 74, .45); border-color: rgba(255, 216, 74, .8); }
.hud .ib { width: 2.2em; height: 2.2em; }

/* 开场横幅 */
.intro { position: absolute; left: 0; right: 0; top: 37%; display: flex; flex-direction: column; align-items: center; gap: .35em; padding: 1.1em 0 1.2em; z-index: 6; pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 6, 22, 0), rgba(5, 6, 22, .72) 30%, rgba(5, 6, 22, .72) 70%, rgba(5, 6, 22, 0)); animation: intro 2.3s ease both; }
.intro span { font-size: .95em; font-weight: 700; letter-spacing: .5em; padding-left: .5em; color: var(--fire-2); }
.intro b { font-size: 2.5em; font-weight: 900; letter-spacing: .3em; padding-left: .3em;
  background: linear-gradient(90deg, #ffcc55, #ffffff 50%, #63ceff); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes intro { 0% { opacity: 0; transform: translateY(.6em); } 14% { opacity: 1; transform: none; } 72% { opacity: 1; } 100% { opacity: 0; transform: translateY(-.4em); } }

/* ---------- 屏幕 ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; z-index: 10; animation: fadeIn .28s ease both; }
.screen.dim { justify-content: center; padding-bottom: 1.2em; background: linear-gradient(180deg, rgba(5, 6, 22, .8), rgba(5, 6, 22, .9)); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(.8em); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.86) translateY(.6em); } 60% { transform: scale(1.02); } 100% { opacity: 1; transform: none; } }

/* 标题 */
#scrTitle { background: radial-gradient(70% 55% at 50% 30%, rgba(5, 6, 22, .28), rgba(5, 6, 22, 0) 70%); }
.logo { margin-top: 5.2em; text-align: center; animation: rise .5s ease both; }
.logo h1 { display: flex; align-items: center; justify-content: center; font-size: 8em; font-weight: 900; line-height: 1.05; letter-spacing: .02em; }
.logo h1 span { display: inline-block; -webkit-background-clip: text; background-clip: text; }
.c-fire { color: transparent; background-image: linear-gradient(180deg, #fff8cf 10%, #ffcc55 38%, #ff8424 66%, #d9400e 92%);
  filter: drop-shadow(0 .035em 0 #6a1c05) drop-shadow(0 0 .2em rgba(255, 122, 31, .6)); }
.c-ice { color: transparent; background-image: linear-gradient(180deg, #ffffff 10%, #cdf5ff 38%, #63ceff 66%, #2a86e0 92%);
  filter: drop-shadow(0 .035em 0 #0c3a78) drop-shadow(0 0 .2em rgba(99, 206, 255, .6)); }
.c-and { font-size: .42em; font-weight: 700; color: #e4eaff; margin: 0 .34em; transform: translateY(.18em); opacity: .92; text-shadow: 0 0 .5em rgba(160, 175, 255, .6); }
.logo .sub { margin-top: .55em; padding-left: .7em; font-size: 1.02em; font-weight: 800; letter-spacing: .7em; color: #c3ccf5; }
.logo .tag { display: flex; align-items: center; justify-content: center; gap: .9em; margin-top: .75em; font-size: .92em; font-weight: 500; letter-spacing: .28em; color: var(--ink-2); }
.logo .tag i { width: 3.4em; height: 1px; background: linear-gradient(90deg, transparent, rgba(190, 200, 255, .6)); }
.logo .tag i:last-child { transform: scaleX(-1); }
.menu { display: flex; flex-direction: column; gap: .8em; margin-top: 2.5em; animation: rise .5s .1s ease both; }
.corner { position: absolute; right: 1.1em; top: .9em; display: flex; gap: .5em; }
.keys { position: absolute; left: 0; right: 0; bottom: 8.4em; display: flex; justify-content: center; gap: 4.4em; pointer-events: none; }
.kc { display: inline-flex; align-items: center; gap: .3em; height: 2.3em; padding: 0 .7em 0 .85em; border-radius: 1.15em; font-size: .9em;
  background: var(--glass); border: 1px solid var(--line); }
.kc b { margin-right: .35em; letter-spacing: .1em; }
.kc.fire { border-color: rgba(255, 150, 60, .45); } .kc.fire b { color: var(--fire-2); }
.kc.ice { border-color: rgba(99, 206, 255, .45); } .kc.ice b { color: var(--ice-3); }

/* 顶栏 */
.bar { width: 62em; display: flex; align-items: center; justify-content: space-between; }
.bar h2 { font-size: 1.7em; font-weight: 800; letter-spacing: .3em; padding-left: .3em;
  background: linear-gradient(90deg, #ffcc55, #ffffff 50%, #63ceff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar .sp { width: 2.35em; }
.bar .total .star { color: var(--gold); width: 1.1em; height: 1.1em; }

/* 选关 */
.grid { width: 62em; margin-top: 1.9em; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2em; }
.card { position: relative; display: flex; flex-direction: column; height: 13.8em; padding: .6em .6em .7em; border-radius: 1.1em; text-align: left; overflow: hidden;
  background: linear-gradient(180deg, rgba(48, 54, 110, .9), rgba(20, 23, 58, .94)); border: 1px solid rgba(175, 190, 255, .26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 .5em 1.4em rgba(0, 0, 12, .5);
  transition: transform .14s ease, filter .14s ease, border-color .14s ease; animation: rise .35s ease both; }
.card:not(.locked):hover { transform: translateY(-3px); filter: brightness(1.14); border-color: rgba(255, 220, 140, .7); }
.card:not(.locked):active { transform: translateY(0) scale(.985); }
.card canvas { width: 100%; height: 8.2em; border-radius: .7em; background: linear-gradient(180deg, #151b42, #0a0c24); border: 1px solid rgba(175, 190, 255, .14); }
.card .no { position: absolute; left: .95em; top: .95em; min-width: 1.9em; height: 1.9em; padding: 0 .4em; border-radius: .95em; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95em; color: #3d1503; background: linear-gradient(180deg, #ffe07a, #ff9a2e); box-shadow: 0 .15em .5em rgba(0, 0, 12, .5), inset 0 1px 0 rgba(255, 255, 255, .6); }
.card .nm { margin: .65em .25em 0; font-size: 1.02em; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.card .meta { display: flex; align-items: center; justify-content: space-between; margin: .4em .25em 0; }
.card .ss { display: flex; gap: .12em; }
.card .ss svg { width: 1.12em; height: 1.12em; color: rgba(150, 162, 220, .28); }
.card .ss svg.on { color: var(--gold); filter: drop-shadow(0 0 .3em rgba(255, 216, 74, .55)); }
.card .bt { font-size: .84em; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.card.locked { cursor: default; filter: saturate(.4) brightness(.62); }
.card.locked .no { background: linear-gradient(180deg, #7c86c0, #4a5290); color: #0d1030; }
.card .lock { position: absolute; left: 0; right: 0; top: 3.2em; display: flex; justify-content: center; color: #dfe5ff; }
.card .lock svg { width: 2.3em; height: 2.3em; filter: drop-shadow(0 .15em .4em rgba(0, 0, 12, .8)); }

/* 玩法 */
.help { width: 62em; margin-top: 1.7em; display: grid; grid-template-columns: 1fr 1fr; gap: 1.1em 1.2em; animation: rise .35s ease both; }
.who { display: flex; align-items: center; gap: 1.2em; padding: 1.1em 1.4em; border-radius: 1.1em;
  background: linear-gradient(180deg, rgba(44, 50, 104, .9), rgba(20, 23, 58, .94)); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.who.fire { border-color: rgba(255, 150, 60, .5); background: linear-gradient(180deg, rgba(86, 46, 58, .88), rgba(30, 20, 46, .94)); }
.who.ice { border-color: rgba(99, 206, 255, .5); background: linear-gradient(180deg, rgba(36, 66, 116, .88), rgba(16, 24, 60, .94)); }
.who .pf { width: 6.2em; height: 6.2em; flex: none; }
.who h3 { font-size: 1.4em; font-weight: 800; letter-spacing: .2em; }
.who.fire h3 { color: var(--fire-2); } .who.ice h3 { color: var(--ice-3); }
.who p { margin-top: .5em; font-size: .95em; line-height: 1.65; color: var(--ink-2); }
.who p.kb { color: var(--ink); font-weight: 600; }
em { font-style: normal; font-weight: 700; margin: 0 .12em; }
.t-fire { color: var(--fire-2); } .t-ice { color: var(--ice-3); }
.rules { grid-column: 1 / -1; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: .15em 2.4em; padding: 1em 1.5em; border-radius: 1.1em;
  background: rgba(14, 16, 42, .78); border: 1px solid var(--line); }
.rules li { display: flex; align-items: center; gap: .8em; min-height: 2.5em; font-size: .95em; color: var(--ink-2); }
.rules b { color: var(--ink); margin-right: .7em; letter-spacing: .1em; }
.dot { flex: none; width: 1.05em; height: 1.05em; border-radius: 50%; }
.dot.void { background: radial-gradient(circle at 35% 30%, #f6c8ff, #7a2fe0 70%); box-shadow: 0 0 .6em rgba(176, 92, 255, .7); }
.dot.gem { background: linear-gradient(90deg, #ff8a2a 50%, #63ceff 50%); transform: rotate(45deg); border-radius: .22em; }
.dot.chan { background: conic-gradient(#ffd84a 0 25%, #c58bff 0 50%, #6fe39a 0 75%, #ff7fb0 0); }
.dot.crate { border-radius: .26em; background: linear-gradient(135deg, #aab2f2, #3c4083); border: 1px solid #12143a; }
.dot.door { border-radius: .55em .55em .1em .1em; height: 1.2em; background: linear-gradient(90deg, #ff7a1f 50%, #2a8fe6 50%); }
.dot.star { border-radius: 0; background: var(--gold); clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.hot { grid-column: 1 / -1; text-align: center; font-size: .9em; color: var(--ink-3); letter-spacing: .06em; }

/* ---------- 浮层 ---------- */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20;
  background: radial-gradient(60% 60% at 50% 50%, rgba(5, 6, 22, .5), rgba(4, 5, 18, .8)); animation: fadeIn .2s ease both; }
.panel { position: relative; min-width: 27em; padding: 2em 2.4em 1.8em; border-radius: 1.5em; text-align: center; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, rgba(34, 39, 88, .96), rgba(14, 16, 44, .97));
  box-shadow: 0 1.6em 4.5em rgba(0, 0, 12, .7), inset 0 1px 0 rgba(255, 255, 255, .14); animation: pop .32s cubic-bezier(.2, .9, .3, 1.15) both; }
.panel::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(120deg, #ffab38, rgba(190, 200, 255, .22) 32%, rgba(190, 200, 255, .22) 68%, #63ceff);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.panel h2 { font-size: 2.3em; font-weight: 900; letter-spacing: .26em; padding-left: .26em; line-height: 1.2; }
.panel .col { display: flex; flex-direction: column; gap: .75em; margin-top: 1.5em; }
.panel .row { display: flex; gap: .8em; margin-top: 1.6em; justify-content: center; }
.panel .row .btn { min-width: 10.4em; }
.panel .tgs { margin-top: 1.4em; }
.eyebrow { font-size: .9em; font-weight: 600; letter-spacing: .3em; color: var(--ink-2); margin-bottom: .3em; padding-left: .3em; }
.win h2 { background: linear-gradient(180deg, #fff8cf, #ffd15a 55%, #ff9a2e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 .25em rgba(255, 190, 80, .5)); }
.stars { display: flex; align-items: flex-end; justify-content: center; gap: .5em; height: 5.2em; margin-top: .7em; }
.stars .st { width: 3.5em; height: 3.5em; color: rgba(140, 152, 215, .22); transition: color .2s; }
.stars .st.big { width: 4.7em; height: 4.7em; margin-bottom: .35em; }
.stars .st.on { color: var(--gold); filter: drop-shadow(0 0 .7em rgba(255, 200, 60, .75)); animation: starPop .45s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes starPop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.22) rotate(6deg); } 100% { transform: none; } }
.crit { list-style: none; width: 19.5em; margin-top: 1em; display: flex; flex-direction: column; gap: .4em; }
.crit li { display: flex; align-items: center; gap: .7em; height: 2.35em; padding: 0 .95em 0 .7em; border-radius: .8em; font-size: .96em;
  background: rgba(8, 10, 30, .55); border: 1px solid rgba(170, 185, 255, .14); color: var(--ink-3); }
.crit li .ic { width: 1.25em; height: 1.25em; padding: .14em; border-radius: 50%; color: transparent; background: rgba(150, 162, 220, .16); }
.crit li span { flex: 1; text-align: left; letter-spacing: .1em; }
.crit li b { font-variant-numeric: tabular-nums; }
.crit li.ok { color: var(--ink); border-color: rgba(255, 216, 74, .32); }
.crit li.ok .ic { color: #3d1503; background: linear-gradient(180deg, #ffe07a, #ff9a2e); }
.rec { margin-top: .8em; padding: .25em 1em; border-radius: 1em; font-size: .85em; font-weight: 800; letter-spacing: .3em; color: #3d1503;
  background: linear-gradient(90deg, #ffe07a, #ffab38); box-shadow: 0 0 1.2em rgba(255, 190, 80, .5); }
.lose h2 { color: #ffd0dc; text-shadow: 0 0 .5em rgba(255, 110, 150, .5); }
.lose .why { margin-top: .8em; font-size: 1.25em; font-weight: 700; letter-spacing: .1em; }
.lose .tip { margin-top: .5em; font-size: .92em; color: var(--ink-2); letter-spacing: .06em; }

/* ---------- 触屏按键 ---------- */
#touch { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.tc { position: absolute; bottom: .7em; display: grid; grid-template-columns: repeat(3, 4.3em); gap: .5em; pointer-events: none; }
.tc.ice { left: .8em; } .tc.fire { right: .8em; }
.tc button { width: 4.3em; height: 4.3em; border-radius: 50%; display: flex; align-items: center; justify-content: center; pointer-events: auto; touch-action: none;
  background: rgba(12, 14, 38, .26); border: 2px solid rgba(190, 200, 255, .35); color: rgba(255, 255, 255, .8); }
.tc button .ic { width: 2em; height: 2em; }
.tc.ice button { border-color: rgba(99, 206, 255, .65); } .tc.fire button { border-color: rgba(255, 150, 60, .7); }
.tc button.on { background: rgba(255, 255, 255, .28); transform: scale(.94); }

/* ---------- 竖屏提示 ---------- */
#rotate { display: none; position: fixed; inset: 0; z-index: 99; align-items: center; justify-content: center; text-align: center; background: #05060f; padding: 2em; }
#rotate b { display: block; font-size: 1.3em; letter-spacing: .12em; }
#rotate span { display: block; margin-top: .6em; color: var(--ink-2); font-size: .95em; }
@media (orientation: portrait) and (max-width: 820px) { #rotate { display: flex; } }
@media (prefers-reduced-motion: reduce) { .screen, .logo, .menu, .card, .help, .overlay, .panel, .stars .st.on { animation: none !important; } .intro { animation-name: introPlain; } }
@keyframes introPlain { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
