:root {
  color-scheme: only light;
  --bg-cream: #FBF6EE;
  --bg-paper: #F5ECDC;
  --card: #F9F2E4;
  --card-grad: linear-gradient(180deg, #FDF8EE 0%, #F7EFE0 100%);
  --ink: #4A3423;
  --ink-soft: #6F5643;
  --coral: #E8896B;
  --coral-deep: #C45E3E;
  --coral-soft: #FDF0EB;
  --green: #68A374;
  --green-deep: #296438;
  --green-soft: #E4F5E8;
  --gold-bg: #F8D878;
  --gold-border: #DDA636;
  --blue-bg: #CFE6F7;
  --blue-ink: #1F4A6E;
  --blue-border: #89B9DF;
  --wood-bg: #FFFBF2;
  --wood-border: #DFD1BA;
  --red-bg: #FCE8E4;
  --red-ink: #9F3223;
  --red-border: #E06C5A;
  --border-warm: #E9DEC9;
  --shadow-soft: 0 10px 24px -8px rgba(74, 52, 35, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: #FBF6EE;
  background-image:
    radial-gradient(rgba(218, 198, 166, 0.36) 1.4px, transparent 1.4px),
    linear-gradient(180deg, #FBF6EE 0%, #F7EFE1 100%);
  background-size: 22px 22px, 100% 100%;
  color: #4A3423;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Nunito", system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, h4, p, strong, b, small { color: inherit; }

button {
  font-family: inherit;
  color: #4A3423;
  background: none;
  border: none;
  cursor: pointer;
}
button:focus-visible { outline: 3px solid rgba(232, 137, 107, 0.55); outline-offset: 2px; }
.hidden { display: none !important; }

.workshop-shell {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 14px 106px;
  overflow-x: hidden;
}

/* Single-Row Top Bar */
.topbar {
  position: sticky;
  top: 8px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(253, 248, 238, 0.96), rgba(247, 239, 224, 0.96));
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-warm);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  color: #4A3423;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brand-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-paper);
  border: 2px solid var(--coral);
  flex-shrink: 0;
}
.brand-titles { min-width: 0; }
.brand-titles h1 {
  font-size: 15px;
  font-weight: 900;
  color: #4A3423;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-titles small {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desktop-nav { display: none; gap: 6px; }
.nav-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink-soft);
  border: 1.5px solid transparent;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.nav-pill:hover { background: var(--bg-paper); color: var(--ink); }
.nav-pill.active {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 3px 0 var(--coral-deep);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.star-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--gold-bg);
  border: 1.5px solid var(--gold-border);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 900;
  white-space: nowrap;
}
.icon-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card-grad);
  border: 1.5px solid var(--border-warm);
  color: #4A3423;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.icon-chip[aria-pressed="true"] {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
}

/* Toast placed below topbar, never blocking speaker buttons */
.toast-banner {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: #4A3423;
  color: #FFFDF8;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(74, 52, 35, 0.28);
  text-align: center;
  pointer-events: none;
}

.main-stage { margin-top: 14px; width: 100%; max-width: 100%; min-width: 0; }
.tab-view { display: none; width: 100%; max-width: 100%; min-width: 0; }
.tab-view.active { display: block; }
#mapOverview, #unitQuest { width: 100%; max-width: 100%; min-width: 0; }

/* Hero Workshop Banner */
.hero-workshop {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 2px solid var(--border-warm);
  box-shadow: var(--shadow-soft);
  min-height: 158px;
  margin-bottom: 14px;
  color: #4A3423;
}
.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(251, 246, 238, 0.95) 0%, rgba(251, 246, 238, 0.84) 58%, rgba(251, 246, 238, 0.42) 100%);
}
.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  color: #4A3423;
}
.hero-kicker {
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--coral-soft);
  color: var(--coral-deep);
  border: 1px solid #F2C3B3;
  margin-bottom: 7px;
}
.hero-text h2 {
  font-size: 21px;
  font-weight: 900;
  line-height: 1.28;
  color: #4A3423;
}
.hero-text p {
  font-size: 13.5px;
  color: #6F5643;
  font-weight: 700;
  margin-top: 6px;
}
.hero-cat {
  width: 112px;
  height: 128px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 14px rgba(74, 52, 35, 0.16));
}

/* Level Pills */
.level-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.lvl-pill {
  flex-shrink: 0;
  padding: 10px 10px;
  border-radius: 14px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  color: #4A3423;
  font-size: 13.5px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 3px 0 #E4D7C0;
  white-space: nowrap;
}
.lvl-pill.active {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral-deep);
  box-shadow: 0 3px 0 var(--coral-deep);
}
.lvl-pill.soon { opacity: 0.72; }
@media (min-width: 540px) {
  .level-pills {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Map Board */
.map-board {
  background: var(--card) url("./assets/art/scene-map-bg.webp?v=202629") center/cover no-repeat;
  border: 2px solid var(--border-warm);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(253, 248, 238, 0.94), rgba(247, 239, 224, 0.94));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--border-warm);
  margin-bottom: 14px;
  color: #4A3423;
}
.map-header h3 { font-size: 17px; font-weight: 900; color: #4A3423; }
.map-header p { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.level-badge {
  font-size: 12px;
  font-weight: 900;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--gold-bg);
  border: 1.5px solid var(--gold-border);
  color: #4A3423;
}

.unit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
@media (min-width: 540px) and (max-width: 959px) {
  .unit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .unit-grid > .unit-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
@media (min-width: 960px) {
  .unit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.unit-card {
  text-align: left;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(253, 248, 238, 0.96), rgba(247, 239, 224, 0.96));
  border: 2px solid var(--border-warm);
  box-shadow: 0 4px 0 #E4D7C0;
  color: #4A3423;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.unit-card:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--coral); }
.unit-card:disabled { cursor: default; opacity: 0.85; }
.unit-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.unit-code-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.unit-focus-tag {
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue-ink);
  border: 1px solid var(--blue-border);
  white-space: nowrap;
}
.unit-code {
  font-size: 12px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--coral-soft);
  color: var(--coral-deep);
}
.unit-stars { font-size: 15px; color: #C98218; font-weight: 900; letter-spacing: 1px; }
.unit-card h4 { font-size: 17px; font-weight: 900; color: #4A3423; }
.unit-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.unit-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.unit-chip {
  font-size: 13px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 10px;
  background: var(--wood-bg);
  border: 1.5px solid var(--wood-border);
  color: #4A3423;
  box-shadow: 0 2px 0 #E4D7C0;
}

/* Quest Views */
.quest-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.back-btn {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  color: #4A3423;
  font-size: 13.5px;
  font-weight: 900;
}
.quest-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step-pill {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--card-grad);
  border: 1.5px solid var(--border-warm);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
}
.step-pill.active {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral-deep);
}

.quest-head-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 20px;
  padding: 13px 16px;
  margin-bottom: 12px;
  color: #4A3423;
}
.quest-head-card > div { min-width: 0; flex: 1 1 200px; }
.quest-unit-tag {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: #4A3423;
}
.quest-head-card h2 { font-size: 18px; font-weight: 900; margin-top: 3px; color: #4A3423; }
.quest-head-card p { font-size: 12.5px; color: var(--ink-soft); }
.mini-action-btn {
  flex-shrink: 0;
  padding: 7px 11px;
  border-radius: 12px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-warm);
  color: #4A3423;
  font-size: 12px;
  font-weight: 800;
}
.mini-action-btn[aria-pressed="true"] {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
}

.quest-panel {
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  color: #4A3423;
}

/* Step 1: Magnetic Slide */
.slide-stage {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.slide-mascot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  min-width: 0;
}
.stage-cat { width: 126px; height: 140px; object-fit: contain; }
.speech-bubble {
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-warm);
  color: #4A3423;
  border-radius: 14px;
  padding: 8px 10px;
}
.slide-card {
  background: linear-gradient(180deg, #FBF6EE 0%, #F5ECDC 100%);
  border: 2px solid var(--border-warm);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  min-width: 0;
  color: #4A3423;
}
.slide-word-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.book-tag {
  font-size: 11.5px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue-ink);
  border: 1px solid var(--blue-border);
  white-space: nowrap;
  flex-shrink: 0;
}
.slide-counter { font-size: 12px; font-weight: 800; color: var(--ink-soft); }

.slide-blocks-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 78px;
  margin: 8px 0;
  transition: gap 0.25s ease;
}
.slide-blocks-row.blended { gap: 3px; }

/* Phoneme Tile Color Coding (High Contrast!) */
.ph-tile {
  min-width: 68px;
  height: 72px;
  padding: 0 15px;
  border-radius: 16px;
  font-size: 30px;
  font-weight: 900;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--wood-border);
  background: var(--wood-bg);
  color: var(--ink);
  box-shadow: 0 4px 0 #D8C7AE;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.ph-tile small { font-size: 12px; font-weight: 700; opacity: 0.82; line-height: 1; margin-top: 2px; }
.ph-tile.vowel {
  background: var(--gold-bg);
  border-color: var(--gold-border);
  color: var(--ink);
  box-shadow: 0 4px 0 #C89226;
}
.ph-tile.digraph {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue-ink);
  box-shadow: 0 4px 0 #6A9FC9;
}
.ph-tile.magic {
  background: linear-gradient(180deg, #F6ECFF 0%, #EAD6FF 100%);
  border-color: #B27EE2;
  color: #582A87;
  box-shadow: 0 4px 0 #9560C9;
}
.magic-arc-banner {
  display: inline-block;
  margin: 0 auto 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #FEF3CE 0%, #F5E8FF 100%);
  border: 1.5px dashed #B27EE2;
  color: #582A87;
  font-size: 12.5px;
  font-weight: 800;
}
.slide-blocks-row.has-magic-e {
  position: relative;
  padding-top: 6px;
}
.ph-tile.lit {
  transform: translateY(-5px) scale(1.07);
  box-shadow: 0 0 0 4px rgba(232, 137, 107, 0.35), 0 6px 0 #C45E3E;
}
.ph-tile.locked {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
  box-shadow: 0 4px 0 var(--green);
}
.ph-tile.oops {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-ink);
  animation: tileShake 0.38s ease;
}
@keyframes tileShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  55% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}

.slide-meaning { font-size: 20px; font-weight: 900; margin: 8px 0 13px; color: #4A3423; }
.slide-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.slide-phoneme-tip {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(248, 216, 120, 0.25);
  border: 1px solid #E5CE9A;
  font-size: 13px;
  font-weight: 700;
  color: #4A3423;
  min-height: 20px;
}

.slide-word-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.word-tab-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-warm);
  font-size: 14px;
  font-weight: 800;
}
.word-tab-pill.active {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral-deep);
}
.step-footer { margin-top: 14px; text-align: center; }

/* Primary / Secondary Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--coral);
  border: 2px solid var(--coral-deep);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--coral-deep);
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--coral-deep); }
.btn-primary.wide { width: 100%; max-width: 360px; padding: 12px 20px; font-size: 15px; }
.btn-primary.small { padding: 7px 12px; font-size: 12.5px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  color: #4A3423;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 3px 0 #DECDB3;
}
.btn-secondary.small { padding: 7px 12px; font-size: 12.5px; }

/* Step 2: Fox Duel */
.duel-arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, #FFF9EF 0%, #F6ECDA 100%);
  border: 2px solid var(--border-warm);
  max-width: 100%;
}
.fighter-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.fighter-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--border-warm);
  color: #4A3423;
  max-width: 100%;
}
.shield-pill {
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 999px;
}
.duel-sprite { width: 120px; height: 132px; object-fit: contain; transition: transform 0.2s ease; }

.duel-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.fox-hp-dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.hp-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #E2D2B8;
  border: 1.5px solid #B59E7D;
}
.hp-dot.done { background: var(--green); border-color: var(--green-deep); }
.hp-dot.now { background: var(--coral); border-color: var(--coral-deep); transform: scale(1.2); }

.big-speaker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 82px;
  border-radius: 22px;
  background: var(--coral);
  border: 2.5px solid var(--coral-deep);
  color: #fff;
  box-shadow: 0 5px 0 var(--coral-deep);
}
.spk-ico { font-size: 28px; line-height: 1.1; }
.spk-lbl { font-size: 12.5px; font-weight: 900; }

.hint-row { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.whisper-btn {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-bg);
  border: 1.5px solid var(--gold-border);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 900;
}
.whisper-zh {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--coral-deep);
  background: var(--card);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-warm);
}

.duel-feedback {
  text-align: center;
  font-size: 13.5px;
  font-weight: 800;
  margin: 12px 0 8px;
  min-height: 22px;
}

.slots-tray {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 72px;
  padding: 10px;
  background: var(--bg-paper);
  border: 2px dashed #D3C1A3;
  border-radius: 18px;
}
.slot-btn {
  min-width: 68px;
  height: 66px;
  padding: 0 12px;
  border-radius: 15px;
  border: 2.5px dashed #BFA988;
  background: rgba(255, 253, 248, 0.72);
  font-size: 28px;
  font-weight: 900;
  color: var(--ink-soft);
}
.slot-btn.filled {
  border-style: solid;
  border-color: var(--wood-border);
  background: var(--wood-bg);
  color: var(--ink);
  box-shadow: 0 4px 0 #D8C7AE;
}
.slot-btn.locked {
  border-style: solid;
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
  box-shadow: 0 4px 0 var(--green);
}
.slot-btn.oops {
  border-style: solid;
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-ink);
  animation: tileShake 0.38s ease;
}
.slot-btn.magic {
  background: linear-gradient(180deg, #F6ECFF 0%, #EAD6FF 100%);
  border-color: #B27EE2;
  color: #582A87;
  box-shadow: 0 4px 0 #9560C9;
}

.tiles-bank {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.tiles-bank .ph-tile:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: none; }

.duel-action-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Step 3: Clear Card */
.clear-card { text-align: center; padding: 10px 6px; }
.clear-cat { width: 140px; height: 150px; object-fit: contain; }
.clear-stars { font-size: 30px; color: #E29B1E; margin: 4px 0; }
.clear-card h3 { font-size: 20px; font-weight: 900; }
.clear-card p { font-size: 13px; color: var(--ink-soft); margin: 4px 0 14px; }
.clear-words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.clear-word-btn {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-cream);
  border: 2px solid var(--border-warm);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.clear-word-btn strong { font-size: 16px; }
.clear-word-btn small { font-size: 12px; color: var(--ink-soft); }
.clear-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* Section Intro */
.section-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 20px;
  padding: 12px 15px;
  margin-bottom: 12px;
  color: #4A3423;
}
.mini-mentor { width: 64px; height: 70px; object-fit: contain; flex-shrink: 0; }
.section-intro h2 { font-size: 18px; font-weight: 900; color: #4A3423; }
.section-intro p { font-size: 12.5px; color: var(--ink-soft); }

/* Tab 2: Flip Book */
.family-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fam-pill {
  flex-shrink: 0;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  color: #4A3423;
  font-size: 13.5px;
  font-weight: 900;
}
.fam-pill.active {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral-deep);
}

.flipbook-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  border-radius: 24px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  box-shadow: var(--shadow-soft);
  color: #4A3423;
}
.flip-page {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #F6ECDC 0%, #EFE2CD 100%);
  border: 2px solid var(--border-warm);
}
.onset-page { flex-direction: column; }
.flip-arrow {
  width: 56px;
  height: 34px;
  border-radius: 10px;
  background: var(--card-grad);
  border: 1.5px solid var(--border-warm);
  color: #4A3423;
  font-size: 15px;
  font-weight: 900;
}
.flip-tile {
  min-width: 78px;
  height: 84px;
  padding: 0 12px;
  border-radius: 16px;
  font-size: 40px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--wood-border);
  background: var(--wood-bg);
  color: #4A3423;
  box-shadow: 0 4px 0 #D8C7AE;
}
.flip-tile.vowel { background: var(--gold-bg); border-color: var(--gold-border); color: #4A3423; box-shadow: 0 4px 0 #C89226; }
.flip-tile.digraph { background: var(--blue-bg); border-color: var(--blue-border); color: var(--blue-ink); box-shadow: 0 4px 0 #6A9FC9; }
.flip-plus { font-size: 24px; font-weight: 900; color: #4A3423; }

.flip-result-card {
  margin-top: 12px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 20px;
  padding: 14px 16px;
  text-align: center;
  color: #4A3423;
}
.flip-word-row { display: inline-flex; align-items: center; gap: 10px; }
.flip-word-row strong { font-size: 30px; font-weight: 900; color: #4A3423; }
.flip-result-card p { font-size: 15px; color: var(--ink-soft); font-weight: 800; margin: 4px 0 12px; }
.flip-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.family-all-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

/* Tab 3: Free Board */
.board-tray-card {
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 22px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
  color: #4A3423;
}
.board-slots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 76px;
  padding: 10px;
  border-radius: 16px;
  background: var(--bg-paper);
  border: 2px dashed #D3C1A3;
}
.board-match { font-size: 16px; font-weight: 900; margin: 10px 0 12px; min-height: 26px; color: #4A3423; }
.board-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.board-palette { display: flex; flex-direction: column; gap: 12px; }
.palette-group {
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 18px;
  padding: 12px 14px;
  color: #4A3423;
}
.palette-group h4 { font-size: 13px; font-weight: 900; color: var(--ink-soft); margin-bottom: 8px; }
.palette-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-grid .ph-tile { min-width: 56px; height: 56px; font-size: 23px; padding: 0 10px; }

/* Tab 4: Sight Words & Analytics */
.sight-section, .analytics-section {
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  border-radius: 22px;
  padding: 15px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
  color: #4A3423;
}
.subhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.subhead-row h3 { font-size: 16px; font-weight: 900; color: #4A3423; }
.analytics-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}
.sight-card {
  text-align: left;
  padding: 13px 14px;
  border-radius: 15px;
  background: linear-gradient(180deg, #FBF6EE 0%, #F5ECDC 100%);
  border: 2px solid var(--border-warm);
  color: #4A3423;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sight-card.known { background: var(--green-soft); border-color: var(--green); }
.sight-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: nowrap; }
.sight-top strong { display: inline-flex; align-items: center; gap: 4px; font-size: 17px; font-weight: 900; color: #4A3423; white-space: nowrap; }
.sight-zh { font-size: 12.5px; font-weight: 800; color: var(--coral-deep); }
.sight-trick { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; flex: 1; }
.sight-mark {
  align-self: flex-start;
  margin-top: auto;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  border-radius: 999px;
  background: var(--card-grad);
  border: 1px solid var(--border-warm);
  color: #4A3423;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-card {
  padding: 14px 15px;
  border-radius: 15px;
  background: linear-gradient(180deg, #FBF6EE 0%, #F5ECDC 100%);
  border: 1.5px solid var(--border-warm);
  color: #4A3423;
}
.kpi-card small { display: block; font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }
.kpi-card b { font-size: 22px; font-weight: 900; color: #4A3423; }

.weak-box h4, .recent-logs h4 { font-size: 13.5px; font-weight: 900; margin-bottom: 8px; color: #4A3423; }
.weak-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.weak-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-ink);
  font-size: 12.5px;
  font-weight: 900;
}
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FBF6EE 0%, #F5ECDC 100%);
  border: 1px solid var(--border-warm);
  color: #4A3423;
}

/* Mobile & Mid-Width Bottom Dock */
.bottom-nav {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 500px;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(253, 248, 238, 0.97), rgba(247, 239, 224, 0.97));
  backdrop-filter: blur(12px);
  border: 2px solid #DFCFAF;
  box-shadow: 0 12px 28px rgba(74, 52, 35, 0.2);
}
.bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 7px 4px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 900;
  color: #5B4330;
  transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease;
}
.bnav-btn span { font-size: 21px; line-height: 1; }
.bnav-btn small { font-size: 12px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.bnav-btn.active {
  background: linear-gradient(180deg, #EE9375 0%, #E07A5B 100%);
  color: #fff;
  box-shadow: 0 3px 0 var(--coral-deep);
}
.bnav-btn.active small { color: #fff; }
.bnav-btn:active { transform: translateY(1px); }

@media (min-width: 520px) and (max-width: 879px) {
  .bnav-btn {
    flex-direction: row;
    gap: 6px;
    min-height: 46px;
    padding: 9px 10px;
  }
  .bnav-btn span { font-size: 19px; }
  .bnav-btn small { font-size: 14px; }
}

/* Responsive Desktop & Seewo Classroom Smartboard */
@media (min-width: 880px) {
  .workshop-shell { padding: 14px 24px 32px; }
  .desktop-nav { display: flex; }
  .bottom-nav { display: none; }
  .brand-titles h1 { font-size: 17px; }
  .hero-text h2 { font-size: 25px; }
  .hero-cat { width: 130px; height: 146px; }
}

@media (max-width: 560px) {
  .slide-stage { grid-template-columns: minmax(0, 1fr); }
  .slide-mascot-col { flex-direction: row; text-align: left; }
  .stage-cat { width: 76px; height: 84px; }
  .duel-sprite { width: 72px; height: 82px; }
  .big-speaker-btn { width: 76px; height: 64px; }
  .flip-tile { min-width: 60px; height: 68px; font-size: 32px; }
  .chip-lbl { display: none; }
}

/* Classroom Smartboard Mode (1280x720 No-Scroll Friendly) */
body.classroom-mode .hero-workshop,
body.classroom-mode .analytics-section { display: none !important; }
body.classroom-mode .ph-tile { min-width: 78px; height: 82px; font-size: 36px; }
body.classroom-mode .slot-btn { min-width: 82px; height: 80px; font-size: 34px; }
body.classroom-mode .flip-tile { min-width: 96px; height: 98px; font-size: 46px; }
body.classroom-mode .palette-grid .ph-tile { min-width: 62px; height: 62px; font-size: 26px; }

/* Map Mode Switch & Grade / Unit Cards */
.map-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  box-shadow: 0 4px 12px rgba(74, 52, 35, 0.08);
  color: #4A3423;
}
.mode-switch-btn {
  padding: 11px 14px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 900;
  color: #4A3423;
  background: transparent;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
  text-align: center;
  line-height: 1.3;
}
.mode-switch-btn.active {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 3px 0 var(--coral-deep);
}
.mode-switch-btn:active { transform: translateY(1px); }

.tb-unit-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: var(--card-grad);
  border: 2px solid var(--border-warm);
  box-shadow: 0 4px 0 #E4D7C0;
  color: #4A3423;
  text-align: left;
}
.tb-unit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tb-unit-card h4 {
  font-size: 15px;
  font-weight: 900;
  color: #4A3423;
  line-height: 1.3;
}
.tb-unit-zh {
  font-size: 12px;
  font-weight: 700;
  color: #6F5643;
}
.tb-word-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tb-sec-label {
  font-size: 11px;
  font-weight: 800;
  color: #6F5643;
}
.tb-word-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tb-word-chip,
.tb-sight-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  color: #4A3423;
  border: 1.5px solid var(--wood-border);
  background: var(--wood-bg);
  box-shadow: 0 2px 0 #E4D7C0;
}
.tb-sight-chip {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue-ink);
  box-shadow: 0 2px 0 #B3CFE5;
}
.tb-word-chip:active,
.tb-sight-chip:active { transform: translateY(1px); }
.tb-hint-note {
  font-size: 12px;
  font-weight: 700;
  color: #6F5643;
  background: rgba(248, 216, 120, 0.25);
  border: 1px dashed var(--gold-border);
  border-radius: 12px;
  padding: 8px 10px;
}
.tb-fuel-badge {
  background: linear-gradient(180deg, #FEF3CE 0%, #FBE8AE 100%);
  border: 1.5px solid #DDA636;
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: #4A3423;
  line-height: 1.4;
}
.tb-unit-footer {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tb-unit-footer .btn-primary,
.tb-unit-footer .btn-secondary {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
}

@media (max-width: 420px) {
  .mode-switch-btn { padding: 9px 6px; font-size: 12px; }
}
