@font-face {
  font-family: "SlateDevanagari";
  src: url("../assets/fonts/NotoSansDevanagari.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg-top: #fff7e6;
  --bg-bot: #ffe3b3;
  --board-bg: #ffffff;
  --board-frame: #ff9f2e;
  --board-shadow: #d9750b;
  --text-dark: #3a2415;
  --text-muted: #7a5840;
  --green-start: #2fb54a;
  --orange-arrow: #ff8a2a;
  --gold-star: #ffc814;
  --accent-red: #e8322f;
  --accent-blue: #2f6fe8;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bot) 100%);
  color: var(--text-dark);
  font-family: "SlateDevanagari", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

/* Studio Shell & Responsive 2-Column Workspace */
.slate-shell {
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.focus-board-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  color: #5a2800;
  background: linear-gradient(180deg, #ffe680 0%, #ffb82b 100%);
  border: 2.5px solid #d47a00;
  border-radius: 14px;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 #a85c00;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.focus-board-btn.active {
  background: linear-gradient(180deg, #4cd964 0%, #249e3d 100%);
  color: #ffffff;
  border-color: #146926;
  box-shadow: 0 4px 0 #0c4718;
}

.word-Quick-nav {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 2px solid #ffb84d;
  background: #fff3d6;
  color: #8a4200;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #e0962b;
}

.studio-board-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1 1 0;
}

.slate-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(90deg, #ffffff 0%, #fff6e4 100%);
  border: 3px solid #ffd285;
  border-radius: 22px;
  padding: 8px 14px;
  box-shadow: 0 5px 0 #f0be6e;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-sparkle {
  font-size: 1.4rem;
}

.app-title {
  font-size: 1.18rem;
  font-weight: 900;
  color: #b84a00;
  margin: 0;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-select {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  color: #5a3200;
  background: #fff4db;
  border: 2px solid #ffb84d;
  border-radius: 12px;
  padding: 5px 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #e69d2e;
}

.mirror-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: #10497e;
  background: linear-gradient(180deg, #e3f4ff 0%, #bce3ff 100%);
  border: 2px solid #5cb3f5;
  border-radius: 12px;
  padding: 5px 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #3a8fd6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mirror-btn.mirror-popout {
  color: #5e1d80;
  background: linear-gradient(180deg, #f6e8ff 0%, #e4c6ff 100%);
  border-color: #b070f0;
  box-shadow: 0 3px 0 #8a44d1;
}

.mirror-btn:active,
.mirror-btn.active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #3a8fd6;
}

.sound-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #3ad059 0%, #249e3d 100%);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #18752b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sound-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #18752b;
}

/* 2-Column Workspace Grid */
.slate-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

@media (min-width: 860px) {
  .slate-workspace {
    grid-template-columns: 316px minmax(0, 1fr);
    gap: 14px;
  }
}

/* Left Column: Clean 3D Chunnu Stage + 5-Sawal Milestone Party Bar */
.companion-stage {
  background: linear-gradient(180deg, #ffffff 0%, #fff7e8 100%);
  border: 3px solid #ffc973;
  border-radius: 22px;
  padding: 10px;
  box-shadow: 0 5px 0 #e9ad50, 0 8px 20px rgba(90, 45, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 860px) {
  .companion-stage {
    position: sticky;
    top: 10px;
  }
}

.companion-top-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.companion-info-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.living-room-stage {
  position: relative;
  width: 100%;
  height: 360px;
  border-radius: 18px;
  border: 3px solid #ff9f2e;
  background: #2b1d12;
  overflow: hidden;
  box-shadow: 0 5px 14px rgba(90, 42, 0, 0.2);
  user-select: none;
  flex-shrink: 0;
  transition: width 0.25s ease, height 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.companion-stage.party-video-playing .living-room-stage {
  border-color: #2fb54a;
  box-shadow: 0 0 0 4px #ffd21f, 0 10px 28px rgba(47, 181, 74, 0.4);
}

.stage-3d-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 24%;
  z-index: 1;
  display: block;
  background: #2b1d12;
}

.stage-sparkle-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.skip-party-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 20;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  color: #ffffff;
  background: rgba(20, 120, 45, 0.92);
  border: 2px solid #ffd93b;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.skip-party-btn[hidden] {
  display: none !important;
}

/* 5-Sawal Party Milestone Bar */
.milestone-bar {
  background: linear-gradient(180deg, #fffdf5 0%, #fff0c7 100%);
  border: 2.5px solid #ffb838;
  border-radius: 16px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 3px 0 #e69d22;
}

.milestone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.milestone-title {
  font-size: 0.82rem;
  font-weight: 900;
  color: #8c3b00;
}

.milestone-count {
  font-size: 0.8rem;
  font-weight: 900;
  color: #ffffff;
  background: #e86b00;
  padding: 1px 8px;
  border-radius: 999px;
}

.milestone-stars {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #ffffff;
  border: 1.5px solid #ffe09e;
  border-radius: 10px;
  padding: 3px 8px;
}

.m-star {
  font-size: 1.2rem;
  color: #d6c5ad;
  transition: transform 0.2s ease, color 0.2s ease;
}

.m-star.earned {
  color: #ffae00;
  transform: scale(1.16);
  filter: drop-shadow(0 2px 3px rgba(255, 160, 0, 0.35));
}

.party-preview-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(180deg, #ff5ca8 0%, #d92378 100%);
  border: 2px solid #a61156;
  border-radius: 10px;
  padding: 5px 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #820a40;
  text-align: center;
}

.party-preview-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #820a40;
}

/* Speech Bubble & Accuracy Warning Banner */
.speech-bubble {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-dark);
  background: #fff9ed;
  border: 2px solid #ffd791;
  border-left: 5px solid var(--green-start);
  padding: 7px 10px;
  border-radius: 12px;
  margin: 0;
  line-height: 1.32;
}

.accuracy-banner {
  font-size: 0.82rem;
  font-weight: 800;
  color: #8f1d00;
  background: linear-gradient(90deg, #ffe8e5 0%, #fff2d6 100%);
  border: 2px solid #ff6b57;
  border-radius: 12px;
  padding: 6px 10px;
  line-height: 1.28;
  box-shadow: 0 3px 0 #e0533c;
  animation: gentleShake 0.45s ease;
}

.accuracy-banner[hidden] {
  display: none !important;
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.act-chip {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  background: linear-gradient(180deg, #fff6df 0%, #ffe1a8 100%);
  color: #7c3500;
  border: 2px solid #ffb74d;
  border-radius: 12px;
  padding: 5px 8px;
  cursor: pointer;
  box-shadow: 0 3px 0 #e09224;
  text-align: center;
  white-space: nowrap;
}

/* Right Column: Main Magic Slate Studio */
.slate-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Separate Kids-Style 3D Coloured Mode Switcher */
.mode-switch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 3px solid #ffd285;
  border-radius: 20px;
  padding: 8px 12px;
  box-shadow: 0 4px 0 #f0be6e;
  flex-wrap: wrap;
}

.mode-big-btn {
  flex: 1;
  min-width: 170px;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 900;
  padding: 10px 16px;
  border-radius: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.mode-big-btn.mode-tracing {
  background: linear-gradient(180deg, #27c96b 0%, #149948 100%);
  color: #ffffff;
  border: 3px solid #0e7333;
  box-shadow: 0 5px 0 #0a5926;
}

.mode-big-btn.mode-colouring {
  background: linear-gradient(180deg, #ff4da6 0%, #e6257e 100%);
  color: #ffffff;
  border: 3px solid #b5125d;
  box-shadow: 0 5px 0 #890b44;
}

.mode-big-btn:not(.active) {
  opacity: 0.82;
  filter: saturate(0.85);
}

.mode-big-btn.active {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 0 #3a2415, 0 0 0 3px #ffd93b;
  opacity: 1;
}

.mode-big-btn:active {
  transform: translateY(2px);
}

.double-item-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: #6b3400;
  background: #fff3cf;
  border: 2px dashed #ffae33;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* 10 Category Tabs */
.category-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
}

.cat-pill {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 14px;
  border: 2px solid #ffd285;
  background: #ffffff;
  color: #6b3c00;
  cursor: pointer;
  box-shadow: 0 3px 0 #f0be6e;
}

.cat-pill.active {
  background: linear-gradient(180deg, #ff9929 0%, #f06d00 100%);
  color: #ffffff;
  border-color: #c25200;
  box-shadow: 0 3px 0 #993f00;
}

/* Item Strip + 6 Rotating Kids Candy Colours */
.item-nav-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 2.5px solid #ffd99c;
  border-radius: 16px;
  padding: 6px 8px;
}

.nav-arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid #ffc978;
  background: #fff3db;
  color: #8a4500;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #e6ae5c;
}

.item-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  padding: 3px 2px;
  scrollbar-width: thin;
}

.item-chip {
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 900;
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border-radius: 12px;
  border: 2px solid #ecd4b4;
  background: #fffaf0;
  color: #3a2415;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 3px 0 rgba(120, 70, 10, 0.22);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

/* 6 Rotating Kids Candy Colours (.candy-0 .. .candy-5) */
.item-chip.candy-0 {
  background: linear-gradient(180deg, #fff59d 0%, #ffd54f 100%);
  border-color: #f9a825;
  color: #5c3800;
  box-shadow: 0 3px 0 #e68a00;
}

.item-chip.candy-1 {
  background: linear-gradient(180deg, #b3e5fc 0%, #4fc3f7 100%);
  border-color: #0288d1;
  color: #003c6c;
  box-shadow: 0 3px 0 #0277bd;
}

.item-chip.candy-2 {
  background: linear-gradient(180deg, #c8e6c9 0%, #81c784 100%);
  border-color: #2e7d32;
  color: #0d4715;
  box-shadow: 0 3px 0 #1b5e20;
}

.item-chip.candy-3 {
  background: linear-gradient(180deg, #f8bbd0 0%, #f48fb1 100%);
  border-color: #c2185b;
  color: #560027;
  box-shadow: 0 3px 0 #ad1457;
}

.item-chip.candy-4 {
  background: linear-gradient(180deg, #e1bee7 0%, #ba68c8 100%);
  border-color: #7b1fa2;
  color: #38006b;
  box-shadow: 0 3px 0 #6a1b9a;
}

.item-chip.candy-5 {
  background: linear-gradient(180deg, #ffe0b2 0%, #ffb74d 100%);
  border-color: #ef6c00;
  color: #5f2700;
  box-shadow: 0 3px 0 #d84315;
}

.item-chip.active {
  background: linear-gradient(180deg, #2fb54a 0%, #1c8c33 100%) !important;
  color: #ffffff !important;
  border-color: #0f5c1f !important;
  box-shadow: 0 4px 0 #0a3d14, 0 0 0 2px #ffd93b !important;
  transform: translateY(-2px) scale(1.06);
}

.name-input-row {
  display: flex;
  gap: 8px;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 14px;
  border: 2px solid #ffd99c;
  flex-shrink: 0;
}

.name-input-row[hidden] {
  display: none !important;
}

.name-input {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid #ffc978;
  user-select: text;
  -webkit-user-select: text;
}

/* Word / Picture badge & progress bar */
.word-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  border-radius: 16px;
  padding: 7px 14px;
  border: 2px solid #ffd99c;
}

.word-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.16rem;
  font-weight: 900;
}

.word-emoji {
  font-size: 1.6rem;
}

.progress-wrap {
  flex: 1;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
}

.meter-track {
  width: 100%;
  height: 14px;
  background: #f2e5d5;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid #e2cbb0;
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2fb54a 0%, #7ee03b 100%);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

/* Drawing Tools & Brush Sizes Bar */
.tools-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border: 2.5px solid #ffd99c;
  border-radius: 16px;
  padding: 6px 10px;
  flex-wrap: wrap;
}

.tool-group,
.size-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tool-btn,
.size-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 12px;
  border: 2px solid #ffd089;
  background: #fff9ee;
  color: #5c330a;
  cursor: pointer;
  box-shadow: 0 3px 0 #e6b76e;
  transition: transform 0.12s ease, background 0.12s ease;
}

.tool-btn.active {
  background: linear-gradient(180deg, #2f80ed 0%, #1b5ec4 100%);
  color: #ffffff;
  border-color: #10418f;
  box-shadow: 0 3px 0 #0a2d66;
  transform: translateY(-1px);
}

.size-btn.active {
  background: linear-gradient(180deg, #9b51e0 0%, #7429b8 100%);
  color: #ffffff;
  border-color: #53178a;
  box-shadow: 0 3px 0 #3a0d63;
  transform: translateY(-1px);
}

/* Main Slate Board */
.board-frame {
  position: relative;
  background: var(--board-bg);
  border: 8px solid var(--board-frame);
  border-radius: 28px;
  box-shadow: 0 8px 0 var(--board-shadow), 0 12px 24px rgba(90, 45, 0, 0.14);
  padding: 8px;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  overflow: hidden;
}

.slate-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  touch-action: none;
  cursor: crosshair;
}

/* Sticky mouse badge + Top Stars Overlay (Never hides middle writing!) */
.sticky-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(47, 111, 232, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sticky-badge.active {
  opacity: 1;
  transform: translateY(0);
}

.star-celebration {
  position: absolute;
  top: 8px;
  right: 12px;
  left: auto;
  bottom: auto;
  height: 44px;
  padding: 4px 10px;
  background: rgba(255, 249, 230, 0.92);
  border: 2px solid #ffb32c;
  border-radius: 999px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(-10px) scale(0.6);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.22, 1.3, 0.36, 1);
  z-index: 5;
}

.star-celebration.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.star-icon {
  font-size: 1.55rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Colour Palette & Controls */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border-radius: 18px;
  padding: 10px 12px;
  border: 2px solid #ffd99c;
  flex-wrap: wrap;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch.active {
  transform: scale(1.18);
  border-color: #3a2415;
  box-shadow: 0 0 0 3px #ffd21f;
}

.swatch-rainbow {
  background: conic-gradient(#e8322f, #ff8a1f, #ffd21f, #2fb54a, #2f6fe8, #8a5cf0, #ff7eb6, #e8322f);
}

.action-btns {
  display: flex;
  gap: 8px;
}

.btn {
  font-family: inherit;
  border: none;
  border-radius: 14px;
  padding: 9px 14px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-reset {
  background: #fff0d6;
  color: #8a4500;
  border: 2px solid #ffc978;
}

.btn-share {
  background: #2f6fe8;
  color: #ffffff;
  box-shadow: 0 4px 0 #1b4ca8;
}

.btn-share:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1b4ca8;
}

.hint-footer {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0;
  flex-shrink: 0;
}

/* Desktop & Laptop 100vh Lock (Maximizes Slate Canvas by docking Tools Left & Colours Right!) */
@media (min-width: 860px) {
  html, body {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .slate-shell {
    height: 100vh;
    max-height: 100vh;
    padding: 5px 12px 6px;
    gap: 5px;
    overflow: hidden;
  }

  .slate-topbar {
    padding: 4px 12px;
    border-radius: 15px;
    box-shadow: 0 3px 0 #f0be6e;
    flex-shrink: 0;
  }

  .sound-btn {
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
  }

  .slate-workspace {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    grid-template-columns: 256px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
  }

  .companion-stage {
    position: relative;
    top: 0;
    height: 100%;
    min-height: 0;
    padding: 7px;
    gap: 5px;
    overflow: hidden;
  }

  .companion-top-row {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .living-room-stage {
    flex: 1 1 0;
    min-height: 140px;
    height: auto;
  }

  .slate-main {
    height: 100%;
    min-height: 0;
    gap: 4px;
    justify-content: space-between;
  }

  .mode-switch-bar {
    padding: 4px 10px;
    border-radius: 14px;
    box-shadow: 0 3px 0 #f0be6e;
    flex-shrink: 0;
  }

  .mode-big-btn {
    padding: 5px 12px;
    font-size: 0.92rem;
    border-radius: 12px;
  }

  .category-bar {
    padding: 2px 2px;
    flex-shrink: 0;
  }

  .cat-pill {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 11px;
  }

  .item-nav-row {
    padding: 3px 8px;
    border-radius: 13px;
    flex-shrink: 0;
  }

  .item-chip {
    height: 30px;
    font-size: 0.86rem;
    padding: 0 9px;
  }

  .nav-arrow-btn {
    width: 28px;
    height: 28px;
  }

  .word-bar {
    padding: 3px 12px;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .word-pill {
    font-size: 1rem;
  }

  .word-emoji {
    font-size: 1.25rem;
  }

  /* Side-docked Studio Board Area: Left Tools | HUGE Center Canvas | Right Colours */
  .studio-board-area {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    padding: 2px 0;
  }

  .tools-bar {
    width: 128px;
    padding: 8px 6px;
    border-radius: 16px;
    flex-shrink: 0;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 8px;
  }

  .tool-group,
  .size-group {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  .size-group {
    border-top: 2px dashed #ffd99c;
    padding-top: 6px;
  }

  .tool-btn,
  .size-btn {
    width: 100%;
    padding: 6px 6px;
    font-size: 0.8rem;
    text-align: center;
  }

  .board-frame {
    flex: 0 1 auto;
    height: 100%;
    width: auto;
    max-height: 100%;
    max-width: calc(100% - 296px);
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 6px;
    border-width: 7px;
    box-shadow: 0 5px 0 var(--board-shadow), 0 8px 18px rgba(90, 45, 0, 0.14);
  }

  .controls-row {
    width: 158px;
    padding: 6px 7px;
    border-radius: 16px;
    flex-shrink: 0;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  .swatches {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    justify-items: center;
  }

  .swatch {
    width: 31px;
    height: 31px;
  }

  .action-btns {
    width: 100%;
    flex-direction: column;
    gap: 6px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 7px 6px;
    font-size: 0.8rem;
    text-align: center;
  }

  .hint-footer {
    display: none;
  }
}

/* ============================================================
   RESPONSIVE TABLET & MOBILE (<= 859px) — 100dvh ZERO-SCROLL HUGE BOARD!
   ============================================================ */

@media (max-width: 859px) {
  html, body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .slate-shell {
    height: 100dvh;
    max-height: 100dvh;
    padding: 4px 6px 6px;
    gap: 4px;
    overflow: hidden;
  }

  .slate-topbar {
    padding: 4px 8px;
    border-radius: 12px;
    gap: 4px;
    flex-shrink: 0;
  }

  .app-title {
    font-size: 0.92rem;
  }

  .brand-sparkle {
    font-size: 1.05rem;
  }

  .mirror-btn.mirror-popout,
  .mirror-btn#fullscreenMirrorBtn,
  .double-item-badge,
  .hint-footer {
    display: none !important;
  }

  .lang-select,
  .mirror-btn {
    font-size: 0.75rem;
    padding: 3px 7px;
    border-radius: 9px;
  }

  .sound-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .slate-workspace {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  /* Compact 1-Line Companion Strip on Mobile (Expands into Modal when Party Video plays!) */
  .companion-stage {
    padding: 4px 8px;
    border-radius: 12px;
    border-width: 2px;
    box-shadow: 0 2px 0 #e9ad50;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
  }

  .companion-top-row {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .living-room-stage {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border-width: 2px;
    flex-shrink: 0;
  }

  .companion-info-col {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
  }

  .milestone-bar {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 3px 6px;
    border-radius: 10px;
    gap: 4px;
    box-shadow: none;
  }

  .milestone-header {
    gap: 4px;
    min-width: 0;
  }

  .milestone-title {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .milestone-count {
    font-size: 0.66rem;
    padding: 1px 5px;
    flex-shrink: 0;
  }

  .milestone-stars {
    padding: 1px 4px;
    gap: 1px;
    flex-shrink: 0;
  }

  .m-star {
    font-size: 0.82rem;
  }

  .party-preview-btn {
    font-size: 0.68rem;
    padding: 3px 6px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .speech-bubble {
    display: none;
  }

  /* When the 5th-question Party Video plays on Tablet/Mobile, pop up full-screen overlay! */
  .companion-stage.party-video-playing {
    position: fixed;
    inset: 12px;
    z-index: 95;
    justify-content: center;
    align-items: center;
    background: rgba(255, 248, 232, 0.98);
    padding: 16px;
  }

  .companion-stage.party-video-playing .companion-top-row {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .companion-stage.party-video-playing .living-room-stage {
    width: min(82vw, 320px);
    height: min(58dvh, 420px);
    border-radius: 22px;
    margin: 0 auto;
  }

  .companion-stage.party-video-playing .companion-info-col {
    flex-direction: column;
    width: 100%;
  }

  .companion-stage.party-video-playing .speech-bubble {
    display: block;
    text-align: center;
  }

  .slate-main {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    gap: 4px;
    justify-content: space-between;
  }

  .mode-switch-bar {
    padding: 4px 6px;
    gap: 4px;
    border-radius: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
  }

  .mode-big-btn {
    min-width: 96px;
    flex: 1 1 30%;
    font-size: 0.74rem;
    padding: 6px 6px;
    border-radius: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .focus-board-btn {
    font-size: 0.72rem;
    padding: 6px 7px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .category-bar {
    padding: 1px 2px;
    gap: 4px;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
  }

  .cat-pill {
    font-size: 0.74rem;
    padding: 4px 8px;
    border-radius: 10px;
  }

  .item-nav-row {
    padding: 3px 5px;
    border-radius: 11px;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
  }

  .nav-arrow-btn {
    width: 26px;
    height: 26px;
  }

  .item-chip {
    min-width: 32px;
    height: 27px;
    font-size: 0.8rem;
    padding: 0 7px;
  }

  .word-bar {
    padding: 3px 8px;
    border-radius: 10px;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
  }

  .word-pill {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.8rem;
    gap: 4px;
  }

  .word-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .word-emoji {
    font-size: 1rem;
    flex-shrink: 0;
  }

  .word-quick-nav {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  .progress-wrap {
    flex: 0 0 84px;
    max-width: 84px;
    gap: 2px;
  }

  .progress-meta {
    font-size: 0.64rem;
  }

  .meter-track {
    height: 8px;
  }

  .studio-board-area {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
  }

  .board-frame {
    order: 1;
    flex: 0 1 auto;
    width: min(100%, 54dvh);
    min-width: 190px;
    min-height: 190px;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    margin: auto;
    padding: 4px;
    border-width: 5px;
    border-radius: 18px;
    box-shadow: 0 4px 0 var(--board-shadow);
  }

  body.big-board-mode .board-frame {
    width: min(100%, 72dvh);
    min-width: 210px;
    min-height: 210px;
  }

  .tools-bar {
    order: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 3px 6px;
    gap: 4px;
    border-radius: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex-shrink: 0;
  }

  .tool-group,
  .size-group {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .tool-btn,
  .size-btn {
    font-size: 0.72rem;
    padding: 4px 7px;
    white-space: nowrap;
  }

  .controls-row {
    order: 3;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 4px 6px;
    gap: 5px;
    border-radius: 11px;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex-shrink: 0;
  }

  .swatches {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .swatch {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  .btn {
    padding: 5px 8px;
    font-size: 0.74rem;
    white-space: nowrap;
  }
}

/* ============================================================
   📱↔️ MOBILE LANDSCAPE & SHORT VIEWPORT FIX (max-height: 540px)
   Side-by-side landscape studio: Chunnu Left | Bars + Tools + 1:1 Square Board + Swatches Right!
   ============================================================ */
@media (max-height: 540px) and (orientation: landscape) {
  html,
  body {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .slate-shell {
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 3px 6px 4px !important;
    gap: 3px !important;
    overflow: hidden !important;
  }

  .slate-topbar {
    padding: 2px 8px !important;
    min-height: 28px !important;
    border-radius: 10px !important;
  }

  .topbar-brand img {
    height: 22px !important;
    width: auto !important;
  }

  .slate-workspace {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    display: grid !important;
    grid-template-columns: 136px minmax(0, 1fr) !important;
    gap: 6px !important;
    overflow: hidden !important;
  }

  .companion-stage {
    height: 100% !important;
    min-height: 0 !important;
    padding: 4px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow: hidden !important;
  }

  .companion-top-row {
    flex-direction: column !important;
    height: 100% !important;
    gap: 4px !important;
  }

  .living-room-stage {
    width: 100% !important;
    flex: 1 1 0 !important;
    min-height: 110px !important;
    height: auto !important;
    border-radius: 12px !important;
  }

  .companion-info-col {
    flex: 0 0 auto !important;
    width: 100% !important;
    flex-direction: column !important;
  }

  .milestone-bar {
    flex-direction: column !important;
    width: 100% !important;
    padding: 3px 4px !important;
    gap: 2px !important;
  }

  .slate-main {
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    overflow: hidden !important;
  }

  .mode-switch-bar,
  .item-nav-row,
  .word-bar {
    padding: 2px 6px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .mode-big-btn,
  .focus-board-btn {
    padding: 3px 6px !important;
    font-size: 0.7rem !important;
  }

  .category-bar {
    padding: 1px 2px !important;
    flex-shrink: 0 !important;
  }

  .cat-pill {
    padding: 2px 7px !important;
    font-size: 0.68rem !important;
  }

  .item-chip {
    height: 22px !important;
    min-width: 26px !important;
    font-size: 0.72rem !important;
    padding: 0 5px !important;
  }

  .nav-arrow-btn,
  .word-quick-nav {
    width: 20px !important;
    height: 20px !important;
    font-size: 0.68rem !important;
  }

  .studio-board-area {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: space-between !important;
    gap: 6px !important;
    overflow: hidden !important;
  }

  .tools-bar {
    order: 1 !important;
    width: 104px !important;
    max-width: 104px !important;
    height: 100% !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 4px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex-shrink: 0 !important;
  }

  .tool-group,
  .size-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 2px !important;
  }

  .tool-btn,
  .size-btn {
    width: 100% !important;
    padding: 2px 4px !important;
    font-size: 0.64rem !important;
  }

  .board-frame {
    order: 2 !important;
    height: 100% !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    max-width: calc(100% - 236px) !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 auto !important;
    padding: 3px !important;
    border-width: 4px !important;
  }

  .controls-row {
    order: 3 !important;
    width: 120px !important;
    max-width: 120px !important;
    height: 100% !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 4px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex-shrink: 0 !important;
  }

  .colour-sample-canvas {
    width: 56px !important;
    height: 56px !important;
  }

  .colour-sample-sub {
    display: none !important;
  }

  .swatches {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 3px !important;
  }

  .swatch {
    width: 20px !important;
    height: 20px !important;
  }

  .action-btns {
    flex-direction: column !important;
    width: 100% !important;
    gap: 2px !important;
  }

  .action-btns .btn {
    width: 100% !important;
    padding: 2px 4px !important;
    font-size: 0.62rem !important;
  }
}

/* ============================================================
   🔍 BIG BOARD FOCUS MODE (body.big-board-mode) — Desktop, Tablet & Mobile!
   ============================================================ */
body.big-board-mode .slate-topbar,
body.big-board-mode .category-bar,
body.big-board-mode .item-nav-row,
body.big-board-mode .double-item-badge,
body.big-board-mode .hint-footer,
body.big-board-mode .companion-stage:not(.party-video-playing) {
  display: none !important;
}

body.big-board-mode .slate-workspace {
  grid-template-columns: 1fr !important;
}

/* Fullscreen / Big Screen TV Mirror Mode */
body.tv-mirror-mode .slate-shell,
.slate-shell.tv-mirror-mode {
  max-width: 1480px;
  padding: 14px 24px;
}

body.tv-mirror-mode .board-frame,
.slate-shell.tv-mirror-mode .board-frame {
  max-width: 580px;
  border-width: 10px;
}

body.tv-mirror-mode .host-avatar,
.slate-shell.tv-mirror-mode .host-avatar {
  height: 195px;
}

/* Parent Gate Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 20, 8, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: #ffffff;
  border: 4px solid var(--board-frame);
  border-radius: 24px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #b84a00;
}

.modal-prompt {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.gate-question {
  font-size: 1.5rem;
  font-weight: 900;
  background: #fff6e5;
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.gate-options {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.gate-opt {
  min-width: 68px;
  padding: 10px 14px;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: 12px;
  border: 2px solid #ffd285;
  background: #fffdf9;
  cursor: pointer;
}

.gate-opt:hover {
  background: #ffe8bd;
}

/* ============================================================
   👆 SMART HAND GUIDE OVERLAY (On-Canvas Animated Hand Coach + UI Tour)
   ============================================================ */
.help-guide-btn {
  background: linear-gradient(180deg, #ffdd57 0%, #ff9f1c 100%) !important;
  color: #4a2300 !important;
  border-color: #c96e00 !important;
  box-shadow: 0 3px 0 #a35600 !important;
  font-weight: 900 !important;
  animation: guideBtnPulse 2.4s ease-in-out infinite;
}

.auto-next-btn {
  background: linear-gradient(180deg, #e8f8ee 0%, #c6f0d6 100%);
  color: #0f5c25;
  border-color: #27ae60;
}

.auto-next-btn.active {
  background: linear-gradient(180deg, #27c96b 0%, #149948 100%) !important;
  color: #ffffff !important;
  border-color: #0e7333 !important;
  box-shadow: 0 3px 0 #0a5926 !important;
}

@keyframes guideBtnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.hand-guide-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
  transition: opacity 0.25s ease;
}

.hand-guide-overlay.hidden-guide {
  opacity: 0 !important;
}

.hand-guide-cursor {
  position: absolute;
  left: 32%;
  top: 28%;
  transform: translate(-18%, -12%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  will-change: left, top, transform;
  filter: drop-shadow(0 6px 10px rgba(45, 20, 0, 0.28));
}

.hand-guide-icon {
  font-size: 2.35rem;
  line-height: 1;
  display: inline-block;
  animation: handTapBob 0.9s ease-in-out infinite;
}

.hand-guide-badge {
  background: rgba(255, 248, 225, 0.95);
  color: #5c2800;
  border: 2px solid #ff9f1c;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(201, 110, 0, 0.45);
}

@keyframes handTapBob {
  0%, 100% { transform: scale(1) rotate(-8deg); }
  50% { transform: scale(0.92) translateY(3px) rotate(0deg); }
}

/* Step-by-Step Interactive UI Tour Coach */
.ui-tour-highlight {
  position: relative;
  z-index: 91 !important;
  box-shadow: 0 0 0 4px #ff9f1c, 0 0 0 9px rgba(255, 209, 59, 0.55), 0 8px 24px rgba(0, 0, 0, 0.25) !important;
  transition: box-shadow 0.25s ease;
}

.ui-tour-coach {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 98;
  width: min(94vw, 480px);
  pointer-events: auto;
}

.ui-tour-coach[hidden] {
  display: none !important;
}

.ui-tour-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #fffdf7 0%, #ffefc7 100%);
  border: 3.5px solid #ff8c00;
  border-radius: 22px;
  padding: 10px 14px;
  box-shadow: 0 8px 0 #b85600, 0 14px 32px rgba(45, 20, 0, 0.32);
}

.ui-tour-hand {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
  animation: handTapBob 0.85s ease-in-out infinite;
}

.ui-tour-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ui-tour-step-badge {
  align-self: flex-start;
  background: #ff8c00;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
}

.ui-tour-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: #3a1d00;
  line-height: 1.32;
}

.ui-tour-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.ui-tour-next-btn,
.ui-tour-close-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 900;
  padding: 5px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.ui-tour-next-btn {
  background: linear-gradient(180deg, #27c96b 0%, #149948 100%);
  color: #ffffff;
  border: 2px solid #0e7333;
  box-shadow: 0 3px 0 #0a5926;
}

.ui-tour-close-btn {
  background: #ffffff;
  color: #6b3400;
  border: 2px solid #ffb74d;
  box-shadow: 0 3px 0 #e09224;
}

@media (max-width: 859px) {
  .auto-next-btn {
    display: none !important;
  }
  .hand-guide-icon {
    font-size: 1.95rem;
  }
  .hand-guide-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
  }
}

/* ============================================================
   🖼️ COLOURED SAMPLE REFERENCE CARD ("रंगीन सैंपल — देखकर रंग भरें!")
   ============================================================ */
.colour-sample-card {
  width: 100%;
  background: linear-gradient(180deg, #fffdf8 0%, #fff3dc 100%);
  border: 2.5px solid #ff9d2e;
  border-radius: 14px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow: 0 3px 0 #d97b10, 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.colour-sample-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.colour-sample-title {
  font-size: 0.72rem;
  font-weight: 900;
  color: #9e3f00;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.colour-sample-zoom-btn {
  border: 1.5px solid #ffb04f;
  background: #ffffff;
  border-radius: 7px;
  font-size: 0.72rem;
  padding: 1px 5px;
  cursor: pointer;
  line-height: 1.1;
}

.colour-sample-canvas {
  width: 124px;
  height: 124px;
  border-radius: 10px;
  border: 2px solid #f0c27b;
  background: #ffffff;
  cursor: pointer;
  display: block;
}

.colour-sample-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.colour-sample-sub {
  font-size: 0.64rem;
  font-weight: 800;
  color: #7a4208;
  text-align: center;
}

.colour-hint-toggle-btn {
  width: 100%;
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 900;
  padding: 3px 4px;
  border-radius: 8px;
  border: 1.5px solid #229954;
  background: linear-gradient(180deg, #e8f8f0 0%, #c8f0dc 100%);
  color: #0e6231;
  cursor: pointer;
}

.colour-hint-toggle-btn:not(.active) {
  border-color: #c9a77c;
  background: #f7efe2;
  color: #6e5233;
}

/* Zoomed state when child clicks 🔍 on the Coloured Sample Card */
.colour-sample-card.sample-zoomed {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 286px;
  padding: 10px;
  z-index: 125;
  border-width: 4px;
  box-shadow: 0 8px 0 #b85d00, 0 20px 50px rgba(0, 0, 0, 0.45);
}

.colour-sample-card.sample-zoomed .colour-sample-canvas {
  width: 248px;
  height: 248px;
}

.colour-sample-card.sample-zoomed .colour-sample-title {
  font-size: 0.95rem;
}

.colour-sample-card.sample-zoomed .colour-sample-sub,
.colour-sample-card.sample-zoomed .colour-hint-toggle-btn {
  font-size: 0.82rem;
}

@media (max-width: 859px) and (orientation: portrait) {
  .studio-board-area {
    position: relative;
  }
  .colour-sample-card:not(.sample-zoomed) {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 78px;
    padding: 3px;
    border-radius: 10px;
    z-index: 16;
    gap: 2px;
  }
  .colour-sample-card:not(.sample-zoomed) .colour-sample-canvas {
    width: 66px;
    height: 66px;
    border-radius: 7px;
  }
  .colour-sample-card:not(.sample-zoomed) .colour-sample-title {
    font-size: 0.56rem;
  }
  .colour-sample-card:not(.sample-zoomed) .colour-sample-sub {
    display: none;
  }
  .colour-sample-card:not(.sample-zoomed) .colour-hint-toggle-btn {
    font-size: 0.54rem;
    padding: 1px 2px;
  }
}


/* ============================================================
   📖 COLOURED USER GUIDE & 832-ITEM CATALOG MODAL
   ============================================================ */
.catalog-guide-btn {
  background: linear-gradient(180deg, #ff5f8d 0%, #d91c5c 100%) !important;
  color: #ffffff !important;
  border-color: #9e0b3e !important;
  box-shadow: 0 3px 0 #7a062e !important;
  font-weight: 900 !important;
}

.catalog-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 16, 4, 0.72);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.catalog-modal-backdrop[hidden] {
  display: none !important;
}

.catalog-modal-card {
  width: min(96vw, 1140px);
  max-height: 92vh;
  background: linear-gradient(180deg, #fffdf9 0%, #fff4de 100%);
  border: 4px solid #ff8c1a;
  border-radius: 24px;
  box-shadow: 0 12px 0 #b85600, 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.catalog-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(90deg, #ffedd1 0%, #ffe0b5 100%);
  border-bottom: 2.5px solid #ffb866;
  flex-wrap: wrap;
}

.catalog-header-badge {
  display: inline-block;
  background: #ff6f00;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 3px;
}

.catalog-modal-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
  color: #4a2000;
}

.catalog-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.catalog-install-btn {
  background: linear-gradient(180deg, #27c96b 0%, #149948 100%);
  color: #ffffff;
  border: 2px solid #0e7333;
  box-shadow: 0 3px 0 #0a5926;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.catalog-print-link {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  text-decoration: none;
  border: 2px solid #1e3a8a;
  box-shadow: 0 3px 0 #172554;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 12px;
}

.catalog-close-btn {
  background: #ffffff;
  color: #7c2d12;
  border: 2px solid #fb923c;
  box-shadow: 0 3px 0 #c2410c;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.catalog-stats-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 18px;
  background: #fff9ed;
  border-bottom: 2px dashed #f5c27c;
}

.cat-stat-pill {
  border-radius: 14px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 2px solid transparent;
}

.cat-stat-pill .stat-num {
  font-size: 1.24rem;
  font-weight: 900;
  line-height: 1.1;
}

.cat-stat-pill .stat-lbl {
  font-size: 0.68rem;
  font-weight: 800;
}

.stat-orange { background: #fff0db; border-color: #ff9800; color: #8c3b00; }
.stat-pink   { background: #ffe6f0; border-color: #ec407a; color: #880e4f; }
.stat-gold   { background: linear-gradient(180deg, #fff5bf 0%, #ffe066 100%); border-color: #d97706; color: #5c2800; box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2); }
.stat-green  { background: #e6f9ed; border-color: #2ecc71; color: #0b5e2b; }
.stat-blue   { background: #e6f2ff; border-color: #3498db; color: #0d3c6e; }
.stat-purple { background: #f3e8ff; border-color: #9b59b6; color: #4a156b; }

.catalog-langs-banner {
  background: linear-gradient(90deg, #eff6ff 0%, #f5f3ff 50%, #fff7ed 100%);
  border: 2.5px solid #6366f1;
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: 0 3px 0 #4f46e5;
}

.catalog-langs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.catalog-langs-title {
  font-size: 0.88rem;
  font-weight: 900;
  color: #1e1b4b;
}

.catalog-langs-note {
  font-size: 0.74rem;
  font-weight: 800;
  background: #fde047;
  color: #422006;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1.5px solid #ca8a04;
}

.catalog-langs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.catalog-lang-pill {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.catalog-lang-pill:hover {
  transform: translateY(-1px);
  border-color: #6366f1;
  background: #eef2ff;
}

.catalog-lang-pill.active {
  background: linear-gradient(180deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  border-color: #312e81;
  box-shadow: 0 2px 0 #1e1b4b;
}

.catalog-modal-scroll {
  padding: 12px 18px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.catalog-sec-heading {
  margin: 8px 0 10px;
  font-size: 1rem;
  font-weight: 900;
  color: #5c2600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.guide-step-card {
  position: relative;
  border-radius: 16px;
  padding: 10px 12px;
  border: 2.5px solid transparent;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.guide-step-card .gcard-num {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.14);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-step-card .gcard-icon {
  font-size: 1.5rem;
  margin-bottom: 3px;
}

.guide-step-card h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 900;
}

.guide-step-card p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.36;
  font-weight: 700;
}

.gcard-green  { background: linear-gradient(180deg, #edfdf2 0%, #d4f8e0 100%); border-color: #28b463; color: #0e4d26; }
.gcard-pink   { background: linear-gradient(180deg, #fff0f6 0%, #ffd9e8 100%); border-color: #e91e63; color: #6e0b2e; }
.gcard-blue   { background: linear-gradient(180deg, #eef6ff 0%, #d6eaff 100%); border-color: #2980b9; color: #0c395c; }
.gcard-amber  { background: linear-gradient(180deg, #fff9e6 0%, #ffecb3 100%); border-color: #f39c12; color: #663c00; }
.gcard-purple { background: linear-gradient(180deg, #f6eeff 0%, #e8d4ff 100%); border-color: #8e44ad; color: #3f1057; }
.gcard-teal   { background: linear-gradient(180deg, #e8fcfb 0%, #ccf5f3 100%); border-color: #16a085; color: #07473a; }

.catalog-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cat-detail-card {
  background: #ffffff;
  border: 2.5px solid #f0c27b;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 3px 0 #e0ab5a;
}

.cat-detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cat-detail-title {
  font-size: 0.94rem;
  font-weight: 900;
  color: #3d1d00;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-detail-count {
  background: linear-gradient(180deg, #ff7a00 0%, #d95300 100%);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.cat-detail-desc {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: #6b421b;
  font-weight: 700;
  line-height: 1.34;
}

.cat-detail-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cat-sample-chip {
  background: #fff5e4;
  border: 1px solid #f5c784;
  color: #5c2e04;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
}

.cat-detail-btns {
  display: flex;
  gap: 6px;
}

.cat-jump-btn {
  flex: 1 1 0;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 5px 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
}

.cat-jump-trace {
  background: linear-gradient(180deg, #2ecc71 0%, #1e9e54 100%);
  color: #ffffff;
  border-color: #11783c;
}

.cat-jump-colour {
  background: linear-gradient(180deg, #ff4da6 0%, #d81b72 100%);
  color: #ffffff;
  border-color: #9c0d4e;
}

@media (max-width: 859px) {
  .catalog-stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .guide-steps-grid,
  .catalog-category-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   CATEGORIZED PAGE & IMAGE PICKER DRAWER + BOTTOM NEXT/PREV NAV
   (Declutters top bars on Desktop, Tablet & Mobile!)
   ============================================================ */

.category-bar[hidden],
.item-nav-row[hidden] {
  display: none !important;
}

.drawer-open-btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 13px;
  border: 2.5px solid #c25200;
  background: linear-gradient(180deg, #ff9929 0%, #e66000 100%);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 0 #993f00;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.drawer-open-btn:hover {
  filter: brightness(1.05);
}

.drawer-open-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #993f00;
}

.drawer-btn-arrow {
  font-size: 0.72rem;
  opacity: 0.9;
}

#wordPillPickerTrigger {
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 12px;
  background: #fff8eb;
  border: 2px dashed #ffae33;
  transition: background 0.15s ease, transform 0.12s ease;
}

#wordPillPickerTrigger:hover {
  background: #ffefd2;
}

.page-counter-pill {
  font-size: 0.76rem;
  font-weight: 900;
  background: #ff8a1f;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
  white-space: nowrap;
}

/* Prominent Bottom Previous & Next Navigation Buttons */
.bottom-nav-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.btn-nav-prev,
.btn-nav-next {
  font-family: inherit;
  font-weight: 900;
  font-size: 0.88rem;
  padding: 9px 10px;
  border-radius: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-nav-prev {
  background: linear-gradient(180deg, #ff9f2e 0%, #e06d00 100%);
  color: #ffffff;
  border: 2px solid #b35300;
  box-shadow: 0 4px 0 #8a3e00;
}

.btn-nav-next {
  background: linear-gradient(180deg, #27c96b 0%, #149948 100%);
  color: #ffffff;
  border: 2px solid #0e7333;
  box-shadow: 0 4px 0 #0a5926;
}

.btn-nav-prev:active,
.btn-nav-next:active {
  transform: translateY(2px);
}

.btn-picker-bottom {
  background: linear-gradient(180deg, #8a5cf0 0%, #6837d6 100%);
  color: #ffffff;
  border: 2px solid #4e22b0;
  box-shadow: 0 4px 0 #39158a;
  font-weight: 900;
}

.btn-picker-bottom:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #39158a;
}

/* Categorized Page & Image Picker Drawer Modal */
.picker-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(30, 15, 5, 0.68);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.picker-drawer-backdrop[hidden] {
  display: none !important;
}

.picker-drawer-card {
  width: min(1040px, 96vw);
  height: min(680px, 90dvh);
  background: #fffbf2;
  border: 4px solid #ff9929;
  border-radius: 24px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(90deg, #ff8a1f 0%, #e65100 100%);
  color: #ffffff;
  flex-shrink: 0;
}

.picker-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.picker-drawer-icon {
  font-size: 1.7rem;
  flex-shrink: 0;
}

.picker-drawer-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.2;
}

.picker-drawer-sub {
  margin: 2px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff3d1;
}

.picker-drawer-close {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  padding: 7px 14px;
  border-radius: 12px;
  border: 2px solid #ffffff;
  background: #b83300;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.picker-drawer-body {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  overflow: hidden;
}

.picker-cat-list {
  background: #fff2d6;
  border-right: 3px solid #ffd285;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.picker-cat-btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid #ffc978;
  background: #ffffff;
  color: #5c3000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  box-shadow: 0 3px 0 #e6b467;
  transition: transform 0.1s ease, background 0.12s ease;
}

.picker-cat-btn.active {
  background: linear-gradient(180deg, #ff8a1f 0%, #e05300 100%);
  color: #ffffff;
  border-color: #993300;
  box-shadow: 0 3px 0 #702400;
}

.picker-cat-count {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.picker-items-pane {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fffdf9;
  overflow: hidden;
}

.picker-subcat-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #fff6e3;
  border-bottom: 2px solid #ffe0a3;
  overflow-x: auto;
  flex-shrink: 0;
}

.picker-subcat-bar[hidden] {
  display: none !important;
}

.picker-subcat-chip {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 5px 11px;
  border-radius: 999px;
  border: 2px solid #ffb74d;
  background: #ffffff;
  color: #6b3400;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.picker-subcat-chip.active {
  background: #2f6fe8;
  color: #ffffff;
  border-color: #1849a8;
}

.picker-items-grid {
  flex: 1 1 0;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  align-content: start;
}

.picker-item-card {
  position: relative;
  font-family: inherit;
  background: #ffffff;
  border: 2.5px solid #ffd285;
  border-radius: 16px;
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 86px;
  box-shadow: 0 4px 0 #f0be6e;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-align: center;
}

.picker-item-card:hover {
  transform: translateY(-2px);
}

.picker-item-card.active {
  background: linear-gradient(180deg, #e8f8ed 0%, #c8f0d4 100%);
  border-color: #1c8c33;
  box-shadow: 0 4px 0 #116622, 0 0 0 3px #ffd93b;
}

.picker-item-num {
  position: absolute;
  top: 5px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 900;
  color: #8a5a2b;
  background: #fff2d6;
  padding: 1px 6px;
  border-radius: 999px;
}

.picker-item-status {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.78rem;
}

.picker-item-emoji {
  font-size: 1.7rem;
  line-height: 1.1;
  margin-top: 6px;
}

.picker-item-title {
  font-size: 0.84rem;
  font-weight: 900;
  color: #3a2415;
  line-height: 1.2;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 859px) {
  .drawer-open-btn {
    font-size: 0.75rem;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .action-btns {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .bottom-nav-btns {
    display: flex;
    gap: 4px;
    width: auto;
  }

  .btn-nav-prev,
  .btn-nav-next {
    font-size: 0.76rem;
    padding: 6px 9px;
    border-radius: 10px;
  }

  .picker-drawer-card {
    width: 98vw;
    height: 92dvh;
    border-radius: 18px;
  }

  .picker-drawer-header {
    padding: 9px 12px;
  }

  .picker-drawer-title {
    font-size: 0.92rem;
  }

  .picker-drawer-sub {
    display: none;
  }

  .picker-drawer-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .picker-cat-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 2.5px solid #ffd285;
    padding: 7px 8px;
    gap: 6px;
    flex-shrink: 0;
  }

  .picker-cat-btn {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  .picker-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .picker-item-card {
    min-height: 74px;
    padding: 8px 6px;
  }

  .picker-item-emoji {
    font-size: 1.45rem;
  }

  .picker-item-title {
    font-size: 0.75rem;
  }
}



/* ============================================================
   STRICT TRACING vs COLOURING MODE UI SEPARATION
   - Tracing Mode: Hides Colour Sample Card & Tap-Fill Bucket
   - Colouring Mode: Shows Colour Sample Card & Tap-Fill Bucket
   ============================================================ */
body.mode-is-tracing #colourSampleCard,
body.mode-is-tracing .tool-btn[data-tool="fill"] {
  display: none !important;
}

body.mode-is-colouring #colourSampleCard {
  display: flex !important;
}


/* ============================================================
   POEMS, STORIES, SONGS & YOUTUBE THEATER MODE (v21)
   - When active (body.mode-is-theater), the Drawing Slate board,
     word bar, name input, and hint footer smoothly close/hide so
     the audio/video poem, story, or song plays on a spacious stage!
   ============================================================ */
.mode-big-btn.mode-poems {
  background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  border: 2.5px solid #581c87;
  box-shadow: 0 4px 0 #4c1d95;
  font-weight: 900;
}

.mode-big-btn.mode-poems.active {
  background: linear-gradient(180deg, #ec4899 0%, #be185d 100%);
  border-color: #831843;
  box-shadow: 0 4px 0 #500724, 0 0 14px rgba(236, 72, 153, 0.55);
  transform: translateY(-1px);
}

/* Auto-close / hide the Slate when Poems/Stories/Songs Theater is playing */
body.mode-is-theater #studioBoardArea,
body.mode-is-theater .word-bar,
body.mode-is-theater #nameInputRow,
body.mode-is-theater #hintFooter,
body.mode-is-theater #openCatalogDrawerBtn,
body.mode-is-theater #focusBoardBtn,
body.mode-is-theater #doubleItemBadge {
  display: none !important;
}

body.mode-is-theater .poems-theater-section {
  display: flex !important;
}

.poems-theater-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%);
  border: 4px solid #f59e0b;
  border-radius: 22px;
  padding: 12px;
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.45);
  min-height: 520px;
}

.theater-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.14);
}

.theater-filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.theater-filter-tab {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  padding: 7px 13px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theater-filter-tab:hover {
  background: rgba(255, 255, 255, 0.2);
}

.theater-filter-tab.active {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #fff;
  border-color: #fde68a;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.45);
}

.theater-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theater-yt-channel-btn {
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 900;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  border: 2px solid #fca5a5;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.4);
  white-space: nowrap;
}

.theater-back-slate-btn {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  border: 2px solid #bbf7d0;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.4);
  white-space: nowrap;
}

.theater-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
  gap: 12px;
  flex: 1 1 auto;
  min-height: 430px;
}

.theater-stage-box {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid #38bdf8;
  background: #090d16;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 410px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7);
}

/* Back Layer: Auto-Clip Muted 3D Video */
.theater-bg-clip-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  filter: saturate(1.25) contrast(1.05);
  z-index: 1;
  pointer-events: none;
}

.theater-bg-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.25) 0%, rgba(15, 23, 42, 0.82) 100%);
  z-index: 2;
  pointer-events: none;
}

/* Front Layer: Animated/PNG/JPG Image Showcase + Optional MP4 Video */
.theater-front-stage {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  flex-wrap: wrap;
}

.theater-front-art-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.theater-glow-ring {
  position: absolute;
  inset: -10px;
  border-radius: 26px;
  background: linear-gradient(135deg, #f59e0b, #ec4899, #38bdf8, #22c55e);
  opacity: 0.65;
  filter: blur(12px);
  z-index: -1;
  animation: theaterPulseGlow 3s ease-in-out infinite alternate;
}

.theater-front-img {
  width: min(240px, 52vw);
  height: min(240px, 52vw);
  max-height: 240px;
  object-fit: cover;
  border-radius: 22px;
  border: 4px solid #fde047;
  background: #1e293b;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  animation: theaterFloatFrontImg 3.6s ease-in-out infinite;
}

.theater-stage-box:not(.is-playing) .theater-front-img {
  animation-play-state: paused;
}

@keyframes theaterFloatFrontImg {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-8px) scale(1.03); }
}

@keyframes theaterPulseGlow {
  0% { opacity: 0.45; transform: scale(0.97); }
  100% { opacity: 0.85; transform: scale(1.04); }
}

/* Animated Musical Equalizer Bars under Front Image */
.theater-eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 24px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(253, 224, 71, 0.45);
}

.theater-eq-bars span {
  width: 5px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(180deg, #fde047, #f97316);
  animation: theaterEqBounce 0.75s ease-in-out infinite alternate;
}

.theater-eq-bars span:nth-child(2) { animation-delay: 0.12s; }
.theater-eq-bars span:nth-child(3) { animation-delay: 0.24s; }
.theater-eq-bars span:nth-child(4) { animation-delay: 0.08s; }
.theater-eq-bars span:nth-child(5) { animation-delay: 0.3s; }
.theater-eq-bars span:nth-child(6) { animation-delay: 0.18s; }
.theater-eq-bars span:nth-child(7) { animation-delay: 0.36s; }

.theater-stage-box:not(.is-playing) .theater-eq-bars span {
  animation: none;
  height: 5px;
}

@keyframes theaterEqBounce {
  0% { height: 5px; }
  100% { height: 20px; }
}

.theater-main-video {
  width: min(360px, 85vw);
  max-height: 250px;
  border-radius: 16px;
  border: 3px solid #38bdf8;
  background: #000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.65);
}

/* YouTube Embed Stage */
.theater-youtube-wrap {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px 4px;
  gap: 8px;
}

.theater-youtube-frame {
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  border: 3px solid #ef4444;
  border-radius: 14px;
  background: #000;
}

.theater-yt-fallback-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  background: rgba(15, 23, 42, 0.85);
  padding: 5px 12px;
  border-radius: 999px;
}

.theater-yt-direct-link {
  color: #fde047;
  font-weight: 900;
  text-decoration: none;
}

/* Bottom Stage Transport Controls */
.theater-controls-bar {
  position: relative;
  z-index: 3;
  background: rgba(15, 23, 42, 0.9);
  border-top: 2px solid rgba(255, 255, 255, 0.14);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theater-now-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theater-type-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.theater-now-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  color: #fde047;
}

.theater-now-desc {
  margin: 0;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.theater-transport-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theater-ctrl-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 7px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
}

.theater-play-btn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-color: #86efac;
  padding: 7px 16px;
}

.theater-play-btn.playing {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #fde68a;
}

.theater-seek-wrap {
  flex: 1 1 140px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theater-seek-bar {
  flex: 1 1 auto;
  accent-color: #fde047;
  cursor: pointer;
}

.theater-time-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #e2e8f0;
  white-space: nowrap;
}

/* Playlist Sidebar */
.theater-playlist-pane {
  background: rgba(15, 23, 42, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
}

.theater-playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 900;
  color: #fde047;
  padding-bottom: 6px;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.14);
}

.theater-playlist-yt-tag {
  color: #fca5a5;
  text-decoration: none;
  font-size: 0.75rem;
}

.theater-playlist-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.theater-playlist-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
}

.theater-playlist-card:hover {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 1);
}

.theater-playlist-card.active {
  border-color: #fde047;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28) 0%, rgba(234, 88, 12, 0.25) 100%);
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.3);
}

.tpc-thumb-wrap {
  position: relative;
  width: 66px;
  height: 52px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: #0f172a;
}

.tpc-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tpc-type-pill {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.88);
  color: #fde047;
}

.tpc-type-pill.type-youtube {
  background: #dc2626;
  color: #fff;
}

.tpc-playing-wave {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 0.55rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 5px;
  background: #16a34a;
  color: #fff;
}

.tpc-info {
  flex: 1 1 auto;
  min-width: 0;
}

.tpc-title {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 900px) {
  .theater-main-layout {
    grid-template-columns: 1fr;
  }
  .theater-playlist-pane {
    max-height: 260px;
  }
}


/* Ensure [hidden] always wins over display:flex/block inside theater and slate */
.poems-theater-section[hidden],
.theater-youtube-wrap[hidden],
.theater-main-video[hidden],
.theater-front-stage[hidden] {
  display: none !important;
}

body.mode-is-theater #studioBoardArea,
body.mode-is-theater #toolsBar,
body.mode-is-theater #boardFrame,
body.mode-is-theater .controls-row,
body.mode-is-theater .word-bar,
body.mode-is-theater #nameInputRow,
body.mode-is-theater #hintFooter,
body.mode-is-theater #openCatalogDrawerBtn,
body.mode-is-theater #focusBoardBtn,
body.mode-is-theater #doubleItemBadge {
  display: none !important;
}

/* Fix desktop absolute/grid layout when Theater Mode is active */
body.mode-is-theater .slate-main {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  gap: 8px !important;
}

body.mode-is-theater .poems-theater-section {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  margin-top: 0 !important;
}

/* Hide Share button completely & style Zoom In / Zoom Out / Fullscreen / Stop in Theater */
#shareBtn {
  display: none !important;
}

.theater-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.75);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
}

.theater-zoom-btn,
.theater-fullscreen-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid #38bdf8;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}

.theater-fullscreen-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  border-color: #c4b5fd;
}

.theater-zoom-label {
  font-size: 0.78rem;
  font-weight: 900;
  color: #fde047;
  min-width: 42px;
  text-align: center;
}

.theater-stop-btn {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
  border-color: #fca5a5 !important;
  color: #ffffff !important;
}

.theater-front-art-card,
.theater-main-video {
  transition: transform 0.2s ease;
  transform-origin: center center;
}

.theater-front-art-card[hidden] {
  display: none !important;
}

/* Theater Fullscreen Mode */
body.theater-is-fullscreen #poemsTheaterSection {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  height: 100dvh !important;
  width: 100vw !important;
  margin: 0 !important;
}

/* ============================================================
   v24 FULL-STAGE ORIGINAL VIDEO PLAYER (ZERO MIDDLE IMAGE BOX!)
   ============================================================ */
.theater-front-art-card,
.theater-bg-scrim {
  display: none !important;
}

.theater-front-stage {
  position: relative !important;
  z-index: 3 !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000000 !important;
  overflow: hidden !important;
}

.theater-main-video {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 440px !important;
  aspect-ratio: 16 / 9 !important;
  object-fit: contain !important;
  border: none !important;
  border-radius: 0 !important;
  background: #000000 !important;
  box-shadow: none !important;
  display: block !important;
}

.theater-bg-clip-video {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 440px !important;
  object-fit: contain !important;
  opacity: 1 !important;
  filter: none !important;
  background: #000000 !important;
}

body.theater-is-fullscreen .theater-main-video,
body.theater-is-fullscreen .theater-bg-clip-video {
  max-height: calc(100dvh - 150px) !important;
}


/* ============================================================
   v26 LANGUAGE-WISE SONG TABS & FILTER BAR (THEATER)
   ============================================================ */
.theater-lang-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #fbbf24;
  border-radius: 14px;
  padding: 7px 12px;
}

.theater-lang-label {
  font-size: 0.84rem;
  font-weight: 900;
  color: #fde047;
  white-space: nowrap;
}

.theater-lang-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.theater-lang-tab {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.theater-lang-tab:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
}

.theater-lang-tab.active {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  border-color: #bbf7d0;
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.45);
}

.theater-lang-dropdown {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid #38bdf8;
  background: #0f172a;
  color: #f8fafc;
  cursor: pointer;
}


/* ============================================================
   v28 STRICT TRACING vs COLOURING MODE ISOLATION
   - In Tracing Mode (body.mode-is-tracing):
     HIDE all 9 colour swatches (.swatches), colour sample card (#colourSampleCard),
     and colouring tools (Brush, Crayon, Tap-Fill, Line-Lock).
     Show ONLY Pencil (✏️) and Eraser (🧽) + S/M/L sizes!
   ============================================================ */
body.mode-is-tracing #colourSampleCard,
body.mode-is-tracing .swatches,
body.mode-is-tracing .tool-btn[data-tool="brush"],
body.mode-is-tracing .tool-btn[data-tool="crayon"],
body.mode-is-tracing .tool-btn[data-tool="fill"],
body.mode-is-tracing .tool-btn[data-tool="stencil"] {
  display: none !important;
}

body.mode-is-colouring .swatches {
  display: flex !important;
}


/* ============================================================
   v32 MOBILE PORTRAIT & LANDSCAPE THEATER + LANDSCAPE BOARD FIXES
   ============================================================ */
/* Tablet & Desktop 1024x768+ — Keep all 4 bottom buttons & sample card 100% inside viewport */
@media (min-width: 860px) {
  body.mode-is-colouring .colour-sample-card {
    padding: 5px 6px !important;
    gap: 3px !important;
  }
  body.mode-is-colouring .colour-sample-canvas {
    width: 82px !important;
    height: 82px !important;
  }
  body.mode-is-colouring .colour-sample-sub {
    display: none !important;
  }
  .controls-row {
    gap: 5px !important;
    padding: 5px 6px !important;
    justify-content: space-between !important;
  }
  .swatches {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 5px !important;
    justify-items: center !important;
  }
  .swatch {
    width: 28px !important;
    height: 28px !important;
  }
  .action-btns {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
    width: 100% !important;
  }
  .bottom-nav-btns {
    display: contents !important;
  }
  .action-btns .btn,
  .bottom-nav-btns .btn {
    padding: 6px 4px !important;
    font-size: 0.72rem !important;
    min-height: 28px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* Portrait Mobile & Narrow Tablet (<= 859px) — Keep all 4 bottom buttons on-screen without horizontal overflow */
@media (max-width: 859px) {
  .controls-row {
    flex-wrap: wrap !important;
    overflow-x: hidden !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 3px 5px !important;
    gap: 4px !important;
  }
  body.mode-is-colouring .colour-sample-card {
    padding: 2px 5px !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  body.mode-is-colouring .colour-sample-title,
  body.mode-is-colouring .colour-sample-sub {
    display: none !important;
  }
  body.mode-is-colouring .colour-sample-canvas {
    width: 34px !important;
    height: 34px !important;
  }
  body.mode-is-colouring .swatches {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    flex: 1 1 auto !important;
    justify-content: space-between !important;
    min-width: 0 !important;
  }
  body.mode-is-colouring .swatch {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
  }
  .action-btns {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 4px !important;
  }
  .bottom-nav-btns {
    display: contents !important;
  }
  .action-btns .btn,
  .bottom-nav-btns .btn {
    width: 100% !important;
    padding: 5px 3px !important;
    font-size: 0.68rem !important;
    min-height: 26px !important;
    justify-content: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (max-width: 900px) {
  body.mode-is-theater,
  body.mode-is-theater .slate-shell,
  body.mode-is-theater .slate-workspace,
  body.mode-is-theater .slate-main {
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow-y: auto !important;
  }
  body.mode-is-theater .companion-stage {
    display: none !important;
  }
  body.mode-is-theater .poems-theater-section {
    padding: 6px 8px !important;
    gap: 6px !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.mode-is-theater .theater-top-bar,
  body.mode-is-theater .theater-header-bar,
  body.mode-is-theater .theater-lang-bar {
    padding: 4px 6px !important;
    gap: 4px !important;
  }
  body.mode-is-theater .theater-lang-tab,
  body.mode-is-theater .theater-filter-tab {
    padding: 3px 7px !important;
    font-size: 0.72rem !important;
  }
  body.mode-is-theater .theater-stage-box {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 6px !important;
  }
  body.mode-is-theater .theater-front-stage {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: 215px !important;
    min-height: 215px !important;
    max-height: 250px !important;
    aspect-ratio: 16 / 9 !important;
  }
  body.mode-is-theater .theater-main-video,
  body.mode-is-theater .theater-bg-clip-video,
  body.mode-is-theater .theater-yt-frame {
    width: 100% !important;
    height: 215px !important;
    min-height: 210px !important;
    max-height: 250px !important;
  }
  body.mode-is-theater .theater-playlist-pane {
    flex: 0 0 auto !important;
    max-height: 240px !important;
    overflow-y: auto !important;
  }
}

/* Landscape Phone (844x390) — Keep Board >= 200px, All 4 Bottom Buttons In-Bounds, and Song Video in First Screen */
@media (max-height: 540px) and (orientation: landscape) {
  .slate-workspace {
    grid-template-columns: 112px minmax(0, 1fr) !important;
    gap: 4px !important;
  }
  .mode-switch-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding: 2px 4px !important;
    gap: 3px !important;
  }
  .mode-big-btn,
  .drawer-open-btn,
  .focus-board-btn {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    padding: 2px 6px !important;
    font-size: 0.65rem !important;
    white-space: nowrap !important;
  }
  .word-bar {
    padding: 1px 6px !important;
    min-height: 24px !important;
  }
  .board-frame {
    height: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    max-width: calc(100% - 224px) !important;
    aspect-ratio: 1 / 1 !important;
  }
  .controls-row {
    width: 118px !important;
    max-width: 118px !important;
    gap: 2px !important;
    padding: 3px 4px !important;
    justify-content: space-between !important;
    overflow: hidden !important;
  }
  body.mode-is-colouring .colour-sample-card {
    padding: 2px 3px !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    min-height: 0 !important;
  }
  body.mode-is-colouring .colour-sample-title,
  body.mode-is-colouring .colour-sample-sub {
    display: none !important;
  }
  body.mode-is-colouring .colour-sample-canvas {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }
  body.mode-is-colouring .swatches {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2px !important;
    padding: 1px !important;
    width: 100% !important;
    justify-items: center !important;
  }
  body.mode-is-colouring .swatch {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
  }
  .action-btns {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2px !important;
    width: 100% !important;
  }
  .bottom-nav-btns {
    display: contents !important;
  }
  .action-btns .btn,
  .bottom-nav-btns .btn {
    padding: 2px 2px !important;
    font-size: 0.56rem !important;
    min-height: 19px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border-radius: 6px !important;
    box-shadow: none !important;
  }
  body.mode-is-theater .companion-stage {
    display: none !important;
  }
  body.mode-is-theater .slate-workspace {
    grid-template-columns: 1fr !important;
  }
  body.mode-is-theater .poems-theater-section {
    padding: 4px 6px !important;
    gap: 4px !important;
  }
  body.mode-is-theater .theater-top-bar,
  body.mode-is-theater .theater-lang-bar {
    padding: 2px 6px !important;
    gap: 3px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }
  body.mode-is-theater .theater-lang-tabs,
  body.mode-is-theater .theater-filter-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 3px !important;
  }
  body.mode-is-theater .theater-lang-tab,
  body.mode-is-theater .theater-filter-tab,
  body.mode-is-theater .theater-back-slate-btn,
  body.mode-is-theater .theater-yt-channel-btn,
  body.mode-is-theater .theater-zoom-btn,
  body.mode-is-theater .theater-fullscreen-btn {
    padding: 2px 6px !important;
    font-size: 0.64rem !important;
    white-space: nowrap !important;
  }
  body.mode-is-theater .theater-main-layout {
    display: grid !important;
    grid-template-columns: 1.35fr 1fr !important;
    gap: 6px !important;
    min-height: 0 !important;
  }
  body.mode-is-theater .theater-front-stage,
  body.mode-is-theater .theater-main-video,
  body.mode-is-theater .theater-bg-clip-video {
    height: 175px !important;
    min-height: 165px !important;
    max-height: 190px !important;
  }
  body.mode-is-theater .theater-controls-bar {
    padding: 4px 8px !important;
    gap: 3px !important;
  }
  body.mode-is-theater .theater-now-title {
    font-size: 0.78rem !important;
  }
  body.mode-is-theater .theater-now-desc {
    display: none !important;
  }
  body.mode-is-theater .theater-playlist-pane {
    max-height: 235px !important;
    padding: 6px !important;
  }
}


/* ============================================================================
   Parent & Family Voice Studio ("माँ-पापा की आवाज़") v33 Styles
   ============================================================================ */
.parent-voice-btn {
  background: linear-gradient(135deg, #ec4899, #be185d) !important;
  color: #ffffff !important;
  border-color: #f9a8d4 !important;
  font-weight: 900 !important;
}

.pvs-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 1250;
}
.pvs-modal-backdrop[hidden] {
  display: none !important;
}
.pvs-modal-card {
  width: min(920px, 96vw);
  max-height: 92vh;
  background: #fffdf9;
  border: 4px solid #ec4899;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #1e293b;
}
.pvs-header {
  background: linear-gradient(90deg, #be185d 0%, #db2777 50%, #f59e0b 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pvs-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pvs-header-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.2);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pvs-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
}
.pvs-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  opacity: 0.95;
  font-weight: 700;
}
.pvs-close-btn {
  background: #ffffff;
  color: #9d174d;
  border: 2px solid #fbcfe8;
  border-radius: 999px;
  padding: 7px 15px;
  font-weight: 900;
  font-size: 0.88rem;
  cursor: pointer;
}
.pvs-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pvs-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}
.pvs-config-box {
  background: #fdf2f8;
  border: 2px solid #f9a8d4;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pvs-label {
  font-size: 0.82rem;
  font-weight: 900;
  color: #831843;
}
.pvs-select,
.pvs-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid #f472b6;
  background: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}
.pvs-recorder-panel {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px solid #f59e0b;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pvs-slot-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.pvs-current-target-pill {
  background: #ffffff;
  border: 2px solid #f59e0b;
  color: #92400e;
  padding: 7px 12px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 0.86rem;
}
.pvs-slot-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #78350f;
  font-weight: 700;
}
.pvs-free-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pvs-controls-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pvs-btn {
  font-family: inherit;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s, opacity 0.12s;
}
.pvs-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.pvs-btn-record {
  background: #ef4444;
  color: #ffffff;
  border-color: #b91c1c;
}
.pvs-btn-stop {
  background: #1e293b;
  color: #ffffff;
  border-color: #0f172a;
}
.pvs-btn-preview {
  background: #3b82f6;
  color: #ffffff;
  border-color: #1d4ed8;
}
.pvs-btn-save {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}
.pvs-btn-danger-all {
  background: #fee2e2;
  color: #991b1b;
  border-color: #f87171;
  padding: 6px 12px;
  font-size: 0.8rem;
}
.pvs-timer-pill {
  margin-left: auto;
  background: #0f172a;
  color: #fde047;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0.5px;
}
.pvs-timer-pill.recording {
  background: #dc2626;
  color: #ffffff;
}
.pvs-status-banner {
  background: #ffffff;
  border: 1.5px dashed #d97706;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.83rem;
  font-weight: 800;
  color: #451a03;
}
.pvs-status-banner.pvs-status-recording {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}
.pvs-status-banner.pvs-status-ok {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #14532d;
}
.pvs-status-banner.pvs-status-error {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}
.pvs-list-section {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pvs-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.pvs-list-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 900;
  color: #0f172a;
}
.pvs-storage-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: #475569;
}
.pvs-recordings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.pvs-empty-state {
  text-align: center;
  padding: 18px 12px;
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 700;
}
.pvs-rec-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.pvs-rec-title {
  font-weight: 900;
  font-size: 0.9rem;
  color: #0f172a;
}
.pvs-rec-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.pvs-tag {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.pvs-tag-speaker {
  background: #fce7f3;
  color: #9d174d;
}
.pvs-tag-dialect {
  background: #e0f2fe;
  color: #075985;
}
.pvs-tag-size {
  background: #f1f5f9;
  color: #334155;
}
.pvs-rec-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pvs-act-btn {
  font-family: inherit;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
}
.pvs-act-play {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.pvs-act-rerecord {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}
.pvs-act-delete {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}


/* v34: family messages and small phones */
.family-messages-btn { width: 100%; margin-top: 6px; }
.family-messages-btn[hidden] { display: none !important; }
.family-messages-card { max-height: 86vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.family-message-row { min-height: 54px; padding: 10px 14px; border-radius: 16px; border: 3px solid #f59e0b; background: #fff7e6; font: inherit; font-weight: 800; text-align: start; cursor: pointer; }
@media (max-width: 859px) and (orientation: portrait) and (max-height: 720px) {
  .topbar-brand img:nth-child(2) { display: none; }
  .topbar-actions { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar-actions > * { flex: 0 0 auto; }
  .word-pill { white-space: nowrap; overflow: hidden; }
  .mode-switch-bar { flex-wrap: wrap; row-gap: 3px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .btn-picker-bottom, .btn-reset { font-size: 0.62rem; padding-inline: 2px; white-space: normal; line-height: 1.05; }
}

/* labels-wrap-1106: on phones, long button names in some languages wrap to two lines instead of being cut off. */
@media (max-width: 859px) {
  html body .mode-switch-bar .mode-big-btn,
  html body .action-btns .btn {
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: anywhere;
    height: auto;
    line-height: 1.1;
    text-align: center;
    justify-content: center;
    padding-top: 3px;
    padding-bottom: 3px;
  }
  html body .mode-switch-bar .mode-big-btn { min-height: 36px; }
  /* The bottom buttons carry older one-line rules marked important, so these must be too. */
  html body .action-btns .btn,
  html body .bottom-nav-btns .btn {
    white-space: normal !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    line-height: 1.08 !important;
    min-height: 30px !important;
    height: auto !important;
  }
}

/* hint-below-1106: on phones the hint on/off button sat outside the small sample card, cut off at the board edge. It now sits under the sample. */
@media (max-width: 859px) {
  html body.mode-is-colouring .colour-sample-card:not(.sample-zoomed) {
    flex-wrap: wrap !important;
    width: auto !important;
    max-width: 112px !important;
    justify-content: center !important;
  }
  html body.mode-is-colouring .colour-sample-card:not(.sample-zoomed) .colour-sample-footer {
    flex: 0 0 100% !important;
    width: 100% !important;
  }
  html body.mode-is-colouring .colour-sample-card:not(.sample-zoomed) .colour-hint-toggle-btn {
    width: 100% !important;
    white-space: normal !important;
    line-height: 1.05 !important;
    font-size: 0.56rem !important;
    padding: 2px 3px !important;
  }
}


/* ==========================================================================
   Inclusive Left-Handed Mode (Global Accessibility Standard)
   ========================================================================== */
/* Phone (board above tools): nothing moves. Wide screens: tools go to the physical right of the board, LTR and RTL. */
@media (min-width: 860px) {
  html:not([dir="rtl"]) body.left-handed-mode #studioBoardArea { flex-direction: row-reverse !important; }
  /* RTL: right-handed (default) = tools on the physical left; left-handed = tools on the physical right, same as LTR. */
  html[dir="rtl"] body:not(.left-handed-mode) #studioBoardArea { flex-direction: row-reverse !important; }
  html[dir="rtl"] body.left-handed-mode #studioBoardArea { flex-direction: row !important; }
}
.left-hand-btn.active {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 4px 0 #065f46 !important;
}

/* hand-sound-1106: on phones the hand and sound buttons show only their icon (title/aria carry the words), so the board keeps its size. */
@media (max-width: 859px) { #leftHandBtn .hb-txt, #asmrSoundBtn .hb-txt { display: none; } #leftHandBtn, #asmrSoundBtn { min-width: 40px; padding-left: 8px; padding-right: 8px; } }

/* tools-wrap-1106: on phones every tool and size button stays visible (was a hidden side-scroll strip; Tamil/Malayalam lost half). */
@media (max-width: 859px) { #toolsBar { flex-wrap: wrap !important; overflow-x: visible !important; justify-content: center; row-gap: 6px; } #toolsBar .tool-group, #toolsBar .size-group { flex-wrap: wrap !important; justify-content: center; row-gap: 6px; } }
/* size buttons on phones: the dot shows the size, the word is kept for screen readers only */
@media (max-width: 859px) { #toolsBar .size-btn { font-size: 0 !important; min-width: 40px; padding-left: 8px !important; padding-right: 8px !important; } #toolsBar .size-btn::first-letter { font-size: 18px; } }
