:root {
  color-scheme: dark;
  --ink: #f7f4ea;
  --muted: #aab7c9;
  --panel: rgba(17, 28, 44, 0.92);
  --panel-soft: rgba(26, 41, 62, 0.82);
  --line: rgba(255, 255, 255, 0.1);
  --gold: #ffc64d;
  --gold-deep: #e58a18;
  --cyan: #69e6ef;
  --green: #65df9c;
  --danger: #ff8d85;
  --shadow: 0 24px 70px rgba(1, 7, 16, 0.46);
  --radius: 24px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #0b1321;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 8%, rgba(45, 112, 130, 0.23), transparent 31rem),
    radial-gradient(circle at 88% 16%, rgba(186, 107, 34, 0.18), transparent 34rem),
    linear-gradient(145deg, #0b1321, #101c2e 54%, #0a111d);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

button {
  min-height: 44px;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  color: #102034;
  background: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

body.pseudo-fullscreen {
  overflow: hidden;
}

.page-shell:fullscreen,
.page-shell:-webkit-full-screen,
body.pseudo-fullscreen .page-shell {
  width: 100%;
  max-width: none;
  min-height: 100%;
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  overflow: auto;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 8%, rgba(45, 112, 130, 0.23), transparent 31rem),
    radial-gradient(circle at 88% 16%, rgba(186, 107, 34, 0.18), transparent 34rem),
    linear-gradient(145deg, #0b1321, #101c2e 54%, #0a111d);
  overscroll-behavior: contain;
}

.page-shell:fullscreen,
.page-shell:-webkit-full-screen {
  height: 100%;
}

.page-shell:fullscreen::backdrop {
  background: #0b1321;
}

body.pseudo-fullscreen .page-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  height: 100vh;
  height: 100dvh;
}

.page-shell:fullscreen .topbar,
.page-shell:-webkit-full-screen .topbar,
body.pseudo-fullscreen .page-shell .topbar {
  margin-bottom: 8px;
}

.page-shell:fullscreen .scoreboard,
.page-shell:-webkit-full-screen .scoreboard,
body.pseudo-fullscreen .page-shell .scoreboard {
  gap: 6px;
}

.page-shell:fullscreen .stat-card,
.page-shell:-webkit-full-screen .stat-card,
body.pseudo-fullscreen .page-shell .stat-card {
  min-height: 62px;
}

.page-shell:fullscreen .game-card,
.page-shell:-webkit-full-screen .game-card,
body.pseudo-fullscreen .page-shell .game-card {
  width: min(100%, max(320px, calc(150vh - 470px)));
  width: min(100%, max(320px, calc(150dvh - 470px)));
  margin-right: auto;
  margin-left: auto;
}

.page-shell:fullscreen .legend,
.page-shell:-webkit-full-screen .legend,
body.pseudo-fullscreen .page-shell .legend {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 226, 150, 0.32);
  border-radius: 16px;
  color: #271607;
  font-size: 1.65rem;
  font-weight: 900;
  background: linear-gradient(145deg, #ffe18c, #f1a72b);
  box-shadow: 0 10px 24px rgba(225, 137, 27, 0.2);
  transform: rotate(-6deg);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  letter-spacing: 0.02em;
}

.brand div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0.64rem 0.82rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #dce5f2;
  background: rgba(21, 34, 52, 0.76);
  backdrop-filter: blur(12px);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  border-color: rgba(105, 230, 239, 0.34);
  background: rgba(34, 53, 78, 0.9);
  transform: translateY(-1px);
}

.icon-button[aria-pressed="false"] {
  color: #8995a8;
}

.scoreboard {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr 1.18fr 0.9fr;
  gap: 10px;
}

.stat-card {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(29, 45, 66, 0.94), rgba(17, 29, 46, 0.94));
  box-shadow: 0 12px 28px rgba(2, 8, 18, 0.14);
}

.stat-card > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-card strong {
  color: #fff;
  font-size: clamp(1.05rem, 2.6vw, 1.42rem);
  white-space: nowrap;
}

.stat-card strong b {
  color: inherit;
  font-size: 1.55em;
}

.stat-card strong small {
  margin-left: 3px;
  color: #9eabc0;
  font-size: 0.68em;
  font-weight: 600;
}

.stat-level strong,
.stat-score strong {
  color: var(--gold);
}

.stat-time strong {
  color: var(--cyan);
}

.stat-time.is-urgent strong {
  color: var(--danger);
  animation: urgent-pulse 800ms ease-in-out infinite alternate;
}

.goal-strip {
  margin: 10px 0 14px;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(14, 25, 40, 0.72);
}

.goal-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #d7e0ec;
  font-size: 0.84rem;
}

.goal-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mode-badge {
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(105, 230, 239, 0.16);
  border-radius: 999px;
  color: #a9dce5;
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
  background: rgba(105, 230, 239, 0.07);
}

.coin-total {
  color: #9ff0bd;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

#starTotal {
  color: #ffe080;
  font-weight: 800;
  white-space: nowrap;
}

.goal-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.goal-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e89b27, #ffd75f 58%, #fff0a3);
  box-shadow: 0 0 15px rgba(255, 199, 77, 0.46);
  transition: width 260ms ease;
}

.active-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.active-tools span {
  padding: 0.22rem 0.46rem;
  border: 1px solid rgba(255, 198, 77, 0.2);
  border-radius: 999px;
  color: #ffe8a7;
  font-size: 0.68rem;
  font-weight: 750;
  background: rgba(255, 198, 77, 0.08);
}

.game-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: #0d1827;
  box-shadow: var(--shadow);
}

.canvas-stage {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #4b2d1c;
  isolation: isolate;
}

.canvas-stage::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  box-shadow: inset 0 0 76px rgba(1, 7, 15, 0.42);
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.toast {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 4;
  max-width: calc(100% - 28px);
  padding: 0.68rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(11, 22, 37, 0.84);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(10px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-good {
  border-color: rgba(101, 223, 156, 0.5);
  color: #c7ffe0;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  overflow: auto;
  place-items: center;
  padding: clamp(12px, 3vw, 28px);
  background: rgba(5, 12, 23, 0.68);
  backdrop-filter: blur(8px) saturate(0.85);
}

.screen-panel {
  width: min(610px, 100%);
  margin: auto;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  text-align: center;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 196, 74, 0.18), transparent 48%),
    linear-gradient(155deg, rgba(30, 46, 67, 0.97), rgba(13, 24, 40, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.screen-panel h1,
.screen-panel h2 {
  margin: 8px 0 8px;
  line-height: 1.12;
}

.screen-panel h1 {
  color: #fff3c6;
  font-size: clamp(2rem, 6vw, 3.35rem);
  letter-spacing: 0.03em;
  text-shadow: 0 4px 22px rgba(245, 162, 38, 0.32);
}

.screen-panel h2 {
  font-size: clamp(1.55rem, 4vw, 2.25rem);
}

.screen-panel p {
  color: #bcc8d8;
  line-height: 1.65;
}

.screen-panel .lead {
  margin: 0 auto 20px;
  max-width: 470px;
  font-size: 1rem;
}

.mode-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.compact-mode-choice {
  margin: 12px 0 14px;
}

.mode-card {
  display: grid;
  min-width: 0;
  min-height: 94px;
  padding: 13px 12px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.mode-card:hover {
  border-color: rgba(105, 230, 239, 0.4);
  background: rgba(105, 230, 239, 0.08);
  transform: translateY(-1px);
}

.mode-card.is-active,
.mode-card[aria-pressed="true"] {
  border-color: rgba(255, 198, 77, 0.58);
  background: linear-gradient(145deg, rgba(255, 198, 77, 0.17), rgba(105, 230, 239, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 198, 77, 0.15);
}

.mode-card > span,
.mode-card > strong,
.mode-card > small {
  display: block;
}

.mode-card > span {
  font-size: 1.45rem;
}

.mode-card > strong {
  margin: 4px 0 3px;
  color: #fff1bd;
  font-size: 0.9rem;
}

.mode-card > small {
  color: #9eacbf;
  font-size: 0.7rem;
  line-height: 1.45;
}

.mode-panel {
  width: min(590px, 100%);
}

.mode-panel > p {
  margin: 0 auto;
  max-width: 480px;
}

.mode-cancel-button {
  display: block;
  margin: 0 auto;
}

.how-to-play {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 18px 0 22px;
}

.how-to-play div {
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.how-to-play div > span,
.how-to-play b,
.how-to-play small {
  display: block;
}

.how-to-play div > span {
  margin-bottom: 6px;
  font-size: 1.5rem;
}

.how-to-play b {
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.how-to-play small {
  color: #9eacbf;
  font-size: 0.72rem;
  line-height: 1.35;
}

.screen-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-width: 150px;
  padding: 0.82rem 1.15rem;
  border-radius: 14px;
  font-size: 0.94rem;
  font-weight: 800;
  transition: transform 150ms ease, filter 150ms ease;
}

.primary-button {
  color: #2b1908;
  background: linear-gradient(145deg, #ffe38a, #f5aa2e);
  box-shadow: 0 10px 24px rgba(230, 142, 25, 0.24);
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #e6edf6;
  background: #263a54;
}

.primary-button:hover,
.secondary-button:hover,
.drop-button:hover,
.dynamite-button:hover:not(:disabled),
.finish-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.text-button {
  min-height: 36px;
  margin-top: 10px;
  padding: 0.35rem 0.5rem;
  color: #9fdbe3;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  background: transparent;
}

.compact-panel {
  width: min(470px, 100%);
}

.big-icon {
  display: block;
  color: var(--gold);
  font-size: clamp(2.4rem, 7vw, 4.5rem);
}

.result-badge {
  display: grid;
  width: 74px;
  height: 74px;
  margin: -2px auto 6px;
  place-items: center;
  border: 1px solid rgba(255, 224, 128, 0.28);
  border-radius: 50%;
  font-size: 2.15rem;
  background: rgba(255, 197, 67, 0.1);
}

.result-stars {
  margin: 8px 0;
  color: var(--gold);
  font-size: clamp(2rem, 7vw, 3.4rem);
  letter-spacing: 0.16em;
  text-shadow: 0 0 22px rgba(255, 198, 77, 0.4);
}

.record-note {
  min-height: 1.5em;
  margin-top: -8px;
  color: var(--cyan) !important;
  font-size: 0.84rem;
}

.anniversary-screen {
  --treasure-x: 50%;
  --treasure-y: 68%;
  z-index: 14;
  display: block;
  overflow: hidden;
  padding: 0;
  background-color: #25130f;
  background-image:
    linear-gradient(180deg, rgba(19, 8, 7, 0.34) 0%, rgba(19, 8, 7, 0.04) 37%, rgba(19, 8, 7, 0.2) 55%, rgba(12, 5, 7, 0.88) 100%),
    url("./assets/anniversary-813.jpg");
  background-position: center 30%;
  background-size: cover;
  backdrop-filter: none;
  opacity: 0;
}

.anniversary-screen::before,
.anniversary-screen::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.anniversary-screen::before {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 230, 169, 0.2), transparent 30%),
    linear-gradient(90deg, rgba(31, 10, 11, 0.36), transparent 24%, transparent 76%, rgba(31, 10, 11, 0.36));
}

.anniversary-screen::after {
  z-index: 1;
  border: 1px solid rgba(255, 220, 168, 0.25);
  box-shadow: inset 0 0 90px rgba(42, 10, 14, 0.62);
}

.anniversary-screen.is-playing {
  animation: anniversary-photo-reveal 1.35s ease-out forwards;
}

.anniversary-hook-point {
  position: absolute;
  left: var(--treasure-x);
  top: var(--treasure-y);
  z-index: 3;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  color: #ffe9a9;
  font-size: 1.5rem;
  line-height: 32px;
  text-align: center;
  text-shadow: 0 0 8px #fff3c4, 0 0 22px #ffb532, 0 0 42px #f18431;
  opacity: 0;
}

.anniversary-screen.is-playing .anniversary-hook-point {
  animation: anniversary-treasure-glint 1.9s ease-out forwards;
}

.anniversary-title {
  position: absolute;
  left: 50%;
  top: 7.5%;
  z-index: 4;
  width: min(90%, 720px);
  margin: 0;
  color: #fff2c8;
  font-family: "STKaiti", "KaiTi", "FZKai-Z03", "Microsoft YaHei", cursive;
  font-size: clamp(1.5rem, 4.2vw, 2.65rem);
  font-weight: 900;
  letter-spacing: 0.09em;
  line-height: 1.18;
  text-align: center;
  text-shadow: 0 3px 4px rgba(29, 8, 8, 0.95), 0 0 24px rgba(255, 184, 77, 0.55);
  opacity: 0;
  transform: translateX(-50%);
}

.anniversary-screen.is-playing .anniversary-title {
  animation: anniversary-treasure-rise 1.9s cubic-bezier(0.18, 0.78, 0.2, 1) 0.15s forwards;
}

.anniversary-story {
  position: absolute;
  right: 4%;
  bottom: 4.5%;
  z-index: 4;
  width: min(620px, 66%);
  padding: clamp(13px, 2.2vw, 23px) clamp(16px, 3vw, 30px);
  border: 1px solid rgba(255, 232, 195, 0.27);
  border-radius: 23px;
  color: #fffaf1;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(46, 15, 17, 0.82), rgba(15, 8, 12, 0.78)),
    rgba(16, 8, 10, 0.74);
  box-shadow: 0 20px 52px rgba(7, 2, 4, 0.42), inset 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(9px) saturate(1.15);
}

.anniversary-line {
  min-height: 2.9em;
  margin: 0 0 8px;
  color: #fffaf2;
  font-size: clamp(0.8rem, 1.75vw, 1.08rem);
  font-weight: 650;
  letter-spacing: 0.035em;
  line-height: 1.48;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.anniversary-line.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.anniversary-line.is-typing::after {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: #ffd997;
  box-shadow: 0 0 9px rgba(255, 198, 91, 0.75);
  animation: anniversary-caret 0.7s steps(1) infinite;
  content: "";
}

.anniversary-final {
  margin: 8px 0 0;
  color: #fff0cf;
  font-family: "STKaiti", "KaiTi", "FZKai-Z03", "Microsoft YaHei", cursive;
  font-size: clamp(0.9rem, 2.15vw, 1.32rem);
  font-weight: 900;
  letter-spacing: 0.045em;
  line-height: 1.42;
  opacity: 0;
  transform: translateY(13px) scale(0.98);
  transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 0.82, 0.24, 1);
}

.anniversary-final strong,
.anniversary-final span {
  display: block;
}

.anniversary-final span {
  margin-top: 4px;
}

.anniversary-final b {
  display: inline-block;
  font-family: inherit;
  filter: drop-shadow(0 0 8px rgba(255, 101, 124, 0.72));
}

.anniversary-final.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.anniversary-final.is-visible b {
  animation: anniversary-heartbeat 1.35s ease-in-out 0.55s 2;
}

.anniversary-button {
  min-height: 40px;
  margin-top: 13px;
  padding: 0.6rem 1.15rem;
  border: 1px solid rgba(255, 235, 202, 0.54);
  border-radius: 999px;
  color: #3d1518;
  font-size: 0.84rem;
  font-weight: 900;
  background: linear-gradient(145deg, #fff1c9, #f7b97b 64%, #ed8b85);
  box-shadow: 0 9px 28px rgba(221, 91, 89, 0.27);
  opacity: 0;
  transform: translateY(9px);
}

.anniversary-button.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 650ms ease, transform 650ms ease, filter 150ms ease;
}

.anniversary-button:hover {
  filter: brightness(1.06);
}

@keyframes anniversary-photo-reveal {
  from { opacity: 0; filter: saturate(0.78) brightness(0.72); }
  to { opacity: 1; filter: saturate(1) brightness(1); }
}

@keyframes anniversary-treasure-glint {
  0% { opacity: 0; transform: scale(0.35) rotate(0deg); }
  30% { opacity: 1; transform: scale(1.3) rotate(55deg); }
  68% { opacity: 0.86; transform: scale(0.88) rotate(115deg); }
  100% { opacity: 0; transform: scale(2.4) rotate(180deg); }
}

@keyframes anniversary-treasure-rise {
  0% {
    left: var(--treasure-x);
    top: var(--treasure-y);
    opacity: 0;
    filter: blur(5px);
    transform: translate(-50%, -50%) scale(0.65);
  }
  22% { opacity: 0.92; }
  100% {
    left: 50%;
    top: 7.5%;
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes anniversary-caret {
  50% { opacity: 0; }
}

@keyframes anniversary-heartbeat {
  0%, 100% { transform: scale(1); }
  36% { transform: scale(1.24); }
  58% { transform: scale(0.96); }
}

.reunion-screen {
  z-index: 14;
  display: block;
  overflow: hidden;
  padding: 0;
  background-color: #771514;
  background-image:
    linear-gradient(180deg, rgba(34, 2, 4, 0.12) 0%, rgba(34, 2, 4, 0.02) 42%, rgba(26, 2, 5, 0.82) 100%),
    url("./assets/anniversary-999.jpg");
  background-position: center 42%;
  background-size: cover;
  backdrop-filter: none;
  opacity: 0;
}

.reunion-screen::before,
.reunion-screen::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.reunion-screen::before {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 38%, transparent 18%, rgba(63, 4, 7, 0.13) 58%, rgba(30, 1, 4, 0.52) 100%),
    linear-gradient(90deg, rgba(48, 3, 5, 0.35), transparent 22%, transparent 78%, rgba(48, 3, 5, 0.35));
}

.reunion-screen::after {
  z-index: 2;
  border: 1px solid rgba(255, 228, 193, 0.22);
  box-shadow: inset 0 0 100px rgba(40, 0, 4, 0.5);
}

.reunion-screen.is-playing {
  animation: reunion-photo-reveal 1.45s ease-out forwards;
}

.reunion-glint {
  position: absolute;
  z-index: 3;
  color: #fff0c5;
  text-shadow: 0 0 9px #fff6dc, 0 0 24px rgba(255, 196, 86, 0.88);
  opacity: 0;
}

.reunion-glint-one {
  top: 13%;
  left: 15%;
  font-size: 1.55rem;
}

.reunion-glint-two {
  top: 20%;
  right: 13%;
  font-size: 1.15rem;
}

.reunion-screen.is-playing .reunion-glint-one {
  animation: reunion-glint 2.6s ease-in-out 1.1s infinite;
}

.reunion-screen.is-playing .reunion-glint-two {
  animation: reunion-glint 3.1s ease-in-out 1.8s infinite;
}

.reunion-slides {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: clamp(16px, 4vw, 38px);
  pointer-events: none;
}

.reunion-slide {
  grid-area: 1 / 1;
  width: min(760px, 90%);
  margin: 0;
  padding: clamp(15px, 2.4vw, 24px) clamp(18px, 3vw, 32px);
  border: 1px solid rgba(255, 232, 205, 0.3);
  border-radius: 24px;
  color: #fff9ef;
  text-align: center;
  background: linear-gradient(135deg, rgba(73, 10, 15, 0.83), rgba(25, 5, 9, 0.78));
  box-shadow: 0 22px 62px rgba(24, 0, 4, 0.46), inset 0 1px rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(9px) saturate(1.08);
  opacity: 0;
  transform: translateY(20px) scale(0.985);
}

.reunion-slide p {
  margin: 0;
  color: inherit;
  font-family: "STKaiti", "KaiTi", "FZKai-Z03", "Microsoft YaHei", cursive;
  font-size: clamp(1rem, 2.35vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.55;
  text-shadow: 0 2px 7px rgba(31, 0, 3, 0.8);
}

.reunion-slide p span,
.reunion-slide p strong {
  display: block;
}

.reunion-slide p strong {
  color: #fff0ca;
  font-weight: 900;
}

.reunion-slide-final p {
  font-size: clamp(1.04rem, 2.5vw, 1.55rem);
}

.reunion-slide-final b {
  display: inline-block;
  filter: drop-shadow(0 0 10px rgba(135, 224, 255, 0.86));
}

.reunion-slide.is-visible {
  pointer-events: auto;
  animation: reunion-slide-in 0.9s cubic-bezier(0.18, 0.76, 0.2, 1) forwards;
}

.reunion-slide.is-leaving {
  animation: reunion-slide-out 0.72s ease-in forwards;
}

.reunion-slide-final.is-visible b {
  animation: reunion-diamond-glow 1.8s ease-in-out 0.65s infinite;
}

.reunion-button {
  min-height: 42px;
  margin-top: 14px;
  padding: 0.62rem 1.2rem;
  border: 1px solid rgba(255, 238, 213, 0.56);
  border-radius: 999px;
  color: #5d1117;
  font-size: 0.88rem;
  font-weight: 900;
  background: linear-gradient(145deg, #fff3d1, #ffc38a 58%, #f59a91);
  box-shadow: 0 9px 28px rgba(80, 0, 7, 0.32);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 650ms ease, transform 650ms ease, filter 150ms ease;
}

.reunion-button.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reunion-button:hover {
  filter: brightness(1.06);
}

.reunion-screen.is-reduced {
  overflow-y: auto;
}

.reunion-screen.is-reduced .reunion-slides {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
  pointer-events: auto;
}

.reunion-screen.is-reduced .reunion-slide {
  position: static;
  width: min(760px, 96%);
  padding: 8px 16px;
  opacity: 1;
  transform: none;
  animation: none;
}

.reunion-screen.is-reduced .reunion-slide p {
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  line-height: 1.35;
}

@keyframes reunion-photo-reveal {
  from { opacity: 0; filter: saturate(0.75) brightness(0.68); }
  to { opacity: 1; filter: saturate(1) brightness(1); }
}

@keyframes reunion-glint {
  0%, 100% { opacity: 0; transform: rotate(0deg) scale(0.55); }
  42% { opacity: 0.9; transform: rotate(70deg) scale(1.15); }
  66% { opacity: 0.26; transform: rotate(115deg) scale(0.8); }
}

@keyframes reunion-slide-in {
  from { opacity: 0; filter: blur(3px); transform: translateY(22px) scale(0.985); }
  to { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}

@keyframes reunion-slide-out {
  from { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
  to { opacity: 0; filter: blur(3px); transform: translateY(-18px) scale(1.01); }
}

@keyframes reunion-diamond-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 7px rgba(135, 224, 255, 0.62)); }
  50% { transform: scale(1.18); filter: drop-shadow(0 0 16px rgba(188, 241, 255, 0.98)); }
}

.level-screen {
  place-items: stretch center;
}

.level-panel {
  width: min(810px, 100%);
  padding: clamp(16px, 3vw, 26px);
  text-align: left;
}

.level-heading,
.chapter-caption,
.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.level-heading h2 {
  margin: 4px 0 0;
}

.close-button {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #dbe6f2;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.06);
}

.chapter-tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0 13px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: rgba(255, 198, 77, 0.38) rgba(255, 255, 255, 0.04);
  scroll-snap-type: x proximity;
}

.chapter-tab {
  flex: 0 0 43px;
  min-height: 38px;
  padding: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #a9b7c8;
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.045);
  scroll-snap-align: center;
}

.chapter-tab[aria-selected="true"] {
  border-color: rgba(255, 207, 92, 0.42);
  color: #2a1907;
  background: var(--gold);
}

.chapter-tab.is-locked {
  opacity: 0.42;
}

.chapter-caption {
  margin-bottom: 10px;
}

.chapter-caption strong {
  color: #fff2c5;
  font-size: 1.05rem;
}

.chapter-caption span,
.map-footer > span {
  color: #9cabbf;
  font-size: 0.78rem;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 7px;
}

.level-tile {
  position: relative;
  display: grid;
  min-height: 54px;
  padding: 5px 2px 4px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #eaf0f7;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.055);
}

.level-tile small {
  display: block;
  min-height: 1em;
  color: var(--gold);
  font-size: 0.57rem;
  letter-spacing: -0.08em;
}

.level-tile:hover:not(:disabled) {
  border-color: rgba(105, 230, 239, 0.45);
  background: rgba(105, 230, 239, 0.1);
}

.level-tile.is-current {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(255, 198, 77, 0.4);
}

.level-tile.is-admin-unlocked {
  border-color: rgba(105, 230, 239, 0.34);
  color: #d9fcff;
  background: linear-gradient(145deg, rgba(105, 230, 239, 0.12), rgba(200, 153, 255, 0.08));
}

.level-tile.is-admin-unlocked small {
  color: var(--cyan);
  letter-spacing: 0;
}

.level-tile:disabled {
  color: #68788d;
  background: rgba(3, 10, 19, 0.32);
}

.level-tile:disabled::after {
  content: "🔒";
  font-size: 0.7rem;
}

.level-tile.is-completed:disabled {
  color: #8fa2b6;
  background: rgba(101, 223, 156, 0.045);
}

.level-tile.is-completed:disabled::after {
  content: "";
}

.map-footer {
  margin-top: 12px;
}

.map-footer-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.map-footer-actions .text-button {
  margin-top: 0;
}

.admin-bar {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  padding: 10px 11px;
  border: 1px solid rgba(105, 230, 239, 0.16);
  border-radius: 15px;
  background: rgba(12, 26, 43, 0.72);
}

.admin-bar.is-active {
  border-color: rgba(101, 223, 156, 0.42);
  background: linear-gradient(135deg, rgba(45, 130, 86, 0.2), rgba(31, 69, 100, 0.24));
  box-shadow: inset 0 0 24px rgba(101, 223, 156, 0.06);
}

.admin-shield {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: rgba(105, 230, 239, 0.1);
}

.admin-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.admin-copy strong,
.admin-copy small {
  display: block;
}

.admin-copy strong {
  color: #ecf8ff;
  font-size: 0.88rem;
}

.admin-copy small {
  margin-top: 2px;
  color: #93a7bd;
  font-size: 0.72rem;
  line-height: 1.4;
}

.admin-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(105, 230, 239, 0.28);
  border-radius: 11px;
  color: #c9faff;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(52, 118, 136, 0.22);
}

.admin-bar.is-active .admin-button {
  border-color: rgba(255, 141, 133, 0.25);
  color: #ffd2ce;
  background: rgba(145, 59, 55, 0.18);
}

.admin-panel {
  width: min(480px, 100%);
  text-align: left;
}

.admin-panel > .eyebrow,
.admin-panel > h2,
.admin-panel > p,
.admin-lock {
  text-align: center;
}

.admin-lock {
  display: block;
  margin-bottom: 3px;
  font-size: clamp(2rem, 7vw, 3.35rem);
}

.password-field {
  display: block;
  margin-top: 13px;
}

.password-field > span {
  display: block;
  margin-bottom: 6px;
  color: #ced9e6;
  font-size: 0.83rem;
  font-weight: 750;
}

.password-field input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  outline: none;
  color: #fff;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.08em;
  background: rgba(5, 14, 25, 0.65);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.password-field input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(105, 230, 239, 0.12);
}

.form-error {
  min-height: 1.45em;
  margin: 8px 0 10px;
  color: #ffaaa3 !important;
  font-size: 0.78rem;
  text-align: left !important;
}

.admin-note {
  margin: 13px 0 -4px;
  color: #8294aa !important;
  font-size: 0.72rem;
  text-align: center !important;
}

.settings-panel {
  width: min(700px, 100%);
  text-align: left;
}

.settings-heading,
.setting-label-row,
.weight-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-heading h2 {
  margin: 4px 0 0;
}

.difficulty-fieldset {
  min-width: 0;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.difficulty-fieldset legend,
.setting-label-row label {
  color: #e8eff7;
  font-size: 0.9rem;
  font-weight: 800;
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 9px;
}

.difficulty-option {
  position: relative;
  min-width: 0;
  padding: 13px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  text-align: center;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.difficulty-option:hover {
  border-color: rgba(105, 230, 239, 0.34);
  transform: translateY(-1px);
}

.difficulty-option:has(input:checked) {
  border-color: rgba(255, 205, 82, 0.55);
  background: linear-gradient(145deg, rgba(255, 198, 77, 0.16), rgba(105, 230, 239, 0.07));
  box-shadow: inset 0 0 0 1px rgba(255, 198, 77, 0.18);
}

.difficulty-option:has(input:focus-visible) {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.difficulty-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.difficulty-option > span,
.difficulty-option strong,
.difficulty-option small {
  display: block;
}

.difficulty-option > span {
  margin-bottom: 5px;
  font-size: 1.45rem;
}

.difficulty-option strong {
  color: #fff;
  font-size: 0.9rem;
}

.difficulty-option small {
  margin-top: 4px;
  color: #96a6ba;
  font-size: 0.72rem;
  line-height: 1.35;
}

.speed-setting {
  margin-top: 16px;
  padding: 14px 15px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  background: rgba(4, 13, 24, 0.28);
}

.setting-label-row output {
  min-width: 58px;
  padding: 0.25rem 0.48rem;
  border-radius: 9px;
  color: #172211;
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
  background: var(--gold);
}

#hookSpeedRange {
  width: 100%;
  height: 28px;
  margin: 10px 0 2px;
  accent-color: var(--gold);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: #7f91a7;
  font-size: 0.69rem;
}

.weight-preview {
  margin-top: 12px;
  padding: 12px 15px;
  border: 1px solid rgba(105, 230, 239, 0.1);
  border-radius: 15px;
  background: rgba(10, 26, 42, 0.5);
}

.weight-preview-heading {
  margin-bottom: 9px;
}

.weight-preview-heading strong {
  color: #dbe8f4;
  font-size: 0.82rem;
}

.weight-preview-heading small {
  color: #8498ae;
  font-size: 0.7rem;
}

.weight-row {
  display: grid;
  grid-template-columns: 92px minmax(70px, 1fr) 76px;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: #b9c6d5;
  font-size: 0.74rem;
}

.weight-row i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.weight-row em {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #56cbd6, #ffcf58);
  transition: width 140ms ease;
}

.weight-row b {
  color: #d8e4ef;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.settings-note {
  margin: 10px 0 12px;
  color: #8ea0b4 !important;
  font-size: 0.75rem;
  text-align: center;
}

.shop-panel {
  width: min(880px, 100%);
  padding: clamp(16px, 2.6vw, 25px);
  text-align: left;
}

.shop-heading,
.shop-heading-actions,
.shop-item-footer,
.shop-loadout-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-heading h2 {
  margin: 4px 0 0;
}

.shop-heading-actions {
  flex: 0 0 auto;
}

.shop-balance {
  padding: 0.48rem 0.72rem;
  border: 1px solid rgba(101, 223, 156, 0.28);
  border-radius: 12px;
  color: #baffd2;
  font-size: 0.92rem;
  white-space: nowrap;
  background: rgba(47, 139, 91, 0.14);
}

.shop-intro {
  margin: 8px 0 13px;
  color: #9dadbf !important;
  font-size: 0.82rem;
  line-height: 1.5 !important;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.shop-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  background: rgba(5, 15, 27, 0.48);
  transition: border-color 150ms ease, background 150ms ease;
}

.shop-item.is-prepared {
  border-color: rgba(101, 223, 156, 0.32);
  background: rgba(35, 102, 70, 0.14);
}

.shop-item-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 210, 100, 0.15);
  border-radius: 13px;
  font-size: 1.45rem;
  background: rgba(255, 198, 77, 0.08);
}

.shop-item-copy {
  min-width: 0;
}

.shop-item-copy strong,
.shop-item-copy small,
.shop-item-footer span,
.shop-item-footer span > * {
  display: block;
}

.shop-item-copy strong {
  color: #fff1c4;
  font-size: 0.9rem;
}

.shop-item-copy small {
  margin-top: 3px;
  color: #96a6ba;
  font-size: 0.72rem;
  line-height: 1.4;
}

.shop-item-footer {
  grid-column: 1 / -1;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.shop-item-footer b {
  color: #9ff0bd;
  font-size: 0.79rem;
}

.shop-item-footer small {
  margin-top: 2px;
  color: #7f91a6;
  font-size: 0.66rem;
}

.shop-buy-button {
  min-height: 38px;
  padding: 0.4rem 0.72rem;
  border: 1px solid rgba(255, 198, 77, 0.3);
  border-radius: 11px;
  color: #2a1908;
  font-size: 0.84rem;
  font-weight: 850;
  background: linear-gradient(145deg, #ffe08a, #efa02b);
}

.shop-buy-button:disabled {
  border-color: rgba(255, 255, 255, 0.08);
  color: #78889b;
  background: rgba(255, 255, 255, 0.055);
}

.shop-loadout-line {
  margin-top: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(105, 230, 239, 0.12);
  border-radius: 14px;
  background: rgba(16, 39, 58, 0.48);
}

.shop-loadout-line > strong {
  flex: 0 0 auto;
  color: #cde9ef;
  font-size: 0.82rem;
}

.shop-loadout {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.shop-loadout > span {
  padding: 0.24rem 0.48rem;
  border-radius: 999px;
  color: #ffe6a0;
  font-size: 0.7rem;
  background: rgba(255, 198, 77, 0.09);
}

.shop-loadout .shop-loadout-empty {
  color: #8091a6;
  background: transparent;
}

.shop-done-button {
  display: block;
  min-width: 180px;
  margin: 12px auto 0;
}

.shop-link {
  color: #ffe08b;
}

.danger-text {
  flex: 0 0 auto;
  color: #d89b9b;
}

.play-controls {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #122137, #101c2e);
}

.tip-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aebacc;
  font-size: 0.86rem;
}

.tip-key {
  display: inline-grid;
  min-width: 54px;
  min-height: 30px;
  padding: 0 8px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-bottom-width: 3px;
  border-radius: 8px;
  color: #dde7f2;
  font-size: 0.72rem;
  font-weight: 800;
  background: #283b54;
}

.control-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.drop-button,
.dynamite-button,
.finish-button {
  min-height: 56px;
  padding: 0.72rem 1.2rem;
  border-radius: 17px;
  font-weight: 900;
  transition: transform 150ms ease, filter 150ms ease;
}

.drop-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 180px;
  color: #261707;
  background: linear-gradient(145deg, #ffe592, #f5ad31);
  box-shadow: 0 12px 26px rgba(218, 132, 23, 0.25);
}

.drop-button span {
  font-size: 1.35rem;
}

.drop-button:disabled {
  color: #8490a0;
  background: #29384b;
  box-shadow: none;
}

.dynamite-button {
  display: inline-flex;
  min-width: 118px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 143, 91, 0.42);
  color: #ffe2c8;
  background: linear-gradient(145deg, rgba(162, 61, 31, 0.92), rgba(103, 36, 34, 0.94));
  box-shadow: 0 10px 23px rgba(122, 39, 27, 0.22);
}

.dynamite-button span {
  font-size: 1.28rem;
}

.dynamite-button small {
  color: #ffc993;
  font-size: 0.72rem;
}

.dynamite-button:disabled {
  border-color: rgba(255, 255, 255, 0.08);
  color: #7f8b9a;
  background: #263547;
  box-shadow: none;
}

.finish-button {
  border: 1px solid rgba(101, 223, 156, 0.38);
  color: #caffdf;
  background: rgba(47, 139, 91, 0.28);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  padding: 16px 10px 0;
  color: #8f9db1;
  font-size: 0.78rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.legend-dot.gold { color: var(--gold); background: currentColor; }
.legend-dot.diamond { color: var(--cyan); background: currentColor; }
.legend-dot.clock { color: var(--green); background: currentColor; }
.legend-dot.bag { color: #d39a68; background: currentColor; }
.legend-dot.rock { color: #8d97a6; background: currentColor; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes urgent-pulse {
  to { transform: scale(1.05); }
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 20px, 680px);
    padding-top: 12px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .top-actions {
    margin-left: auto;
  }

  .button-label {
    display: none;
  }

  .icon-button {
    width: 44px;
    padding: 0;
  }

  .scoreboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card {
    min-height: 64px;
    padding: 10px 13px;
  }

  .chapter-tabs {
    grid-template-columns: repeat(5, 1fr);
  }

  .level-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .settings-panel {
    padding: 17px;
  }

  .shop-panel {
    padding: 16px;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-copy {
    width: calc(100% - 52px);
  }

  .admin-button {
    width: 100%;
  }

  .map-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-footer-actions {
    width: 100%;
    justify-content: space-between;
  }

  .anniversary-story {
    right: 3%;
    bottom: 3.5%;
    width: min(690px, 74%);
  }

  .reunion-slide {
    width: min(720px, 94%);
  }

  .play-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .tip-line {
    justify-content: center;
  }

  .control-buttons {
    width: 100%;
  }

  .drop-button,
  .finish-button {
    flex: 1 1 0;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: calc(100% - 12px);
    padding-bottom: 20px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 1.4rem;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand div > span {
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 5px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .scoreboard {
    gap: 6px;
  }

  .stat-card {
    min-height: 56px;
    padding: 8px 10px;
    border-radius: 13px;
  }

  .stat-card > span {
    font-size: 0.7rem;
  }

  .stat-card strong {
    font-size: 0.94rem;
  }

  .goal-strip {
    margin-top: 7px;
  }

  .goal-meta {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
  }

  .goal-copy {
    align-items: flex-start;
  }

  .mode-badge {
    font-size: 0.64rem;
  }

  .game-card {
    border-radius: 17px;
  }

  .screen {
    align-items: start;
    padding: 8px;
  }

  .screen-panel {
    border-radius: 18px;
  }

  .start-panel {
    padding: 15px;
  }

  .screen-panel h1 {
    margin-top: 4px;
    font-size: 1.65rem;
  }

  .anniversary-screen {
    background-position: center 30%;
  }

  .anniversary-title {
    top: 4%;
    font-size: clamp(1rem, 5.2vw, 1.35rem);
    letter-spacing: 0.045em;
  }

  .anniversary-story {
    right: 2.5%;
    bottom: 2.5%;
    width: 95%;
    max-height: 72%;
    padding: 7px 10px 8px;
    border-radius: 14px;
    overflow-y: auto;
  }

  .anniversary-line {
    min-height: 2.55em;
    margin-bottom: 3px;
    font-size: clamp(0.64rem, 3.1vw, 0.79rem);
    line-height: 1.3;
  }

  .anniversary-final {
    margin-top: 3px;
    font-size: clamp(0.69rem, 3.35vw, 0.84rem);
    line-height: 1.27;
  }

  .anniversary-final span {
    margin-top: 2px;
  }

  .anniversary-button {
    min-height: 32px;
    margin-top: 6px;
    padding: 0.34rem 0.82rem;
    font-size: 0.7rem;
  }

  .reunion-screen {
    background-position: center 42%;
  }

  .reunion-slides {
    padding: 8px;
  }

  .reunion-slide {
    width: 96%;
    padding: 9px 12px;
    border-radius: 15px;
  }

  .reunion-slide p,
  .reunion-slide-final p {
    font-size: 0.875rem;
    line-height: 1.35;
  }

  .reunion-button {
    min-height: 36px;
    margin-top: 7px;
    padding: 0.42rem 0.9rem;
    font-size: 0.82rem;
  }

  .screen-panel .lead {
    margin-bottom: 10px;
    font-size: 0.82rem;
  }

  .how-to-play {
    gap: 5px;
    margin: 8px 0 12px;
  }

  .how-to-play div {
    padding: 7px 4px;
    border-radius: 11px;
  }

  .how-to-play div > span {
    margin-bottom: 2px;
    font-size: 1.15rem;
  }

  .how-to-play small {
    display: none;
  }

  .mode-choice:not(.compact-mode-choice) {
    grid-template-columns: 1fr;
  }

  .compact-mode-choice {
    gap: 6px;
    margin: 7px 0 9px;
  }

  .mode-card {
    min-height: 78px;
    padding: 8px 6px;
    border-radius: 12px;
  }

  .mode-card > span {
    font-size: 1.15rem;
  }

  .mode-card > strong {
    margin: 2px 0;
    font-size: 0.78rem;
  }

  .mode-card > small {
    font-size: 0.61rem;
  }

  .screen-actions {
    gap: 7px;
  }

  .difficulty-options {
    grid-template-columns: 1fr;
  }

  .difficulty-option {
    display: grid;
    grid-template-columns: 34px 70px 1fr;
    align-items: center;
    padding: 8px 10px;
    text-align: left;
  }

  .difficulty-option > span {
    margin: 0;
    text-align: center;
  }

  .difficulty-option small {
    margin: 0;
  }

  .weight-row {
    grid-template-columns: 82px minmax(50px, 1fr) 68px;
    gap: 6px;
  }

  .shop-heading,
  .shop-loadout-line {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .shop-heading-actions {
    width: 100%;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .shop-item {
    padding: 9px 10px;
  }

  .shop-loadout {
    justify-content: flex-start;
  }

  .primary-button,
  .secondary-button {
    min-width: 0;
    padding: 0.65rem 0.8rem;
    font-size: 0.82rem;
  }

  .play-controls {
    padding: 10px;
  }

  .tip-line {
    font-size: 0.74rem;
  }

  .tip-key {
    display: none;
  }

  .drop-button,
  .dynamite-button,
  .finish-button {
    min-width: 0;
    min-height: 50px;
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
  }

  .dynamite-button {
    min-width: 92px;
    flex: 0 1 104px;
  }

  .legend {
    justify-content: flex-start;
    gap: 8px 14px;
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .anniversary-screen,
  .reunion-screen {
    opacity: 1;
    filter: none;
  }
}
