:root {
  --ink: #f6efff; --muted: #c7b4de; --dim: #9d86ba;
  --ground: #0c0614; --panel: #1a0d2a; --panel-raised: #25133a;
  --line: #5d3d82; --line-soft: rgba(171, 132, 222, .24);
  --pink: #ff65a8; --pink-deep: #be3f86; --violet: #a979ff;
  --gold: #f2cf81; --green: #62d995; --red: #ff7b8c;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ground); }
body {
  min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 86% 0%, rgba(169, 121, 255, .16), transparent 34rem), radial-gradient(circle at 0% 86%, rgba(255, 101, 168, .12), transparent 31rem), linear-gradient(180deg, #150a25 0%, var(--ground) 64%);
  background-attachment: fixed;
}
button, input, select { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(242, 207, 129, .82); outline-offset: 3px; }
::selection { color: #1b0a22; background: var(--gold); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #10071b; }
::-webkit-scrollbar-thumb { background: #69468d; border: 2px solid #10071b; border-radius: 10px; }
.ambient { position: fixed; inset: 0; pointer-events: none; opacity: .5; background: linear-gradient(112deg, transparent 0 46%, rgba(242, 207, 129, .025) 46% 46.1%, transparent 46.1% 100%), linear-gradient(22deg, transparent 0 72%, rgba(169, 121, 255, .035) 72% 72.1%, transparent 72.1% 100%); }
.shell { position: relative; width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 52px; }
.masthead { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 20px; }
h1 { margin: 0; font-family: "STZhongsong", "SimSun", serif; font-size: clamp(32px, 5vw, 52px); line-height: 1; letter-spacing: .09em; }
.tagline { margin: 11px 0 0; color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.text-button { min-height: 38px; padding: 8px 13px; color: var(--muted); background: #1b0e2a; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.text-button:hover { color: var(--ink); border-color: var(--gold); }
.danger-text { color: #e5a4b0; }
.status-strip { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 14px; background: rgba(28, 14, 45, .9); overflow: hidden; }
.status-strip > div { min-width: 0; padding: 12px 16px; border-inline-end: 1px solid var(--line-soft); }
.status-strip > div:last-child { border-inline-end: 0; }
.status-strip span { display: block; margin-bottom: 2px; color: var(--dim); font-size: 11px; letter-spacing: .12em; }
.status-strip strong { display: block; overflow: hidden; color: var(--ink); font-size: 18px; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.distance { margin: 18px 0 22px; }
.distance-copy { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.track { height: 8px; overflow: hidden; border-radius: 5px; background: #241433; box-shadow: inset 0 1px 4px rgba(0, 0, 0, .52); }
.track-fill { width: 0; height: 100%; background: linear-gradient(90deg, var(--pink-deep), var(--pink), var(--gold)); }
.milestones { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin-top: 7px; }
.milestones i { height: 3px; border-radius: 2px; background: #2f1b41; }
.milestones i.done { background: var(--pink); }
.milestones i.current { background: var(--gold); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 20px; align-items: start; }
.play-column, .control-column { min-width: 0; }
.control-column { position: sticky; top: 16px; display: grid; gap: 14px; }
.stage, .tool-section, .journal, .recovery-panel { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, rgba(36, 19, 57, .97), rgba(23, 11, 38, .98)); }
.stage { min-height: 540px; overflow: hidden; }
.stage-top { display: grid; grid-template-columns: minmax(260px, .92fr) minmax(320px, 1.08fr); min-height: 430px; }
.visual { position: relative; display: grid; place-items: center; height: 430px; min-height: 430px; overflow: hidden; background: #09040e; }
.visual img { width: 100%; height: 100%; min-height: 0; object-fit: contain; display: block; animation: image-in .55s cubic-bezier(.22, 1, .36, 1); }
.visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 54%, rgba(10, 4, 16, .78)); pointer-events: none; }
.visual-label { position: absolute; z-index: 1; inset: auto 18px 18px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.visual-label span { color: var(--muted); font-size: 12px; }
.visual-label strong { font-size: 20px; }
@keyframes image-in { from { opacity: .35; filter: blur(10px); transform: scale(1.035); } to { opacity: 1; filter: blur(0); transform: scale(1); } }
.game-copy { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: clamp(24px, 4vw, 44px); }
.game-copy h2 { margin: 0 0 12px; font-family: "STZhongsong", "SimSun", serif; font-size: clamp(26px, 4vw, 40px); line-height: 1.16; }
.game-copy p { max-width: 62ch; margin: 0 0 14px; color: var(--muted); line-height: 1.75; }
.game-copy .lead { color: var(--ink); font-size: 17px; }
.instruction { margin: 12px 0 20px; padding: 18px 0; border-block: 1px solid var(--line-soft); color: var(--ink); font-size: clamp(19px, 2.5vw, 27px); font-weight: 800; line-height: 1.48; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.badge { padding: 4px 9px; border-radius: 999px; color: #eadfff; background: #38204f; font-size: 12px; font-weight: 700; }
.badge.gold { color: #2b1900; background: var(--gold); }
.badge.green { color: #071b10; background: var(--green); }
.die { display: grid; place-items: center; width: 78px; height: 78px; margin-bottom: 18px; color: #24102a; background: var(--gold); border-radius: 14px; font-family: Georgia, serif; font-size: 42px; font-weight: 900; box-shadow: 0 13px 24px rgba(0, 0, 0, .32); transform: rotate(-2deg); }
.die.rolling { animation: dice-roll .46s cubic-bezier(.22, 1, .36, 1); }
@keyframes dice-roll { 0% { transform: rotate(-18deg) scale(.78); filter: blur(4px); } 70% { transform: rotate(5deg) scale(1.08); } 100% { transform: rotate(-2deg) scale(1); filter: blur(0); } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary, .secondary, .danger-button { min-height: 45px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 800; cursor: pointer; transition: transform .16s ease, filter .16s ease, border-color .16s ease; }
.primary { color: #fff; background: linear-gradient(180deg, #ff78b5, #bd3e86); box-shadow: 0 10px 22px rgba(190, 63, 134, .25); }
.secondary { color: var(--ink); background: #35204b; border-color: #76539e; }
.danger-button { color: #fff; background: #9f3558; border-color: #d65f7f; }
.primary:hover, .secondary:hover, .danger-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
button:disabled { cursor: not-allowed; opacity: .4; transform: none !important; filter: none !important; }
.button-note { color: var(--dim); font-size: 12px; }
.task-progress { margin: 16px 0; }
.task-progress-line { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.task-progress .track { height: 10px; }
.timer { margin: 6px 0 18px; color: var(--gold); font-size: clamp(36px, 6vw, 64px); font-weight: 900; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.task-steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; }
.task-steps li { position: relative; padding: 7px 0 7px 28px; color: var(--dim); }
.task-steps li::before { counter-increment: step; content: counter(step); position: absolute; inset-inline-start: 0; top: 7px; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: var(--dim); border: 1px solid var(--line); font-size: 10px; }
.task-steps li.active { color: var(--ink); font-weight: 700; }
.task-steps li.done { color: var(--green); }
.stage-footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line-soft); background: rgba(13, 6, 22, .46); }
.stage-footer p { margin: 0; color: var(--dim); font-size: 12px; }
.swap-button { color: var(--muted); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.tool-section { padding: 16px; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 17px; }
.section-heading span { color: var(--dim); font-size: 11px; }
.gallery-current { display: grid; gap: 3px; margin-bottom: 12px; }
.gallery-current strong { font-size: 15px; }
.gallery-current span { color: var(--dim); font-size: 12px; line-height: 1.5; }
.gallery-open { width: 100%; }
.gallery-featured, .gallery-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.gallery-featured .gallery-option:first-child { grid-column: 1 / -1; }
.gallery-option { min-width: 0; min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--ink); text-align: start; background: #2b173d; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background-color .16s ease; }
.gallery-option:hover { transform: translateY(-2px); border-color: var(--gold); }
.gallery-option.selected { color: #24182a; background: var(--gold); border-color: var(--gold); }
.gallery-option span { min-width: 0; display: grid; gap: 4px; }
.gallery-option strong, .gallery-option small { overflow-wrap: anywhere; }
.gallery-option strong { font-size: 14px; }
.gallery-option small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.gallery-option.selected small { color: #5d4420; }
.gallery-option b { flex: 0 0 auto; color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.gallery-option.selected b { color: #5d4420; }
.tool-list { display: grid; gap: 8px; }
.tool-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.tool-row:first-child { border-top: 0; }
.tool-row h3 { margin: 0 0 3px; font-size: 13px; }
.tool-row p { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.mini-button { min-width: 72px; min-height: 34px; padding: 6px 10px; color: var(--ink); background: #392150; border: 1px solid #74509c; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.mini-button.accent { color: #251022; background: var(--gold); border-color: var(--gold); }
.lock-state { padding: 12px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.inventory { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.inventory span { padding: 4px 7px; color: var(--muted); background: #2c183e; border-radius: 6px; font-size: 11px; }
.volume-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.music-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.music-choice { min-height: 40px; padding: 8px 12px; color: var(--muted); background: #2c183e; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 800; }
.music-choice:hover { color: var(--ink); border-color: var(--gold); }
.music-choice.active { color: #24182a; background: var(--gold); border-color: var(--gold); }
input[type="range"] { width: 100%; accent-color: var(--pink); }
.recovery-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, .9fr); gap: 28px; align-items: center; margin-top: 20px; padding: 20px; }
.recovery-copy h2 { margin: 0 0 7px; font-size: 17px; }
.recovery-copy p { max-width: 68ch; margin: 0; color: var(--dim); font-size: 12px; line-height: 1.65; }
.teleport-control { display: grid; grid-template-columns: auto minmax(110px, 1fr) auto; gap: 8px; align-items: center; }
.teleport-control label { color: var(--muted); font-size: 12px; font-weight: 700; }
.teleport-control select { min-width: 0; min-height: 42px; padding: 8px 34px 8px 12px; color: var(--ink); background: #241433; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.teleport-control span { grid-column: 2 / -1; color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.journal { margin-top: 18px; overflow: hidden; }
.journal summary { display: flex; justify-content: space-between; padding: 15px 18px; cursor: pointer; font-weight: 700; }
.journal summary span { color: var(--dim); font-size: 12px; }
.log { max-height: 290px; overflow: auto; border-top: 1px solid var(--line-soft); }
.log-entry { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 10px 18px; border-bottom: 1px solid rgba(171, 132, 222, .12); color: var(--muted); font-size: 12px; line-height: 1.55; }
.log-entry time { color: var(--dim); font-variant-numeric: tabular-nums; }
.empty-log { padding: 24px 18px; color: var(--dim); text-align: center; }
.dice-overlay { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; overflow: auto; padding: 18px; background: radial-gradient(circle at 50% 44%, rgba(169, 121, 255, .2), transparent 34rem), rgba(5, 2, 9, .92); animation: dice-backdrop-in .28s ease-out; }
.dice-overlay[hidden] { display: none; }
.dice-chamber { position: relative; isolation: isolate; width: min(620px, 100%); min-height: min(720px, calc(100vh - 36px)); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: clamp(28px, 6vw, 54px); color: var(--ink); text-align: center; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 50% 38%, rgba(255, 101, 168, .14), transparent 19rem), linear-gradient(180deg, #241338, #12091f 72%); box-shadow: 0 30px 90px rgba(0, 0, 0, .66); animation: chamber-in .52s cubic-bezier(.16, 1, .3, 1); }
.dice-chamber:focus { outline: none; }
.dice-chamber::before { content: ""; position: absolute; z-index: -1; inset: 14px; border: 1px solid rgba(242, 207, 129, .18); border-radius: 12px; pointer-events: none; }
.dice-chamber h2 { max-width: 14ch; margin: 0; font-family: "STZhongsong", "SimSun", serif; font-size: clamp(28px, 6vw, 44px); line-height: 1.08; }
.dice-progress { margin: 10px 0 6px; color: var(--gold); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.dice-orbit { position: absolute; z-index: -1; inset: 15% 6%; pointer-events: none; }
.dice-orbit i { position: absolute; inset: 50% auto auto 50%; width: min(62vw, 380px); aspect-ratio: 1; border: 1px solid rgba(169, 121, 255, .2); border-radius: 50%; transform: translate(-50%, -50%); }
.dice-orbit i:nth-child(2) { width: min(76vw, 470px); border-color: rgba(255, 101, 168, .13); }
.dice-orbit i:nth-child(3) { width: min(92vw, 560px); border-color: rgba(242, 207, 129, .08); }
.d10-object { position: relative; width: min(76vw, 350px); aspect-ratio: 1; display: grid; place-items: center; margin: 12px 0 4px; transform-origin: 50% 55%; }
.d10-object img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 24px 26px rgba(0, 0, 0, .48)); }
.d10-object strong { position: relative; z-index: 1; display: grid; place-items: center; width: 34%; aspect-ratio: 1; color: #fff8df; font-family: Georgia, serif; font-size: clamp(58px, 14vw, 92px); font-weight: 900; line-height: 1; text-shadow: 0 4px 16px rgba(255, 101, 168, .72); font-variant-numeric: tabular-nums; transform: translateY(2%); }
.dice-status { min-height: 26px; margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.dice-accept { min-width: 180px; }
.dice-chamber.is-rolling .d10-object { animation: d10-tumble 1.05s cubic-bezier(.16, 1, .3, 1); will-change: transform, filter; }
.dice-chamber.is-rolling .dice-orbit i { animation: orbit-pulse .52s ease-in-out infinite alternate; }
.dice-chamber.is-rolling .dice-orbit i:nth-child(2) { animation-delay: .12s; }
.dice-chamber.is-rolling .dice-orbit i:nth-child(3) { animation-delay: .24s; }
.dice-chamber.is-settled .d10-object { animation: dice-lock .38s cubic-bezier(.16, 1, .3, 1); }
@keyframes dice-backdrop-in { from { opacity: 0; } }
@keyframes chamber-in { from { opacity: .55; clip-path: inset(7% 4% round 24px); filter: blur(10px); } to { opacity: 1; clip-path: inset(0 round 16px); filter: blur(0); } }
@keyframes d10-tumble { 0% { transform: rotate(-24deg) scale(.76); filter: blur(5px) brightness(.8); } 32% { transform: rotate(13deg) scale(1.04); filter: blur(2px) brightness(1.18); } 65% { transform: rotate(-8deg) scale(.93); filter: blur(1px) brightness(1); } 100% { transform: rotate(0) scale(1); filter: blur(0) brightness(1); } }
@keyframes orbit-pulse { from { opacity: .28; transform: translate(-50%, -50%) scale(.92); } to { opacity: .9; transform: translate(-50%, -50%) scale(1.04); } }
@keyframes dice-lock { 0% { transform: scale(.92); filter: brightness(1.38); } 100% { transform: scale(1); filter: brightness(1); } }
.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(6, 2, 10, .8); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(720px, 100%); max-height: min(86vh, 820px); overflow: auto; padding: clamp(22px, 5vw, 38px); border: 1px solid var(--line); border-radius: 16px; background: #1c0e2d; box-shadow: 0 30px 90px rgba(0, 0, 0, .62); }
.modal:focus { outline: none; }
.modal h2 { margin: 0 0 10px; font-family: "STZhongsong", "SimSun", serif; font-size: 30px; }
.modal h3 { margin: 26px 0 8px; color: var(--gold); font-size: 18px; }
.modal p, .modal li { color: var(--muted); line-height: 1.7; }
.modal .actions { margin-top: 22px; }
.rule-table { width: 100%; margin: 12px 0 24px; border-collapse: collapse; font-size: 13px; }
.rule-table th, .rule-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: start; vertical-align: top; }
.rule-table th { color: var(--gold); }
.rule-table td:first-child { width: 42px; color: var(--dim); font-variant-numeric: tabular-nums; }
.route-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 20px 0; }
.route-grid span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; color: var(--dim); background: #2c183e; font-size: 11px; }
.route-grid span.done { color: #102117; background: var(--green); }
.route-grid span.current { color: #24182a; background: var(--gold); font-weight: 900; }
.ending-video { width: 100%; margin: 12px 0 20px; border-radius: 12px; background: #09040e; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } .control-column { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); } .sound-section { grid-column: 1 / -1; } .recovery-panel { grid-template-columns: 1fr; gap: 16px; } }
@media (max-width: 720px) {
  .shell { width: min(100% - 20px, 620px); padding-top: 18px; }
  .masthead { align-items: start; flex-direction: column; gap: 16px; }
  .header-actions { justify-content: flex-start; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .status-strip > div { border-bottom: 1px solid var(--line-soft); }
  .status-strip > div:nth-child(even) { border-inline-end: 0; }
  .status-strip > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .stage-top { grid-template-columns: 1fr; }
  .visual { height: clamp(280px, 72vw, 360px); min-height: 280px; max-height: 360px; }
  .visual img { min-height: 0; max-height: 100%; }
  .game-copy { order: -1; padding: 25px 20px 30px; }
  .stage-footer { align-items: start; flex-direction: column; }
  .control-column { grid-template-columns: 1fr; }
  .sound-section { grid-column: auto; }
  .recovery-panel { padding: 18px; }
  .teleport-control { grid-template-columns: 1fr; }
  .teleport-control span { grid-column: auto; }
  .teleport-control .secondary { width: 100%; }
  .modal { padding: 22px 18px; }
  .gallery-featured, .gallery-options { grid-template-columns: 1fr; }
  .gallery-featured .gallery-option:first-child { grid-column: auto; }
  .dice-overlay { padding: 10px; }
  .dice-chamber { min-height: calc(100vh - 20px); padding: 28px 18px; }
  .d10-object { width: min(88vw, 330px); }
  .route-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
