:root {
  color-scheme: dark;
  --ink: #f5f5f5;
  --muted: rgba(245, 245, 245, 0.58);
  --faint: rgba(245, 245, 245, 0.2);
  --panel: rgba(5, 5, 6, 0.72);
  --panel-strong: rgba(4, 4, 5, 0.9);
  --line: rgba(255, 255, 255, 0.3);
  --error: rgba(255, 255, 255, 0.86);
  --ok: #ffffff;
  --candidate: #f2c96d;
  --shadow: rgba(0, 0, 0, 0.58);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@font-face {
  font-family: "Beidou Serif";
  src:
    local("Noto Serif SC"),
    local("Noto Serif CJK SC");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #000;
  color: var(--ink);
  font-size: clamp(16px, calc(1rem + 0.18vw), 19px);
  font-family:
    "Beidou Serif",
    "Noto Serif SC",
    "Songti SC",
    "STSong",
    serif;
}

button {
  font: inherit;
}

#app {
  position: relative;
  isolation: isolate;
}

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

#meteorLabels {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.meteor-label {
  position: fixed;
  min-width: 56px;
  transform: translate(-50%, 11px);
  border: 0;
  padding: 9px 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  pointer-events: auto;
  text-align: center;
  text-shadow:
    0 0 9px rgba(255, 255, 255, 0.38),
    0 2px 10px #000;
  transition:
    color 180ms ease,
    opacity 180ms ease,
    text-shadow 180ms ease;
}

.meteor-label:hover,
.meteor-label:focus-visible,
.meteor-label.is-lit,
.meteor-label.is-complete {
  color: #fff;
  text-shadow:
    0 0 7px #fff,
    0 0 22px rgba(255, 255, 255, 0.76),
    0 2px 10px #000;
}

.meteor-label.is-hint {
  animation: label-hint 720ms ease-in-out 3;
}

.meteor-label.is-candidate {
  animation: candidate-breathe 920ms ease-in-out infinite;
  color: var(--candidate);
  text-shadow:
    0 0 10px rgba(255, 231, 168, 0.94),
    0 0 30px rgba(236, 181, 74, 0.78),
    0 0 54px rgba(222, 155, 54, 0.45),
    0 2px 10px #000;
}

.meteor-label.is-magnet {
  animation: magnet-label-breathe 450ms ease-in-out infinite;
  color: var(--candidate);
  text-shadow:
    0 0 7px #fff2ad,
    0 0 26px var(--candidate),
    0 0 46px rgba(240, 183, 72, 0.66);
}

.meteor-label[hidden] {
  display: none;
}

.meteor-label__name {
  display: block;
  font-size: clamp(16px, calc(1rem + 0.2vw), 19px);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

@keyframes candidate-breathe {
  0%,
  100% {
    transform: translate(-50%, 11px) scale(1);
    color: rgba(242, 201, 109, 0.78);
  }
  50% {
    transform: translate(-50%, 11px) scale(1.23);
    color: #fff0bd;
    text-shadow:
      0 0 12px rgba(255, 240, 194, 1),
      0 0 34px rgba(241, 193, 91, 0.9),
      0 0 64px rgba(222, 155, 54, 0.6);
  }
}

@keyframes magnet-label-breathe {
  0%,
  100% {
    transform: translate(-50%, 11px) scale(1);
    text-shadow:
      0 0 7px #fff2ad,
      0 0 22px rgba(242, 201, 109, 0.78),
      0 0 40px rgba(240, 183, 72, 0.48);
  }
  50% {
    transform: translate(-50%, 11px) scale(1.18);
    text-shadow:
      0 0 10px #fff9d4,
      0 0 34px rgba(255, 223, 133, 0.98),
      0 0 62px rgba(240, 183, 72, 0.78);
  }
}

@keyframes label-hint {
  0%,
  100% {
    transform: translate(-50%, 11px) scale(1);
  }
  50% {
    transform: translate(-50%, 11px) scale(1.14);
    color: #fff;
    text-shadow: 0 0 18px #fff;
  }
}

#uiShell {
  position: fixed;
  top: max(8px, var(--safe-top));
  right: max(12px, var(--safe-right));
  left: max(12px, var(--safe-left, 0px));
  z-index: 14;
  width: auto;
  max-width: none;
  display: grid;
  gap: 6px;
  pointer-events: none;
}

#uiShell[hidden] {
  display: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.finale-command {
  position: static;
  margin: 0;
  pointer-events: auto;
}

.header-status-row {
  position: relative;
  display: flex;
  min-height: 20px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  pointer-events: none;
}

.header-status-row .return-hint,
.header-status-row .status-text {
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: clamp(12px, calc(0.76rem + 0.08vw), 15px);
  line-height: 1.4;
  text-shadow: 0 1px 6px #000;
}

.header-status-row .return-hint {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  flex: 0 1 auto;
  max-width: min(420px, calc(100vw - 24px));
  text-align: right;
}

.header-status-row .status-text {
  flex: 0 1 auto;
  max-width: min(420px, calc(100vw - 24px));
  text-align: right;
}

.end-actions .command {
  position: static;
  margin: 0;
}

.end-actions {
  position: fixed;
  right: max(12px, var(--safe-right));
  bottom: max(18px, var(--safe-bottom));
  left: max(12px, var(--safe-left, 0px));
  z-index: 16;
  width: auto;
}

.command,
.progress-pill,
.return-button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 7px 11px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 10px 28px var(--shadow);
  backdrop-filter: blur(12px);
}

.command {
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.command:hover,
.command:focus-visible {
  border-color: rgba(255, 255, 255, 0.68);
  background: rgba(22, 22, 24, 0.82);
}

.command[hidden] {
  display: none;
}

.progress-pill {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.status-text {
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: clamp(12px, calc(0.76rem + 0.08vw), 15px);
  line-height: 1.45;
  padding: 0;
  border-radius: 0;
  background: transparent;
  text-align: right;
  text-shadow: 0 2px 10px #000;
}

.star-progress-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  margin-top: 0;
  padding: 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  border-right: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  border-left: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.star-progress-row {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 2px 8px #000;
}

.star-progress-row.is-complete {
  color: #fff0bd;
  text-shadow: 0 0 14px rgba(239, 194, 88, 0.62), 0 2px 8px #000;
}

.status-text.is-error {
  color: #ffe4a0;
}

.status-text.is-ok {
  color: var(--ok);
}

.status-text:empty {
  display: none;
}

.pool-layer {
  position: fixed;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  pointer-events: none;
  perspective: 900px;
}

.pool-layer[hidden] {
  display: none;
}

.pool-grid {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.word-card {
  --card-depth: 1;
  --card-tilt: 0deg;
  --card-drift-x: 4px;
  --card-drift-y: -8px;
  position: fixed;
  z-index: var(--card-z, 1);
  display: flex;
  min-height: 44px;
  max-width: min(176px, calc(100vw - 20px));
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 1px;
  padding: 10px 11px;
  background:
    linear-gradient(145deg, rgba(36, 36, 38, 0.9), rgba(7, 7, 9, 0.94)),
    rgba(7, 7, 8, 0.92);
  color: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(0, 0, 0, 0.84),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 26px rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  line-height: 1.4;
  font-size: clamp(16px, calc(0.95rem + 0.2vw), 19px);
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.86);
  letter-spacing: 0;
  overflow-wrap: anywhere;
  opacity: var(--card-opacity, 0.9);
  transform: rotate(var(--card-tilt)) scale(var(--card-depth));
  transform-origin: center;
  animation: card-drift var(--card-duration, 8s) ease-in-out var(--card-delay, 0s) infinite alternate;
  will-change: transform, opacity;
}

.word-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.word-card::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.56);
  border-right: 1px solid rgba(255, 255, 255, 0.56);
  opacity: 0.72;
}

.word-card.is-theme {
  border-color: rgba(255, 255, 255, 0.64);
  background:
    linear-gradient(145deg, rgba(42, 42, 45, 0.9), rgba(9, 9, 11, 0.94)),
    rgba(8, 8, 9, 0.9);
  box-shadow:
    0 0 18px rgba(255, 255, 255, 0.08),
    0 13px 34px rgba(0, 0, 0, 0.66);
}

.word-card:hover,
.word-card:focus-visible {
  z-index: 30;
  border-color: rgba(255, 255, 255, 0.8);
  color: #fff;
  opacity: 1;
  box-shadow:
    0 0 17px rgba(255, 255, 255, 0.14),
    0 14px 34px rgba(0, 0, 0, 0.72);
}

.word-card.dragging {
  z-index: 40;
  cursor: grabbing;
  opacity: 0.98;
  animation: none;
  box-shadow:
    0 0 13px rgba(255, 255, 255, 0.48),
    0 0 34px rgba(255, 255, 255, 0.2),
    0 22px 46px rgba(0, 0, 0, 0.76);
}

.word-card.dragging::before {
  border-color: rgba(255, 255, 255, 0.72);
  animation: note-border-pulse 760ms ease-in-out infinite;
}

.word-card.is-magnetized {
  border-color: #ffe794;
  box-shadow:
    0 0 16px rgba(255, 226, 124, 0.82),
    0 0 46px rgba(255, 194, 58, 0.38),
    0 22px 46px rgba(0, 0, 0, 0.76);
  animation: magnet-card-breathe 450ms ease-in-out infinite;
}

.word-card.is-candidate {
  z-index: 35;
  border-color: rgba(255, 255, 255, 0.72);
  color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.18),
    0 0 24px rgba(255, 255, 255, 0.08),
    0 16px 38px rgba(0, 0, 0, 0.72);
}

.word-card.is-candidate::after {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.28);
}

.word-card.is-candidate.is-magnetized {
  border-color: #ffe794;
  color: #fff2bd;
  box-shadow:
    0 0 18px rgba(255, 226, 124, 0.92),
    0 0 48px rgba(255, 194, 58, 0.48),
    0 22px 46px rgba(0, 0, 0, 0.76);
}

.word-card.is-wrong {
  animation: card-wrong 280ms ease-in-out;
  border-color: rgba(255, 255, 255, 0.96);
}

.word-card.is-hint {
  z-index: 42;
  animation: card-hint 1080ms ease-in-out 4;
  border-color: #ffe29a;
  color: #fff4c7;
}

.word-card.is-matched {
  pointer-events: none;
  animation: none;
}

@keyframes card-drift {
  from {
    transform: translate3d(0, 0, 0) rotate(var(--card-tilt)) scale(var(--card-depth));
  }
  to {
    transform: translate3d(var(--card-drift-x), var(--card-drift-y), 28px) rotate(calc(var(--card-tilt) + 0.8deg)) scale(var(--card-depth));
  }
}

@keyframes note-border-pulse {
  0%,
  100% {
    opacity: 0.48;
  }
  50% {
    opacity: 1;
  }
}

@keyframes magnet-card-breathe {
  0%,
  100% {
    box-shadow:
      0 0 13px rgba(255, 226, 124, 0.58),
      0 0 34px rgba(255, 194, 58, 0.26),
      0 22px 46px rgba(0, 0, 0, 0.76);
  }
  50% {
    box-shadow:
      0 0 22px rgba(255, 238, 166, 0.98),
      0 0 58px rgba(255, 194, 58, 0.62),
      0 22px 46px rgba(0, 0, 0, 0.76);
  }
}

#dragSparkLayer {
  position: fixed;
  inset: 0;
  z-index: 13;
  overflow: hidden;
  pointer-events: none;
}

.drag-spark {
  position: fixed;
  width: var(--spark-size);
  height: var(--spark-size);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, rgba(255, 255, 255, 0.92) 34%, rgba(255, 255, 255, 0.18) 64%, transparent 74%);
  box-shadow:
    0 0 5px rgba(255, 255, 255, 0.98),
    0 0 13px rgba(255, 255, 255, 0.72),
    0 0 24px rgba(242, 201, 109, 0.24);
  opacity: 0;
  animation: drag-spark-fly 820ms ease-out var(--spark-delay) forwards;
  will-change: transform, opacity;
}

.drag-spark::before {
  display: none;
}

@keyframes drag-spark-fly {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.4);
  }
  18% {
    opacity: 1;
    transform: translate3d(calc(var(--spark-x) * 0.08), calc(var(--spark-y) * 0.08), 0) scale(1.12);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(0.06);
  }
}

@keyframes card-wrong {
  0%,
  100% {
    transform: translateX(0);
  }
  28% {
    transform: translateX(-7px);
  }
  58% {
    transform: translateX(7px);
  }
}

@keyframes card-hint {
  0%,
  100% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.62);
  }
  50% {
    box-shadow:
      0 0 18px rgba(255, 239, 190, 0.92),
      0 0 42px rgba(235, 183, 65, 0.58),
      0 16px 38px rgba(0, 0, 0, 0.72);
    transform: translateZ(42px) scale(1.08);
  }
}

.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 11;
  isolation: isolate;
  overflow: hidden;
  pointer-events: none;
  color: var(--ink);
  background: #000;
}

.focus-overlay[hidden] {
  display: none;
}

.focus-overlay.is-finale {
  background: transparent;
}

.focus-heading {
  position: absolute;
  top: 47%;
  left: 50%;
  z-index: 3;
  width: min(680px, calc(100vw - 40px));
  transform: translateX(-50%);
  text-align: center;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.7),
    0 0 36px rgba(255, 255, 255, 0.28);
}

.focus-overlay.is-single .focus-heading {
  top: 7%;
}

#focusStar {
  font-size: 44px;
  font-weight: 500;
  color: #fff;
}

.pluck-hint {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 4;
  max-width: min(360px, calc(100vw - 32px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.68);
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(16px, calc(1rem + 0.2vw), 19px);
  line-height: 1.45;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.68);
  animation: pluck-pulse 1600ms ease-in-out infinite;
}

@keyframes pluck-pulse {
  0%,
  100% {
    opacity: 0.48;
  }
  50% {
    opacity: 1;
  }
}

.rain-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: auto;
  touch-action: none;
  perspective: 900px;
  transform-style: preserve-3d;
}

.rain-drop {
  position: absolute;
  left: calc(50% + var(--rain-x));
  top: calc(47% + 58px + var(--rain-y));
  width: 68px;
  height: min(80vh, 820px);
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
  cursor: default;
  pointer-events: none;
  line-height: 1;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.34),
    0 2px 12px #000;
  transform: translateX(-50%) translateX(var(--pluck-x, 0px)) translateZ(var(--rain-depth, 0px)) rotateY(var(--rain-turn, 0deg)) rotate(var(--pluck-rotate, 0deg));
  transform-origin: 50% 0;
  transition: none;
  overflow: visible;
  will-change: transform;
}

.rain-drop::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 112px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.84));
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.52);
}

.rain-drop::after {
  content: "";
  position: absolute;
  top: 5px;
  left: calc(50% + 2px);
  width: 1px;
  height: 102px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.42));
  filter: blur(0.4px);
}

.rain-text {
  position: absolute;
  top: 120px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  transform: translateX(-50%);
}

.rain-glyph {
  position: relative;
  display: grid;
  width: 1.42em;
  height: 1.42em;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.045);
  color: inherit;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.12), inset 0 0 7px rgba(255, 255, 255, 0.08);
  cursor: grab;
  font-size: 17px;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  transform: translate3d(var(--glyph-pluck-x, 0px), var(--glyph-pluck-y, 0px), 0) rotate(var(--glyph-pluck-rotate, 0deg));
  transform-origin: center;
  will-change: transform;
}

.rain-glyph:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 1px);
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.rain-glyph:hover,
.rain-glyph:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.72);
  outline: none;
}

.rain-glyph.is-plucking {
  color: #fff;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.34),
    0 0 24px rgba(255, 255, 255, 0.12),
    inset 0 0 7px rgba(255, 255, 255, 0.12);
}

.final-rain-cluster {
  position: absolute;
  display: flex;
  width: min(15.2vw, 250px);
  height: 82%;
  justify-content: space-evenly;
  gap: 2px;
  transform: translateX(-50%);
  pointer-events: none;
}

.final-rain-name {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(20px, 1.25rem, 25px);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.42);
}

.final-rain-drop {
  position: relative;
  left: auto;
  top: 0;
  height: 100%;
  max-height: none;
  padding: 0;
  flex: 0 1 18px;
  min-width: 0;
  transform: translateX(var(--pluck-x, 0px)) rotate(var(--pluck-rotate, 0deg));
}

.final-rain-drop::before {
  height: 60px;
}

.final-rain-drop::after {
  height: 54px;
}

.final-rain-drop .rain-text {
  top: 70px;
  gap: 8px;
}

.final-rain-drop .rain-glyph {
  width: 1.36em;
  height: 1.36em;
  font-size: 15px;
}

.final-rain-drop .rain-glyph:not(:last-child)::after {
  height: 3px;
}

.focus-overlay.is-single .rain-drop {
  top: calc(15% + var(--rain-y));
  height: 85vh;
}

.pool-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 15;
  width: max-content;
  max-width: min(720px, calc(100vw - 28px - var(--safe-right)));
  margin: 0;
  padding: 10px 15px;
  border: 1px solid rgba(255, 224, 143, 0.42);
  border-radius: 5px;
  transform: translateX(-50%);
  background: rgba(3, 3, 4, 0.84);
  color: rgba(255, 244, 207, 0.96);
  box-shadow:
    0 0 18px rgba(255, 206, 102, 0.12),
    0 12px 30px rgba(0, 0, 0, 0.72);
  font-size: clamp(15px, calc(1rem + 0.24vw), 18px);
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.28), 0 2px 10px #000;
  pointer-events: none;
  animation: prompt-breathe 2200ms ease-in-out infinite;
}

.pool-prompt[hidden] {
  display: none;
}

/* 顶部工具行：左上横排（陨诗提示 + 生成海报），不与卡片/状态区互扰 */
.top-tools {
  position: fixed;
  top: max(8px, var(--safe-top));
  left: max(8px, var(--safe-left, 0px));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 16px - var(--safe-right));
  flex-wrap: wrap;
  pointer-events: none;
}

.top-tools[hidden] {
  display: none;
}

.return-hint {
  position: static;
  width: max-content;
  max-width: min(420px, calc(100vw - 28px - var(--safe-right)));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.62);
  font-size: clamp(13px, 0.85rem, 15px);
  line-height: 1.4;
  text-align: left;
  text-shadow: 0 1px 6px #000;
  pointer-events: none;
}

.return-hint[hidden] {
  display: none;
}

@keyframes prompt-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.return-button {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  cursor: pointer;
  pointer-events: auto;
}

.pluck-all {
  position: absolute;
  left: 18px;
  top: 66px;
  z-index: 5;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

.pluck-all[hidden] {
  display: none;
}

.focus-overlay.is-finale .pluck-all {
  top: auto;
  bottom: 18px;
}

.loader {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 30;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  letter-spacing: 0;
  transition: opacity 300ms ease;
}

.loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

@supports (top: env(safe-area-inset-top)) {
  #uiShell {
    top: max(8px, var(--safe-top));
    right: max(8px, var(--safe-right));
    left: max(8px, var(--safe-left, 0px));
  }

  .pluck-hint {
    top: max(16px, var(--safe-top));
    left: max(16px, var(--safe-left, 0px));
  }

  .return-button {
    right: max(22px, var(--safe-right));
    bottom: max(22px, var(--safe-bottom));
  }
}

@media (horizontal-viewport-segments: 2), (vertical-viewport-segments: 2) {
  #uiShell {
    max-width: calc(100vw - 24px);
  }

  .pool-prompt {
    max-width: calc(100vw - 32px);
  }

  .word-card {
    max-width: min(132px, calc(100vw - 20px));
  }
}

@media (max-width: 680px), (orientation: landscape) and (max-height: 680px) {
  #uiShell {
    top: max(8px, var(--safe-top));
    right: max(8px, var(--safe-right));
    left: max(8px, var(--safe-left, 0px));
    width: auto;
    max-width: none;
  }

  .star-progress-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px 5px;
    margin-top: 0;
    padding: 6px 7px;
  }

  .star-progress-row {
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
  }

  .status-text {
    margin-top: 4px;
    padding: 4px 7px;
    font-size: clamp(13px, 0.9rem, 15px);
  }

  .command,
  .progress-pill,
  .return-button {
    min-height: 32px;
    padding: 6px 9px;
  }

  .word-card {
    min-height: 42px;
    max-width: 122px;
    padding: 8px 8px;
    font-size: clamp(16px, calc(0.95rem + 0.3vw), 18px);
    line-height: 1.35;
    backdrop-filter: blur(8px);
  }

  .meteor-label {
    min-width: 48px;
    padding: 8px 5px;
  }

  .meteor-label__name {
    font-size: clamp(18px, calc(1rem + 0.55vw), 21px);
  }

  #focusStar {
    font-size: clamp(38px, 2.2rem, 48px);
  }

  .rain-drop {
    width: 58px;
    height: min(82vh, 760px);
  }

  .rain-text {
    top: 102px;
    gap: 10px;
  }

  .rain-drop::before {
    height: 94px;
  }

  .rain-drop::after {
    height: 86px;
  }

  .rain-glyph {
    width: 1.38em;
    height: 1.38em;
    font-size: 15px;
  }

  .final-rain-cluster {
    width: 26vw;
    height: 43%;
    gap: 0;
  }

  .final-rain-name {
    top: -31px;
    font-size: clamp(17px, 1.1rem, 21px);
  }

  .final-rain-drop {
    width: 10px;
    height: 100%;
    max-height: none;
    padding: 0;
    flex-basis: 10px;
  }

  .final-rain-drop::before {
    height: 42px;
  }

  .final-rain-drop::after {
    height: 38px;
  }

  .final-rain-drop .rain-text {
    top: 48px;
    gap: 6px;
  }

  .final-rain-drop .rain-glyph {
    width: 1.2em;
    height: 1.2em;
    font-size: clamp(12px, 0.82rem, 14px);
  }

  .final-rain-drop .rain-glyph:not(:last-child)::after {
    height: 3px;
  }

  .pool-prompt {
    bottom: calc(14px + var(--safe-bottom));
    max-width: calc(100vw - 24px - var(--safe-right));
    padding: 9px 12px;
    font-size: clamp(15px, 1rem, 17px);
  }

  .top-tools {
    position: static;
    margin-top: 6px;
    max-width: none;
  }

  .return-hint {
    padding: 0;
    font-size: clamp(13px, 0.85rem, 15px);
    max-width: min(240px, calc(100vw - 24px - var(--safe-right)));
  }

  .pluck-hint {
    left: max(10px, var(--safe-left, 0px));
    top: max(10px, var(--safe-top));
    font-size: clamp(15px, 1rem, 17px);
  }

  .pluck-all {
    left: 10px;
    top: 66px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .final-rain-cluster {
    width: 14.28vw;
    height: 78%;
  }

  .final-rain-name {
    top: -28px;
    font-size: 16px;
  }

  .final-rain-drop {
    width: 10px;
    flex-basis: 10px;
  }

  .final-rain-drop::before {
    height: 34px;
  }

  .final-rain-drop::after {
    height: 30px;
  }

  .final-rain-drop .rain-text {
    top: 40px;
    gap: 3px;
  }

  .final-rain-drop .rain-glyph {
    width: 1.2em;
    height: 1.2em;
    font-size: 12px;
  }

  .final-rain-drop .rain-glyph:not(:last-child)::after {
    height: 1px;
  }

  .star-progress-list {
    padding: 4px 6px;
  }

  .star-progress-row {
    font-size: 10px;
  }

  .word-card {
    min-height: 40px;
    font-size: 16px;
  }

  .focus-overlay.is-single .focus-heading {
    top: 6%;
  }

  .focus-overlay.is-single .rain-drop {
    top: calc(14% + var(--rain-y));
    height: 86vh;
  }

  .focus-overlay.is-single .rain-drop::before {
    height: 62px;
  }

  .focus-overlay.is-single .rain-drop::after {
    height: 56px;
  }

  .focus-overlay.is-single .rain-text {
    top: 70px;
    gap: 5px;
  }

  .focus-overlay.is-single .rain-glyph {
    font-size: 12px;
  }
}

@media (min-width: 430px) and (max-width: 680px) and (orientation: portrait) {
  .final-rain-drop {
    width: 11px;
    flex-basis: 11px;
  }

  .final-rain-drop .rain-glyph {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .word-card,
  .pluck-hint,
  .word-card.is-hint,
  .meteor-label.is-hint {
    animation: none;
  }

  .drag-spark {
    display: none;
  }

  .token-float {
    animation: none;
  }
}

/* ── 开局规则提示卡 ─────────────────────────── */
.rules-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(48, 62, 120, 0.34), transparent 62%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}

.rules-overlay[hidden] {
  display: none;
}

.rules-card {
  width: min(480px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 26px 24px 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(26, 30, 48, 0.94), rgba(6, 7, 12, 0.97));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 0 34px rgba(120, 150, 255, 0.12),
    0 30px 70px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: var(--ink);
  text-align: left;
}

.rules-eyebrow {
  margin: 0 0 10px;
  color: rgba(245, 245, 245, 0.58);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.rules-title {
  margin: 0 0 18px;
  font-size: clamp(20px, 1.4rem, 24px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 16px rgba(242, 201, 109, 0.35);
}

.rules-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  counter-reset: rules;
  display: grid;
  gap: 13px;
}

.rules-list li {
  counter-increment: rules;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  font-size: clamp(14.5px, 0.92rem, 16px);
  line-height: 1.6;
  color: rgba(245, 245, 245, 0.88);
}

.rules-list li::before {
  content: counter(rules);
  width: 22px;
  height: 22px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(242, 201, 109, 0.6);
  border-radius: 50%;
  color: var(--candidate);
  font-size: 12px;
  box-shadow: 0 0 10px rgba(242, 201, 109, 0.25);
}

.rules-copy {
  min-width: 0;
}

.rules-copy b {
  white-space: nowrap;
}

.rules-list em {
  color: var(--candidate);
  font-style: normal;
  text-shadow: 0 0 8px rgba(242, 201, 109, 0.5);
}

.rules-start {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-color: rgba(242, 201, 109, 0.55);
  color: #fff;
  background:
    linear-gradient(150deg, rgba(242, 201, 109, 0.22), rgba(180, 130, 40, 0.12)),
    var(--panel-strong);
  box-shadow:
    0 0 22px rgba(242, 201, 109, 0.2),
    0 12px 30px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.2em;
}

@media (max-width: 680px) {
  .rules-overlay {
    padding: 14px;
  }

  .rules-card {
    width: 100%;
    max-height: calc(100dvh - 28px);
    padding: 20px 17px 18px;
    border-radius: 8px;
  }

  .rules-list {
    gap: 15px;
    margin-bottom: 22px;
  }

  .rules-list li {
    gap: 10px;
    font-size: clamp(15px, 1rem, 16px);
    line-height: 1.7;
  }
}

/* ── 匹配成功的 +1 token 浮动提示 ──────────── */
.token-float {
  position: fixed;
  z-index: 40;
  transform: translate(-50%, -50%);
  color: var(--candidate);
  font-family: "Beidou Serif", "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 8px rgba(242, 201, 109, 0.9),
    0 0 24px rgba(242, 201, 109, 0.45),
    0 2px 6px #000;
  pointer-events: none;
  animation: token-float-rise 1150ms ease-out forwards;
  will-change: transform, opacity;
}

@keyframes token-float-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.7);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -180%) scale(1);
  }
}

/* ── 分享海报预览 ──────────────────────────── */
.poster-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.poster-overlay[hidden] {
  display: none;
}

.poster-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#posterImage {
  display: block;
  max-width: min(420px, 92vw);
  max-height: 74vh;
  width: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 0 34px rgba(120, 150, 255, 0.14),
    0 26px 60px rgba(0, 0, 0, 0.7);
  background: #000;
}

.poster-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.poster-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(242, 201, 109, 0.55);
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.12em;
}

/* 生成海报按钮：位于顶部工具行内，横排显示 */
.poster-command {
  position: static;
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  white-space: nowrap;
  pointer-events: auto;
}
