@font-face{font-family:"Noto Sans Thai";src:url("/assets/fonts/noto-sans-thai.woff2") format("woff2");font-style:normal;font-weight:400 700;font-display:swap;unicode-range:U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC}
@font-face{font-family:"Noto Sans Thai";src:url("/assets/fonts/noto-sans-thai-latin.woff2") format("woff2");font-style:normal;font-weight:400 700;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* ═══════════════════════════════════════════════════════════════
   AUDIKUNG NORTH STAR — ALL-ROUNDER ENGLISH OS
   Duolingo Gamification Engine × Prestige Cosmic Aesthetic
   ═══════════════════════════════════════════════════════════════ */
:root {
  color-scheme: dark;
  --bg: #030712;
  --surface: #090f20;
  --surface-card: rgba(13, 22, 42, 0.82);
  --surface-raised: rgba(20, 34, 64, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --ink: #f0f0f5;
  --ink-soft: #a3a3b8;
  --muted: #72768d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-gold: rgba(247, 197, 72, 0.35);

  /* Audikung Brand Accents */
  --gold: #F7C548;
  --gold-light: #ffd76b;
  --gold-glow: rgba(247, 197, 72, 0.45);
  --gold-dim: rgba(247, 197, 72, 0.12);
  --gold-shadow: #8d6210;

  --shrimp: #ff6a4d;
  --shrimp-glow: rgba(255, 106, 77, 0.45);
  --shrimp-dim: rgba(255, 106, 77, 0.12);
  --orange: #FF8C42;
  --orange-shadow: #7a3a0e;

  --blue: #6aa9e8;
  --blue-shadow: #194677;
  --blue-dim: rgba(106, 169, 232, 0.12);

  --green: #4DD2A0;
  --green-dark: #ffd76b;
  --green-shadow: #185f43;
  --green-soft: rgba(77, 210, 160, 0.1);

  --red: #f0857a;
  --red-shadow: #731b1b;
  --red-dim: rgba(240, 133, 122, 0.12);

  --focus: #ffd76b;
  --font-en-display: "Outfit", "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-en-body: "Plus Jakarta Sans", "Outfit", system-ui, -apple-system, sans-serif;
  --sans: "Plus Jakarta Sans", "Noto Sans Thai", "Sarabun", sans-serif;
  --display: "Outfit", "Mitr", "Noto Sans Thai", sans-serif;
  --ease-pop: cubic-bezier(.2, .9, .3, 1.35);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: clip;
  background: radial-gradient(ellipse at 50% -12%, rgba(247, 197, 72, 0.14) 0%, rgba(255, 106, 77, 0.07) 32%, #030712 68%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: radial-gradient(rgba(247, 197, 72, 0.22) .65px, transparent .75px);
  background-size: 28px 28px;
  content: "";
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
  opacity: .5;
  pointer-events: none;
}

.shrimp-wm {
  position: fixed;
  right: -30px;
  bottom: -40px;
  font-size: 240px;
  opacity: 0.04;
  transform: rotate(-12deg);
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

::selection {
  background: var(--gold);
  color: #030712;
}

button, input { font: inherit; }
button { min-height: 44px; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
button:disabled {
  cursor: not-allowed;
  filter: grayscale(.65);
  opacity: .45;
}
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 30;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--gold);
  color: #030712;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}
.skip-link:focus { transform: translateY(0); }

/* ── SHELL CONTAINER ── */
.vocab-shell {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 96px 0 100px;
  position: relative;
  z-index: 1;
}

/* ── WORKSPACE HEADER (HERO WITH KUNG-KI MASCOT) ── */
.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .74fr);
  gap: clamp(32px, 6vw, 76px);
  align-items: center;
  margin-bottom: 28px;
}

.workspace-hero-brand {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hero-pixel-badge {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  padding: 3px;
  background: radial-gradient(circle at 35% 35%, rgba(247, 197, 72, 0.4), rgba(13, 22, 42, 0.95) 75%);
  border: 2px solid rgba(247, 197, 72, 0.5);
  box-shadow: 0 0 28px rgba(247, 197, 72, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#heroPixelCanvas,
.hero-pixel-img {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7));
  animation: hero-head-bob 3.2s ease-in-out infinite;
  transform-origin: center bottom;
  transition: transform 220ms var(--ease-pop);
}

@keyframes hero-head-bob {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  35% { transform: translateY(-3px) scale(1.04, 0.98) rotate(-2.5deg); }
  70% { transform: translateY(-1px) scale(0.98, 1.02) rotate(2.5deg); }
}

.hero-pixel-badge:hover .hero-pixel-img {
  transform: scale(1.15) rotate(5deg);
}

.mascot-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px dashed rgba(247, 197, 72, 0.6);
  pointer-events: none;
  animation: ring-spin 18s linear infinite;
}

@keyframes ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(247, 197, 72, 0.1);
  border: 1px solid rgba(247, 197, 72, 0.3);
  margin-bottom: 6px;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--shrimp);
  box-shadow: 0 0 8px var(--shrimp);
}

.eyebrow, .sheet-kicker, .quest-kicker, .challenge-label {
  color: var(--gold-light);
  font-family: var(--display);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.workspace-title h1 {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 4.6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: .98;
  color: #fff;
  text-shadow: 0 0 28px rgba(247, 197, 72, 0.25);
  text-wrap: balance;
}

.workspace-title p {
  max-width: 58ch;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: .98rem;
  line-height: 1.65;
  text-wrap: pretty;
}

/* ── PLAYER STATUS HUD (GAMIFIED STATS) ── */
.player-hud {
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 5px solid #cfbf9f;
  border-radius: 26px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 55%, #f6efe0 100%);
  color: #111827;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.65),
    0 0 36px rgba(245, 158, 11, 0.12),
    inset 0 1px 0 #ffffff,
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hud-stat {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 18px 14px;
  border-right: 1px solid #e5dcc7;
}
.hud-stat:last-child { border-right: 0; }
.hud-stat > span {
  font-size: 1.45rem;
  filter: drop-shadow(0 2px 6px rgba(217, 119, 6, 0.25));
}
.hud-stat div, .hud-stat strong, .hud-stat small {
  display: block;
  min-width: 0;
}
.hud-stat strong {
  font-family: var(--font-en-display);
  font-size: 1.25rem;
  color: #111827;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.hud-stat small {
  margin-top: 3px;
  color: #6b7280;
  font-size: .68rem;
  white-space: nowrap;
}

.hud-goal {
  padding: 14px 18px 16px;
  border-top: 1.5px solid #e5dcc7;
  background: rgba(241, 235, 217, 0.45);
}
.hud-goal > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #4b5563;
  font-size: .78rem;
}
.hud-goal strong {
  color: #92400e;
  font-family: var(--font-en-display);
  font-variant-numeric: tabular-nums;
}
.hud-goal-track {
  height: 10px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2d7c0;
}
.hud-goal-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 480ms var(--ease-pop);
}

/* ── 3D TACTILE TABS & CAROUSEL NAVIGATION ── */
.workspace-tabs-wrapper {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  width: 100%;
  gap: 8px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 6px 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.workspace-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 4px 2px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  flex: 1 1 0;
  min-width: 0;
}
.workspace-tabs.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}
.workspace-tabs::-webkit-scrollbar { display: none; }

/* Left & Right Smooth Scroll Chevrons */
.tabs-scroll-btn {
  position: relative;
  z-index: 3;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fef3c7;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.tabs-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(245, 158, 11, 0.6);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 14px rgba(245, 158, 11, 0.3);
}
.tabs-scroll-btn:active {
  transform: translateY(1px) scale(0.96);
}
.tabs-scroll-btn[hidden] {
  display: none !important;
}

/* Base Tab Styling: Luminous Frosted Capsule — ชัดเจน คอนทราสต์สูง อ่านง่าย สบายตา */
.workspace-tab {
  flex: 0 0 auto;
  min-width: 136px;
  min-height: 44px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-bottom: 3.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  padding: 8px 18px 6px;
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  cursor: pointer;
  font-family: var(--font-en-display);
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .01em;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.workspace-tab:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  border-bottom-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.workspace-tab:active {
  border-bottom-width: 1.5px;
  transform: translateY(2px) scale(0.98);
}

.workspace-tab[data-panel="review"]:hover { border-color: rgba(245, 158, 11, 0.5); }
.workspace-tab[data-panel="phrasal"]:hover { border-color: rgba(168, 85, 247, 0.5); }
.workspace-tab[data-panel="speaking"]:hover { border-color: rgba(14, 165, 233, 0.5); }
.workspace-tab[data-panel="shadowing"]:hover { border-color: rgba(20, 184, 166, 0.5); }
.workspace-tab[data-panel="grammar"]:hover { border-color: rgba(16, 185, 129, 0.5); }
.workspace-tab[data-panel="writing"]:hover { border-color: rgba(249, 115, 22, 0.5); }
.workspace-tab[data-panel="library"]:hover { border-color: rgba(234, 179, 8, 0.5); }
.workspace-tab[data-panel="capture"]:hover { border-color: rgba(236, 72, 153, 0.5); }

/* Category Signature 3D Gamified Active States & Borders */
.workspace-tab[data-panel="review"][aria-selected="true"] {
  border: 1.5px solid #fde68a;
  border-bottom: 4px solid #b45309;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.55), 0 0 14px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="phrasal"][aria-selected="true"] {
  border: 1.5px solid #e9d5ff;
  border-bottom: 4px solid #6b21a8;
  background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.55), 0 0 14px rgba(168, 85, 247, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="speaking"][aria-selected="true"] {
  border: 1.5px solid #bae6fd;
  border-bottom: 4px solid #0369a1;
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.55), 0 0 14px rgba(14, 165, 233, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="shadowing"][aria-selected="true"] {
  border: 1.5px solid #99f6e4;
  border-bottom: 4px solid #0f766e;
  background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.55), 0 0 14px rgba(20, 184, 166, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="grammar"][aria-selected="true"] {
  border: 1.5px solid #a7f3d0;
  border-bottom: 4px solid #047857;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.55), 0 0 14px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="writing"][aria-selected="true"] {
  border: 1.5px solid #fed7aa;
  border-bottom: 4px solid #c2410c;
  background: linear-gradient(180deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.55), 0 0 14px rgba(249, 115, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="library"][aria-selected="true"] {
  border: 1.5px solid #fef08a;
  border-bottom: 4px solid #a16207;
  background: linear-gradient(180deg, #eab308 0%, #ca8a04 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(234, 179, 8, 0.55), 0 0 14px rgba(234, 179, 8, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-tab[data-panel="capture"][aria-selected="true"] {
  border: 1.5px solid #fbcfe8;
  border-bottom: 4px solid #be185d;
  background: linear-gradient(180deg, #ec4899 0%, #db2777 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.55), 0 0 14px rgba(236, 72, 153, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.workspace-panel { min-width: 0; }

/* ── REVIEW WORKSPACE LAYOUT ── */
.review-layout {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 46px);
  align-items: start;
}
.review-layout::before {
  content: "";
  position: absolute;
  inset: -60px -40px;
  background: radial-gradient(ellipse at 50% 30%, rgba(245, 158, 11, 0.09) 0%, rgba(217, 119, 6, 0.03) 50%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* ── SESSION LEDGER (LEFT PRESTIGE QUEST HUB) ── */
.session-ledger {
  position: sticky;
  top: 90px;
  z-index: 2;
  min-width: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 6px solid #cfbf9f;
  border-radius: 28px;
  padding: 24px 20px 20px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 55%, #f6efe0 100%);
  color: #111827;
  backdrop-filter: blur(14px);
  box-shadow:
    0 22px 55px rgba(0, 0, 0, 0.65),
    0 0 45px rgba(245, 158, 11, 0.12),
    inset 0 1px 0 #ffffff,
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* ── 16-BIT KUNG-KI PIXEL COMPANION STAGE ── */
.pixel-companion-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: -6px 0 18px;
  position: relative;
  text-align: center;
}

.pixel-speech-bubble {
  position: relative;
  z-index: 3;
  margin-bottom: 12px;
  padding: 9px 18px;
  border: 1.5px solid #e2d7c0;
  border-radius: 18px;
  background: #ffffff;
  color: #111827;
  font-family: var(--font-en-display);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), inset 0 1px 0 #ffffff;
  max-width: 220px;
  text-align: center;
  transition: transform 200ms var(--ease-pop);
}

.pixel-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #e2d7c0;
}

.pixel-speech-bubble.is-pop {
  animation: bubble-pop 340ms var(--ease-pop) both;
}

@keyframes bubble-pop {
  0% { transform: scale(0.85) translateY(4px); opacity: 0; }
  60% { transform: scale(1.08) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.pixel-companion-avatar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  padding: 4px;
  border-radius: 20px;
  transition: transform 220ms var(--ease-pop);
}

.pixel-companion-avatar:hover {
  transform: scale(1.08) translateY(-4px);
}

.pixel-companion-avatar:active {
  transform: scale(0.96) translateY(2px);
}

#pixelMascotCanvas,
.pixel-mascot-img {
  display: block;
  width: 130px;
  height: 130px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 18px rgba(247, 197, 72, 0.32));
  animation: pixel-mascot-idle 2.6s ease-in-out infinite;
  transform-origin: center bottom;
  user-select: none;
  pointer-events: none;
}

/* Pose-specific living motions */
.pixel-companion-avatar.pose-idle .pixel-mascot-img {
  animation: pixel-mascot-idle 2.6s ease-in-out infinite;
}

.pixel-companion-avatar.pose-study .pixel-mascot-img {
  animation: pixel-mascot-study 2.8s ease-in-out infinite;
}

.pixel-companion-avatar.pose-cheer .pixel-mascot-img {
  animation: pixel-mascot-cheer 1.35s ease-in-out infinite;
}

.pixel-companion-avatar.pose-encourage .pixel-mascot-img {
  animation: pixel-mascot-encourage 2.2s ease-in-out infinite;
}

.pixel-companion-avatar.pose-victory .pixel-mascot-img {
  animation: pixel-mascot-victory 1.6s ease-in-out infinite;
}

@keyframes pixel-mascot-idle {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  30% { transform: translateY(-7px) scale(1.02, 0.98) rotate(-1.5deg); }
  70% { transform: translateY(-2px) scale(0.99, 1.01) rotate(1.5deg); }
}

@keyframes pixel-mascot-study {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  40% { transform: translateY(-5px) scale(1.02, 0.98) rotate(-2deg); }
  75% { transform: translateY(-1px) scale(0.99, 1.01) rotate(1deg); }
}

@keyframes pixel-mascot-cheer {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  25% { transform: translateY(-14px) scale(1.06, 0.94) rotate(-4deg); }
  50% { transform: translateY(0) scale(0.95, 1.05) rotate(0deg); }
  75% { transform: translateY(-9px) scale(1.03, 0.97) rotate(4deg); }
}

@keyframes pixel-mascot-encourage {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  30% { transform: translateY(-8px) scale(1.04, 0.96) rotate(2.5deg); }
  70% { transform: translateY(-2px) scale(0.98, 1.02) rotate(-1deg); }
}

@keyframes pixel-mascot-victory {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  25% { transform: translateY(-11px) scale(1.06, 0.94) rotate(4.5deg); }
  50% { transform: translateY(0) scale(0.96, 1.04) rotate(0deg); }
  75% { transform: translateY(-11px) scale(1.06, 0.94) rotate(-4.5deg); }
}

.pixel-companion-avatar.is-active-pose .pixel-mascot-img {
  animation: mascot-pose-pop 420ms var(--ease-pop) forwards;
}

@keyframes mascot-pose-pop {
  0% { transform: scale(0.85); }
  40% { transform: scale(1.16) translateY(-12px) rotate(-3deg); }
  75% { transform: scale(0.96) translateY(2px) rotate(2deg); }
  100% { transform: scale(1) translateY(0) rotate(0deg); }
}

.pixel-shadow {
  width: 54px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, transparent 72%);
  margin-top: 2px;
  animation: shadow-pulse 2.4s ease-in-out infinite;
}

@keyframes shadow-pulse {
  0%, 100% { transform: scaleX(1); opacity: 0.7; }
  50% { transform: scaleX(0.72); opacity: 0.3; }
}

.pixel-controls {
  margin-top: 8px;
}

.pixel-pose-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 14px;
  border: 1.5px solid #d8cdb7;
  border-bottom: 3px solid #bdae95;
  border-radius: 9999px;
  background: #fbf6ec;
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: filter 140ms ease, transform 140ms ease, background 140ms ease;
}

.pixel-pose-btn:hover {
  background: #f1ebd9;
  color: #78350f;
  transform: translateY(-2px);
}

.pixel-pose-btn:active {
  border-bottom-width: 1px;
  transform: translateY(2px) scale(0.98);
}

.pixel-spark-icon {
  font-size: 0.95rem;
}

.quest-kicker {
  margin: 0;
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.session-ledger h2 {
  margin: 3px 0 0;
  font-family: var(--font-en-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: #111827;
}

.quest-copy {
  margin: 8px 0 16px;
  color: #4b5563;
  font-size: .84rem;
  line-height: 1.55;
}

.session-vitals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.session-vitals span {
  padding: 6px 12px;
  border-radius: 12px;
  background: #f1ebd9;
  border: 1px solid #d8cdb7;
  border-bottom: 2px solid #cfbf9f;
  color: #374151;
  font-size: .74rem;
  font-weight: 700;
}
.session-vitals strong {
  color: #111827;
  font-family: var(--font-en-display);
  font-variant-numeric: tabular-nums;
}

.ledger-list {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1.5px solid #e5dcc7;
}
.ledger-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid #eadecb;
}
.ledger-line dt {
  color: #374151;
  font-size: .8rem;
  font-weight: 600;
}
.ledger-line dd {
  margin: 0;
  color: #111827;
  font-family: var(--font-en-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ledger-note {
  margin: 16px 0 10px;
  color: #374151;
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.55;
}

.session-ledger .text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: #f1ebd9;
  border: 1.5px solid #d8cdb7;
  border-bottom: 4px solid #bdae95;
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: filter 140ms ease, transform 140ms ease, background 140ms ease;
}
.session-ledger .text-action:hover {
  background: #ece4cd;
  color: #78350f;
  transform: translateY(-2px);
}
.session-ledger .text-action:active {
  border-bottom-width: 1.5px;
  transform: translateY(2px);
}

.text-action, .undo-button, .quiet-button {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--gold-light);
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(247, 197, 72, 0.4);
  text-underline-offset: 5px;
  transition: color 140ms ease;
}
.text-action:hover, .undo-button:hover, .quiet-button:hover {
  color: #fff;
}

/* ── REVIEW STAGE & PATH ── */
.review-stage {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.session-progress { margin: 0 4px 18px; }
.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: .82rem;
}
.progress-copy strong {
  color: var(--gold-light);
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.progress-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--gold), var(--green));
  box-shadow: 0 0 16px rgba(247, 197, 72, 0.4);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 520ms var(--ease-pop);
}

.lesson-path {
  display: flex;
  justify-content: space-between;
  margin: -9px 6px 0;
}
.lesson-path span {
  width: 8px;
  height: 8px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: #252e46;
  box-shadow: 0 0 0 1px #252e46;
  transition: background 220ms ease, transform 220ms var(--ease-pop);
}
.lesson-path span.is-complete {
  background: #fff;
  box-shadow: 0 0 0 1px var(--gold);
}
.lesson-path span.is-current {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-shadow), 0 0 10px var(--gold);
  transform: scale(1.45);
}

/* ── THE CITATION SLIP (PRESTIGE CREAM FLASHCARD / TRADING CARD) ── */
.citation-slip {
  position: relative;
  height: clamp(480px, 62vh, 560px);
  max-height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 6px solid #cfbf9f;
  border-radius: 36px;
  padding: clamp(24px, 4vw, 38px);
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 55%, #f6efe0 100%);
  color: #111827;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.75),
    0 0 55px rgba(245, 158, 11, 0.15),
    0 0 110px rgba(251, 191, 36, 0.08),
    inset 0 1px 0 #ffffff,
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  scroll-margin-top: 96px;
  animation: card-appear 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.citation-slip.is-revealed {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* Custom sleek warm scrollbar for card */
.citation-slip::-webkit-scrollbar {
  width: 6px;
}
.citation-slip::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  margin: 12px;
}
.citation-slip::-webkit-scrollbar-thumb {
  background: #cfbf9f;
  border-radius: 999px;
}
.citation-slip::-webkit-scrollbar-thumb:hover {
  background: #b5a484;
}

@keyframes card-appear {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.citation-slip::before {
  content: none;
}
.citation-slip::after {
  position: absolute;
  right: -34px;
  bottom: -35px;
  width: 130px;
  height: 130px;
  border: 18px solid rgba(217, 119, 6, 0.04);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.slip-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #6b7280;
  font-size: .75rem;
  flex-shrink: 0;
}
.challenge-label {
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
}
.slip-position {
  padding: 5px 12px;
  border-radius: 10px;
  background: #f1ebd9;
  border: 1px solid #d8cdb7;
  color: #4b5563;
  font-family: var(--font-en-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.prompt-block {
  padding: 24px 0 20px;
  text-align: center;
  flex-shrink: 0;
}
.prompt-kicker {
  margin: 0 0 12px;
  color: #4b5563;
  font-family: var(--font-en-body);
  font-weight: 600;
  font-size: .95rem;
}
.word-line {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.review-word {
  margin: 0;
  overflow-wrap: anywhere;
  color: #111827;
  font-family: var(--font-en-display);
  font-size: clamp(3.2rem, 7.5vw, 5.2rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: .98;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  text-wrap: balance;
}

.sense-number, .part-of-speech {
  display: inline-block;
  border-radius: 8px;
  font-size: .74rem;
  font-weight: 700;
}
.sense-number {
  padding: 4px 10px;
  white-space: nowrap;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
}
.part-of-speech {
  margin-top: 10px;
  padding: 4px 12px;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  color: #0369a1;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.pronunciation-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  color: #4b5563;
}
.pronunciation-row span {
  overflow-wrap: anywhere;
  font-family: monospace;
  font-size: 1.05rem;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  place-items: center;
  border: 1.5px solid #c7d2fe;
  border-bottom: 4px solid #818cf8;
  border-radius: 12px;
  background: #eef2ff;
  color: #4338ca;
  cursor: pointer;
  transition: transform 140ms ease, border-bottom-width 140ms ease;
}
.icon-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.icon-button:active { border-bottom-width: 1px; transform: translateY(3px); }
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* ── 3D REVEAL BUTTON (CHUNKY DUOLINGO STYLE × SCULPTED PILL) ── */
.reveal-button, .primary-dark-button, .paper-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-bottom-width: 5px;
  border-radius: 9999px;
  padding: 12px 26px 10px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  transition: filter 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.reveal-button {
  position: relative;
  display: flex;
  width: min(390px, 100%);
  min-height: 68px;
  flex-direction: column;
  margin: 16px auto 8px;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2px solid #fcd34d;
  border-bottom: 6px solid #b45309;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(217, 119, 6, 0.35);
  overflow: hidden;
}
.reveal-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-150%) skewX(-20deg);
  animation: sheen-sweep 3.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen-sweep {
  0% { transform: translateX(-150%) skewX(-20deg); }
  22%, 100% { transform: translateX(350%) skewX(-20deg); }
}
.reveal-button span {
  position: relative;
  z-index: 1;
  font-size: 1.15rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.reveal-button small {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 600;
}
.reveal-button:hover, .primary-dark-button:hover, .paper-button:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}
.reveal-button:active, .primary-dark-button:active, .paper-button:active {
  border-bottom-width: 2px;
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2);
}

/* ── ANSWER PANEL (WARM LUXURY MINT/SAGE PARCHMENT INSET) ── */
.answer-panel {
  margin-top: 14px;
  border: 2px solid #bbf7d0;
  border-radius: 26px;
  padding: clamp(20px, 3.5vw, 30px);
  background: linear-gradient(175deg, #f0fdf4 0%, #ecfdf5 100%);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.08), inset 0 1px 0 #ffffff;
  animation: reveal-answer 380ms var(--ease-pop) both;
}
.answer-panel h3 {
  margin: 0 0 6px;
  color: #15803d;
  font-family: var(--display);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.definition-en {
  max-width: 44ch;
  margin: 0;
  font-family: var(--font-en-display);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  color: #0f172a;
  line-height: 1.34;
}
.definition-th {
  margin: 8px 0 0;
  color: #047857;
  font-family: 'Sarabun', var(--sans);
  font-size: 1.18rem;
  font-weight: 700;
}

.example-block {
  max-width: 68ch;
  margin-top: 18px;
  border-top: 1.5px dashed #cbd5e1;
  padding-top: 16px;
}
.example-block h3 {
  color: #0369a1;
}
.example-en {
  margin: 0;
  font-family: var(--font-en-body);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.6;
  color: #1e3a8a;
}
.example-th {
  margin: 6px 0 0;
  color: #475569;
  font-family: 'Sarabun', var(--sans);
  font-size: .92rem;
}
.usage-note {
  margin: 8px 0 0;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
  color: #92400e;
  font-size: .86rem;
}
.proof-note {
  margin: 16px 0 0;
  color: #2563eb;
  font-size: .82rem;
  font-weight: 600;
}

/* ── GAME FEEDBACK TOAST (FLOATS WITHOUT SHIFTING BUTTONS) ── */
.game-feedback {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 110px;
  z-index: 20;
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 14px;
  border: 1.5px solid #10b981;
  border-radius: 18px;
  padding: 8px 18px;
  background: rgba(16, 185, 129, 0.96);
  backdrop-filter: blur(8px);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: feedback-pop 320ms var(--ease-pop) both;
}
.game-feedback.is-miss {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.96);
  color: #ffffff;
}
.feedback-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: #ffffff;
  color: #10b981;
  font-size: 1.15rem;
  font-weight: 800;
}
.game-feedback.is-miss .feedback-icon {
  background: #ffffff;
  color: #ef4444;
}
.game-feedback div, .game-feedback strong, .game-feedback small { display: block; }
.game-feedback strong { font-family: var(--display); line-height: 1.2; font-size: 1.02rem; }
.game-feedback small { margin-top: 1px; color: #ffffff; opacity: .92; font-weight: 600; }

/* ── 16-BIT KUNG-KI COMBO PEEK-A-BOO POPUP ── */
.combo-peek-banner {
  position: absolute;
  right: 18px;
  bottom: 108px;
  z-index: 35;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
  cursor: pointer;
  transform: translateY(140%) scale(0.85);
  opacity: 0;
  transition: transform 380ms var(--ease-pop), opacity 300ms ease;
}

.combo-peek-banner.is-peeking {
  transform: translateY(0) scale(1);
  opacity: 1;
  animation: peek-wobble 2.2s ease-in-out;
}

@keyframes peek-wobble {
  0% { transform: translateY(120%) scale(0.8); opacity: 0; }
  18% { transform: translateY(-8px) scale(1.06) rotate(3deg); opacity: 1; }
  35% { transform: translateY(0) scale(1) rotate(-2deg); }
  75% { transform: translateY(-4px) scale(1.02) rotate(1deg); opacity: 1; }
  90% { transform: translateY(20px) scale(0.95); opacity: 0.8; }
  100% { transform: translateY(120%) scale(0.8); opacity: 0; }
}

.combo-peek-img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 12px rgba(247, 197, 72, 0.45));
  transform-origin: center bottom;
  animation: pixel-peek-bounce 1s ease-in-out infinite alternate;
}

@keyframes pixel-peek-bounce {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-6px) rotate(4deg); }
}

.combo-peek-bubble {
  background: #ffffff;
  border: 2px solid #f59e0b;
  border-bottom: 5px solid #d97706;
  border-radius: 18px;
  padding: 8px 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  min-width: 140px;
}

.combo-peek-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: #d97706;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.combo-peek-bubble strong {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.combo-peek-bubble small {
  font-size: 0.72rem;
  color: #4b5563;
  font-weight: 600;
}

/* ── 3D TACTILE RATING CONTROLS (THE DUOLINGO SCHEDULE BUTTONS) ── */
.rating-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.rating-button {
  min-width: 0;
  min-height: 84px;
  border: 2px solid #e2d8c3;
  border-bottom: 5px solid #cfc4ac;
  border-radius: 20px;
  padding: 12px 10px 10px;
  background: #fbf7ee;
  color: #1f2937;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.rating-button strong, .rating-button > span { display: block; }
.rating-button strong {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #111827;
  line-height: 1.2;
}

.rating-button > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 5px;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rating-button b {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
  color: #1f2937;
  font-size: 0.7rem;
  font-weight: 700;
}

.rating-button [data-schedule] {
  display: inline;
  font-weight: 700;
}

/* Disabled State: elegant neutral cream paper tile */
.rating-button:disabled {
  background: #ece5d6;
  border-color: #d8cebc;
  border-bottom-color: #bfb29c;
  color: #8c8270;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.78;
}
.rating-button:disabled strong { color: #6b6352; }
.rating-button:disabled > span { color: #8c8270; }
.rating-button:disabled b { background: rgba(0, 0, 0, 0.05); color: #8c8270; }

/* Enabled State Hover & Active tactile feedback */
.rating-button:not(:disabled):hover {
  filter: brightness(1.03);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.rating-button:not(:disabled):active {
  border-bottom-width: 2px;
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* Semantic Tinted Cream Cards */
.rating-button[data-rating="again"]:not(:disabled),
.rating-button[data-phrasal-rating="again"]:not(:disabled) {
  background: linear-gradient(180deg, #fff5f5 0%, #fee2e2 100%);
  border-color: #fca5a5;
  border-bottom-color: #dc2626;
  color: #991b1b;
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.22), inset 0 1px 0 #fff;
}
.rating-button[data-rating="again"]:not(:disabled) strong,
.rating-button[data-phrasal-rating="again"]:not(:disabled) strong { color: #991b1b; }
.rating-button[data-rating="again"]:not(:disabled) > span,
.rating-button[data-phrasal-rating="again"]:not(:disabled) > span { color: #b91c1c; }
.rating-button[data-rating="again"]:not(:disabled) b,
.rating-button[data-phrasal-rating="again"]:not(:disabled) b { background: rgba(220, 38, 38, 0.14); color: #991b1b; }

.rating-button[data-rating="hard"]:not(:disabled),
.rating-button[data-phrasal-rating="hard"]:not(:disabled) {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fdba74;
  border-bottom-color: #ea580c;
  color: #9a3412;
  box-shadow: 0 10px 26px rgba(234, 88, 12, 0.22), inset 0 1px 0 #fff;
}
.rating-button[data-rating="hard"]:not(:disabled) strong,
.rating-button[data-phrasal-rating="hard"]:not(:disabled) strong { color: #9a3412; }
.rating-button[data-rating="hard"]:not(:disabled) > span,
.rating-button[data-phrasal-rating="hard"]:not(:disabled) > span { color: #c2410c; }
.rating-button[data-rating="hard"]:not(:disabled) b,
.rating-button[data-phrasal-rating="hard"]:not(:disabled) b { background: rgba(234, 88, 12, 0.14); color: #9a3412; }

.rating-button[data-rating="good"]:not(:disabled),
.rating-button[data-phrasal-rating="good"]:not(:disabled) {
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #86efac;
  border-bottom-color: #16a34a;
  color: #14532d;
  box-shadow: 0 10px 26px rgba(22, 163, 74, 0.22), inset 0 1px 0 #fff;
}
.rating-button[data-rating="good"]:not(:disabled) strong,
.rating-button[data-phrasal-rating="good"]:not(:disabled) strong { color: #14532d; }
.rating-button[data-rating="good"]:not(:disabled) > span,
.rating-button[data-phrasal-rating="good"]:not(:disabled) > span { color: #15803d; }
.rating-button[data-rating="good"]:not(:disabled) b,
.rating-button[data-phrasal-rating="good"]:not(:disabled) b { background: rgba(22, 163, 74, 0.14); color: #14532d; }

.rating-button[data-rating="easy"]:not(:disabled),
.rating-button[data-phrasal-rating="easy"]:not(:disabled) {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #93c5fd;
  border-bottom-color: #2563eb;
  color: #1e3a8a;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.22), inset 0 1px 0 #fff;
}
.rating-button[data-rating="easy"]:not(:disabled) strong,
.rating-button[data-phrasal-rating="easy"]:not(:disabled) strong { color: #1e3a8a; }
.rating-button[data-rating="easy"]:not(:disabled) > span,
.rating-button[data-phrasal-rating="easy"]:not(:disabled) > span { color: #1d4ed8; }
.rating-button[data-rating="easy"]:not(:disabled) b,
.rating-button[data-phrasal-rating="easy"]:not(:disabled) b { background: rgba(37, 99, 235, 0.14); color: #1e3a8a; }

.review-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}
.review-status {
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: .78rem;
  overflow-wrap: anywhere;
}
.undo-button {
  flex: 0 0 auto;
  padding-left: 16px;
  font-size: .78rem;
}
.keyboard-help {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: .74rem;
  text-align: center;
}
.keyboard-help kbd {
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: .7rem;
}

/* ── SYSTEM STATES (LOADING, ERROR, COMPLETE) ── */
.system-state {
  min-height: 480px;
  border: 1.5px solid var(--line-gold);
  border-bottom: 7px solid rgba(0, 0, 0, 0.6);
  border-radius: 36px;
  padding: clamp(38px, 8vw, 90px);
  background: var(--surface-card);
  color: var(--ink-soft);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.state-mascot {
  margin-bottom: 16px;
  font-size: 4rem;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}
.state-mascot.celebration { animation: mascot-bounce 1.6s ease-in-out infinite; }

#emptyPixelCanvas,
.empty-pixel-img {
  display: inline-block;
  width: 120px;
  height: 120px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(247, 197, 72, 0.35));
  animation: pixel-mascot-bob 1.8s ease-in-out infinite;
}

.system-state h2, .system-state h3 {
  margin: 0 0 10px;
  color: #fff;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -.025em;
}
.system-state p { max-width: 55ch; margin-inline: auto; }
.error-state { border-color: rgba(240, 133, 122, 0.5); background: rgba(240, 133, 122, 0.05); }
.primary-dark-button {
  border-color: #ffd76b;
  border-bottom: 5px solid var(--gold-shadow);
  background: var(--gold);
  color: #030712;
  font-weight: 800;
}
.empty-undo-button { display: block; margin: 12px auto 0; }

/* ── WORKSPACE SHEETS (STUDIOS, LIBRARY, CAPTURE) ── */
.workspace-sheet {
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 4px solid rgba(0, 0, 0, 0.4);
  border-radius: 36px;
  padding: clamp(26px, 5vw, 56px);
  background: rgba(13, 20, 36, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(245, 158, 11, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
}
.workspace-sheet::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.sheet-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 24px;
}
.sheet-head h2, .capture-sheet h2 {
  margin: 5px 0 0;
  font-family: var(--font-en-display);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 24px rgba(245, 158, 11, 0.2);
}
.sheet-head p { max-width: 58ch; margin: 12px 0 0; color: var(--ink-soft); font-family: var(--font-en-body); font-size: 1rem; }

.library-controls {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: 28px 0 18px;
}
.search-field, #queueInput {
  min-width: 0;
  min-height: 50px;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-bottom: 3.5px solid rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-family: var(--font-en-body);
  font-size: .95rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-field:focus, #queueInput:focus {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 14px rgba(245, 158, 11, 0.25);
  outline: none;
}
.scope-controls { display: flex; gap: 8px; }
.ledger-scope-controls { margin: 14px 0 16px; }

.filter-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-bottom: 3.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-en-display);
  font-size: .86rem;
  letter-spacing: .01em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.filter-button:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: translateY(-1px);
}
.filter-button:active {
  border-bottom-width: 1.5px;
  transform: translateY(2px);
}
.filter-button.active,
.filter-button[aria-pressed="true"] {
  border: 1.5px solid #fde68a;
  border-bottom: 4px solid #b45309;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.paper-button {
  border: 1.5px solid #fde68a;
  border-bottom: 4px solid #b45309;
  border-radius: 9999px;
  padding: 8px 20px;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-family: var(--font-en-display);
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* ── LIBRARY STAGE BOX & HIGH CONTRAST PALETTE ── */
.library-stage-box {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 6px solid #cfbf9f;
  border-radius: 32px;
  padding: 30px 28px 36px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 50px rgba(234, 179, 8, 0.12), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.library-controls {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: 0 0 16px;
}

.library-search-input {
  min-width: 0;
  min-height: 50px;
  border: 1.5px solid #cbd5e1 !important;
  border-bottom: 3.5px solid #94a3b8 !important;
  border-radius: 16px;
  padding: 10px 18px;
  background: #ffffff !important;
  color: #0f172a !important;
  font-family: var(--font-en-body);
  font-size: .96rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
.library-search-input::placeholder {
  color: #64748b !important;
}
.library-search-input:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
  outline: none;
}

.library-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 38px;
  margin-bottom: 12px;
  color: #475569;
  font-size: .86rem;
  font-weight: 700;
}
.library-list { border-top: 1.5px solid #e2d8c3; }
.library-entry {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(0, 1.8fr) auto;
  gap: 24px;
  border-bottom: 1px solid #e8dfcf;
  padding: 20px 10px;
  transition: background 180ms ease, padding 180ms ease;
}
.library-entry:hover {
  padding-inline: 14px;
  background: rgba(245, 158, 11, 0.05);
}
.library-state-button {
  align-self: center;
  min-height: 42px;
  border: 1.5px solid #d8cdb7;
  border-bottom: 3.5px solid #bdae95;
  border-radius: 12px;
  padding: 7px 16px;
  background: #f1ebd9;
  color: #78350f;
  cursor: pointer;
  font-family: var(--font-en-display);
  font-size: .78rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}
.library-state-button:hover {
  background: #ece4cd;
  color: #451a03;
  transform: translateY(-1px);
}
.library-state-button:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
}
.library-term h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-family: var(--font-en-display);
  font-size: 1.38rem;
  font-weight: 800;
  line-height: 1.25;
}
.entry-meta {
  margin: 6px 0 0;
  color: #0284c7;
  font-family: var(--font-en-display);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.library-definition p { margin: 0; }
.library-definition .entry-definition {
  font-family: var(--font-en-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.45;
  color: #0f172a;
}
.library-definition .entry-thai {
  margin-top: 6px;
  color: #047857;
  font-family: 'Sarabun', var(--sans);
  font-size: .96rem;
  font-weight: 700;
}
.library-definition .entry-example {
  margin-top: 6px;
  color: #1e3a8a;
  font-family: var(--font-en-body);
  font-size: .92rem;
  font-style: italic;
  line-height: 1.55;
}
.empty-line { padding: 38px 0; color: #64748b; font-weight: 600; }

/* ── CAPTURE & SETTINGS (HIGH CONTRAST PARCHMENT PALETTE) ── */
.capture-lead {
  max-width: 62ch;
  margin: 10px 0 0;
  color: #334155;
  font-family: var(--font-en-body);
  font-size: .96rem;
  font-weight: 500;
  line-height: 1.6;
}
.capture-script {
  margin-top: 16px;
  border: 1.5px solid #e2d7c0;
  border-radius: 16px;
  padding: 20px;
  background: #fbf7ed;
  color: #1e293b;
  font-family: monospace;
  font-size: .86rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
}
.capture-actions, .settings-actions, .queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.capture-status {
  min-height: 24px;
  margin: 8px 0 0;
  color: #b45309;
  font-weight: 700;
  font-size: .86rem;
}
.vocab-queue-section {
  margin-top: 2.4rem;
  border-top: 1.5px dashed #cbd5e1;
  padding-top: 1.4rem;
}
.queue-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}
.queue-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.queue-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid #fde68a;
  border-bottom: 3px solid #f59e0b;
  border-radius: 12px;
  padding: 6px 12px;
  background: #fef3c7;
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: .84rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.15);
}
.queue-remove {
  display: inline-grid;
  min-height: 22px;
  width: 22px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #b45309;
  cursor: pointer;
  font-weight: 900;
}
.queue-remove:hover {
  background: rgba(180, 83, 9, 0.15);
  color: #78350f;
}
.danger-button { color: var(--red); text-decoration-color: rgba(240, 133, 122, 0.4); }
.policy-note {
  margin-top: 28px;
  border: 1.5px solid #e2d8c3;
  border-bottom: 5px solid #cfbf9f;
  border-radius: 20px;
  padding: 24px;
  background: #faf6ed;
  color: #1e293b;
}
.policy-note > h3 {
  margin-top: 0;
  color: #0f172a;
  font-family: var(--font-en-display);
  font-weight: 800;
}
.policy-note p { color: #475569; }
.flow-list { margin: 16px 0 0; padding: 0; list-style: none; counter-reset: flow; }
.flow-list li {
  position: relative;
  border-top: 1px solid #e2d8c3;
  padding: 15px 0 15px 38px;
  color: #334155;
  counter-increment: flow;
  font-size: .88rem;
  line-height: 1.55;
}
.flow-list li strong {
  color: #0f172a;
}
.flow-list li::before {
  position: absolute;
  top: 15px;
  left: 0;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: rgba(247, 197, 72, 0.15);
  color: var(--gold-light);
  content: counter(flow);
  font-size: .72rem;
  font-weight: 800;
}
.settings-panel {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.settings-panel summary {
  min-height: 44px;
  cursor: pointer;
  font-weight: 700;
  line-height: 44px;
  color: #fff;
}
.import-label { position: relative; overflow: hidden; }
.import-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ── REWARD FEEDBACK BURST ── */
.reward-burst {
  position: absolute;
  z-index: 6;
  top: 20rem;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  visibility: hidden;
}
.reward-xp {
  position: absolute;
  left: 50%;
  top: 0;
  min-width: max-content;
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 10px 18px;
  background: rgba(8, 13, 27, 0.96);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5), 0 0 32px var(--gold-glow);
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .02em;
  opacity: 0;
  transform: translate(-50%, 18px) scale(.75);
}
.reward-burst i {
  --x: 0;
  --y: -72px;
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gold-light);
  box-shadow: 0 0 14px var(--gold);
  opacity: 0;
  transform: translate(0, 0) rotate(0deg);
}
.reward-burst i:nth-of-type(1) { --x: -78px; --y: -36px; }
.reward-burst i:nth-of-type(2) { --x: -48px; --y: -82px; }
.reward-burst i:nth-of-type(3) { --x: 4px; --y: -96px; }
.reward-burst i:nth-of-type(4) { --x: 52px; --y: -78px; }
.reward-burst i:nth-of-type(5) { --x: 82px; --y: -30px; }
.reward-burst i:nth-of-type(6) { --x: 24px; --y: -48px; }
.reward-burst.is-active { visibility: visible; }
.reward-burst.is-active .reward-xp { animation: reward-xp-float 820ms var(--ease-pop) both; }
.reward-burst.is-active i { animation: reward-particle 720ms ease-out both; }
.reward-burst.is-active i:nth-of-type(2), .reward-burst.is-active i:nth-of-type(5) { animation-delay: 45ms; }
.review-stage.is-correct .citation-slip { animation: correct-card-pulse 620ms var(--ease-pop); }

@keyframes reward-xp-float {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(.72); }
  24% { opacity: 1; transform: translate(-50%, -8px) scale(1.08); }
  72% { opacity: 1; transform: translate(-50%, -22px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(.96); }
}
@keyframes reward-particle {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(.4); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(150deg) scale(1); }
}
@keyframes correct-card-pulse {
  0%, 100% { box-shadow: 0 25px 65px rgba(0, 0, 0, 0.65), 0 0 40px rgba(247, 197, 72, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
  38% { border-color: #ffd76b; box-shadow: 0 25px 65px rgba(0, 0, 0, 0.65), 0 0 0 6px rgba(247, 197, 72, 0.2), 0 0 50px rgba(247, 197, 72, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
}

@keyframes reveal-answer {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes feedback-pop {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-7px) rotate(3deg); }
}

/* ═══════════════════════════════════════════════════════════════
   STUDIO 1: PHRASAL VERBS QUEST & EXPLORER
   ═══════════════════════════════════════════════════════════════ */
.sibling-senses-container {
  margin-top: 18px;
  border-top: 1.5px dashed #cbd5e1;
  padding-top: 16px;
}
.sibling-senses-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #0f172a;
  font-family: var(--display);
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.sibling-sense-card {
  margin-bottom: 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.sibling-sense-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.sibling-sense-badge {
  border-radius: 6px;
  padding: 2px 8px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: .72rem;
  font-weight: 700;
}
.sibling-sense-pos { color: #64748b; font-size: .72rem; text-transform: uppercase; font-weight: 600; }
.sibling-sense-def-en { margin: 0; color: #0f172a; font-weight: 700; font-size: .96rem; }
.sibling-sense-def-th { margin: 4px 0 0; color: #047857; font-family: 'Sarabun', var(--sans); font-size: .9rem; font-weight: 600; }
.sibling-sense-example { margin: 6px 0 0; color: #1e3a8a; font-size: .88rem; font-style: italic; }

.phrasal-head { border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.phrasal-root-wrapper {
  margin-bottom: 16px;
}
.phrasal-view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0 14px;
}
.phrasal-view-toggle .filter-button {
  padding: 6px 10px;
  font-size: .78rem;
  min-height: 38px;
}
.phrasal-toolbar { margin: 22px 0 24px; }
.phrasal-root-scroll {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 2px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 0;
  min-width: 0;
}
.phrasal-root-scroll::-webkit-scrollbar { display: none; }
.phrasal-root-nav { display: flex; gap: 8px; min-width: max-content; align-items: center; }
.phrasal-root-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-bottom: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  cursor: pointer;
  font-family: var(--font-en-display);
  font-size: .84rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease, background 160ms ease;
}
.phrasal-root-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(168, 85, 247, 0.5);
  color: #fff;
  transform: translateY(-1px);
}
.phrasal-root-pill:active { transform: translateY(2px); border-bottom-width: 1.5px; }
.phrasal-root-pill[aria-pressed="true"] {
  border: 1.5px solid #e9d5ff;
  border-bottom: 3.5px solid #6b21a8;
  background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.phrasal-root-pill span {
  border-radius: 999px;
  padding: 1px 7px;
  background: rgba(0, 0, 0, 0.2);
  font-size: .7rem;
  color: #ffffff;
  font-weight: 700;
}
.phrasal-root-pill[aria-pressed="true"] span {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
.phrasal-search-row { margin-top: 14px; }

.phrasal-quest-view { min-width: 0; }
.phrasal-quest-layout { display: grid; grid-template-columns: 1fr; gap: 20px; max-width: 780px; margin: 0 auto; }
.phrasal-formula-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border: 1.5px solid #d8cdb7;
  border-radius: 12px;
  padding: 5px 16px;
  background: #f1ebd9;
}
.phrasal-formula-tag .verb-part { color: #92400e; font-family: var(--font-en-display); font-weight: 800; }
.phrasal-formula-tag .plus-sign { color: #6b7280; font-weight: 700; }
.phrasal-formula-tag .particle-part { color: #0369a1; font-family: var(--font-en-display); font-weight: 800; }

.phrasal-answer-panel {
  margin-top: 16px;
  border: 1.5px solid #e5dcc7;
  border-bottom: 4px solid #cfbf9f;
  border-radius: 24px;
  padding: 22px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), inset 0 1px 0 #ffffff;
  animation: reveal-answer 380ms var(--ease-pop) both;
}
.particle-logic-box {
  margin-bottom: 16px;
  border: 1.5px solid #fde68a;
  border-radius: 16px;
  padding: 14px 18px;
  background: #fffbeb;
}
.particle-logic-label {
  display: block;
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.particle-logic-text { margin: 4px 0 0; color: #78350f; font-family: var(--font-en-body); font-size: .94rem; line-height: 1.55; font-weight: 600; }
.phrasal-meanings-list { display: grid; gap: 12px; }
.phrasal-meaning-item {
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 16px;
  background: #fbf9f4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.phrasal-meaning-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.phrasal-meaning-badge {
  border-radius: 6px;
  padding: 2px 8px;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
}
.phrasal-meaning-en { margin: 0; color: #0f172a; font-family: var(--font-en-display); font-size: 1.05rem; font-weight: 800; line-height: 1.35; }
.phrasal-meaning-th { margin: 5px 0 0; color: #047857; font-family: 'Sarabun', var(--sans); font-size: .94rem; font-weight: 600; }
.phrasal-example-box {
  margin-top: 10px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
}
.phrasal-example-en { margin: 0; color: #1e3a8a; font-family: var(--font-en-body); font-size: .95rem; font-style: italic; line-height: 1.55; }
.phrasal-example-en mark {
  background: #fef08a;
  color: #854d0e;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  font-style: normal;
}
.phrasal-example-th { margin: 4px 0 0; color: #475569; font-family: 'Sarabun', var(--sans); font-size: .88rem; }
.phrasal-tip { margin: 8px 0 0; color: #92400e; font-size: .82rem; line-height: 1.45; font-weight: 600; }
.phrasal-nav-buttons { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }

.phrasal-grid-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: .84rem;
}
.phrasal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.phrasal-card {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 5px solid #cfbf9f;
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 28px rgba(168, 85, 247, 0.1), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.phrasal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 35px rgba(168, 85, 247, 0.18), inset 0 1px 0 #ffffff;
}
.phrasal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.phrasal-card-title {
  margin: 0;
  font-family: var(--font-en-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #111827;
}
.phrasal-card-formula {
  display: inline-flex;
  gap: 4px;
  border-radius: 8px;
  padding: 3px 9px;
  background: #f1ebd9;
  border: 1px solid #d8cdb7;
  color: #78350f;
  font-family: var(--font-en-display);
  font-size: .74rem;
  font-weight: 700;
}
.phrasal-card-meanings { display: grid; gap: 10px; margin-top: 10px; }
.phrasal-card-meaning-line { font-size: .88rem; }
.phrasal-card-meaning-line strong { color: #92400e; font-family: var(--font-en-body); font-weight: 700; display: block; margin-bottom: 2px; }
.phrasal-card-meaning-line small { color: #4b5563; display: block; }
.phrasal-card-act { margin-top: 16px; display: flex; justify-content: flex-end; }
.phrasal-practice-btn {
  min-height: 40px;
  border: 1.5px solid #d8b4fe;
  border-bottom: 3.5px solid #7e22ce;
  border-radius: 9999px;
  padding: 7px 18px;
  background: linear-gradient(180deg, #a855f7 0%, #9333ea 100%);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--font-en-display);
  font-size: .82rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.phrasal-practice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.phrasal-practice-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
}

/* ═══════════════════════════════════════════════════════════════
   STUDIO 2: SPEAKING STUDIO (CHATGPT INTEGRATION)
   ═══════════════════════════════════════════════════════════════ */
.speaking-toolbar { margin-bottom: 20px; }
.speaking-category-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.speaking-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.speaking-card {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 5px solid #cfbf9f;
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45), 0 0 30px rgba(14, 165, 233, 0.1), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  transition: transform 180ms ease, box-shadow 180ms ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.speaking-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), 0 0 38px rgba(14, 165, 233, 0.18), inset 0 1px 0 #ffffff;
}
.speaking-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.speaking-card-title {
  margin: 0;
  font-family: var(--font-en-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.3;
}
.speaking-card-title-th {
  margin: 4px 0 0;
  font-size: .88rem;
  color: #92400e;
  font-weight: 600;
}
.speaking-card-badge {
  border-radius: 8px;
  padding: 4px 10px;
  background: #f1ebd9;
  border: 1px solid #d8cdb7;
  color: #0369a1;
  font-family: var(--font-en-display);
  font-size: .74rem;
  font-weight: 800;
  white-space: nowrap;
}
.speaking-card-summary {
  margin: 0 0 12px;
  font-size: .92rem;
  color: #4b5563;
  line-height: 1.6;
}
.speaking-box {
  border: 1.5px solid #e5dcc7;
  border-radius: 14px;
  padding: 12px 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-top: 10px;
}
.speaking-box-label {
  display: block;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #0284c7;
  margin-bottom: 5px;
}
.speaking-box-text {
  margin: 0;
  font-family: var(--font-en-body);
  font-size: .88rem;
  line-height: 1.5;
  color: #1f2937;
}
.speaking-openers-list {
  margin: 0;
  padding-left: 18px;
  font-family: var(--font-en-body);
  font-size: .86rem;
  line-height: 1.5;
  color: #374151;
}
.speaking-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.speaking-launch-btn {
  flex: 1;
  min-height: 44px;
  border: 1.5px solid #7dd3fc;
  border-bottom: 3.5px solid #0369a1;
  border-radius: 9999px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  font-family: var(--font-en-display);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.speaking-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.speaking-launch-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
}
.speaking-copy-btn {
  min-height: 44px;
  border: 1.5px solid #d8cdb7;
  border-bottom: 3.5px solid #bdae95;
  border-radius: 9999px;
  padding: 8px 18px;
  background: #f1ebd9;
  color: #92400e;
  font-family: var(--font-en-display);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 140ms ease, background 140ms ease;
}
.speaking-copy-btn:hover {
  background: #ece4cd;
  color: #78350f;
  transform: translateY(-2px);
}
.speaking-copy-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
}

/* ═══════════════════════════════════════════════════════════════
   STUDIO 3: SHADOWING CADENCE DECK
   ═══════════════════════════════════════════════════════════════ */
.speaking-stage,
.shadowing-stage,
.grammar-stage,
.writing-stage,
.library-stage,
.capture-stage {
  min-width: 0;
}
.shadowing-stage { width: 100%; }

.capture-stage-box {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 6px solid #cfbf9f;
  border-radius: 32px;
  padding: 32px 28px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 50px rgba(236, 72, 153, 0.12), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.capture-stage-box h2 {
  margin: 5px 0 0;
  font-family: var(--font-en-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: #111827;
}
.capture-stage-box h3 {
  color: #0f172a;
}
.shadowing-card {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 6px solid #cfbf9f;
  border-radius: 32px;
  padding: 32px 28px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 50px rgba(20, 184, 166, 0.12), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.shadowing-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.shadowing-category-badge {
  border-radius: 8px;
  padding: 4px 12px;
  background: #f1ebd9;
  border: 1px solid #d8cdb7;
  color: #0f766e;
  font-family: var(--font-en-display);
  font-size: .76rem;
  font-weight: 800;
}
.shadowing-counter {
  font-family: var(--font-en-display);
  font-weight: 800;
  font-size: .88rem;
  color: #6b7280;
}
.shadowing-sentence-box {
  border: 1.5px solid #e5dcc7;
  border-bottom: 4px solid #cfbf9f;
  border-radius: 24px;
  padding: 26px;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  margin-bottom: 22px;
}
.shadowing-blind-cover { text-align: center; padding: 26px 16px; }
.blind-icon { font-size: 2.6rem; display: block; margin-bottom: 10px; }
.blind-title {
  font-family: var(--font-en-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #111827;
  margin: 0;
}
.blind-hint {
  color: #4b5563;
  font-size: .92rem;
  margin: 6px 0 18px;
  line-height: 1.5;
}
.shadowing-en-text {
  font-family: var(--font-en-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.38;
  margin: 0 0 8px;
}
.shadowing-th-text {
  font-size: 1.1rem;
  color: #0f766e;
  font-weight: 600;
  margin: 0 0 8px;
}
.shadowing-ipa-text {
  font-family: monospace;
  font-size: .95rem;
  color: #0369a1;
  margin: 0 0 18px;
}
.shadowing-tips-box {
  border: 1.5px solid #ccfbf1;
  border-radius: 16px;
  padding: 14px 18px;
  background: #f0fdfa;
  margin-bottom: 14px;
}
.shadowing-tips-label {
  display: block;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #0f766e;
  margin-bottom: 6px;
}
.shadowing-tips-list {
  margin: 0;
  padding-left: 18px;
  font-family: var(--font-en-body);
  font-size: .88rem;
  line-height: 1.55;
  color: #134e4a;
}
.shadowing-cadence-note {
  font-size: .84rem;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
}
.shadowing-controls { display: grid; gap: 14px; }
.shadowing-playback-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.shadowing-play-btn {
  flex: 1;
  min-height: 44px;
  border: 1.5px solid #5eead4;
  border-bottom: 3.5px solid #0f766e;
  border-radius: 9999px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff;
  font-family: var(--font-en-display);
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.shadowing-speed-group {
  display: flex;
  gap: 4px;
  border: 1.5px solid #d8cdb7;
  border-radius: 12px;
  padding: 4px;
  background: #f1ebd9;
}
.speed-button {
  min-height: 36px;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  background: transparent;
  color: #78350f;
  cursor: pointer;
  font-family: var(--font-en-display);
  font-weight: 800;
  font-size: .8rem;
  transition: background 140ms ease, color 140ms ease;
}
.speed-button.active {
  background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.35);
}
.shadowing-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   STUDIO 4: GRAMMAR KNOWLEDGE HUB
   ═══════════════════════════════════════════════════════════════ */
.grammar-toolbar { margin-bottom: 18px; }
.grammar-level-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.grammar-search-row { margin-top: 14px; }
.grammar-meta {
  display: flex;
  justify-content: space-between;
  font-size: .84rem;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.grammar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.grammar-card {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 5px solid #cfbf9f;
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 28px rgba(16, 185, 129, 0.1), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.grammar-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 35px rgba(16, 185, 129, 0.18), inset 0 1px 0 #ffffff;
}
.grammar-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.grammar-card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.grammar-chapter-badge {
  border-radius: 6px;
  padding: 3px 9px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
}
.grammar-level-badge {
  border-radius: 6px;
  padding: 3px 9px;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
}
.grammar-level-badge.level-beginner { background: #d1fae5; border: 1px solid #a7f3d0; color: #065f46; }
.grammar-level-badge.level-intermediate { background: #ffedd5; border: 1px solid #fed7aa; color: #9a3412; }
.grammar-level-badge.level-advanced { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; }
.grammar-cat-badge {
  border-radius: 6px;
  padding: 3px 9px;
  background: #f1ebd9;
  border: 1px solid #d8cdb7;
  color: #4b5563;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 700;
}
.grammar-card-time { font-family: var(--font-en-display); font-size: .76rem; color: #6b7280; font-weight: 700; }
.grammar-card-title {
  margin: 0 0 4px;
  font-family: var(--font-en-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
}
.grammar-card-sub {
  margin: 0 0 8px;
  font-size: .88rem;
  color: #047857;
  font-weight: 600;
}
.grammar-card-desc {
  margin: 0 0 18px;
  font-size: .9rem;
  color: #4b5563;
  line-height: 1.55;
}
.grammar-card-footer { margin-top: auto; }
.grammar-link-btn {
  width: 100%;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1.5px solid #6ee7b7;
  border-bottom: 3.5px solid #047857;
  border-radius: 9999px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-family: var(--font-en-display);
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.grammar-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.grammar-link-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
}

/* ═══════════════════════════════════════════════════════════════
   STUDIO 5: WRITING FRAMEWORK STUDIO
   ═══════════════════════════════════════════════════════════════ */
.writing-category-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.writing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}
.writing-card {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-bottom: 5px solid #cfbf9f;
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(175deg, #fffdfa 0%, #fbf6ec 60%, #f6efe0 100%);
  color: #111827;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45), 0 0 30px rgba(249, 115, 22, 0.1), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.writing-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), 0 0 38px rgba(249, 115, 22, 0.18), inset 0 1px 0 #ffffff;
}
.writing-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.writing-card-title {
  margin: 0;
  font-family: var(--font-en-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #111827;
}
.writing-card-sub {
  margin: 4px 0 0;
  font-size: .88rem;
  color: #c2410c;
  font-weight: 600;
}
.writing-card-badge {
  border-radius: 8px;
  padding: 4px 10px;
  background: #ffedd5;
  border: 1px solid #fed7aa;
  color: #c2410c;
  font-family: var(--font-en-display);
  font-size: .74rem;
  font-weight: 800;
  white-space: nowrap;
}
.writing-card-objective {
  margin: 0 0 14px;
  font-size: .92rem;
  color: #374151;
  line-height: 1.55;
}
.writing-box {
  border: 1.5px solid #e5dcc7;
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-top: 10px;
}
.writing-box-label {
  display: block;
  font-family: var(--font-en-display);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #ea580c;
  margin-bottom: 6px;
}
.writing-framework-pre {
  font-family: var(--font-en-body);
  white-space: pre-wrap;
  font-size: .88rem;
  color: #1f2937;
  line-height: 1.55;
  margin: 0;
}
.writing-phrases-list {
  margin: 0;
  padding-left: 18px;
  font-family: var(--font-en-body);
  font-size: .88rem;
  line-height: 1.55;
  color: #1f2937;
}
.writing-template-pre {
  font-family: var(--font-en-body);
  white-space: pre-wrap;
  font-size: .84rem;
  background: #faf7f0;
  border: 1px solid #e5dcc7;
  border-radius: 10px;
  padding: 14px;
  color: #111827;
  line-height: 1.55;
  max-height: 220px;
  overflow-y: auto;
  margin: 6px 0 10px;
}
.writing-copy-btn {
  width: 100%;
  min-height: 42px;
  border: 1.5px solid #fdba74;
  border-bottom: 3.5px solid #c2410c;
  border-radius: 9999px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  font-family: var(--font-en-display);
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.writing-copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.writing-copy-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE CRAFT FLOOR & ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */
@media(max-width: 920px) {
  .workspace-header { grid-template-columns: minmax(0, 1fr) minmax(310px, .8fr); gap: 32px; }
  .review-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
  .session-ledger { padding-inline: 16px; }
  .hud-stat { padding-inline: 10px; }
  .hud-stat small { white-space: normal; }
}

@media(max-width: 760px) {
  .vocab-shell { width: min(100% - 24px, 680px); padding: 94px 0 72px; }
  .workspace-header, .sheet-head, .capture-sheet { grid-template-columns: 1fr; }
  .workspace-header { gap: 24px; }
  .workspace-hero-brand { align-items: flex-start; }
  .workspace-title h1 { max-width: 100%; }

  .workspace-tabs-wrapper {
    position: sticky;
    z-index: 8;
    top: 64px;
    margin-inline: -12px;
    padding: 8px 6px 10px;
    background: rgba(3, 7, 18, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .workspace-tabs { padding: 2px; }
  .tabs-scroll-btn { display: none !important; }
  .workspace-tab { flex: 1 0 auto; min-width: 120px; padding-inline: 12px; font-size: .82rem; }

  .review-layout { grid-template-columns: 1fr; }
  .session-ledger {
    position: static;
    border-radius: 28px;
    padding: 20px 16px;
    margin-bottom: 20px;
  }
  .pixel-companion-stage { margin: 0 0 14px; }
  .ledger-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ledger-line {
    display: block;
    min-width: 0;
    border-right: 1px solid #eadecb;
    border-bottom: 0;
    padding: 7px;
    text-align: center;
  }
  .ledger-line:last-child { border-right: 0; }
  .ledger-line dt, .ledger-line dd { display: block; }
  .ledger-line dt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ledger-note { display: none; }

  .citation-slip { min-height: 440px; border-radius: 22px; padding: 26px 20px 32px; }
  .prompt-block { padding: 44px 0 32px; }

  .rating-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rating-controls.is-ready {
    position: sticky;
    z-index: 7;
    bottom: 0;
    margin-inline: -12px;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
    background: rgba(3, 7, 18, 0.96);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-gold);
  }
  .rating-button { min-height: 66px; }

  .speaking-cards-grid, .grammar-grid, .writing-grid, .phrasal-grid { grid-template-columns: 1fr; }
  .phrasal-view-toggle { width: 100%; }
  .phrasal-view-toggle .filter-button { flex: 1; }
  .shadowing-playback-row { flex-direction: column; align-items: stretch; }
  .shadowing-speed-group { justify-content: center; }

  .library-controls, .library-entry { grid-template-columns: 1fr; }
  .library-entry:hover { padding-inline: 8px; }
  .scope-controls { min-width: 0; }
  .filter-button { flex: 1 1 0; }
  .policy-note { margin-top: 5px; }
}

@media(max-width: 480px) {
  .workspace-title h1 { font-size: clamp(2.5rem, 13vw, 3.4rem); }
  .workspace-title p { font-size: .92rem; }
  .hud-stat { display: block; padding: 13px 8px; text-align: center; }
  .hud-stat > span { display: block; margin-bottom: 4px; font-size: 1.2rem; }
  .hud-stat strong { font-size: 1.05rem; }
  .hud-stat small { font-size: .62rem; }
  .citation-slip { min-height: 410px; }
  .slip-head { align-items: flex-start; }
  .review-word { font-size: clamp(2.7rem, 16vw, 4.4rem); }
  .word-line { align-items: flex-end; flex-wrap: wrap; }
  .answer-panel { padding: 20px 18px; }
  .review-tools, .library-meta { align-items: flex-start; flex-direction: column; }
  .undo-button { padding-left: 0; }
  .keyboard-help span { display: none; }
  .keyboard-help kbd { margin-left: 7px; }
  .queue-input-row { grid-template-columns: 1fr; }
}

@media(prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
