/* The Noah Game — colorful pre-K theme */
:root {
  --ink: #2B0B5C;
  --ink-soft: #5B2B86;
  --paper: #7FD8FF;
  --got: #16C85A;
  --miss: #FF3B5C;
  --card-radius: 32px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font-ui: "Nunito", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-glyph: "Baloo 2", "Nunito", "Arial Rounded MT Bold", ui-rounded, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
  height: 100dvh;
  background: #7FD8FF;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 800;
  overflow: hidden;
}
button { font-family: inherit; font-weight: 800; cursor: pointer; }
button, a { color: inherit; }

@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/Baloo2.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}

/* Sky */
#fun-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 500px at 50% -10%, #FFF7C2 0%, transparent 55%),
    linear-gradient(180deg, #7FD8FF 0%, #C5B7FF 42%, #FFB4E6 78%, #FFD56A 100%);
  overflow: hidden;
}
.floater {
  position: absolute;
  bottom: -12%;
  animation: rise var(--dur, 16s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0.9;
  font-size: var(--size, 28px);
  filter: drop-shadow(0 4px 0 rgba(43,11,92,0.12));
  will-change: transform;
}
.floater.bubble {
  width: var(--size, 28px);
  height: var(--size, 28px);
  font-size: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--c, #fff) 45%, rgba(255,255,255,0.15));
  border: 3px solid rgba(255,255,255,0.7);
}
.floater.cloud {
  font-size: var(--size, 40px);
  opacity: 0.85;
}
@keyframes rise {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { transform: translate3d(var(--drift, 40px), -120vh, 0) rotate(360deg); }
}

#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.view {
  display: none;
  position: absolute;
  inset: 0;
  padding: calc(var(--safe-top) + 12px) calc(var(--safe-right) + 16px) calc(var(--safe-bot) + 16px) calc(var(--safe-left) + 16px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.view.active { display: flex; flex-direction: column; }
.view.play-view, .view.match-view, .view.your-turn-view, .view.celebrate {
  overflow: hidden;
}
.play-view {
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 12px) calc(var(--safe-bot) + 12px) calc(var(--safe-left) + 12px);
}

/* Mascot */
.mascot-slot { display: flex; justify-content: center; pointer-events: none; }
.buddy { width: 100%; height: auto; overflow: visible; }
.buddy .outfit { display: none !important; }
.buddy .outfit.is-on { display: inline !important; }
.mascot-home { width: 150px; height: 165px; margin: 0 auto 2px; animation: bob 2.2s ease-in-out infinite; }
.mascot-play { position: absolute; right: 6px; bottom: 4px; width: 88px; height: 96px; z-index: 3; }
.mascot-party { width: 180px; height: 198px; margin: 8px auto 0; }
.mascot-match { width: 64px; height: 70px; pointer-events: none; }
.buddy .arm-l { transform-origin: 70px 138px; }
.buddy .arm-r { transform-origin: 150px 136px; }
.buddy .eyes { transform-origin: 114px 78px; animation: blink 4.5s infinite; }
.mascot-slot.cheer .buddy { animation: cheer 0.7s ease-in-out; }
.mascot-slot.cheer .arm-l { animation: wave-l 0.7s ease-in-out; }
.mascot-slot.cheer .arm-r { animation: wave-r 0.7s ease-in-out; }
.mascot-slot.wiggle .buddy { animation: wiggle 0.7s ease-in-out; }
.mascot-slot.dance .buddy { animation: dance 0.9s ease-in-out infinite; }
.mascot-slot.dance .arm-l { animation: wave-l 0.9s ease-in-out infinite; }
.mascot-slot.dance .arm-r { animation: wave-r 0.9s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-22px) rotate(-10deg); }
  50% { transform: translateY(0) rotate(8deg); }
  75% { transform: translateY(-14px) rotate(-6deg); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0) translateX(0); }
  20% { transform: rotate(-12deg) translateX(-6px); }
  40% { transform: rotate(12deg) translateX(6px); }
  60% { transform: rotate(-8deg) translateX(-4px); }
  80% { transform: rotate(8deg) translateX(4px); }
}
@keyframes dance {
  0%, 100% { transform: translateY(0) rotate(-6deg) scale(1); }
  25% { transform: translateY(-16px) rotate(8deg) scale(1.05); }
  50% { transform: translateY(0) rotate(-8deg) scale(1); }
  75% { transform: translateY(-10px) rotate(6deg) scale(1.04); }
}
@keyframes wave-l {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-28deg); }
}
@keyframes wave-r {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(32deg); }
}
@keyframes blink {
  0%, 88%, 100% { transform: scaleY(1); }
  92% { transform: scaleY(0.08); }
}

/* Home */
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand h1 {
  font-family: var(--font-glyph);
  font-size: clamp(2rem, 9vw, 3.3rem);
  margin: 0;
  line-height: 0.95;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #FF2D55, #FF7A00, #FFD000, #21C45A, #2F8CFF, #8B5CFF, #FF3DAA, #FF2D55);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(43,11,80,0.28));
  animation: rainbow-shift 7s linear infinite;
}
@keyframes rainbow-shift { to { background-position: 200% 0; } }
.brand p { margin: 4px 0 0; color: var(--ink); font-size: 1.15rem; text-shadow: 0 1px 0 #fff; }

.stats-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip {
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.95rem;
  box-shadow: 0 4px 0 rgba(43,11,92,0.14);
  border: 3px solid #fff;
  color: var(--ink);
}
.chip.ahead, .chip.on-track { background: #B8F5C8; border-color: #16C85A; color: #0C6A2C; }
.chip.behind { background: #FFD0D8; border-color: #FF3B5C; color: #9B1220; }
.mastered-line { text-align: center; font-size: 1.25rem; margin: 4px 0 0; text-shadow: 0 1px 0 #fff; }
.mastered-line strong { font-family: var(--font-glyph); font-size: 1.55rem; }

.play-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  gap: 14px;
}
.btn-play {
  width: min(210px, 58vw);
  height: min(210px, 58vw);
  max-height: 240px;
  margin: 8px 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF06A, #FFB703 46%, #FF5A1F 100%);
  color: var(--ink);
  font-family: var(--font-glyph);
  font-size: clamp(3rem, 12vw, 4.4rem);
  box-shadow:
    0 0 0 6px #fff,
    0 0 0 11px #FF4DAB,
    0 0 0 15px #FFD000,
    0 0 0 19px #3B8BFF,
    0 10px 0 #D56A00,
    0 16px 28px rgba(251, 80, 130, 0.35);
  transition: transform 0.08s ease;
  line-height: 1;
  display: grid;
  place-items: center;
  position: relative;
  animation: play-pulse 2s ease-in-out infinite;
}
@keyframes play-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.btn-play:active { transform: translateY(6px) scale(0.98); animation: none; }
.btn-play .play-sub {
  position: absolute;
  bottom: 18%;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
  opacity: 0.8;
}

.sessions-meter { text-align: center; font-size: 1.2rem; text-shadow: 0 1px 0 #fff; }
.pips { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.pip {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 4px solid #E0C899;
}
.pip.on {
  background: linear-gradient(160deg, #FFE066, #FF4DAB);
  border-color: #C026D3;
  box-shadow: 0 0 0 3px #fff;
}

.home-nav { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 6px; }
.nav-btn {
  background: #fff;
  border: 4px solid #fff;
  border-radius: 22px;
  padding: 12px 6px 10px;
  font-size: 0.95rem;
  box-shadow: 0 5px 0 rgba(43,11,92,0.14);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-btn.nav-progress { background: #FFE066; }
.nav-btn.nav-practice { background: #FF9EC8; }
.nav-btn.nav-settings { background: #B7E3FF; }
.nav-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43,11,92,0.14); }
.nav-btn .ico { font-size: 1.6rem; line-height: 1; }

.install-tip {
  margin-top: 10px;
  background: rgba(255,255,255,0.85);
  border: 3px dashed #8B5CFF;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--ink);
  display: none;
  position: relative;
}
.install-tip.show { display: block; }
.install-tip button { position: absolute; right: 8px; top: 6px; border: 0; background: transparent; font-size: 1.1rem; }

/* Play / intro cards */
.play-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 16px; border: 0;
  background: #fff; box-shadow: 0 4px 0 rgba(43,11,92,0.14);
  font-size: 1.4rem; display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn.ghost { background: transparent; box-shadow: none; font-size: 1.6rem; }
.icon-btn:active { transform: translateY(2px); }
.progress-mini { flex: 1; text-align: center; font-size: 1.05rem; color: var(--ink); text-shadow: 0 1px 0 #fff; }
.progress-mini strong { font-size: 1.15rem; }

.card-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; margin: 8px 0; }
.glyph-card {
  flex: 1; min-height: 0;
  border-radius: var(--card-radius);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10px 16px 86px;
  box-shadow: 0 12px 0 rgba(0,0,0,0.14), 0 20px 44px rgba(43,11,92,0.22);
  position: relative; overflow: hidden;
  color: #fff;
  border: 6px solid #fff;
  animation: card-in 0.4s cubic-bezier(.2,1.4,.4,1);
}
@keyframes card-in {
  0% { transform: scale(0.86) rotate(-2deg); opacity: 0.4; }
  100% { transform: none; opacity: 1; }
}
.glyph-card .prompt, .intro-kicker {
  font-size: clamp(1rem, 2.8vw, 1.3rem);
  margin: 0 0 2px;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0,0,0,0.18);
}
.intro-kicker {
  font-family: var(--font-glyph);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  margin-bottom: 2px;
}

.glyph {
  font-family: var(--font-glyph);
  font-weight: 700;
  font-size: min(72vw, 42vh, 18rem);
  line-height: 0.82;
  letter-spacing: -0.04em;
  user-select: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  animation: glyph-pop 0.55s cubic-bezier(.2,1.5,.4,1);
  text-shadow:
    -5px -5px 0 rgba(43,11,92,0.9),
    5px -5px 0 rgba(43,11,92,0.9),
    -5px 5px 0 rgba(43,11,92,0.9),
    5px 5px 0 rgba(43,11,92,0.9),
    0 12px 0 rgba(0,0,0,0.2);
  filter: saturate(1.15);
}
.glyph.num { font-size: min(62vw, 38vh, 16rem); }
@keyframes glyph-pop {
  0% { transform: scale(0.35) rotate(-12deg); }
  55% { transform: scale(1.16) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.glyph.wiggling { animation: wiggle 0.5s ease-in-out; }
.glyph.pop { animation: glyph-pop 0.45s cubic-bezier(.2,1.5,.4,1); }

.hint {
  min-height: 3rem;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  font-family: var(--font-glyph);
  opacity: 0; transform: translateY(6px);
  transition: 0.2s ease;
  text-align: center;
  text-shadow: 0 3px 0 rgba(0,0,0,0.15);
}
.hint.show { opacity: 1; transform: none; }
.hint .emoji { font-size: 1.3em; font-style: normal; }
.dots-hint { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 260px; margin: 4px auto 0; }
.dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}
.case-pair {
  display: none; gap: 18px;
  font-family: var(--font-glyph);
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  line-height: 1;
}
.case-pair.show { display: flex; }
.case-pair .pair-item { text-align: center; }
.case-pair small { display: block; font-family: var(--font-ui); font-size: 0.8rem; }

.yes-burst {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-glyph);
  font-size: clamp(4rem, 22vw, 6.5rem);
  color: #FFE566;
  text-shadow:
    -4px -4px 0 #2B0B5C, 4px -4px 0 #2B0B5C,
    -4px 4px 0 #2B0B5C, 4px 4px 0 #2B0B5C,
    0 10px 0 #FF4DAB;
  animation: yes-pop 0.7s cubic-bezier(.2,1.5,.4,1);
  pointer-events: none;
  z-index: 5;
}
.yes-burst[hidden] { display: none !important; }
@keyframes yes-pop {
  0% { transform: scale(0.2) rotate(-12deg); opacity: 0; }
  40% { transform: scale(1.15) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex-shrink: 0; }
.intro-actions { grid-template-columns: 1fr; }
.btn-got, .btn-miss, .btn-next {
  border: 0; border-radius: 24px;
  padding: 18px 10px;
  font-size: clamp(1.3rem, 4.4vw, 1.7rem);
  min-height: 76px;
  color: #fff;
}
.btn-got { background: var(--got); box-shadow: 0 7px 0 #0B8F3A; }
.btn-miss { background: var(--miss); box-shadow: 0 7px 0 #BE123C; }
.btn-next {
  grid-column: 1 / -1;
  background: #7C3AED;
  box-shadow: 0 7px 0 #5B21B6;
  display: none;
}
.intro-actions .btn-next, .actions.revealed .btn-next { display: block; }
.btn-got:active, .btn-miss:active, .btn-next:active { transform: translateY(4px); box-shadow: 0 3px 0 rgba(0,0,0,0.2); }
.actions.revealed .btn-got,
.actions.revealed .btn-miss { display: none; }
.tap-hint { margin: 0; text-align: center; font-size: 0.95rem; color: var(--ink); text-shadow: 0 1px 0 #fff; }

/* Your turn */
.your-turn-view {
  align-items: center; justify-content: center; text-align: center;
  background: transparent;
}
.your-turn-view h2 {
  font-family: var(--font-glyph);
  font-size: clamp(3rem, 14vw, 5rem);
  margin: 8px 0 0;
  background: linear-gradient(90deg, #FF2D55, #FFD000, #21C45A, #2F8CFF, #FF3DAA);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: rainbow-shift 3s linear infinite, glyph-pop 0.5s cubic-bezier(.2,1.5,.4,1);
  filter: drop-shadow(0 4px 0 rgba(43,11,80,0.3));
}
.your-turn-view .sub { font-size: 1.6rem; text-shadow: 0 1px 0 #fff; }

/* Party */
.celebrate {
  align-items: center; text-align: center; overflow: hidden;
  background: transparent;
}
.sticker {
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFE066, #FFB703 60%, #FF4DAB);
  box-shadow: 0 10px 0 #D56A00, 0 0 0 8px #fff, 0 16px 30px rgba(0,0,0,0.15);
  display: grid; place-items: center;
  font-size: 84px;
  margin: 8px auto 8px;
  animation: glyph-pop 0.55s cubic-bezier(.2,1.5,.4,1);
  position: relative; z-index: 1;
}
.celebrate h2 {
  font-family: var(--font-glyph);
  font-size: clamp(2.1rem, 8vw, 3.2rem);
  margin: 8px 0 0;
  position: relative; z-index: 1;
  text-shadow: 0 2px 0 #fff;
}
.celebrate .sub { font-size: 1.25rem; position: relative; z-index: 1; text-shadow: 0 1px 0 #fff; }
.cele-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0 20px; position: relative; z-index: 1; }
.unlock-banner {
  background: #FFE066;
  border: 4px solid #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-glyph);
  font-size: 1.3rem;
  box-shadow: 0 5px 0 rgba(43,11,92,0.15);
  margin: 0;
  animation: glyph-pop 0.5s cubic-bezier(.2,1.5,.4,1);
}
.unlock-banner[hidden] { display: none !important; }
.btn-row { display: flex; flex-direction: column; gap: 10px; width: min(360px, 92%); position: relative; z-index: 1; }
.btn-primary, .btn-secondary {
  border: 0; border-radius: 18px; padding: 16px; font-size: 1.25rem; min-height: 58px;
}
.btn-primary { background: #7C3AED; color: #fff; box-shadow: 0 5px 0 #5B21B6; }
.btn-secondary { background: #fff; color: var(--ink); box-shadow: 0 5px 0 rgba(43,11,92,0.16); border: 3px solid #fff; }
.btn-primary:active, .btn-secondary:active { transform: translateY(3px); }

/* Progress / settings */
.screen-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.screen-head h2 { font-family: var(--font-glyph); font-size: 1.9rem; margin: 0; flex: 1; line-height: 1.1; }
.plan-banner {
  background: #fff;
  border-radius: 22px;
  padding: 14px 16px;
  border: 4px solid #fff;
  margin: 8px 0 14px;
  box-shadow: 0 6px 0 rgba(43,11,92,0.12);
}
.plan-banner .big { font-family: var(--font-glyph); font-size: 1.7rem; line-height: 1.1; }
.plan-banner .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.sticker-book h3 { margin-top: 4px; }
.sticker-shelf { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.sticker-item {
  aspect-ratio: 1;
  border-radius: 18px;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: 0 4px 0 rgba(43,11,92,0.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 1.8rem;
  padding: 4px;
  font-family: var(--font-glyph);
}
.sticker-item locked, .sticker-item.locked { background: #EDE4FF; color: #9D8DC2; filter: grayscale(0.4); }
.sticker-item.on {
  background: var(--bg, #FFE066);
  animation: bob 3s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.sticker-item small { font-family: var(--font-ui); font-size: 0.62rem; font-weight: 800; line-height: 1.1; text-align: center; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.85rem; margin: 0 0 10px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 2px solid rgba(43,11,92,0.12); }
.swatch.unseen { background: #F3EDE0; }
.swatch.learning { background: #FFD000; }
.swatch.mastered { background: #16C85A; }
.swatch.locked { background: repeating-linear-gradient(45deg, #eee, #eee 3px, #fff 3px, #fff 6px); }

section.block h3 { font-family: var(--font-glyph); font-size: 1.35rem; margin: 14px 0 8px; }
.grid-letters, .grid-numbers { display: grid; gap: 7px; }
.grid-letters { grid-template-columns: repeat(7, 1fr); }
.grid-numbers { grid-template-columns: repeat(5, 1fr); }
.cell {
  aspect-ratio: 1; border-radius: 16px; border: 3px solid #fff;
  background: #FFF8E8; color: var(--ink);
  font-family: var(--font-glyph);
  font-size: clamp(1.15rem, 4.2vw, 1.55rem);
  position: relative; padding: 0; line-height: 1;
  box-shadow: 0 4px 0 rgba(43,11,92,0.1);
  overflow: hidden;
}
.cell .up { font-size: 1.05em; }
.cell .lo { font-size: 0.72em; margin-left: 1px; }
.cell.learning { background: #FFD000; }
.cell.mastered { background: #16C85A; color: #fff; box-shadow: 0 4px 0 #0B8F3A; }
.cell.locked { background: #EDE4FF; color: #9D8DC2; }
.cell.mixed { background: linear-gradient(180deg, #16C85A 0 50%, #FFD000 50% 100%); color: var(--ink); }
.cell.mixed .up { color: #fff; }
.cell .case-dot {
  position: absolute; right: 4px; bottom: 3px;
  width: 8px; height: 8px; border-radius: 50%; background: #ccc;
}
.cell .case-dot.learning { background: #F77F00; }
.cell .case-dot.mastered { background: #fff; box-shadow: 0 0 0 2px #0C6A2C; }
.cell.mastered .case-dot.mastered { background: #FFD000; box-shadow: none; }

.fine-print, .lead { color: var(--ink); font-size: 0.95rem; margin-top: 12px; text-shadow: 0 1px 0 rgba(255,255,255,0.7); }
.lead { margin-top: 0; }

.danger {
  margin: 20px 0 8px; background: transparent; color: #BE123C;
  border: 3px solid #FFB4C0; border-radius: 14px; padding: 12px; width: 100%;
  background: rgba(255,255,255,0.7);
}

.setting-row {
  background: #fff; border-radius: 18px; padding: 14px 16px; margin: 0 0 10px;
  border: 4px solid #fff; box-shadow: 0 4px 0 rgba(43,11,92,0.1);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.setting-row label { font-size: 1.05rem; }
#inp-name {
  width: 140px; border: 3px solid #E0C899; border-radius: 12px;
  padding: 8px 10px; font: inherit; text-align: right; background: #FFFDF7; color: var(--ink);
}
.toggle {
  width: 52px; height: 32px; border-radius: 999px; background: #D9D0C3; border: 0; position: relative; flex-shrink: 0;
}
.toggle.on { background: #16C85A; }
.toggle::after {
  content: ""; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  position: absolute; top: 4px; left: 4px; transition: 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { left: 24px; }
.seg { display: flex; background: #F3EDE0; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 8px 12px; font-size: 0.95rem; }
.seg button.on { background: #fff; box-shadow: 0 2px 0 rgba(43,11,92,0.08); }

.practice-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.practice-list button {
  background: #fff; border: 4px solid #fff; border-radius: 20px;
  padding: 16px; text-align: left; font-size: 1.25rem;
  box-shadow: 0 5px 0 rgba(43,11,92,0.12);
}
.practice-list button:nth-child(1) { background: #FFE066; }
.practice-list button:nth-child(2) { background: #9AE6B4; }
.practice-list button:nth-child(3) { background: #B7E3FF; }
.practice-list button:nth-child(4) { background: #FF9EC8; }
.practice-list button small { display: block; font-size: 0.9rem; font-weight: 700; margin-top: 2px; }

/* Match */
.match-view { overflow: hidden; }
.match-prompt {
  text-align: center; font-family: var(--font-glyph);
  font-size: clamp(1.4rem, 5vw, 2rem); margin: 4px 0 8px; text-shadow: 0 1px 0 #fff;
}
.match-big-wrap { display: flex; justify-content: center; margin: 4px 0 8px; }
.match-big {
  width: min(180px, 42vw); aspect-ratio: 1; border-radius: 50%;
  border: 6px solid #fff; font-family: var(--font-glyph);
  font-size: min(28vw, 7rem); line-height: 1;
  box-shadow: 0 8px 0 rgba(43,11,92,0.16);
  animation: glyph-pop 0.45s cubic-bezier(.2,1.5,.4,1);
  color: #fff;
}
.match-bubbles { position: relative; flex: 1; min-height: 240px; }
.match-bubble {
  position: absolute; width: 86px; height: 86px; border-radius: 50%;
  border: 5px solid #fff; font-family: var(--font-glyph); font-size: 2.6rem;
  color: #fff; box-shadow: 0 6px 0 rgba(43,11,92,0.16);
  display: grid; place-items: center; padding: 0;
  animation: bob 2.4s ease-in-out infinite;
}
.match-bubble.wrong { animation: wiggle 0.45s ease-in-out; }
.match-bubble.pop { animation: glyph-pop 0.4s ease; }

/* Sheet */
.sheet-backdrop {
  display: none; position: absolute; inset: 0;
  background: rgba(43,11,92,0.45); z-index: 20;
  align-items: flex-end; justify-content: center;
}
.sheet-backdrop.show { display: flex; }
.sheet {
  background: #fff; width: min(560px, 100%);
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(var(--safe-bot) + 16px);
  max-height: 80%; overflow: auto;
}
.sheet h3 { font-family: var(--font-glyph); font-size: 1.8rem; margin: 0 0 8px; }
.sheet-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-top: 1px solid #F0E6D4; font-size: 1.05rem;
}
.pill { border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; background: #F3EDE0; }
.pill.learning { background: #FFD000; }
.pill.mastered { background: #16C85A; color: #fff; }
.pill.locked { color: #8A7A66; }
.confirm-box { text-align: center; padding: 8px 4px 0; }
.confirm-box p { font-size: 1.05rem; }

@media (min-width: 700px) {
  .view:not(.play-view):not(.match-view) { max-width: 720px; margin: 0 auto; left: 0; right: 0; }
  .play-view, .match-view { max-width: 900px; margin: 0 auto; left: 0; right: 0; }
  .glyph { font-size: min(56vw, 44vh, 24rem); }
  .mascot-home { width: 190px; height: 210px; }
  .mascot-play { width: 120px; height: 132px; }
  .btn-got, .btn-miss, .btn-next { min-height: 88px; font-size: 1.7rem; }
  .match-bubble { width: 110px; height: 110px; font-size: 3.2rem; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .mascot-home { width: 80px; height: 88px; }
  .btn-play { width: 140px; height: 140px; font-size: 2.2rem; }
  .glyph { font-size: min(36vw, 38vh, 10rem); }
  .mascot-play { width: 64px; height: 70px; }
  .btn-got, .btn-miss, .btn-next { min-height: 56px; padding: 10px; font-size: 1.15rem; }
  .glyph-card { padding-bottom: 64px; }
}

/* Reduced motion (settings toggle only) */
body.calm .floater,
body.calm .buddy .eyes,
body.calm .mascot-home,
body.calm .mascot-slot.dance .buddy,
body.calm .mascot-slot.dance .arm-l,
body.calm .mascot-slot.dance .arm-r,
body.calm .btn-play,
body.calm .brand h1,
body.calm .sticker-item.on,
body.calm .match-bubble,
body.calm .your-turn-view h2 {
  animation: none !important;
}
body.calm .glyph-card,
body.calm .glyph,
body.calm .sticker,
body.calm .yes-burst,
body.calm .match-big {
  animation-duration: 0.01s !important;
}

.hidden { display: none !important; }
