:root {
  --bg: #fff0ad;
  --surface: #ffffff;
  --surface-strong: #fff8d8;
  --ink: #241f2f;
  --muted: #6a5d4e;
  --line: #f1d97a;
  --teal: #4fa693;
  --teal-dark: #296f63;
  --coral: #c95745;
  --gold: #d59a25;
  --green: #2f7d52;
  --yellow: #a96e00;
  --red: #b33a33;
  --peach: #f48c7f;
  --butter: #ffe7a3;
  --lilac: #49405f;
  --mint: #bfe6d5;
  --sky: #dff3ff;
  --shadow: 0 18px 50px rgba(16, 35, 33, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  max-height: 100vh;
  padding: 24px;
  background: #fff4bf;
  color: #241f2f;
  border-right: 4px solid #ffffff;
  overflow: hidden;
  transition: padding 180ms ease, gap 180ms ease;
}

.sidebar-toggle {
  display: grid;
  place-items: center;
  align-self: flex-end;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 3px solid #ffffff;
  border-radius: 8px;
  background: #ffffff;
  color: #352b47;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.14);
}

.sidebar-toggle::before {
  content: "";
  width: 12px;
  height: 12px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: #f0b24b;
  outline: none;
  background: #fff8d8;
}

body.sidebar-collapsed .sidebar {
  align-items: center;
  cursor: pointer;
  gap: 0;
  padding: 16px 9px;
}

body.sidebar-collapsed .sidebar > :not(.sidebar-toggle) {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  align-self: center;
}

body.sidebar-collapsed .sidebar-toggle::before {
  transform: rotate(225deg);
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #82c47d;
  color: #241f2f;
  font-size: 28px;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #6a5d4e;
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.access-panel {
  display: grid;
  gap: 10px;
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: 14px;
  background: #ffe27a;
}

.access-panel h2 {
  color: #241f2f;
  font-size: 16px;
}

.role-buttons {
  display: grid;
  gap: 8px;
}

.role-button {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  background: #bfe9ef;
  color: #241f2f;
  text-align: left;
}

.role-button span {
  color: #5d5045;
  font-size: 12px;
}

.role-button.active,
.role-button.selected,
.role-button:hover {
  border-color: #f0b24b;
  background: #fff5d6;
  color: #17211f;
}

.role-button.active span,
.role-button.selected span,
.role-button:hover span {
  color: #5f5240;
}

.access-code {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.access-code label {
  color: #c9d7d3;
  font-size: 12px;
  font-weight: 800;
}

.access-code input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
}

.access-code .secondary-button {
  width: 100%;
}

.access-error {
  min-height: 18px;
  color: #ffe7a3;
  font-size: 12px;
  font-weight: 800;
}

.nav-button {
  width: 100%;
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  color: #241f2f;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: #ffdce8;
  color: #241f2f;
}

.nav-button.locked,
.nav-button.locked:hover {
  cursor: not-allowed;
  opacity: 0.48;
  background: transparent;
  color: #eef5f3;
}

.privacy-note {
  margin-top: auto;
  padding: 14px;
  border: 3px solid #ffffff;
  border-radius: 8px;
  background: #d8f1f4;
}

.privacy-note strong,
.privacy-note span {
  display: block;
}

.privacy-note span {
  margin-top: 6px;
  color: #5d5045;
  font-size: 13px;
  line-height: 1.45;
}

.main-content {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 20px;
  border: 4px solid #ffffff;
  border-radius: 8px;
  background: #fff8d8;
  box-shadow: var(--shadow);
}

.topbar h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  max-width: 760px;
  margin-top: 5px;
  font-size: 28px;
  line-height: 1.12;
}

.access-summary {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

body[data-view="child"] {
  background:
    linear-gradient(180deg, #fff0ad 0%, #fff7cf 52%, #dff5f2 100%);
}

body[data-view="child"] .topbar {
  border-color: #ffffff;
  background: #ffe27a;
}

body[data-view="child"] .topbar h1 {
  color: #352b47;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.topbar-actions label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.role-pill {
  border-radius: 999px;
  padding: 8px 11px;
  background: #17211f;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

select {
  min-width: 156px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
}

select:disabled {
  cursor: not-allowed;
  background: #eef2f1;
  color: #596663;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.child-grid,
.dashboard-grid,
.parent-layout,
.prd-layout {
  display: grid;
  gap: 18px;
}

.child-grid {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.75fr);
}

.parent-layout,
.prd-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.55fr);
}

.practice-stage,
.motivation-panel,
.panel-wide,
.insight-panel,
.control-panel,
.parent-report,
.home-practice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.practice-stage,
.panel-wide,
.parent-report {
  padding: 22px;
}

.game-stage {
  position: relative;
  overflow: hidden;
  border: 4px solid #352b47;
  background:
    linear-gradient(180deg, rgba(255, 249, 224, 0.98), rgba(239, 253, 244, 0.98));
}

.game-stage.kid-start {
  display: grid;
  min-height: 560px;
  place-items: center;
  border-color: #352b47;
  background:
    linear-gradient(180deg, rgba(255, 250, 218, 0.98) 0%, rgba(231, 249, 238, 0.98) 58%, rgba(212, 244, 240, 0.98) 100%);
}

body[data-child-mode="start"] .child-grid {
  grid-template-columns: 1fr;
}

body[data-child-mode="start"] .game-rewards {
  display: none;
}

body[data-child-mode="start"] #childStage > :not(.stage-actions),
.game-stage.kid-start .floating-shapes,
.game-stage.kid-start .stage-header,
.game-stage.kid-start .quest-path,
.game-stage.kid-start .task-card,
.game-stage.kid-start .listen-button {
  display: none;
}

body[data-child-mode="playing"] .start-graphic {
  display: none;
}

.game-stage .stage-header,
.game-stage .task-card,
.game-stage .stage-actions {
  position: relative;
  z-index: 1;
}

.floating-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floating-shapes span {
  position: absolute;
  display: block;
  width: 54px;
  height: 36px;
  border: 3px solid rgba(73, 64, 95, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  transform: rotate(-7deg);
}

.floating-shapes span:nth-child(1) {
  top: 54px;
  right: 54px;
}

.floating-shapes span:nth-child(2) {
  right: 168px;
  bottom: 72px;
  width: 38px;
  height: 38px;
  background: rgba(191, 230, 213, 0.52);
  transform: rotate(12deg);
}

.floating-shapes span:nth-child(3) {
  left: 42px;
  bottom: 92px;
  width: 46px;
  height: 28px;
  background: rgba(244, 140, 127, 0.24);
  transform: rotate(8deg);
}

.motivation-panel,
.insight-panel,
.control-panel,
.home-practice {
  padding: 20px;
}

.control-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: var(--shadow);
}

.control-panel label {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.control-panel select {
  width: 100%;
  margin-top: 7px;
}

.control-panel button {
  margin-top: 14px;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 9px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.letter-scope {
  margin-top: 14px;
}

.letter-scope > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.letter-scope-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.letter-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.letter-toggle span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
}

.letter-toggle input:checked + span {
  border-color: #352b47;
  background: #ffe7a3;
  color: #352b47;
}

.custom-task-box {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.custom-task-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
}

.custom-task-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.custom-task-list p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.custom-task-item {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  align-items: center;
  border: 1px solid #f1d97a;
  border-radius: 8px;
  padding: 8px;
  background: #fffdf6;
  font-size: 13px;
}

.custom-task-item button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--red);
  font-weight: 900;
}

.stage-header,
.section-heading,
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.stage-header h2,
.section-heading h2,
.insight-panel h2,
.parent-report h2,
.home-practice h2,
.prd-layout h2 {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.15;
}

.section-note {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.level-badge,
.summary-pill,
.status-badge {
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-strong);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.game-stage .level-badge {
  border: 2px solid #f0bc61;
  background: #ffffff;
  box-shadow: 0 6px 0 #e9c05d;
  color: #352b47;
}

.level-badge span,
.level-badge strong {
  display: block;
}

.level-badge span {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  overflow: hidden;
  height: 12px;
  margin: 22px 0;
  border-radius: 999px;
  background: #dfe8e5;
}

.quest-path {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 46px 1fr 46px 1fr 54px;
  gap: 8px;
  align-items: center;
  margin: 24px 0;
  padding: 12px;
  border: 2px solid rgba(73, 64, 95, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.path-node {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 3px solid #352b47;
  border-radius: 8px;
  background: #ffffff;
  color: #352b47;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.14);
}

.path-node.done {
  background: var(--mint);
}

.path-node.treasure {
  width: 54px;
  color: #9b5e00;
  background: var(--butter);
}

.path-line {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #e9dfc8;
}

.path-line.muted {
  background:
    linear-gradient(90deg, #e9dfc8 50%, transparent 50%) 0 0 / 18px 100%;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 180ms ease;
}

.treasure-map-view {
  display: grid;
  gap: 14px;
  width: 100%;
  margin: 18px 0;
}

.map-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.map-status h3 {
  margin: 0;
  color: #352b47;
  font-size: 24px;
}

.map-status strong {
  border: 3px solid #352b47;
  border-radius: 8px;
  padding: 10px 14px;
  background: #ffffff;
  color: #352b47;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.14);
}

.quest-progress-bar {
  overflow: hidden;
  height: 18px;
  border: 3px solid #352b47;
  border-radius: 999px;
  background: #fff8d8;
}

.quest-progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4fa693, #d59a25);
  transition: width 380ms ease;
}

.treasure-map-board {
  position: relative;
  min-height: 360px;
  border: 4px solid #7c5631;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.26) 0 1px, transparent 2px),
    radial-gradient(circle at 74% 64%, rgba(255, 255, 255, 0.2) 0 1px, transparent 2px),
    linear-gradient(135deg, #75c9bf, #8bd7cf 54%, #6fc2bd);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.5), 0 14px 28px rgba(53, 43, 71, 0.14);
  overflow: hidden;
}

.treasure-map-board::before {
  content: "";
  position: absolute;
  inset: 18px;
  z-index: 6;
  border: 2px dashed rgba(124, 86, 49, 0.34);
  border-radius: 8px;
  pointer-events: none;
}

.treasure-map-board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.36), transparent 10% 90%, rgba(255, 255, 255, 0.36)),
    linear-gradient(0deg, rgba(255, 255, 255, 0.34), transparent 12% 88%, rgba(255, 255, 255, 0.34));
  pointer-events: none;
}

.map-island {
  position: absolute;
  inset: 22px 46px 28px 46px;
  z-index: 1;
  border: 8px solid rgba(64, 151, 132, 0.52);
  border-radius: 38% 46% 34% 42%;
  background:
    radial-gradient(circle at 53% 34%, rgba(93, 63, 42, 0.45) 0 3%, transparent 4%),
    radial-gradient(circle at 52% 38%, rgba(93, 63, 42, 0.34) 0 2%, transparent 3%),
    radial-gradient(circle at 16% 70%, rgba(255, 232, 170, 0.82) 0 9%, transparent 10%),
    radial-gradient(circle at 69% 76%, rgba(255, 225, 171, 0.72) 0 8%, transparent 9%),
    radial-gradient(circle at 24% 36%, rgba(117, 201, 191, 0.7) 0 8%, transparent 9%),
    linear-gradient(145deg, #c58b47, #d39a52 56%, #ba7e3c);
  clip-path: polygon(5% 29%, 13% 16%, 28% 18%, 34% 7%, 48% 15%, 59% 6%, 72% 17%, 88% 10%, 98% 28%, 92% 50%, 99% 70%, 82% 83%, 69% 77%, 53% 94%, 39% 82%, 23% 89%, 12% 72%, 1% 61%);
  box-shadow: inset 0 0 0 2px rgba(255, 219, 146, 0.34), 0 9px 0 rgba(52, 125, 110, 0.28);
  pointer-events: none;
}

.map-island::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 28%, rgba(255, 238, 184, 0.36) 0 1px, transparent 2px),
    radial-gradient(circle at 38% 66%, rgba(255, 238, 184, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at 66% 34%, rgba(255, 238, 184, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 70%, rgba(255, 238, 184, 0.3) 0 1px, transparent 2px);
  background-size: 24px 24px, 31px 31px, 28px 28px, 35px 35px;
}

.map-skull,
.map-palm {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.map-skull {
  left: 53%;
  top: 45%;
  width: 56px;
  height: 50px;
  border-radius: 50% 50% 40% 40%;
  background: rgba(92, 61, 35, 0.36);
}

.map-skull::before,
.map-skull::after {
  content: "";
  position: absolute;
  top: 18px;
  width: 10px;
  height: 12px;
  border-radius: 50%;
  background: rgba(68, 45, 31, 0.55);
}

.map-skull::before {
  left: 15px;
}

.map-skull::after {
  right: 15px;
}

.map-palm {
  width: 48px;
  height: 58px;
}

.map-palm::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 22px;
  width: 7px;
  height: 35px;
  border-radius: 999px;
  background: #7c5631;
  transform: rotate(10deg);
}

.map-palm::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 5px;
  width: 40px;
  height: 34px;
  background:
    radial-gradient(ellipse at 50% 100%, transparent 0 28%, #1f7e45 29% 50%, transparent 51%),
    radial-gradient(ellipse at 0 60%, transparent 0 25%, #2f9b57 26% 48%, transparent 49%),
    radial-gradient(ellipse at 100% 60%, transparent 0 25%, #2f9b57 26% 48%, transparent 49%);
}

.palm-one {
  left: 31%;
  top: 67%;
}

.palm-two {
  left: 66%;
  top: 62%;
  transform: scale(0.82) rotate(-8deg);
}

.palm-three {
  left: 82%;
  top: 30%;
  transform: scale(0.72) rotate(7deg);
}

.palm-four {
  left: 17%;
  top: 34%;
  transform: scale(0.7) rotate(-12deg);
}

.palm-five {
  left: 73%;
  top: 67%;
  transform: scale(0.86) rotate(12deg);
}

.palm-six {
  left: 90%;
  top: 50%;
  transform: scale(0.62) rotate(-14deg);
}

.treasure-route {
  position: absolute;
  inset: 13% 7% 8%;
  z-index: 3;
  width: 86%;
  height: 76%;
  overflow: visible;
}

.route-shadow,
.route-done {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-shadow {
  stroke: rgba(124, 76, 42, 0.8);
  stroke-width: 1.9;
  stroke-dasharray: 0.026 0.022;
}

.route-done {
  stroke: #fff2cf;
  stroke-width: 2.4;
  stroke-dasharray: 1;
  filter: drop-shadow(0 0 3px rgba(255, 247, 219, 0.75));
  opacity: 0.86;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 480ms ease;
}

.map-station,
.pirate-avatar,
.treasure-chest {
  position: absolute;
  transform: translate(-50%, -50%);
}

.map-station {
  z-index: 4;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 4px solid #352b47;
  border-radius: 50%;
  background: #ffffff;
  color: #352b47;
  box-shadow: 0 6px 0 rgba(53, 43, 71, 0.18);
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.map-station span {
  font-size: 24px;
  font-weight: 900;
}

.map-station[data-stage="0"] {
  left: 28%;
  top: 56%;
}

.map-station[data-stage="1"] {
  left: 43%;
  top: 62%;
}

.map-station[data-stage="2"] {
  left: 57%;
  top: 43%;
}

.map-station[data-stage="3"] {
  left: 72%;
  top: 34%;
}

.map-station.done {
  background: #bfe6d5;
}

.map-station.current {
  background: #f48c7f;
  transform: translate(-50%, -50%) scale(1.08);
  animation: stationPulse 1300ms ease-in-out infinite;
}

.map-station.locked {
  opacity: 0.48;
}

.map-station:not(:disabled):hover,
.map-station:not(:disabled):focus-visible {
  outline: none;
  background: #ffe27a;
  transform: translate(-50%, -50%) scale(1.1);
}

.pirate-avatar {
  z-index: 5;
  display: grid;
  place-items: center;
  width: 68px;
  height: 92px;
  filter: drop-shadow(0 7px 0 rgba(53, 43, 71, 0.2));
  transition: left 620ms ease, top 620ms ease;
}

.game-stage.stage-advance .pirate-avatar {
  animation: pirateHop 760ms ease both;
}

.game-stage.stage-advance .quest-progress-bar span {
  animation: progressFlash 760ms ease both;
}

.pirate-avatar svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pirate-head {
  fill: #ffd7b5;
  stroke: #352b47;
  stroke-width: 3;
}

.pirate-hair,
.pirate-hat {
  fill: #17121f;
  stroke: #352b47;
  stroke-width: 3;
  stroke-linejoin: round;
}

.pirate-hat-brim,
.pirate-smile {
  fill: none;
  stroke: #352b47;
  stroke-width: 3;
  stroke-linecap: round;
}

.pirate-body {
  fill: #b93028;
  stroke: #352b47;
  stroke-width: 3;
  stroke-linejoin: round;
}

.pirate-coat {
  fill: #8f251f;
}

.pirate-sash {
  fill: none;
  stroke: #ffe27a;
  stroke-width: 5;
  stroke-linecap: round;
}

.pirate-arm,
.pirate-leg,
.pirate-boot {
  fill: none;
  stroke: #352b47;
  stroke-width: 7;
  stroke-linecap: round;
}

.pirate-arm {
  stroke: #ffd7b5;
}

.pirate-eye {
  fill: #352b47;
}

.pirate-scope {
  fill: #d9a32f;
  stroke: #352b47;
  stroke-width: 3;
}

.pirate-scope-glass {
  fill: #ffe27a;
  stroke: #352b47;
  stroke-width: 3;
}

.treasure-chest {
  z-index: 4;
  left: 88%;
  top: 19%;
  width: 86px;
  height: 66px;
  filter: drop-shadow(0 7px 0 rgba(53, 43, 71, 0.16));
}

.chest-lid,
.chest-body {
  position: absolute;
  left: 0;
  width: 86px;
  border: 4px solid #241f2f;
  background:
    linear-gradient(90deg, #dfb22f 0 12px, transparent 12px 74px, #dfb22f 74px),
    linear-gradient(#a84f1d 0 48%, #8f3e17 48% 52%, #ba6327 52%);
}

.chest-lid {
  top: 0;
  height: 30px;
  border-radius: 24px 24px 5px 5px;
  transform-origin: left bottom;
  transition: transform 420ms ease;
  box-shadow: inset 0 9px 0 rgba(255, 221, 105, 0.28);
}

.chest-body {
  bottom: 0;
  height: 40px;
  border-radius: 4px 4px 12px 12px;
  box-shadow:
    inset 0 -10px 0 rgba(67, 36, 18, 0.22),
    inset 0 12px 0 rgba(223, 178, 47, 0.92);
}

.chest-lid::before,
.chest-body::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  background: rgba(36, 31, 47, 0.82);
}

.chest-lid::before {
  top: 15px;
}

.chest-body::before {
  top: 21px;
}

.chest-body::after {
  content: "";
  position: absolute;
  left: 33px;
  top: 8px;
  width: 20px;
  height: 22px;
  border: 3px solid #241f2f;
  border-radius: 6px 6px 8px 8px;
  background:
    radial-gradient(circle at 50% 48%, #241f2f 0 3px, transparent 4px),
    linear-gradient(#e8d7ae, #b7a47e);
}

.treasure-chest.open .chest-lid {
  transform: rotate(-26deg) translate(-5px, -12px);
}

.treasure-spark {
  position: absolute;
  left: 32px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
}

.treasure-chest.open .treasure-spark {
  animation: treasureSpark 900ms ease infinite;
}

.treasure-chest.open .s1 {
  transform: translate(-24px, -28px);
}

.treasure-chest.open .s2 {
  animation-delay: 140ms;
  transform: translate(4px, -36px);
}

.treasure-chest.open .s3 {
  animation-delay: 280ms;
  transform: translate(28px, -22px);
}

.stage-containers {
  display: grid;
  gap: 10px;
}

.quest-stage-container {
  position: relative;
  border: 3px solid #352b47;
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.14);
  overflow: hidden;
}

.quest-stage-container span,
.quest-stage-container strong,
.quest-stage-container p {
  display: block;
}

.quest-stage-container span {
  color: #6a5d4e;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.quest-stage-container strong {
  margin-top: 2px;
  color: #352b47;
  font-size: 18px;
}

.quest-stage-container p {
  margin: 4px 0 0;
  color: #5d5045;
}

.quest-stage-container.current {
  background: #fff8d8;
  animation: missionCardEnter 420ms ease both;
}

.quest-stage-container.current::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: linear-gradient(#f48c7f, #ffe27a, #4fa693);
}

.quest-stage-container.done {
  background: #e7f6ee;
}

.quest-stage-container.done strong::after {
  content: " \2605";
  color: #d59a25;
}

@keyframes treasureSpark {
  0% {
    opacity: 0;
    scale: 0.6;
  }

  45% {
    opacity: 1;
    scale: 1.25;
  }

  100% {
    opacity: 0;
    scale: 0.6;
  }
}

@keyframes stationPulse {
  0%,
  100% {
    box-shadow: 0 6px 0 rgba(53, 43, 71, 0.18), 0 0 0 0 rgba(244, 140, 127, 0.5);
  }

  50% {
    box-shadow: 0 8px 0 rgba(53, 43, 71, 0.16), 0 0 0 12px rgba(244, 140, 127, 0);
  }
}

@keyframes pirateHop {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }

  35% {
    transform: translate(-50%, -65%) rotate(-4deg);
  }

  70% {
    transform: translate(-50%, -46%) rotate(3deg);
  }
}

@keyframes progressFlash {
  0%,
  100% {
    filter: brightness(1);
  }

  45% {
    filter: brightness(1.35);
  }
}

@keyframes missionCardEnter {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.treasure-reward-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 241, 161, 0.92), rgba(255, 212, 92, 0.48) 34%, rgba(39, 31, 52, 0.88) 72%),
    rgba(39, 31, 52, 0.92);
}

.treasure-reward-shell {
  display: grid;
  justify-items: center;
  width: min(940px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 20px;
  border: 5px solid #ffffff;
  border-radius: 8px;
  background: #fff8d8;
  box-shadow: 0 18px 0 rgba(36, 31, 47, 0.28);
}

.big-treasure-chest {
  position: relative;
  width: min(520px, 82vw);
  height: min(360px, 58vw);
  margin: 24px auto 12px;
  filter: drop-shadow(0 18px 0 rgba(36, 31, 47, 0.22));
}

.big-chest-lid,
.big-chest-body {
  position: absolute;
  left: 6%;
  width: 88%;
  border: min(14px, 2.6vw) solid #241f2f;
  background:
    linear-gradient(90deg, #dfb22f 0 13%, transparent 13% 87%, #dfb22f 87%),
    linear-gradient(#bd6428 0 48%, #793112 48% 53%, #ce7b34 53%);
}

.big-chest-lid {
  top: 12%;
  height: 39%;
  border-radius: 46% 46% 7% 7%;
  transform-origin: left bottom;
  transition: transform 780ms cubic-bezier(0.2, 1.2, 0.2, 1);
  box-shadow: inset 0 32px 0 rgba(255, 229, 112, 0.32);
}

.big-chest-body {
  bottom: 7%;
  height: 43%;
  border-radius: 5% 5% 15% 15%;
  box-shadow:
    inset 0 -36px 0 rgba(67, 36, 18, 0.22),
    inset 0 38px 0 rgba(223, 178, 47, 0.92);
}

.big-chest-body::after {
  content: "";
  position: absolute;
  left: 43%;
  top: 16%;
  width: 14%;
  height: 35%;
  border: min(10px, 1.9vw) solid #241f2f;
  border-radius: 8px 8px 18px 18px;
  background:
    radial-gradient(circle at 50% 48%, #241f2f 0 16%, transparent 18%),
    linear-gradient(#f5dfac, #b7a47e);
}

.big-chest-glow {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 38%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98), rgba(255, 229, 101, 0.7) 46%, transparent 72%);
  opacity: 0;
  transform: scale(0.4);
}

.big-spark {
  position: absolute;
  width: min(30px, 5.6vw);
  height: min(30px, 5.6vw);
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
}

.big-spark-one {
  left: 24%;
  top: 24%;
}

.big-spark-two {
  left: 50%;
  top: 12%;
}

.big-spark-three {
  right: 22%;
  top: 28%;
}

.big-spark-four {
  left: 58%;
  top: 44%;
}

.treasure-reward-overlay.open .big-chest-lid {
  transform: rotate(-24deg) translate(-8%, -30%);
}

.treasure-reward-overlay.open .big-chest-glow {
  animation: bigChestGlow 1500ms ease forwards;
}

.treasure-reward-overlay.open .big-spark {
  animation: treasureSpark 780ms ease infinite;
}

.treasure-reward-overlay.open .big-spark-two {
  animation-delay: 120ms;
}

.treasure-reward-overlay.open .big-spark-three {
  animation-delay: 220ms;
}

.treasure-reward-overlay.open .big-spark-four {
  animation-delay: 320ms;
}

.mandala-creator {
  width: min(720px, 100%);
  margin: 4px auto 10px;
  padding: 18px;
  border: 4px solid #352b47;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.mandala-creator h2 {
  margin: 4px 0 8px;
  color: #352b47;
  font-size: 32px;
}

.mandala-instruction,
.mandala-status {
  color: #4d4338;
  font-size: 18px;
  line-height: 1.45;
}

.mandala-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.mandala-form label {
  color: #352b47;
  font-weight: 900;
}

.mandala-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.mandala-input-row input {
  min-width: 0;
  border: 3px solid #352b47;
  border-radius: 8px;
  padding: 14px 16px;
  color: #352b47;
  font-size: 20px;
  font-weight: 800;
}

.mic-button {
  display: grid;
  place-items: center;
  width: 78px;
  min-width: 78px;
  min-height: 78px;
  padding: 0;
}

.mic-icon {
  display: block;
  width: 42px;
  height: 42px;
  background: #1e6f61;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cpath d='M12 19v3'/%3E%3Cpath d='M8 22h8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cpath d='M12 19v3'/%3E%3Cpath d='M8 22h8'/%3E%3C/svg%3E") center / contain no-repeat;
}

.mic-button.listening {
  background: #f48c7f;
  color: #241f2f;
}

.mic-button.listening .mic-icon {
  background: #241f2f;
  animation: micPulse 880ms ease-in-out infinite;
}

@keyframes micPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.14);
  }
}

.mandala-result {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.mandala-result img {
  display: block;
  width: min(520px, 100%);
  margin: 0 auto;
  border: 3px solid #352b47;
  border-radius: 8px;
  background: #ffffff;
}

.mandala-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.mandala-actions a {
  text-decoration: none;
}

@keyframes bigChestGlow {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }

  50% {
    opacity: 1;
    transform: scale(1.16);
  }

  100% {
    opacity: 0.8;
    transform: scale(1);
  }
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fbfdfc;
}

.game-stage .task-card {
  border: 4px solid #ffffff;
  background: #fff8d8;
  box-shadow: 0 10px 0 rgba(164, 128, 37, 0.16);
}

.game-stage.kid-start .task-card {
  display: grid;
  justify-items: center;
  max-width: 720px;
  margin: 0 auto;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.task-type {
  color: var(--coral);
  font-weight: 800;
}

.task-card h3 {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.12;
}

.game-stage .task-card h3 {
  max-width: 720px;
  color: #352b47;
  font-size: 34px;
}

.game-stage.kid-start .task-card h3 {
  margin-top: 4px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.02;
}

.task-helper {
  margin-top: 10px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.game-stage .task-helper {
  color: #6a5572;
}

.game-stage.kid-start .task-helper {
  max-width: 420px;
  font-size: 20px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.task-meta span {
  border: 2px solid rgba(53, 43, 71, 0.14);
  border-radius: 999px;
  padding: 6px 10px;
  background: #ffffff;
  color: #352b47;
  font-size: 13px;
  font-weight: 900;
}

.audio-coach {
  min-height: 30px;
  margin-top: 12px;
  border: 2px solid rgba(79, 166, 147, 0.28);
  border-radius: 8px;
  padding: 8px 10px;
  background: #eef9fa;
  color: #296f63;
  font-size: 14px;
  font-weight: 900;
}

.speak-area {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  border: 3px dashed #f0bc61;
  border-radius: 8px;
  padding: 16px;
  background: #fffdf2;
}

.speak-area[hidden] {
  display: none;
}

.speak-area .primary-button {
  min-height: 58px;
  font-size: 20px;
}

.speak-area p {
  color: #6a5572;
  font-weight: 800;
  line-height: 1.4;
}

.letter-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.media-stage {
  margin-top: 16px;
}

.treasure-island {
  position: relative;
  width: min(520px, 100%);
  aspect-ratio: 1.35;
  margin: 8px auto 0;
  border: 4px solid #ffffff;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #a9e4ff 0 46%, #86d6d0 46% 100%);
  box-shadow: 0 10px 0 rgba(53, 43, 71, 0.13);
}

.treasure-island::before {
  content: "";
  position: absolute;
  left: 11%;
  right: 11%;
  bottom: 12%;
  height: 34%;
  border-radius: 50% 50% 18% 18%;
  background: #f4c86a;
  box-shadow: inset 0 -16px 0 rgba(164, 112, 30, 0.12);
}

.island-sun {
  position: absolute;
  top: 9%;
  right: 13%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffd66b;
  box-shadow: 0 0 0 12px rgba(255, 214, 107, 0.24);
}

.island-palm {
  position: absolute;
  left: 22%;
  bottom: 28%;
  width: 16px;
  height: 98px;
  border-radius: 999px;
  background: #a86f43;
  transform: rotate(8deg);
}

.island-palm::before,
.island-palm::after {
  content: "";
  position: absolute;
  top: -26px;
  width: 82px;
  height: 36px;
  border-radius: 50%;
  background: #58a85b;
}

.island-palm::before {
  right: -8px;
  transform: rotate(-28deg);
}

.island-palm::after {
  left: -58px;
  transform: rotate(28deg);
}

.island-hill {
  position: absolute;
  left: 38%;
  bottom: 22%;
  width: 132px;
  height: 72px;
  border-radius: 80px 80px 18px 18px;
  background: #7bc76b;
}

.island-chest {
  position: absolute;
  right: 22%;
  bottom: 26%;
  width: 96px;
  height: 62px;
  border: 5px solid #6e4424;
  border-radius: 14px 14px 8px 8px;
  background: #d99435;
  box-shadow: inset 0 22px 0 #f0b24b;
}

.island-chest::after {
  content: "";
  position: absolute;
  left: 38px;
  top: 28px;
  width: 18px;
  height: 16px;
  border-radius: 4px;
  background: #ffe27a;
}

.island-letter {
  position: absolute;
  left: 42%;
  bottom: 36%;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 4px solid #352b47;
  border-radius: 8px;
  background: #fffdf2;
  color: #241f2f;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.14);
}

.island-letter.second {
  left: 55%;
  bottom: 48%;
  background: #ffdce8;
}

.picture-card,
.flash-card {
  display: grid;
  place-items: center;
  min-height: 168px;
  border: 4px solid #ffffff;
  border-radius: 8px;
  background: #fffdf2;
  box-shadow: 0 7px 0 rgba(164, 128, 37, 0.16);
}

.flash-card {
  color: #176b6b;
  font-size: 118px;
  font-weight: 900;
  font-family: Arial, "Helvetica Neue", sans-serif;
}

.flash-card.hidden-letter {
  color: #c95745;
}

.game-stage[data-mode="flashChoice"] .task-card {
  background: #fff4bf;
}

.game-stage[data-mode="flashChoice"] .flash-card {
  min-height: 210px;
  border-color: #ffe27a;
}

.game-stage[data-mode="letterIntro"] .task-card {
  background: #fff4bf;
}

.letter-find-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
}

.letter-find-card {
  display: grid;
  min-height: 230px;
  border: 4px solid #ffffff;
  border-radius: 8px;
  padding: 0;
  color: #241f2f;
  background: #fffdf2;
  box-shadow: 0 7px 0 rgba(164, 128, 37, 0.18);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.letter-find-card.blue {
  background: #bfe9ef;
}

.letter-find-card.yellow {
  background: #ffe27a;
}

.letter-find-card:hover,
.letter-find-card:focus-visible {
  border-color: #352b47;
  outline: none;
  box-shadow: 0 12px 0 rgba(53, 43, 71, 0.18);
  transform: translateY(-5px);
}

.letter-find-card.found {
  border-color: #2f7d52;
  box-shadow: 0 7px 0 rgba(47, 125, 82, 0.24);
}

.letter-find-card-inner {
  position: relative;
  display: grid;
  min-height: 100%;
}

.letter-find-face {
  grid-area: 1 / 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 230px;
  border-radius: 4px;
  padding: 16px;
}

.letter-find-front {
  background: inherit;
  display: none;
  grid-template-rows: 1fr;
  place-items: center;
}

.letter-find-card.revealed .letter-find-back {
  display: none;
}

.letter-find-card.revealed .letter-find-front {
  display: grid;
}

.letter-find-back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36) 0 18%, transparent 18% 100%),
    repeating-linear-gradient(45deg, rgba(53, 43, 71, 0.08) 0 10px, transparent 10px 22px),
    #fff8d6;
}

.letter-find-card.blue .letter-find-back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36) 0 18%, transparent 18% 100%),
    repeating-linear-gradient(45deg, rgba(53, 43, 71, 0.08) 0 10px, transparent 10px 22px),
    #bfe9ef;
}

.letter-find-card.yellow .letter-find-back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36) 0 18%, transparent 18% 100%),
    repeating-linear-gradient(45deg, rgba(53, 43, 71, 0.08) 0 10px, transparent 10px 22px),
    #ffe27a;
}

.find-question {
  align-self: center;
  justify-self: center;
  color: #352b47;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 96px;
  font-weight: 900;
  line-height: 1;
}

.find-label,
.belly-hint {
  justify-self: center;
  border: 2px solid rgba(53, 43, 71, 0.14);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #352b47;
  font-size: 14px;
  font-weight: 900;
}

.find-letters {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 18px;
  font-family: Arial, "Helvetica Neue", sans-serif;
  line-height: 1;
}

.find-letters strong {
  font-size: 116px;
  font-style: normal;
}

.find-letters em {
  font-size: 104px;
  font-style: normal;
  font-weight: 900;
}

.game-stage[data-mode="letterSort"] .task-card {
  background: #fff4bf;
}

.letter-sort-stage {
  display: grid;
  gap: 18px;
}

.letter-sort-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  gap: 16px;
}

.letter-sort-box {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 210px;
  border: 4px solid #ffffff;
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfc;
  box-shadow: 0 7px 0 rgba(164, 128, 37, 0.18);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.letter-sort-basket {
  min-height: 230px;
  overflow: visible;
  border-color: #8a562a;
  border-radius: 18px 18px 26px 26px;
  background:
    linear-gradient(90deg, rgba(117, 70, 31, 0.2) 0 8px, transparent 8px 34px),
    linear-gradient(0deg, rgba(255, 244, 202, 0.48) 0 8px, transparent 8px 26px),
    #d69a4a;
  box-shadow:
    inset 0 -12px 0 rgba(117, 70, 31, 0.18),
    0 7px 0 rgba(164, 128, 37, 0.18);
}

.letter-sort-basket::before {
  content: "";
  position: absolute;
  inset: -30px 28px auto;
  height: 58px;
  border: 7px solid #8a562a;
  border-bottom: 0;
  border-radius: 36px 36px 0 0;
  background: transparent;
  z-index: 0;
  pointer-events: none;
}

.letter-sort-basket::after {
  content: "";
  position: absolute;
  inset: 22px 10px auto;
  height: 14px;
  border-radius: 999px;
  background: #7a471f;
  box-shadow: 0 4px 0 rgba(255, 246, 215, 0.35);
  pointer-events: none;
}

.letter-sort-box.ready {
  border-color: #f0b24b;
  transform: translateY(-3px);
}

.letter-sort-box.correct-flash {
  border-color: #2f7d52;
  box-shadow: 0 7px 0 rgba(47, 125, 82, 0.22);
}

.letter-sort-box.wrong {
  border-color: #b33a33;
  background: #fff0ee;
}

.sort-box-label {
  position: relative;
  z-index: 1;
  justify-self: center;
  border: 3px solid #352b47;
  border-radius: 8px;
  padding: 8px 16px;
  background: #ffffff;
  color: #241f2f;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
}

.letter-sort-basket .sort-box-label {
  min-width: 84px;
  margin-top: 20px;
  border-color: #241f2f;
  background: #fff9e3;
  text-align: center;
}

.sort-box-items {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 118px;
  margin-top: 14px;
}

.letter-sort-pictures {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 14px;
}

.sort-picture-card {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 154px;
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: 12px;
  background: var(--picture-bg, #ffffff);
  color: #111111;
  font-weight: 900;
  box-shadow: 0 7px 0 rgba(164, 128, 37, 0.18);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.sort-picture-card.picture-dolphin {
  --picture-bg: #d9f0ff;
}

.sort-picture-card.picture-dino {
  --picture-bg: #e6f7d8;
}

.sort-picture-card.picture-thumb {
  --picture-bg: #ffe2dc;
}

.sort-picture-card.picture-excavator {
  --picture-bg: #fff0bd;
}

.sort-picture-card.picture-ball {
  --picture-bg: #e7e2ff;
}

.sort-picture-card.picture-bear {
  --picture-bg: #ffe8c7;
}

.sort-picture-card.picture-word-sky {
  --picture-bg: #d9f0ff;
}

.sort-picture-card.picture-word-mint {
  --picture-bg: #e6f7d8;
}

.sort-picture-card.picture-word-peach {
  --picture-bg: #ffe2dc;
}

.sort-picture-card.picture-word-cream {
  --picture-bg: #fff0bd;
}

.sort-picture-card.picture-word-lavender {
  --picture-bg: #e7e2ff;
}

.sort-picture-card.picture-word-apricot {
  --picture-bg: #ffe8c7;
}

.sort-word {
  display: inline-grid;
  place-items: center;
  min-height: 74px;
  color: #241f2f;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.sort-animal-image {
  display: block;
  width: min(168px, 100%);
  height: 118px;
  object-fit: contain;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.sort-picture-card:hover,
.sort-picture-card:focus-visible,
.sort-picture-card.selected {
  border-color: #352b47;
  outline: none;
  box-shadow: 0 12px 0 rgba(53, 43, 71, 0.18);
  transform: translateY(-5px);
}

.sort-picture-card.dragging {
  opacity: 0.72;
}

.sort-picture-card.pointer-dragging {
  z-index: 20;
  cursor: grabbing;
  box-shadow: 0 16px 0 rgba(53, 43, 71, 0.18);
}

.sort-picture-card.correct {
  min-height: 102px;
  padding: 6px;
  border-color: #2f7d52;
  background: var(--picture-bg, #ffffff);
  box-shadow: none;
  cursor: default;
}

.sort-picture-card.wrong {
  border-color: #b33a33;
  background: #ffd1cb;
}

.sort-picture-card:disabled {
  color: #241f2f;
}

.sort-picture {
  display: block;
  width: min(172px, 100%);
  height: 124px;
  overflow: visible;
}

.sort-picture-card.correct .sort-picture {
  width: min(96px, 100%);
  height: 72px;
}

.sort-picture-card.correct .sort-animal-image {
  width: min(96px, 100%);
  height: 72px;
}

.sort-picture-card.correct .sort-word {
  min-height: 54px;
  font-size: 27px;
}

.game-stage[data-mode="audioChoice"] .picture-card,
.game-stage[data-mode="pictureChoice"] .picture-card {
  min-height: 190px;
  background: #eef9fa;
}

.game-stage[data-mode="findMany"] .task-card {
  background: #fffdf2;
}

.game-stage[data-mode="trace"] .task-card {
  background: #eef9fa;
}

.game-stage[data-mode="traceSet"] .task-card {
  background: #fff4bf;
}

.game-stage[data-mode="traceSet"] .task-card h3 {
  max-width: 980px;
  font-size: 24px;
  line-height: 1.28;
}

.writing-demo-stage {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  border: 4px solid #ffffff;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 7px 0 rgba(164, 128, 37, 0.15);
}

.writing-demo-card {
  display: grid;
  place-items: center;
  min-height: 148px;
  border: 2px solid rgba(53, 43, 71, 0.14);
  border-radius: 8px;
  background: #fbfdfc;
}

.writing-demo-card svg {
  width: 100%;
  max-width: 160px;
  height: 136px;
  overflow: visible;
}

.demo-outline-letter {
  fill: #ffffff;
  stroke: #241f2f;
  stroke-width: 3.2px;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 86px;
  font-weight: 900;
  paint-order: stroke fill;
}

.stroke-arrow-path {
  fill: none;
  stroke: #241f2f;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stroke-arrow-head {
  fill: #241f2f;
  stroke: none;
}

.stroke-arrow text {
  fill: #241f2f;
  stroke: none;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 17px;
  font-weight: 900;
}

.picture {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  color: #352b47;
  font-size: 42px;
  font-weight: 900;
  animation: soft-pop 1200ms ease-in-out infinite alternate;
}

.picture span {
  position: relative;
  z-index: 2;
}

.picture.speaker {
  border-radius: 50%;
  background: #ffe7a3;
}

.picture.speaker::before {
  content: "";
  position: absolute;
  left: 24px;
  width: 34px;
  height: 44px;
  border-radius: 8px 0 0 8px;
  background: #f48c7f;
}

.picture.tree::before {
  content: "";
  position: absolute;
  bottom: 10px;
  width: 24px;
  height: 64px;
  background: #c48a5a;
}

.picture.tree::after {
  content: "";
  position: absolute;
  top: 14px;
  width: 96px;
  height: 78px;
  border-radius: 48px;
  background: #a9df74;
}

.picture.apple::before {
  content: "";
  position: absolute;
  width: 86px;
  height: 76px;
  border-radius: 42px 42px 34px 34px;
  background: #ef5f62;
}

.picture.apple::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 22px;
  width: 34px;
  height: 18px;
  border-radius: 50%;
  background: #78b957;
  transform: rotate(-24deg);
}

.picture.mouse::before {
  content: "";
  position: absolute;
  width: 82px;
  height: 62px;
  border-radius: 50%;
  background: #d4bb89;
}

.picture.mouse::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 20px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f2d8c4;
  box-shadow: 56px 0 0 #f2d8c4;
}

.picture.magnifier::before {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border: 10px solid #77b8ca;
  border-radius: 50%;
}

.picture.magnifier::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 18px;
  width: 46px;
  height: 12px;
  border-radius: 8px;
  background: #77b8ca;
  transform: rotate(42deg);
}

@keyframes soft-pop {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-4px) scale(1.03);
  }
}

.trace-area {
  margin-top: 22px;
}

.trace-board {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border: 4px dashed #d4bb89;
  border-radius: 8px;
  background: #ffffff;
}

.game-stage[data-mode="traceSet"] .trace-board {
  min-height: 430px;
  border-style: solid;
  background: #fffdf2;
}

.trace-area.has-template-asset .trace-board {
  min-height: clamp(700px, 82vw, 1040px);
  background: #ffffff;
}

.trace-area.has-p5-template .trace-board {
  min-height: clamp(390px, 56vw, 500px);
  background: #ffffff;
}

.trace-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(73, 64, 95, 0.16);
  font-size: 190px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.game-stage[data-mode="traceSet"] .trace-letter {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 18px 18px 16px;
  color: transparent;
  font-size: 1rem;
}

.game-stage[data-mode="traceSet"] .trace-letter.has-template-asset {
  padding: 0;
  background: #ffffff;
}

.game-stage[data-mode="traceSet"] .trace-letter.has-p5-template {
  padding: 0;
  background: #ffffff;
}

.trace-template-stack {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 24px;
  box-sizing: border-box;
  padding: 32px 24px;
  background: #ffffff;
  pointer-events: none;
}

.trace-template-section {
  display: grid;
  gap: 10px;
  width: 100%;
}

.trace-template-image {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  background: #ffffff;
  object-fit: contain;
}

.writing-demo-stage.original-template {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  justify-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.writing-demo-template-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.writing-demo-template {
  display: block;
  width: min(760px, 100%);
  height: auto;
  border: 2px solid rgba(53, 43, 71, 0.12);
  background: #ffffff;
}

.writing-demo-template-row.bb .writing-demo-template,
.writing-demo-template-row.dd .writing-demo-template {
  width: min(210px, 44%);
}

.writing-demo-stage.original-template.p5-demo-stage .writing-demo-card {
  grid-template-rows: minmax(0, 1fr) auto;
}

.p5-demo-stage .writing-demo-template-row {
  align-items: stretch;
  gap: 14px;
}

.p5-writing-demo-card {
  position: relative;
  overflow: hidden;
  width: min(260px, 48%);
  min-height: 230px;
  padding: 0;
  place-items: stretch;
}

.p5-demo-caption {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px 10px;
  border-top: 2px solid rgba(53, 43, 71, 0.12);
  background: #fff8d8;
}

.p5-demo-caption strong {
  color: #352b47;
  font-size: 14px;
}

.p5-demo-caption em {
  color: #6a5572;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.animated-letter-canvas {
  position: relative;
  display: block;
  height: 178px;
  margin: 8px 8px 0;
  overflow: visible;
  border-radius: 8px;
  background: #fbfdfc;
}

.animated-letter-svg-fallback,
.p5-demo-canvas {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.animated-letter-svg-fallback {
  z-index: 0;
  transition: opacity 140ms ease;
}

.p5-demo-canvas {
  z-index: 1;
}

.p5-demo-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.animated-letter-canvas.p5-ready .animated-letter-svg-fallback {
  opacity: 0;
}

.animated-letter-canvas svg {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  overflow: visible;
}

.animated-letter-ghost path,
.animated-letter-stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.animated-letter-ghost path {
  stroke: rgba(53, 43, 71, 0.14);
  stroke-width: 6.4;
}

.animated-letter-stroke {
  stroke: var(--stroke-color, #ff3148);
  stroke-width: 7.6;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: animated-letter-stroke 7s ease-in-out infinite;
  animation-delay: calc(var(--stroke-index) * 820ms);
}

.animated-stroke-label {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #ff3148;
  color: #ffffff;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 10px rgba(53, 43, 71, 0.18);
  transform: translate(-50%, -50%);
}

.p5-trace-template-stack {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.8vw, 14px);
  box-sizing: border-box;
  padding: clamp(14px, 3vw, 22px) clamp(10px, 3vw, 18px);
  background: #ffffff;
  pointer-events: none;
}

.p5-trace-row {
  position: relative;
  min-height: 0;
  overflow: visible;
  background: #ffffff;
  border: 1px solid rgba(186, 181, 156, 0.78);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(53, 43, 71, 0.05);
  isolation: isolate;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.p5-trace-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  height: 32%;
  background: #dff4fb;
  border-top: 1px solid rgba(117, 169, 184, 0.44);
  border-bottom: 1px solid rgba(117, 169, 184, 0.44);
  z-index: 0;
}

.p5-trace-guide {
  display: none;
}

.p5-trace-guide.top {
  top: 7%;
}

.p5-trace-guide.middle {
  top: 36%;
}

.p5-trace-guide.base {
  top: 68%;
}

.p5-trace-guide.bottom {
  top: 92%;
}

.p5-trace-slot-list {
  position: absolute;
  left: clamp(10px, 3vw, 18px);
  right: clamp(34px, 13vw, 72px);
  top: 0;
  height: 66%;
  display: grid;
  grid-template-columns: repeat(3, minmax(34px, 64px));
  justify-content: start;
  gap: clamp(8px, 3.2vw, 22px);
  align-items: stretch;
}

.p5-trace-slot {
  position: relative;
  display: block;
  min-width: 0;
  z-index: 2;
}

.p5-trace-ghost-letter {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.p5-trace-ghost-letter path {
  fill: none;
  stroke: rgba(53, 43, 71, 0.3);
  stroke-width: 14.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 180ms ease, opacity 180ms ease;
}

.p5-trace-row.upper-b .p5-trace-slot-list,
.p5-trace-row.upper-d .p5-trace-slot-list {
  height: 66%;
}

.p5-trace-slot.is-complete .p5-trace-ghost-letter path {
  stroke: rgba(56, 124, 105, 0.5);
}

.p5-trace-row.is-complete {
  border-color: rgba(56, 124, 105, 0.46);
  box-shadow: inset 0 0 0 1px rgba(56, 124, 105, 0.06), 0 1px 0 rgba(56, 124, 105, 0.1);
}

.p5-trace-row-check {
  position: absolute;
  right: 18px;
  top: 48%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #5f9d87;
  color: #ffffff;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  box-shadow: 0 4px 10px rgba(56, 124, 105, 0.16);
  transform: translateY(-50%) scale(0.75);
  transition: opacity 160ms ease, transform 160ms ease;
}

.p5-trace-row.is-complete .p5-trace-row-check {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

@keyframes animated-letter-stroke {
  0%,
  12% {
    stroke-dashoffset: 1;
  }

  46%,
  82% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: 1;
  }
}

.writing-lines {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  gap: 10px;
  height: 100%;
}

.writing-line-row {
  position: relative;
  min-height: 86px;
  border: 2px solid rgba(53, 43, 71, 0.62);
  background: #ffffff;
  --template-font-size: 88px;
  --template-left: 14px;
  --template-top: -10px;
  --template-width: min(45%, 320px);
}

.writing-line-row.capital {
  --template-font-size: 88px;
  --template-top: -10px;
}

.writing-line-row.small {
  --template-font-size: 88px;
  --template-top: -10px;
}

.writing-line-row.upper-b {
  --template-font-size: 88px;
  --template-top: -10px;
}

.writing-line-row.lower-b {
  --template-font-size: 88px;
  --template-top: -10px;
}

.writing-line-row.upper-d {
  --template-font-size: 56px;
  --template-top: -4px;
}

.writing-line-row.lower-d {
  --template-font-size: 88px;
  --template-top: -10px;
}

.line-guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(53, 43, 71, 0.72);
}

.line-guide.top {
  top: 0;
}

.line-guide.middle {
  top: 32%;
  opacity: 0.7;
}

.line-guide.base {
  top: 64%;
}

.line-guide.bottom {
  bottom: 0;
}

.trace-letter-grid {
  position: absolute;
  left: var(--template-left);
  top: var(--template-top);
  width: var(--template-width);
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  column-gap: 18px;
  align-items: start;
  justify-items: start;
}

.trace-letter-text {
  color: rgba(53, 43, 71, 0.12);
  -webkit-text-stroke: 1.6px rgba(53, 43, 71, 0.38);
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: var(--template-font-size);
  font-weight: 900;
  line-height: 1;
  opacity: 0.82;
}

.writing-line-row.small .trace-letter-text {
  font-size: var(--template-font-size);
}

#traceCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.trace-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.trace-actions span {
  color: #6a5572;
  font-weight: 800;
}

.trace-tool-button {
  display: inline-grid;
  place-items: center;
  width: 58px;
  min-width: 58px;
  height: 58px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.trace-tool-button.active,
.trace-tool-button[aria-pressed="true"] {
  background: #ffe27a;
  box-shadow: inset 0 0 0 3px rgba(53, 43, 71, 0.18), 0 5px 0 rgba(53, 43, 71, 0.18);
}

#traceCanvas.eraser-active {
  cursor: crosshair;
}

.letter-option {
  position: relative;
  min-height: 92px;
  border: 2px solid #bfd4cf;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.game-stage .letter-options {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 16px;
}

.game-stage .letter-option {
  display: grid;
  justify-items: center;
  align-items: center;
  place-items: center;
  min-height: 122px;
  border: 4px solid #ffffff;
  border-radius: 8px;
  color: #241f2f;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 72px;
  box-shadow: 0 7px 0 rgba(164, 128, 37, 0.2);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.game-stage .letter-option.with-icon {
  grid-template-rows: 1fr 42px;
}

.game-stage .letter-option.find-tile {
  min-height: 84px;
  font-size: 48px;
}

.game-stage.voice-only-task #taskPrompt,
.game-stage.voice-only-task #taskHelper {
  display: none;
}

.game-stage.voice-only-task .letter-options {
  grid-template-columns: repeat(4, minmax(96px, 1fr));
}

.game-stage.voice-only-task .letter-option.find-tile {
  min-height: 108px;
  font-size: 64px;
}

.game-stage.voice-only-task .find-tile-mirror .letter-text {
  transform: scaleX(-1);
}

.game-stage.voice-only-task .find-tile-tilted .letter-text {
  transform: rotate(-9deg);
}

.game-stage.voice-only-task .find-tile-thin .letter-text {
  font-family: "Times New Roman", Georgia, serif;
  font-weight: 500;
}

.game-stage.voice-only-task .find-tile-round .letter-text {
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-weight: 900;
}

.game-stage .letter-option.selected {
  outline: 5px solid #f0b24b;
  transform: translateY(-4px);
}

.game-stage .letter-option:nth-child(1) {
  background: #bfe9ef;
  color: #241f2f;
}

.game-stage .letter-option:nth-child(2) {
  background: #ffe27a;
}

.game-stage .letter-option:nth-child(3) {
  background: #ffdce8;
}

.game-stage .letter-option:nth-child(4) {
  background: #cdeec8;
}

.game-stage.voice-only-task .letter-option.find-tile {
  background: #ffffff;
}

.game-stage .letter-option::before {
  display: none;
}

.game-stage .letter-option::after {
  display: none;
}

.letter-text {
  display: block;
  line-height: 1;
  transform: none;
}

.option-icon {
  position: relative;
  display: block;
  width: 44px;
  height: 34px;
}

.option-icon.apple {
  border-radius: 44% 44% 48% 48%;
  background: #ef5f62;
}

.option-icon.apple::after {
  content: "";
  position: absolute;
  top: -8px;
  right: 4px;
  width: 18px;
  height: 11px;
  border-radius: 50%;
  background: #7dbb59;
  transform: rotate(-25deg);
}

.option-icon.tree::before {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 0;
  width: 10px;
  height: 26px;
  background: #b77b4a;
}

.option-icon.tree::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  width: 40px;
  height: 27px;
  border-radius: 50%;
  background: #69b763;
}

.option-icon.mouse {
  border-radius: 50%;
  background: #cdb58a;
}

.option-icon.mouse::before,
.option-icon.mouse::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #e8d8c7;
}

.option-icon.mouse::before {
  left: 2px;
}

.option-icon.mouse::after {
  right: 2px;
}

.option-icon.dolphin,
.option-icon.cloud,
.option-icon.jelly,
.option-icon.octopus {
  border-radius: 50% 50% 44% 44%;
  background: #58a9c7;
}

.option-icon.cloud {
  background: #62b7cf;
  box-shadow: 13px -7px 0 #62b7cf, 25px 0 0 #62b7cf;
}

.option-icon.mushroom {
  border-radius: 24px 24px 10px 10px;
  background: #ef5f62;
}

.option-icon.mushroom::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -8px;
  width: 16px;
  height: 18px;
  background: #f8e6c8;
}

.option-icon.sun {
  border-radius: 50%;
  background: #f5b43f;
  box-shadow: 0 0 0 6px rgba(245, 180, 63, 0.36);
}

.option-icon.tiger {
  border-radius: 50%;
  background: #f3a642;
}

.game-stage .letter-option.word-option {
  font-size: 34px;
  line-height: 1.05;
  padding: 12px;
}

.check-many {
  margin-top: 14px;
}

.game-stage .letter-option.word-option::before,
.game-stage .letter-option.word-option::after {
  display: none;
}

.letter-option:hover,
.letter-option:focus-visible {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 4px rgba(23, 107, 107, 0.12);
}

.game-stage .letter-option:hover,
.game-stage .letter-option:focus-visible {
  border-color: #352b47;
  box-shadow: 0 12px 0 rgba(53, 43, 71, 0.18);
  transform: translateY(-5px);
}

.letter-option.correct {
  border-color: var(--green);
  background: #e8f5ee;
}

.letter-option.wrong {
  border-color: var(--red);
  background: #fae9e7;
}

.game-stage .letter-option.correct {
  border-color: #2f7d52;
  background: #bfe6d5;
  color: #1f5539;
}

.game-stage .letter-option.wrong {
  border-color: #b33a33;
  background: #ffd1cb;
  color: #7c2f2a;
}

.feedback {
  min-height: 28px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 700;
}

.game-stage .feedback {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  margin-top: 20px;
  border: 2px solid #f0bc61;
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff6d6;
  color: #352b47;
  font-size: 17px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.feedback.success {
  color: var(--green);
}

.game-stage .feedback.success {
  border-color: #2f7d52;
  background: #e7f6ee;
  animation: feedbackPop 360ms ease both;
}

.feedback.error {
  color: var(--red);
}

.flying-star-reward {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 120;
  pointer-events: none;
  font-size: 78px;
  line-height: 1;
  filter: drop-shadow(0 10px 0 rgba(53, 43, 71, 0.18));
  transform: translate(var(--star-start-x), var(--star-start-y)) translate(-50%, -50%) scale(0.2) rotate(-18deg);
  animation: flyStarToCounter 900ms cubic-bezier(0.18, 0.82, 0.22, 1) forwards;
}

.level-badge.star-target-pop {
  animation: starTargetPop 520ms ease both;
}

@keyframes feedbackPop {
  0% {
    transform: scale(0.96);
  }

  70% {
    transform: scale(1.03);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes flyStarToCounter {
  0% {
    opacity: 0;
    transform: translate(var(--star-start-x), var(--star-start-y)) translate(-50%, -50%) scale(0.2) rotate(-18deg);
  }

  18% {
    opacity: 1;
    transform: translate(var(--star-start-x), var(--star-start-y)) translate(-50%, -50%) scale(1.45) rotate(8deg);
  }

  58% {
    opacity: 1;
    transform: translate(var(--star-mid-x), var(--star-mid-y)) translate(-50%, -50%) scale(1.05) rotate(18deg);
  }

  100% {
    opacity: 0;
    transform: translate(var(--star-end-x), var(--star-end-y)) translate(-50%, -50%) scale(0.38) rotate(36deg);
  }
}

@keyframes starTargetPop {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.12);
  }
}

.stage-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.game-stage.kid-start .stage-actions {
  display: grid;
  justify-items: center;
  gap: 30px;
  margin-top: 0;
  width: min(520px, 86vw);
}

.primary-button,
.secondary-button,
.icon-button,
.file-link {
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 800;
}

.game-stage .primary-button,
.game-stage .secondary-button {
  border: 3px solid #352b47;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.18);
}

.game-stage .primary-button {
  background: var(--peach);
  color: #352b47;
}

.game-stage .secondary-button {
  background: #ffffff;
}

.game-stage .listen-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  min-width: 58px;
  height: 58px;
  padding: 0;
  font-size: 0;
}

.game-stage .listen-button::before {
  content: "";
  width: 38px;
  height: 38px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%23352b47' d='M8 24c0-2.2 1.8-4 4-4h12L39 8c2.6-2.1 6.5-.2 6.5 3.1v41.8c0 3.3-3.9 5.2-6.5 3.1L24 44H12c-2.2 0-4-1.8-4-4V24Z'/%3E%3Cpath fill='none' stroke='%23352b47' stroke-width='5.5' stroke-linecap='round' d='M49 24c3.2 4.7 3.2 11.3 0 16M56 16c7.8 9.4 7.8 22.6 0 32'/%3E%3C/svg%3E");
}

.game-stage .listen-button::after {
  display: none;
}

.game-stage .start-button {
  min-width: 178px;
  min-height: 58px;
  font-size: 20px;
}

.game-stage.kid-start .start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(430px, 78vw);
  min-height: 92px;
  border: 0;
  border-radius: 22px;
  background: #2f9b57;
  color: #ffffff;
  font-size: 36px;
  box-shadow: 0 9px 0 #1f6f3e, 0 18px 30px rgba(31, 111, 62, 0.22);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.game-stage.kid-start .start-button::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 22px solid #ffffff;
}

.game-stage.kid-start .start-button:hover {
  background: #35aa60;
  transform: translateY(-2px);
  box-shadow: 0 11px 0 #1f6f3e, 0 20px 34px rgba(31, 111, 62, 0.24);
}

.game-stage.kid-start .start-button:active {
  transform: translateY(5px);
  box-shadow: 0 4px 0 #1f6f3e, 0 10px 18px rgba(31, 111, 62, 0.2);
}

.start-graphic {
  display: grid;
  grid-template-columns: repeat(3, 82px);
  justify-content: center;
  align-items: end;
  gap: 14px;
  width: min(330px, 80vw);
}

.start-tile {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border: 5px solid #352b47;
  border-radius: 18px;
  color: #241f2f;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 44px;
  font-weight: 900;
  box-shadow: 0 7px 0 rgba(53, 43, 71, 0.18);
}

.tile-a {
  background: #ffe7a3;
  transform: rotate(-7deg) translateY(5px);
}

.tile-b {
  background: #bfe6d5;
  transform: translateY(-8px);
}

.tile-c {
  background: #ffdce8;
  transform: rotate(7deg) translateY(4px);
}

@media (max-width: 720px) {
  .start-graphic {
    grid-template-columns: repeat(3, 68px);
    gap: 10px;
  }

  .start-tile {
    width: 68px;
    height: 68px;
    border-radius: 14px;
    font-size: 36px;
  }

  .game-stage.kid-start .start-button {
    min-height: 82px;
    font-size: 32px;
  }
}

.primary-button {
  border: 1px solid var(--teal-dark);
  background: var(--teal);
  color: #ffffff;
}

.secondary-button,
.file-link {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--teal-dark);
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.map-visual {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.map-visual span,
.home-letters span {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: 8px;
  background: #f2ead8;
  color: #17211f;
  font-size: 34px;
  font-weight: 900;
}

.game-rewards {
  display: none !important;
  border: 3px solid #352b47;
  background: #fffdf4;
}

.game-rewards .map-visual span {
  min-height: 92px;
  border: 3px solid rgba(53, 43, 71, 0.18);
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 42px;
  box-shadow: 0 6px 0 rgba(53, 43, 71, 0.12);
}

.game-rewards .map-visual span::before {
  display: none;
}

.game-rewards .map-visual span::after {
  display: none;
}

.reward-shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.treasure-steps {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 2px solid rgba(53, 43, 71, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.treasure-step-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.treasure-step {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 2px solid #e4d6b7;
  border-radius: 8px;
  background: #fff8d8;
  color: #6a5d4e;
  font-weight: 900;
}

.treasure-step.done {
  border-color: #4fa693;
  background: #bfe6d5;
  color: #296f63;
}

.treasure-step.current {
  border-color: #352b47;
  background: #ffe27a;
  color: #352b47;
}

.treasure-steps strong {
  color: #352b47;
  font-size: 13px;
}

.reward-shelf span {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 3px solid #352b47;
  border-radius: 8px;
  background: var(--butter);
  color: #352b47;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(53, 43, 71, 0.14);
}

.reward-shelf span:nth-child(2) {
  background: var(--mint);
}

.reward-shelf span:nth-child(3) {
  background: #ffd1cb;
}

.map-visual span:nth-child(2),
.home-letters span:nth-child(2) {
  background: #dfeeed;
}

.map-visual span:nth-child(3),
.home-letters span:nth-child(3) {
  background: #f5ded7;
}

.map-visual span:nth-child(4),
.home-letters span:nth-child(4) {
  background: #eadff2;
}

.motivation-panel p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-strong);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

.game-rewards .chip {
  border: 2px solid rgba(53, 43, 71, 0.16);
  background: #ffffff;
  color: #352b47;
}

.game-rewards .chip.active {
  border-color: #f0b24b;
  background: #fff5d6;
}

.student-table {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.student-row {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1.2fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.student-row strong {
  display: block;
}

.student-row span {
  color: var(--muted);
  font-size: 13px;
}

.status-badge.green {
  background: #e8f5ee;
  color: var(--green);
}

.status-badge.yellow {
  background: #fff2d6;
  color: var(--yellow);
}

.status-badge.red {
  background: #fae9e7;
  color: var(--red);
}

.mini-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ece9;
}

.mini-bar span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.row-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--teal-dark);
  font-weight: 800;
}

.recommendation-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.recommendation-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.recommendation-item strong {
  display: block;
}

.recommendation-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.idea-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.idea-heading {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
}

.idea-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: var(--muted);
  line-height: 1.4;
}

.skill-bars {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.adaptive-note,
.trend-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf6;
}

.adaptive-note span,
.trend-card small {
  color: var(--muted);
  line-height: 1.4;
}

.trend-bars {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 86px;
  border-radius: 8px;
  padding: 10px;
  background: #eef9fa;
}

.trend-bars span {
  flex: 1;
  min-height: 12px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #4fa693, #d59a25);
}

.skill-bar {
  display: grid;
  grid-template-columns: 180px 1fr 52px;
  gap: 12px;
  align-items: center;
}

.skill-bar label {
  color: var(--muted);
  font-weight: 800;
}

.bar-track {
  overflow: hidden;
  height: 14px;
  border-radius: 999px;
  background: #e4ece9;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
}

.bar-fill.yellow {
  background: var(--gold);
}

.bar-fill.red {
  background: var(--coral);
}

.insight-panel.accent {
  border-color: #efd2c8;
  background: #fff8f5;
}

.insight-panel p,
.home-practice p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.insight-panel button {
  margin-top: 16px;
}

.report-block {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.report-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.report-section h3 {
  font-size: 16px;
}

.report-section p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.parent-progress-visual {
  margin-top: 16px;
}

.progress-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf6;
}

.progress-card strong,
.progress-card span {
  display: block;
}

.progress-card span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.parent-progress-bars {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 96px;
  border-radius: 8px;
  padding: 12px;
  background: #eef9fa;
}

.parent-progress-bars span {
  flex: 1;
  min-height: 14px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #82c47d, #4fa693);
}

.home-letters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.language-tips {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf6;
}

.language-tips h3 {
  font-size: 16px;
}

.language-tips p {
  margin-top: 6px;
}

.language-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.language-pills span {
  border-radius: 999px;
  padding: 6px 9px;
  background: #e8f5ee;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.feature-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.access-matrix {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.access-matrix div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.access-matrix strong,
.access-matrix span {
  display: block;
}

.access-matrix span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

dialog {
  width: min(760px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(23, 33, 31, 0.35);
}

dialog form {
  padding: 18px;
}

pre {
  overflow: auto;
  max-height: 56vh;
  margin: 16px 0 0;
  border-radius: 8px;
  padding: 14px;
  background: #101816;
  color: #eaf5f1;
  white-space: pre-wrap;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .child-grid,
  .dashboard-grid,
  .parent-layout,
  .prd-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main-content,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .stage-header,
  .section-heading {
    display: grid;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .nav-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .letter-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-stage .letter-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-stage .letter-option {
    min-height: 118px;
    font-size: 58px;
  }

  .letter-find-stage {
    grid-template-columns: 1fr;
  }

  .letter-find-card {
    min-height: 190px;
  }

  .letter-sort-targets,
  .letter-sort-pictures {
    grid-template-columns: 1fr;
  }

  .letter-sort-box {
    min-height: 180px;
  }

  .sort-box-label {
    font-size: 46px;
  }

  .sort-box-items {
    grid-template-columns: repeat(3, minmax(66px, 1fr));
  }

  .find-letters strong {
    font-size: 92px;
  }

  .find-letters em {
    font-size: 84px;
  }

  .quest-path {
    grid-template-columns: 42px 1fr 42px;
  }

  .map-status {
    display: grid;
  }

  .treasure-map-board {
    min-height: 300px;
  }

  .map-station {
    width: 48px;
    height: 48px;
  }

  .pirate-avatar {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }

  .treasure-chest {
    width: 60px;
    height: 52px;
  }

  .chest-lid,
  .chest-body {
    width: 60px;
  }

  .quest-path .muted,
  .quest-path .treasure {
    display: none;
  }

  .student-row,
  .skill-bar {
    grid-template-columns: 1fr;
  }
}
