@font-face {
  font-family: "Kenney Future";
  src: url("data/assets/kenney-future.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --sky: #62d7ff;
  --sky-deep: #1787ff;
  --grass: #2ed65f;
  --grass-dark: #0c9b42;
  --sun: #ffe159;
  --coin: #ffbe22;
  --rose: #ff4f8b;
  --berry: #7c4dff;
  --red: #ff3b30;
  --cyan: #00b8ff;
  --ink: #17223a;
  --paper: #fff8df;
  --panel: #ffffff;
  --line: #112447;
  --water: #0097ff;
  --danger: #ff3b30;
  --shadow: rgba(17, 36, 71, 0.22);
  --soft-shadow: rgba(17, 36, 71, 0.12);
  font-family: "Kenney Future", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    url("data/assets/grass-tile.png") repeat-x bottom center / 72px 72px,
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.9) 0 2.6rem, transparent 2.7rem),
    radial-gradient(circle at 18% 13%, rgba(255, 255, 255, 0.88) 0 2.1rem, transparent 2.2rem),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.85) 0 2.5rem, transparent 2.6rem),
    radial-gradient(circle at 76% 15%, rgba(255, 255, 255, 0.75) 0 1.7rem, transparent 1.8rem),
    linear-gradient(90deg, rgba(255,255,255,0.18) 0 1rem, transparent 1rem 2rem),
    linear-gradient(180deg, #64d8ff 0%, #a9eeff 48%, #4fdb74 48%, #22b74f 100%);
  background-size: auto, auto, auto, auto, 2rem 2rem, auto;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 251, 255, 0.92));
  border-bottom: 5px solid var(--line);
  box-shadow: 0 8px 0 rgba(17, 36, 71, 0.08), 0 16px 30px var(--soft-shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 3.2rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff7a8 0 24%, transparent 25%),
    linear-gradient(180deg, #ffe86a, #ffb51f);
  font-weight: 900;
  font-size: 1.8rem;
  box-shadow: inset 0 -6px rgba(114, 70, 0, 0.18), 0 4px 0 var(--ink);
}

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

.brand h1 {
  font-family: "Kenney Future", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 2.15rem);
  line-height: 1.05;
  font-weight: 800;
}

.brand p {
  font-size: 0.95rem;
  color: #4e6284;
  font-weight: 800;
}

.quick-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #eef8ff 100%);
  color: var(--ink);
  min-width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 0.7rem;
  font-weight: 900;
  font-size: 0.95rem;
  box-shadow: 0 5px 0 var(--ink), inset 0 -4px rgba(0, 151, 255, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease;
  white-space: nowrap;
}

.icon-button span:first-child {
  font-size: 1.25rem;
  line-height: 1;
}

.icon-button:hover,
.choice-card:hover,
.primary-action:hover,
.secondary-action:hover {
  transform: translateY(-2px);
}

.icon-button:active,
.choice-card:active,
.primary-action:active,
.secondary-action:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.main-stage {
  width: min(1180px, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) 0 2rem;
  position: relative;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.85fr) minmax(320px, 1.15fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

.panel,
.hero-panel,
.quest-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(249, 253, 255, 0.98));
  border: 4px solid var(--ink);
  border-radius: 1.25rem;
  box-shadow: 0 8px 0 var(--ink), 0 18px 34px var(--shadow);
  overflow: hidden;
}

.hero-panel {
  padding: clamp(1rem, 2.6vw, 1.5rem);
  position: relative;
}

.hero-panel h2 {
  font-family: "Kenney Future", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.65rem, 4vw, 3rem);
  line-height: 1.02;
  margin-bottom: 0.65rem;
  font-weight: 800;
}

.hero-panel p {
  color: #435777;
  font-size: 1.05rem;
  line-height: 1.45;
  font-weight: 800;
}

.quest-map-scene {
  min-height: 118px;
  margin: 1rem 0;
  border: 4px solid var(--ink);
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
  background:
    url("data/assets/grass-tile.png") repeat-x bottom center / 56px 56px,
    linear-gradient(180deg, #9cecff 0 62%, #35d96a 62% 100%);
  box-shadow: inset 0 -8px rgba(17, 36, 71, 0.08);
}

.quest-map-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.92) 0 1rem, transparent 1.05rem),
    radial-gradient(circle at 23% 18%, rgba(255,255,255,0.82) 0 0.75rem, transparent 0.8rem),
    radial-gradient(circle at 72% 19%, rgba(255,255,255,0.82) 0 1.1rem, transparent 1.15rem);
}

.quest-map-scene img {
  position: absolute;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 0 rgba(17, 36, 71, 0.22));
}

.quest-map-scene img:nth-child(1) {
  width: 78px;
  left: 58%;
  bottom: 25px;
}

.quest-map-scene img:nth-child(2) {
  width: 58px;
  left: 38%;
  bottom: 27px;
}

.quest-map-scene img:nth-child(3) {
  width: 54px;
  left: 12%;
  bottom: 25px;
}

.quest-map-scene img:nth-child(4) {
  width: 50px;
  right: 9%;
  bottom: 25px;
}

.avatar-stage {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 1.25rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, #ffffff 0 1.6rem, transparent 1.7rem),
    radial-gradient(circle at 26% 16%, #ffffff 0 1.2rem, transparent 1.3rem),
    radial-gradient(circle at 80% 20%, #ffffff 0 1.5rem, transparent 1.6rem),
    linear-gradient(180deg, #8ee9ff 0 58%, #33d96b 58% 100%);
  position: relative;
  border-radius: 0.85rem;
  border: 4px solid rgba(17, 36, 71, 0.08);
}

.avatar-stage::before {
  content: "";
  position: absolute;
  left: 5%;
  bottom: 28%;
  width: 23%;
  height: 24%;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), transparent 42%),
    #18a94a;
  border: 4px solid var(--ink);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.avatar-stage::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: 16%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff3a2 0 20%, transparent 21%),
    linear-gradient(180deg, #ffdd4d, #ffae19);
  border: 4px solid var(--ink);
  box-shadow:
    -92px 26px 0 -18px #ff3b30,
    -92px 26px 0 -14px var(--ink),
    inset 0 -8px rgba(145, 82, 0, 0.16);
}

.avatar {
  position: relative;
  width: 190px;
  height: 295px;
  isolation: isolate;
}

.avatar .hat {
  position: absolute;
  left: 45px;
  top: 0;
  width: 100px;
  height: 72px;
  background: var(--hat-color, #7d4bd8);
  border: 4px solid var(--ink);
  z-index: 6;
}

.avatar .hat.pointed {
  clip-path: polygon(50% 0, 94% 90%, 6% 90%);
}

.avatar .hat.cap {
  height: 45px;
  top: 26px;
  border-radius: 50% 50% 0 0;
}

.avatar .hat.floppy {
  height: 45px;
  top: 28px;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.avatar .hat.none {
  display: none;
}

.avatar .hair {
  position: absolute;
  left: 45px;
  top: 55px;
  width: 100px;
  height: 88px;
  background: var(--hair-color, #6b3d23);
  border: 4px solid var(--ink);
  z-index: 2;
}

.avatar .hair.bob {
  border-radius: 45% 45% 32% 32%;
}

.avatar .hair.curls {
  border-radius: 50%;
  box-shadow: -22px 20px 0 -5px var(--hair-color, #6b3d23), 22px 20px 0 -5px var(--hair-color, #6b3d23);
}

.avatar .hair.braids::before,
.avatar .hair.braids::after {
  content: "";
  position: absolute;
  top: 40px;
  width: 24px;
  height: 105px;
  border: 4px solid var(--ink);
  background: var(--hair-color, #6b3d23);
  border-radius: 18px;
}

.avatar .hair.braids::before {
  left: -24px;
}

.avatar .hair.braids::after {
  right: -24px;
}

.avatar .hair.short {
  height: 58px;
  border-radius: 48% 48% 35% 35%;
}

.avatar .head {
  position: absolute;
  left: 58px;
  top: 72px;
  width: 74px;
  height: 78px;
  background: var(--skin-color, #d9966b);
  border: 4px solid var(--ink);
  border-radius: 45%;
  z-index: 4;
}

.avatar .eye {
  position: absolute;
  top: 30px;
  width: 12px;
  height: 13px;
  border: 2px solid var(--ink);
  background: var(--eye-color, #4b8bd8);
  border-radius: 50%;
}

.avatar .eye.left {
  left: 17px;
}

.avatar .eye.right {
  right: 17px;
}

.avatar .smile {
  position: absolute;
  left: 25px;
  top: 53px;
  width: 24px;
  height: 12px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 20px 20px;
}

.avatar .shirt {
  position: absolute;
  left: 48px;
  top: 148px;
  width: 94px;
  height: 74px;
  background: var(--shirt-color, #ff7aa8);
  border: 4px solid var(--ink);
  z-index: 3;
}

.avatar .shirt.tunic {
  clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
}

.avatar .shirt.robe {
  height: 100px;
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.avatar .shirt.jacket {
  border-radius: 15px 15px 4px 4px;
}

.avatar .arm {
  position: absolute;
  top: 158px;
  width: 28px;
  height: 82px;
  border: 4px solid var(--ink);
  background: var(--skin-color, #d9966b);
  border-radius: 18px;
  z-index: 1;
}

.avatar .arm.left {
  left: 25px;
  transform: rotate(12deg);
}

.avatar .arm.right {
  right: 25px;
  transform: rotate(-12deg);
}

.avatar .pants {
  position: absolute;
  left: 56px;
  top: 218px;
  width: 78px;
  height: 52px;
  background: var(--pants-color, #2f9ed9);
  border: 4px solid var(--ink);
  z-index: 2;
}

.avatar .pants.skirt {
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.avatar .pants.trousers::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  border-left: 3px solid var(--ink);
}

.avatar .pants.shorts {
  height: 42px;
}

.avatar .boot {
  position: absolute;
  top: 265px;
  width: 43px;
  height: 22px;
  background: var(--boots-color, #79523b);
  border: 4px solid var(--ink);
  border-radius: 5px;
  z-index: 3;
}

.avatar .boot.left {
  left: 48px;
}

.avatar .boot.right {
  right: 48px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-weight: 800;
  font-size: 0.9rem;
  color: #24385d;
}

.field select,
.field input {
  min-height: 2.85rem;
  border: 3px solid var(--ink);
  border-radius: 0.85rem;
  padding: 0.35rem 0.55rem;
  background:
    linear-gradient(180deg, #ffffff, #eef8ff);
  box-shadow: inset 0 -3px rgba(0, 151, 255, 0.08);
  font-weight: 800;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.swatch {
  width: 2.15rem;
  height: 2.15rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.16), 0 2px 0 var(--ink);
}

.swatch[aria-pressed="true"] {
  outline: 4px solid var(--cyan);
  outline-offset: 2px;
}

.primary-action,
.secondary-action {
  border: 4px solid var(--ink);
  border-radius: 999px;
  min-height: 3rem;
  padding: 0.65rem 1.1rem;
  font-weight: 900;
  box-shadow: 0 5px 0 var(--ink), inset 0 -5px rgba(0, 0, 0, 0.12);
}

.primary-action {
  background:
    linear-gradient(180deg, #5fff89, #15c952);
  color: #061d12;
}

.secondary-action {
  background:
    linear-gradient(180deg, #fff27a, #ffb928);
  color: var(--ink);
}

.danger-action {
  background: #ffb1b1;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-tile {
  padding: 0.8rem;
  background:
    linear-gradient(180deg, #ffffff, #fff6d7);
  border: 4px solid var(--ink);
  border-radius: 1rem;
  box-shadow: 0 5px 0 var(--ink);
  min-height: 5rem;
}

.stat-tile strong {
  display: block;
  font-size: 1.45rem;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

.tree-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.choice-card {
  min-height: 145px;
  border: 4px solid var(--ink);
  border-radius: 1.15rem;
  padding: 0.95rem;
  background:
    url("data/assets/divider.png") no-repeat right 0.7rem bottom 0.8rem / 74px auto,
    radial-gradient(circle at 88% 12%, rgba(255, 225, 89, 0.7) 0 1.4rem, transparent 1.5rem),
    linear-gradient(180deg, #ffffff, #eef8ff);
  text-align: left;
  box-shadow: 0 7px 0 var(--ink), inset 0 -7px rgba(0, 151, 255, 0.08);
  display: grid;
  align-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.choice-card .sigil {
  width: 3.35rem;
  height: 3.35rem;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff7a8 0 24%, transparent 25%),
    linear-gradient(180deg, #ffe86a, #ffb51f);
  font-size: 1.7rem;
  font-weight: 900;
  box-shadow: inset 0 -6px rgba(114, 70, 0, 0.16);
}

.choice-card > span {
  min-width: 0;
}

.choice-card h3 {
  font-size: clamp(0.82rem, 1vw, 0.96rem);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  line-height: 1.16;
  overflow-wrap: break-word;
  word-break: normal;
}

.choice-card strong {
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: clamp(0.76rem, 0.92vw, 0.88rem);
  line-height: 1.18;
  overflow-wrap: normal;
}

.choice-card p,
.muted {
  color: #4b5d80;
  line-height: 1.35;
  font-weight: 700;
}

.quest-panel {
  padding: clamp(1rem, 2vw, 1.35rem);
}

.quest-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.exercise-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background:
    linear-gradient(180deg, #fff27a, #ffb928);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--ink);
}

.step-list {
  display: grid;
  gap: 0.65rem;
}

.step-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  background:
    linear-gradient(180deg, #ffffff, #fff8df);
  border: 3px solid var(--ink);
  border-radius: 1rem;
  box-shadow: 0 4px 0 var(--ink);
}

.step-row.locked {
  opacity: 0.62;
  box-shadow: 0 3px 0 #5d6780;
}

.exercise-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.question-box {
  min-height: 150px;
  display: grid;
  align-content: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 4px solid var(--ink);
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 225, 89, 0.55) 0 1.5rem, transparent 1.6rem),
    radial-gradient(circle at 92% 85%, rgba(255, 59, 48, 0.15) 0 2rem, transparent 2.1rem),
    linear-gradient(180deg, #ffffff, #dff7ff);
  font-size: clamp(1.35rem, 4vw, 2.35rem);
  font-weight: 900;
  text-align: center;
  box-shadow: inset 0 -8px rgba(0, 151, 255, 0.08);
}

.question-box .word-problem {
  font-size: clamp(1.05rem, 3vw, 1.55rem);
  line-height: 1.35;
}

.chart-card {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 0.75rem;
  border: 4px solid var(--ink);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, #fffefa, #ffffff);
  padding: 0.75rem;
  box-shadow: 0 5px 0 var(--ink), inset 0 -5px rgba(0, 151, 255, 0.05);
  overflow: auto;
}

.chart-card figcaption {
  margin-bottom: 0.5rem;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 900;
  color: var(--ink);
}

.chart-card svg {
  display: block;
  width: 100%;
  min-width: 480px;
  height: auto;
}

.chart-paper {
  fill: #fffefa;
}

.chart-grid-line {
  stroke: rgba(17, 36, 71, 0.22);
  stroke-width: 2;
}

.chart-grid-line.muted-line {
  stroke: rgba(17, 36, 71, 0.1);
}

.chart-axis {
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
}

.chart-axis-label,
.chart-title-label,
.chart-value-label {
  fill: var(--ink);
  font-family: "Kenney Future", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-weight: 900;
}

.exit-quest-button {
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem;
  background:
    linear-gradient(180deg, #ffffff, #eef8ff);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

.chart-axis-label {
  font-size: 15px;
}

.chart-title-label {
  font-size: 17px;
}

.chart-value-label {
  font-size: 15px;
}

.chart-bar {
  stroke: var(--ink);
  stroke-width: 3;
}

.chart-line {
  fill: none;
  stroke: #ff4f8b;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: #ffe159;
  stroke: var(--ink);
  stroke-width: 3;
}

.pie-layout {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr);
  gap: 1rem;
  align-items: center;
}

.pie-chart {
  width: min(220px, 52vw);
  aspect-ratio: 1;
  border: 5px solid var(--ink);
  border-radius: 50%;
  box-shadow: inset 0 -10px rgba(17, 36, 71, 0.08), 0 5px 0 var(--ink);
}

.pie-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  text-align: left;
}

.pie-legend li {
  display: grid;
  grid-template-columns: 1.25rem 1fr auto;
  gap: 0.45rem;
  align-items: center;
  border: 3px solid var(--ink);
  border-radius: 0.7rem;
  background: #ffffff;
  padding: 0.45rem;
}

.legend-swatch {
  width: 1rem;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 0.25rem;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto;
  gap: 0.65rem;
}

.multiple-choice-panel {
  display: grid;
  gap: 0.8rem;
}

.choice-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.choice-answer {
  min-height: 3.5rem;
  padding: 0.7rem 0.9rem;
  border: 4px solid var(--ink);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, #ffffff, #eef8ff);
  box-shadow: 0 5px 0 var(--ink), inset 0 -5px rgba(0, 151, 255, 0.08);
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.choice-answer:hover {
  transform: translateY(-2px);
}

.choice-answer.correct-choice {
  background:
    linear-gradient(180deg, #75ff98, #17c956);
}

.choice-answer.incorrect-choice {
  background:
    linear-gradient(180deg, #ff8b84, #ff3b30);
}

.choice-answer:disabled {
  cursor: default;
}

.answer-row input {
  min-height: 3.25rem;
  border: 4px solid var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-size: 1.35rem;
  font-weight: 900;
  background:
    linear-gradient(180deg, #ffffff, #eef8ff);
  box-shadow: inset 0 -5px rgba(0, 151, 255, 0.08);
}

.feedback {
  min-height: 2rem;
  font-weight: 900;
}

.feedback.good {
  color: var(--grass-dark);
}

.feedback.try {
  color: var(--danger);
}

.progress-dots {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dot {
  width: 1.15rem;
  height: 1.15rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 0 var(--ink);
}

.dot.done {
  background:
    linear-gradient(180deg, #5fff89, #15c952);
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.reward-card {
  border: 4px solid var(--ink);
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 92% 15%, rgba(255, 59, 48, 0.2) 0 1.6rem, transparent 1.7rem),
    linear-gradient(180deg, #fffdf2, #fff1a9);
  padding: 0.85rem;
  display: grid;
  gap: 0.55rem;
  min-height: 170px;
  text-align: left;
  box-shadow: 0 7px 0 var(--ink), inset 0 -8px rgba(255, 185, 40, 0.22);
}

.reward-card .item-icon {
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff7a8 0 24%, transparent 25%),
    linear-gradient(180deg, #ffe86a, #ffb51f);
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: inset 0 -5px rgba(114, 70, 0, 0.16);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(17, 36, 71, 0.48);
}

.modal {
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: hidden;
  background:
    linear-gradient(180deg, #ffffff, #f3fbff);
  border: 4px solid var(--ink);
  border-radius: 1.25rem;
  box-shadow: 0 9px 0 var(--ink), 0 22px 50px rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template-rows: auto 1fr;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 4px solid var(--ink);
  background:
    linear-gradient(180deg, #fff27a, #ffb928);
}

.close-button {
  width: 2.45rem;
  height: 2.45rem;
  background: #fff;
}

.modal-body {
  overflow: auto;
  padding: 1rem;
}

.times-table,
.prize-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.times-table th,
.times-table td,
.prize-table th,
.prize-table td {
  border: 2px solid var(--ink);
  padding: 0.45rem;
  text-align: center;
}

.times-table th,
.times-table td {
  transition: background 100ms ease, color 100ms ease, transform 100ms ease;
}

.times-table th {
  background: #bff2ff;
}

.times-table td {
  font-weight: 800;
}

.times-table .table-highlight {
  background: #fff27a;
  color: var(--ink);
}

.times-table .table-focus-cell {
  background: #ff3b30;
  color: #fff;
  font-weight: 900;
  transform: scale(1.04);
}

.prize-table th {
  background: #fff27a;
}

.conversion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.conversion-card {
  border: 3px solid var(--ink);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, #ffffff, #fff8df);
  padding: 0.8rem;
  box-shadow: 0 4px 0 var(--ink);
}

.conversion-card h3 {
  margin-bottom: 0.6rem;
  line-height: 1.1;
}

.conversion-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.conversion-table th,
.conversion-table td {
  border: 2px solid var(--ink);
  padding: 0.4rem;
  text-align: center;
}

.conversion-table th {
  background: #bff2ff;
}

.inventory-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.inventory-item {
  border: 3px solid var(--ink);
  border-radius: 0.9rem;
  padding: 0.65rem;
  background:
    linear-gradient(180deg, #ffffff, #fff8df);
}

.admin-stack {
  display: grid;
  gap: 1rem;
}

.admin-banner,
.admin-card {
  border: 3px solid var(--ink);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, #ffffff, #fff8df);
  padding: 0.9rem;
  box-shadow: 0 4px 0 var(--ink);
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

.admin-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.modal-tool-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.8rem;
}

.admin-login-form,
.admin-control-grid {
  display: grid;
  gap: 0.8rem;
}

.admin-prize-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) minmax(220px, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.admin-control-grid {
  grid-template-columns: minmax(180px, 260px) auto;
  align-items: end;
}

.admin-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
  border: 2px solid var(--ink);
  padding: 0.5rem;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: #bff2ff;
}

.admin-banner code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

.admin-preview-note {
  margin: 0.85rem 0;
  border: 3px solid var(--ink);
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: linear-gradient(180deg, #fff6cf, #fffdf1);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
}

.danger-action {
  background: linear-gradient(180deg, #ffb19f, #ff856d);
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

@media (max-width: 880px) {
  .split-layout,
  .tree-grid,
  .reward-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-stats,
  .admin-control-grid,
  .admin-prize-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
  }
}

@media (max-width: 560px) {
  .topbar {
    flex-direction: column;
  }

  .quick-actions {
    width: 100%;
    justify-content: space-between;
  }

  .icon-button {
    flex: 1 1 45%;
    min-width: 0;
    padding: 0 0.45rem;
    font-size: clamp(0.68rem, 2.8vw, 0.88rem);
  }

  .icon-button span:first-child {
    font-size: 1.05rem;
  }

  .form-grid,
  .answer-row,
  .step-row,
  .choice-answer-grid,
  .conversion-grid,
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .chart-card {
    padding: 0.5rem;
  }

  .chart-card svg {
    min-width: 430px;
  }

  .pie-chart {
    justify-self: center;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .avatar-stage {
    min-height: 315px;
  }
}
