/* Teddy spelling — space interactive, large iPad taps. */
.spelling-app { max-width: 520px; padding-bottom: calc(28px + var(--safe-b)); }

.loading {
  color: var(--ink-soft);
  text-align: center;
  padding: 48px 16px;
  font-size: 15px;
}

.spell-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.spell-top .back-link { margin: 0; }

.week-chip {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teddy-ink);
  background: var(--teddy-bg);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}
.mode-tab {
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(20, 31, 69, 0.85);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 15px;
  padding: 10px 6px;
  -webkit-tap-highlight-color: transparent;
}
.mode-tab:active { transform: scale(0.97); }
.mode-tab.on {
  color: #062016;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  border-color: transparent;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.35);
}

.review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(232, 121, 249, 0.08);
  border: 1px solid rgba(232, 121, 249, 0.25);
}
.review-pill {
  font-size: 13px;
  font-weight: 800;
  color: #f5d0fe;
  letter-spacing: 0.02em;
}
.review-pill.soft { color: var(--ink-soft); font-weight: 700; }

.word-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.nav-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.nav-btn:active { transform: scale(0.96); }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.word-progress {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
}

.word-card {
  background:
    linear-gradient(160deg, rgba(52, 211, 153, 0.10), transparent 45%),
    var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px 18px 20px;
  box-shadow: var(--shadow), var(--glow);
  animation: pulse-glow 2.8s ease-in-out infinite;
  text-align: center;
  margin-bottom: 16px;
}
.word-card.celebrate {
  animation: celebrate-glow 0.9s ease-out;
}

@keyframes celebrate-glow {
  0% { box-shadow: 0 0 0 2px #34d399, 0 0 40px rgba(52, 211, 153, 0.55), 0 0 80px rgba(34, 211, 238, 0.35); }
  100% { box-shadow: var(--shadow), var(--glow); }
}

/* Flip card (See & hear) */
.flip-scene {
  perspective: 1200px;
  margin: 0 auto 16px;
  max-width: 280px;
}
.flip-card {
  position: relative;
  width: 100%;
  min-height: 280px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.flip-card.is-flipped {
  transform: rotateY(180deg);
}
.flip-card:active:not(.is-flipped) {
  transform: rotateY(8deg) scale(0.99);
}
.flip-card.is-flipped:active {
  transform: rotateY(172deg) scale(0.99);
}
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 22px;
  border: 1px solid rgba(165, 243, 252, 0.22);
  background: rgba(7, 13, 34, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  box-shadow: inset 0 0 40px rgba(34, 211, 238, 0.06);
}
.flip-back {
  transform: rotateY(180deg);
}
.flip-cue {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.flip-cue.subtle { opacity: 0.7; margin-top: 8px; }

.flip-front .word-image-wrap {
  width: min(200px, 78%);
  margin-bottom: 0;
}

.word-image-wrap {
  width: min(220px, 70%);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(7, 13, 34, 0.65);
  border: 1px solid rgba(165, 243, 252, 0.2);
  display: grid;
  place-items: center;
}
.word-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.word-placeholder {
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 16px;
  color: var(--ink-soft);
}
.word-placeholder .planet {
  width: 72px;
  height: 72px;
}
.word-placeholder .ph-mark {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.85;
}

.word-display {
  font-family: var(--serif);
  font-size: clamp(36px, 10vw, 52px);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.35);
}
.phonetic {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: #a5f3fc;
  letter-spacing: 0.06em;
}
.word-hint {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 14px;
  min-height: 1.3em;
}

.hear-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.hear-btn {
  min-height: 56px;
  min-width: 140px;
  padding: 12px 20px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 17px;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  color: #062016;
  box-shadow: 0 8px 28px rgba(34, 211, 238, 0.32);
  -webkit-tap-highlight-color: transparent;
}
.hear-btn:active { transform: scale(0.97); }
.hear-btn.secondary {
  background: rgba(20, 31, 69, 0.95);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 15px;
  min-width: 120px;
}

.mark-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.mark-btn {
  min-height: 64px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 18px;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
.mark-btn:active { transform: scale(0.97); }
.mark-btn.got {
  background: linear-gradient(135deg, #34d399, #6ee7b7);
  color: #062016;
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.35);
}
.mark-btn.missed {
  background: linear-gradient(135deg, #fb7185, #f472b6);
  color: #1a0610;
  box-shadow: 0 8px 24px rgba(251, 113, 133, 0.32);
}

.review-banner {
  text-align: center;
  padding: 16px;
  border-radius: 20px;
  background: rgba(232, 121, 249, 0.1);
  border: 1px solid rgba(232, 121, 249, 0.28);
  margin-bottom: 12px;
}
.review-banner p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 15px;
}

.empty-deck { padding: 12px 0; }

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 18px;
  min-height: 56px;
}
.slot {
  width: 48px;
  height: 56px;
  border-radius: 12px;
  border: 2px dashed rgba(165, 243, 252, 0.35);
  background: rgba(7, 13, 34, 0.45);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--teddy-ink);
  text-transform: uppercase;
}
.slot.filled {
  border-style: solid;
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.25);
}

.tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}
.tile {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid rgba(165, 243, 252, 0.28);
  background: linear-gradient(180deg, #1c2a58, #141f45);
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: var(--shadow), 0 0 12px rgba(34, 211, 238, 0.12);
  -webkit-tap-highlight-color: transparent;
}
.tile:active { transform: scale(0.94); }
.tile.used {
  opacity: 0.28;
  pointer-events: none;
}

.feedback {
  min-height: 28px;
  margin: 4px 0 8px;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
}
.feedback.ok { color: var(--teddy-ink); }
.feedback.no { color: #fca5a5; }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
.ghost-btn {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(20, 31, 69, 0.8);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
}
.ghost-btn:active { transform: scale(0.97); color: var(--ink); }

/* Unused Type/Quiz styles kept for potential reuse */
.type-row { display: flex; gap: 10px; margin: 8px 0 12px; }
.type-input {
  flex: 1; min-height: 56px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(7, 13, 34, 0.65); color: var(--ink); font-size: 24px; font-weight: 700;
  letter-spacing: 0.08em; text-align: center; padding: 10px 14px; outline: none;
}
.check-btn {
  min-width: 96px; min-height: 56px; border-radius: 16px; font-weight: 800; font-size: 16px;
  background: linear-gradient(135deg, #e879f9, #22d3ee); color: #0b1638;
}
.os-keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.os-key {
  min-height: 44px; border-radius: 10px; border: 1px solid rgba(165, 243, 252, 0.2);
  background: rgba(20, 31, 69, 0.9); color: var(--ink); font-weight: 800; font-size: 15px;
  text-transform: uppercase;
}

@media (min-width: 700px) {
  .mode-tab { font-size: 16px; }
  .tile, .slot { width: 60px; height: 60px; }
  .flip-scene { max-width: 320px; }
  .flip-card { min-height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  .flip-card { transition: none; }
  .flip-card.is-flipped { transform: none; }
  .flip-card.is-flipped .flip-front { display: none; }
  .flip-card:not(.is-flipped) .flip-back { display: none; }
  .flip-back { transform: none; }
}
