/* ============================================================
   THE CARE LAB — carelab.css
   Design: Claymorphism · Teal + Orange · Fredoka + Nunito
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --teal:          #0D9488;
  --teal-dark:     #0B7A71;
  --teal-light:    #14B8A6;
  --teal-pale:     #CCFBF1;
  --teal-mist:     #F0FDFA;
  --orange:        #EA580C;
  --orange-dark:   #C2400A;
  --orange-light:  #FED7AA;
  --fg:            #134E4A;
  --fg-muted:      #5B7B79;
  --fg-light:      #94A3B8;
  --card:          #FFFFFF;
  --bg:            #E6F7F5;
  --border:        #A7F3D0;
  --border-light:  #D1FAE5;
  --shadow-teal:   rgba(13,148,136,0.25);
  --shadow-sm:     rgba(0,0,0,0.06);
  --r-sm:          12px;
  --r-md:          20px;
  --r-lg:          28px;
  --ease:          cubic-bezier(0.34,1.56,0.64,1);
  --ease-out:      cubic-bezier(0.16,1,0.3,1);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background texture */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle fill='%230D9488' fill-opacity='0.03' cx='20' cy='20' r='1'/%3E%3C/g%3E%3C/svg%3E");
}

/* ── SCREEN SYSTEM ───────────────────────────────────────── */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  opacity: 0; pointer-events: none;
  transform: translateY(24px);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  -webkit-overflow-scrolling: touch;
}
.screen.active {
  opacity: 1; pointer-events: all; transform: translateY(0);
}
.screen.exit {
  opacity: 0; transform: translateY(-24px);
}

.screen-inner {
  max-width: 480px; width: 100%; margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex; flex-direction: column; gap: 20px;
  flex: 1;
}

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 2px solid var(--border-light);
  box-shadow:
    0 8px 0 var(--shadow-teal),
    0 12px 24px var(--shadow-sm);
  padding: 20px;
  position: relative;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 18px 24px;
  background: var(--teal);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 18px; font-weight: 600;
  border: none; border-radius: var(--r-md);
  cursor: pointer;
  box-shadow: 0 6px 0 var(--teal-dark), 0 8px 20px rgba(13,148,136,0.3);
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
.btn-primary:hover { background: var(--teal-light); }
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--teal-dark), 0 4px 8px rgba(13,148,136,0.2);
}
.btn-primary:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 20px;
  background: transparent;
  color: var(--teal);
  font-family: 'Nunito', sans-serif;
  font-size: 16px; font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  touch-action: manipulation;
}
.btn-ghost:hover { background: var(--teal-pale); border-color: var(--teal); }
.btn-ghost:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

.btn-sm { padding: 10px 16px; font-size: 14px; border-radius: var(--r-sm); }

.btn-back {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 2px solid var(--border);
  border-radius: 50%; cursor: pointer; color: var(--teal);
  box-shadow: 0 4px 0 var(--shadow-teal);
  align-self: flex-start;
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.btn-back:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--shadow-teal); }
.btn-back:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.btn-hint {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--orange-light); border: 2px solid #FDBA74;
  color: var(--orange-dark);
  font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #FDBA74;
  transition: transform 0.12s, box-shadow 0.12s;
  touch-action: manipulation;
}
.btn-hint:active { transform: translateY(2px); box-shadow: none; }
.btn-hint:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.btn-full { width: 100%; }

/* ── TYPOGRAPHY ──────────────────────────────────────────── */
h1, h2, h3, .app-title, .screen-title { font-family: 'Fredoka', sans-serif; }

.screen-title {
  font-size: 28px; font-weight: 700;
  color: var(--fg); letter-spacing: -0.5px; line-height: 1.15;
}
.screen-sub {
  font-size: 16px; color: var(--fg-muted); line-height: 1.6;
  margin-top: -10px;
}

/* ── WELCOME SCREEN ─────────────────────────────────────── */
.welcome-inner {
  justify-content: center; min-height: 100dvh;
  padding-top: 48px; padding-bottom: 48px;
}

.welcome-top {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 12px;
}

.logo-mark { width: 72px; height: 72px; }

.app-title {
  font-size: 40px; font-weight: 700; letter-spacing: -1px;
  color: var(--fg); line-height: 1;
}

.app-tagline {
  font-size: 16px; color: var(--fg-muted); font-weight: 500;
}

.partner-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 100px;
  background: var(--teal-pale); border: 2px solid var(--border);
  font-size: 14px; font-weight: 700; color: var(--teal);
}

.how-card {
  display: flex; flex-direction: column; gap: 12px;
}
.how-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 20px; font-weight: 600; color: var(--fg);
}
.step-item {
  display: flex; align-items: flex-start; gap: 14px;
}
.step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: #fff;
  font-family: 'Fredoka', sans-serif; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--teal-dark);
}
.step-text { font-size: 15px; color: var(--fg); line-height: 1.5; padding-top: 5px; }

.welcome-meta {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.meta-pill {
  padding: 6px 14px; border-radius: 100px;
  background: var(--card); border: 2px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--fg-muted);
}

/* ── SETUP SCREEN ───────────────────────────────────────── */
.setup-header { display: flex; flex-direction: column; gap: 6px; }

.setup-form { display: flex; flex-direction: column; gap: 8px; }

.field-group { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 700; color: var(--fg);
}

.field-input {
  width: 100%; padding: 16px 18px;
  background: var(--card);
  border: 2.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif; font-size: 17px; color: var(--fg);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.field-input::placeholder { color: var(--fg-light); }
.field-input:focus {
  border-color: var(--teal);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.04), 0 0 0 4px rgba(13,148,136,0.15);
}

.partner-divider {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0;
}
.partner-divider span { flex: 1; height: 2px; background: var(--border); border-radius: 1px; }

.ipa-explainer {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--teal-mist); border-color: var(--border);
  box-shadow: 0 4px 0 var(--shadow-teal), 0 6px 16px var(--shadow-sm);
}
.explainer-icon { flex-shrink: 0; margin-top: 2px; }
.explainer-title { font-size: 15px; font-weight: 700; color: var(--fg); margin-bottom: 4px; }
.explainer-body { font-size: 14px; color: var(--fg-muted); line-height: 1.6; }

/* ── TUTORIAL SCREEN ────────────────────────────────────── */
.ipa-examples {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ipa-ex-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
  box-shadow: 0 4px 0 var(--shadow-teal);
}
.ipa-symbol {
  font-size: 28px; font-weight: 700; color: var(--teal);
  font-family: 'Fredoka', sans-serif; min-width: 36px; text-align: center;
}
.ipa-ex-label { font-size: 11px; font-weight: 700; color: var(--fg-light); text-transform: uppercase; letter-spacing: 0.5px; }
.ipa-ex-word { font-size: 14px; color: var(--fg); line-height: 1.4; }

.tutorial-tip {
  display: flex; gap: 12px; align-items: flex-start;
  background: #FFF7ED; border-color: #FED7AA;
  box-shadow: 0 4px 0 rgba(234,88,12,0.2), 0 6px 16px var(--shadow-sm);
}
.tutorial-tip svg { flex-shrink: 0; margin-top: 1px; }
.tutorial-tip p { font-size: 14px; color: #7C2D12; line-height: 1.6; }

.tutorial-actions {
  display: flex; gap: 12px; align-items: center;
}
.tutorial-actions .btn-ghost { flex: 0 0 auto; width: auto; padding: 14px 20px; }
.tutorial-actions .btn-primary { flex: 1; }

/* ── ACTIVITY SCREEN ────────────────────────────────────── */
.activity-layout {
  display: flex; flex-direction: column; height: 100dvh;
}

.activity-header {
  flex-shrink: 0;
  background: var(--card); border-bottom: 2px solid var(--border-light);
  padding: 14px 20px 10px;
  box-shadow: 0 2px 12px var(--shadow-sm);
}

.progress-info {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.lang-num {
  font-family: 'Fredoka', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--fg-light); text-transform: uppercase; letter-spacing: 1px;
}
.lang-name-header {
  font-family: 'Fredoka', sans-serif; font-size: 17px; font-weight: 700;
  color: var(--fg);
}

.progress-bar-wrap {
  height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-light));
  border-radius: 4px;
  transition: width 0.5s var(--ease-out);
}

.turn-indicator {
  font-size: 13px; font-weight: 700; color: var(--orange);
  min-height: 18px;
}

.activity-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
  -webkit-overflow-scrolling: touch;
  max-width: 480px; width: 100%; margin: 0 auto;
}

.lang-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px;
  box-shadow: 0 6px 0 var(--shadow-teal), 0 10px 20px var(--shadow-sm);
}
.lang-flag { font-size: 38px; line-height: 1; flex-shrink: 0; }
.lang-info { flex: 1; }
.lang-title { font-size: 22px; font-weight: 700; color: var(--fg); line-height: 1.2; }
.lang-region { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.lang-stats { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.stat-pill {
  padding: 4px 10px; border-radius: 100px;
  background: var(--teal-pale); border: 1.5px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--teal);
}
.status-pill { background: #FFF7ED; border-color: #FED7AA; color: var(--orange-dark); }

.activity-prompt {
  font-size: 15px; color: var(--fg-muted); line-height: 1.6;
  font-style: italic; padding: 0 2px;
}

/* Audio player */
.audio-player {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  box-shadow: 0 6px 0 var(--shadow-teal), 0 10px 20px var(--shadow-sm);
}
.play-btn {
  flex-shrink: 0;
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 var(--teal-dark), 0 8px 20px rgba(13,148,136,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.play-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--teal-dark), 0 3px 8px rgba(13,148,136,0.2); }
.play-btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.play-btn.playing { background: linear-gradient(135deg, var(--orange), #F97316); box-shadow: 0 5px 0 var(--orange-dark), 0 8px 20px rgba(234,88,12,0.4); }

.audio-info { flex: 1; min-width: 0; }
.waveform { width: 100%; height: 40px; border-radius: 6px; }

.audio-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px;
}
.audio-time { font-size: 13px; font-weight: 700; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.replay-count { font-size: 12px; color: var(--fg-light); }

.replay-btn {
  flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--teal-pale); border: 2px solid var(--border);
  color: var(--teal); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
  touch-action: manipulation;
}
.replay-btn:hover { background: var(--teal-pale); }
.replay-btn:active { transform: rotate(-180deg) scale(0.95); }
.replay-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.replay-btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.demo-note {
  font-size: 12px; color: var(--fg-light); text-align: center;
  font-style: italic; margin-top: -8px;
}

/* Transcription */
.transcribe-section { display: flex; flex-direction: column; gap: 10px; }

.transcribe-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 700; color: var(--fg);
}

.transcription-input {
  width: 100%; padding: 16px 18px;
  background: var(--card);
  border: 2.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif; font-size: 20px; font-weight: 600;
  color: var(--fg); line-height: 1.5;
  resize: none;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04), 0 4px 0 var(--shadow-teal);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  min-height: 90px;
}
.transcription-input::placeholder { color: var(--fg-light); font-size: 15px; font-weight: 400; }
.transcription-input:focus {
  border-color: var(--teal);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04), 0 4px 0 var(--shadow-teal), 0 0 0 4px rgba(13,148,136,0.15);
}

.input-hint { font-size: 12px; color: var(--fg-light); }

.transcribe-actions { display: flex; gap: 10px; align-items: center; }

/* IPA Keyboard */
.ipa-keyboard {
  flex-shrink: 0;
  background: var(--card);
  border-top: 2px solid var(--border-light);
  border-radius: 0;
  box-shadow: 0 -4px 12px var(--shadow-sm);
  overflow: hidden;
  /* key-grid scrolls horizontally on small screens */
}

.ipa-keyboard-header {
  padding: 12px 14px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.ipa-keyboard-title {
  font-family: 'Fredoka', sans-serif; font-size: 15px; font-weight: 600;
  color: var(--fg-muted);
}

.ipa-tabs {
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 2px solid var(--border-light);
  margin: 0 -14px; padding: 0 14px;
}
.ipa-tabs::-webkit-scrollbar { display: none; }

.ipa-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  background: none; border: none; border-bottom: 3px solid transparent;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--fg-light); cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap; touch-action: manipulation;
  margin-bottom: -2px;
}
.ipa-tab:hover { color: var(--teal); }
.ipa-tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.ipa-tab:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }

.ipa-key-grid {
  display: flex; flex-wrap: nowrap; gap: 6px;
  padding: 10px 14px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ipa-key-grid::-webkit-scrollbar { display: none; }

.ipa-key {
  min-width: 42px; height: 44px; padding: 0 10px;
  background: var(--teal-mist); border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-family: 'Noto Sans', 'Charis SIL', 'Doulos SIL', sans-serif; font-size: 18px; font-weight: 700;
  color: var(--fg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
  touch-action: manipulation;
  position: relative;
}
.ipa-key:hover { background: var(--teal-pale); border-color: var(--teal); }
.ipa-key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.ipa-key:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }

/* Tooltip on hover */
.ipa-key[data-desc]::after {
  content: attr(data-desc);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--fg); color: #fff;
  font-size: 11px; font-weight: 600; font-family: 'Nunito', sans-serif;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s; z-index: 10;
}
.ipa-key[data-desc]:hover::after { opacity: 1; }

.ipa-backspace {
  display: flex; align-items: center; gap: 6px;
  width: calc(100% - 28px); margin: 0 14px 14px;
  padding: 11px; border-radius: var(--r-sm);
  background: #FEF2F2; border: 2px solid #FECACA;
  color: #DC2626; font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; justify-content: center;
  box-shadow: 0 3px 0 #FECACA;
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
}
.ipa-backspace:active { transform: translateY(2px); box-shadow: none; }
.ipa-backspace:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Activity footer */
.activity-footer {
  flex-shrink: 0; padding: 14px 20px;
  background: var(--card); border-top: 2px solid var(--border-light);
  box-shadow: 0 -4px 12px var(--shadow-sm);
  max-width: 480px; width: 100%; margin: 0 auto;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(19,78,74,0.4);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 20px;
  animation: fadeInOverlay 0.2s ease;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeInOverlay {
  from { opacity: 0; } to { opacity: 1; }
}

.modal-card {
  background: var(--card); border-radius: var(--r-lg);
  border: 2px solid var(--border);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.15), 0 8px 0 var(--shadow-teal);
  padding: 28px 24px;
  width: 100%; max-width: 440px;
  position: relative;
  animation: slideUpModal 0.3s var(--ease);
}
@keyframes slideUpModal {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--border-light); border: none; cursor: pointer;
  color: var(--fg-muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:focus-visible { outline: 3px solid var(--orange); }
.modal-icon { font-size: 32px; margin-bottom: 8px; }
.modal-title { font-family: 'Fredoka', sans-serif; font-size: 22px; font-weight: 700; color: var(--fg); margin-bottom: 10px; }
.modal-body { font-size: 15px; color: var(--fg-muted); line-height: 1.7; }
.modal-ipa {
  margin-top: 14px; padding: 12px 16px;
  background: var(--teal-pale); border-radius: var(--r-sm);
  font-size: 22px; font-weight: 700; color: var(--teal); letter-spacing: 2px;
}

/* ── COMPARE SCREEN ─────────────────────────────────────── */
.compare-title { font-size: 24px; }

.compare-grid {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.compare-card {
  width: 100%;
  box-shadow: 0 5px 0 var(--shadow-teal), 0 8px 16px var(--shadow-sm);
}
.compare-name {
  font-size: 13px; font-weight: 700; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 10px;
}
.compare-transcription {
  font-size: 26px; font-weight: 700; color: var(--fg);
  letter-spacing: 2px; line-height: 1.4; word-break: break-all;
  min-height: 40px;
}
.compare-transcription:empty::before { content: '(nothing written)'; color: var(--fg-light); font-size: 16px; font-weight: 400; font-style: italic; }

.compare-vs {
  font-family: 'Fredoka', sans-serif; font-size: 16px; font-weight: 600;
  color: var(--fg-light); letter-spacing: 1px;
}

.answer-reveal {
  text-align: center;
  background: linear-gradient(135deg, var(--teal-pale), #fff);
  border-color: var(--teal); border-width: 2px;
  box-shadow: 0 6px 0 var(--shadow-teal), 0 10px 20px var(--shadow-sm);
}
.answer-label { font-size: 13px; font-weight: 700; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.answer-ipa { font-size: 30px; font-weight: 700; color: var(--teal); letter-spacing: 3px; margin-bottom: 6px; }
.answer-word { font-size: 15px; color: var(--fg-muted); }

.fact-card {
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 5px 0 var(--shadow-teal), 0 8px 16px var(--shadow-sm);
}
.fact-icon { margin-bottom: 2px; }
.fact-title { font-family: 'Fredoka', sans-serif; font-size: 17px; font-weight: 700; color: var(--fg); }
.fact-body { font-size: 14px; color: var(--fg-muted); line-height: 1.7; }
.fact-link { font-size: 13px; font-weight: 700; color: var(--teal); text-decoration: none; }
.fact-link:hover { text-decoration: underline; }

/* ── COMPLETE SCREEN ────────────────────────────────────── */
.complete-inner { justify-content: flex-start; min-height: 100dvh; padding-top: 40px; }

.complete-celebration {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.confetti-piece {
  position: absolute; width: 10px; height: 10px; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.complete-top {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 12px; position: relative; z-index: 1;
}
.complete-icon {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-pale), #fff);
  border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 0 var(--shadow-teal), 0 10px 24px var(--shadow-sm);
  animation: bounceIn 0.5s var(--ease) 0.2s both;
}
@keyframes bounceIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.complete-title { font-size: 34px; font-weight: 700; color: var(--fg); }
.complete-sub { font-size: 16px; color: var(--fg-muted); }

.complete-summary {
  display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1;
}
.summary-item {
  background: var(--card); border: 2px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: 0 4px 0 var(--shadow-teal), 0 6px 14px var(--shadow-sm);
  padding: 16px 18px;
}
.summary-lang { font-family: 'Fredoka', sans-serif; font-size: 15px; font-weight: 700; color: var(--teal); margin-bottom: 10px; }
.summary-pair { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.summary-name { font-size: 12px; font-weight: 700; color: var(--fg-muted); min-width: 60px; }
.summary-trans { font-size: 16px; font-weight: 700; color: var(--fg); letter-spacing: 1px; }

.complete-message {
  background: linear-gradient(135deg, var(--teal-pale), #fff);
  border-color: var(--teal); position: relative; z-index: 1;
  box-shadow: 0 6px 0 var(--shadow-teal), 0 10px 20px var(--shadow-sm);
}
.complete-msg-text { font-size: 15px; color: var(--fg); line-height: 1.75; }

.complete-actions {
  display: flex; gap: 12px; position: relative; z-index: 1;
}
.complete-actions .btn-ghost { flex: 0 0 auto; width: auto; }
.complete-actions .btn-primary { flex: 1; }

.copy-confirm {
  text-align: center; font-size: 14px; font-weight: 700;
  color: var(--teal); min-height: 20px;
  position: relative; z-index: 1;
}

/* ── ACCESSIBILITY / REDUCED MOTION ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── IPA TEXTAREA FONT ───────────────────────────────────────── */
.transcription-input {
  font-family: 'Noto Sans', 'Charis SIL', 'Doulos SIL', 'Noto Serif', 'Nunito', sans-serif;
}

/* ── DB STATUS ───────────────────────────────────────────────── */
.db-status {
  text-align: center; font-size: 13px; font-weight: 600;
  color: var(--teal); min-height: 18px;
  position: relative; z-index: 1;
}

/* ── TUTORIAL ────────────────────────────────────────────────── */
.tutorial-inner { padding-bottom: 60px; }
.tutorial-header { display: flex; flex-direction: column; gap: 6px; }

.tutorial-concept,
.tutorial-section {
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 5px 0 var(--shadow-teal), 0 8px 16px var(--shadow-sm);
}

.tutorial-concept-title,
.tutorial-section-title {
  display: flex; align-items: center; gap: 7px;
  font-family: 'Fredoka', sans-serif; font-size: 17px; font-weight: 700;
  color: var(--fg);
}

.tutorial-concept-body,
.tutorial-section-body {
  font-size: 14px; color: var(--fg-muted); line-height: 1.7;
}

.tutorial-notation {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.notation-pill {
  padding: 5px 12px; border-radius: 100px;
  background: var(--teal-pale); border: 1.5px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--teal);
  font-family: 'Noto Sans', monospace;
}

.vowel-grid { display: flex; flex-direction: column; gap: 6px; }
.vowel-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vowel-zone {
  font-size: 11px; font-weight: 700; color: var(--fg-light);
  text-transform: uppercase; letter-spacing: 0.5px;
  min-width: 54px; flex-shrink: 0;
}
.vowel-demo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--teal-mist); border: 1.5px solid var(--border);
  font-size: 13px; color: var(--fg-muted);
}
.vowel-demo em { font-style: normal; }

.ipa-sym {
  font-family: 'Noto Sans', 'Charis SIL', sans-serif;
  font-size: 17px; font-weight: 700; color: var(--teal);
}

.consonant-pairs { display: flex; flex-direction: column; gap: 6px; }
.cons-pair { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cons-place {
  font-size: 12px; font-weight: 700; color: var(--fg-light);
  min-width: 110px; flex-shrink: 0;
}
.cons-demo { font-size: 14px; color: var(--fg-muted); }
.cons-demo em { font-style: normal; }

.diacritic-list { display: flex; flex-direction: column; gap: 8px; }
.dia-item {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 14px; color: var(--fg-muted); line-height: 1.5;
}
.dia-item .ipa-sym { flex-shrink: 0; min-width: 36px; font-size: 16px; }

.tutorial-clicks {
  background: #FFF7ED; border-color: #FED7AA;
  box-shadow: 0 5px 0 rgba(234,88,12,0.15), 0 8px 16px var(--shadow-sm);
}
.tutorial-clicks .tutorial-section-title { color: var(--orange-dark); }
.click-demos { display: flex; flex-direction: column; gap: 8px; }
.click-item {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 14px; color: #7C2D12; line-height: 1.5;
}
.click-item .ipa-sym { flex-shrink: 0; min-width: 28px; color: var(--orange); font-size: 18px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (min-width: 480px) {
  .screen-inner { padding: 32px 28px 48px; }
  .activity-scroll { padding: 20px 28px 28px; }
  .activity-header { padding: 16px 28px 12px; }
  .activity-footer { padding: 16px 28px; }
}

@media (max-width: 360px) {
  .ipa-examples { grid-template-columns: 1fr; }
  .app-title { font-size: 32px; }
  .btn-primary { font-size: 16px; padding: 15px 20px; }
  .ipa-key { min-width: 38px; height: 40px; font-size: 16px; }
}
