.start-card,
.reference-card,
.canvas-card,
.option-button,
.hud,
.overlay-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.start-card {
  padding: 32px;
  text-align: center;
}

.start-eyebrow,
.hud-label,
.overlay-subtitle {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.start-card h1,
.overlay-card h2 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.start-description {
  max-width: 36rem;
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.5;
}

.error-detail {
  max-width: 36rem;
  margin: 0 auto 20px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(36, 66, 92, 0.08);
  color: var(--ink);
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

.set-picker {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.set-button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 20px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.set-button,
.primary-button {
  background: linear-gradient(135deg, #ffb7c5, #ffda77);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(244, 93, 122, 0.18);
}

.secondary-button {
  background: var(--card-strong);
  color: var(--ink);
  border: 1px solid var(--line);
}

.set-button:hover,
.primary-button:hover,
.secondary-button:hover,
.option-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

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

.hud-title {
  margin: 4px 0 0;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
}

.hud-stars {
  margin: 0 0 8px;
  text-align: right;
  font-weight: 600;
}

.progress-track {
  width: min(260px, 42vw);
  height: 12px;
  background: rgba(126, 208, 255, 0.22);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--sky), var(--mint));
  border-radius: inherit;
  transition: width 250ms ease;
}

.reference-card,
.canvas-card {
  height: 100%;
  padding: 20px;
}

.reference-card {
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72)),
    var(--card);
}

.reference-emoji {
  font-size: clamp(3rem, 6vw, 4.3rem);
}

.reference-character {
  font-size: clamp(3.2rem, 8vw, 5rem);
  line-height: 1;
}

.reference-pinyin {
  font-size: 1.25rem;
  color: var(--muted);
  margin-top: 10px;
}

.canvas-card {
  display: grid;
  place-items: center;
}

.stroke-canvas {
  width: min(100%, 420px);
  aspect-ratio: 1;
  background: #fffdf8;
  border-radius: 24px;
  border: 1px solid rgba(92, 117, 146, 0.1);
}

.stroke-shape {
  fill: rgba(105, 120, 135, 0.72);
  transition: fill 0.45s ease;
}

.stroke-shape-highlight {
  fill: rgba(255, 183, 3, 0.98);
}

.median-animation {
  filter: drop-shadow(0 0 6px rgba(255, 183, 3, 0.45));
}

.options-panel {
  display: contents;
}

.option-button {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border: 3px solid transparent;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 245, 250, 0.85));
}

.option-button:disabled {
  cursor: default;
}

.option-button.is-correct {
  border-color: #49b675;
}

.option-button.is-wrong {
  border-color: #ef5a67;
  animation: shake 300ms ease;
}

.option-preview {
  width: 100%;
  height: 100%;
}

.option-preview path {
  fill: var(--ink);
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 12px;
  height: 18px;
  border-radius: 4px;
}

.overlay-card {
  width: min(420px, calc(100vw - 48px));
  padding: 28px;
  text-align: center;
}

.star-rating {
  font-size: 2rem;
  margin: 18px 0 22px;
}

.overlay-card button + button {
  margin-top: 10px;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@media (max-width: 900px) {
  .option-button {
    min-height: 160px;
  }
}

@media (max-width: 600px) {
  .hud {
    display: grid;
  }

  .hud-stars {
    text-align: left;
  }

  .progress-track {
    width: 100%;
  }

  .reference-card,
  .canvas-card,
  .option-button {
    border-radius: 22px;
  }

  .option-button {
    min-height: 140px;
    padding: 10px;
  }
}

/* Princess Audrey panel */
.princess-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(180, 220, 255, 0.12);
  border: 1px solid rgba(140, 190, 240, 0.35);
  border-radius: 12px;
  min-width: 110px;
}

.princess-svg {
  width: 100px;
  height: 160px;
  transition: filter 0.6s ease;
  overflow: hidden;
}

.princess-svg .ice-overlay {
  transform-box: view-box;
  transform-origin: 0 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.princess-svg.princess-svg--frozen {
  filter: drop-shadow(0 0 8px #80d0ff) saturate(0.4) brightness(0.85);
  animation: princess-shiver 0.15s ease-in-out 3;
}

@keyframes princess-shiver {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
  100% {
    transform: translateX(0);
  }
}

.princess-label {
  font-size: 0.65rem;
  text-align: center;
  color: #5090c0;
  font-weight: 600;
  max-width: 110px;
  line-height: 1.3;
  min-height: 2.6em;
}

.princess-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* Freeze game-over overlay */
.freeze-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    ellipse at center,
    rgba(100, 180, 240, 0.92) 0%,
    rgba(20, 60, 120, 0.97) 100%
  );
  animation: freeze-overlay-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes freeze-overlay-in {
  from {
    opacity: 0;
    transform: scale(1.05);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.freeze-overlay__content {
  text-align: center;
  color: white;
  padding: 40px 48px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(180, 230, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(100, 200, 255, 0.4);
  backdrop-filter: blur(6px);
  max-width: 420px;
}

.freeze-overlay__snowflakes {
  font-size: 1.8rem;
  letter-spacing: 8px;
  margin-bottom: 16px;
  animation: snowflake-float 2.5s ease-in-out infinite alternate;
}

@keyframes snowflake-float {
  from {
    transform: translateY(-4px);
  }
  to {
    transform: translateY(4px);
  }
}

.freeze-overlay__title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0 0 10px;
  text-shadow: 0 0 20px rgba(160, 230, 255, 0.8);
  color: #e0f4ff;
}

.freeze-overlay__subtitle {
  font-size: 1rem;
  opacity: 0.85;
  margin: 0 0 28px;
  color: #c8e8ff;
}

.freeze-overlay__btn {
  padding: 12px 32px;
  font-size: 1.05rem;
  font-weight: 700;
  background: #fff;
  color: #2060a0;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s, box-shadow 0.1s;
}

.freeze-overlay__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.freeze-overlay__btn:active {
  transform: translateY(0);
}

@media (max-width: 600px) {
  .princess-wrapper {
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 100;
    margin-top: 0;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 12px;
    padding: 6px 8px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    pointer-events: none;
  }

  .princess-wrapper .princess-svg {
    width: 60px;
    height: 96px;
  }

  .princess-wrapper .princess-label {
    font-size: 0.5rem;
    max-width: 72px;
  }
}
