:root {
  color-scheme: light;
  --ink: #24312f;
  --muted: #66756f;
  --paper: #fffdf8;
  --canvas: #f7f2e8;
  --line: #dfd5c5;
  --teal: #1d776b;
  --teal-dark: #145f56;
  --leaf: #7aa95c;
  --sky: #72a6d9;
  --coral: #fb7a5c;
  --gold: #f5c85b;
  --violet: #7b6fb6;
  --shadow: 0 18px 45px rgba(42, 45, 40, 0.14);
  --soft-shadow: 0 10px 24px rgba(42, 45, 40, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    ui-rounded,
    "Hiragino Sans",
    "Yu Gothic",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  line-height: 1.5;
  background:
    linear-gradient(180deg, rgba(255, 248, 232, 0.92), rgba(246, 237, 220, 0.96)),
    var(--canvas);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled,
button[aria-disabled="true"] {
  cursor: not-allowed;
}

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

h1,
h2,
strong,
button,
span,
p,
small,
input {
  overflow-wrap: anywhere;
}

.app-shell {
  min-height: 100vh;
  padding: 14px clamp(12px, 2vw, 28px) 92px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: none;
  margin: -14px calc(clamp(12px, 2vw, 28px) * -1) 18px;
  padding: 14px clamp(16px, 2.4vw, 30px);
  border: 0;
  border-bottom: 1px solid rgba(223, 213, 197, 0.88);
  border-radius: 0;
  background: rgba(255, 251, 242, 0.94);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.brand-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 48%, #fff9df 0 46%, transparent 47%),
    conic-gradient(from 220deg, #3fc1dc, var(--sky), var(--gold), #3fc1dc);
  border: 3px solid #fff;
  box-shadow: 0 8px 16px rgba(33, 73, 93, 0.16);
}

.brand-mark img {
  width: 112%;
  height: 112%;
  object-fit: contain;
}

.brand-title {
  display: block;
  color: #0c2c55;
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.02;
}

.brand-subtitle {
  display: block;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 900;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-chip {
  display: grid;
  min-width: 94px;
  gap: 0;
  padding: 8px 12px;
  border: 1px solid rgba(29, 119, 107, 0.2);
  border-radius: var(--radius);
  background: #ecfaf5;
  text-align: center;
}

.status-chip.recovery {
  border-color: rgba(251, 122, 92, 0.25);
  background: #fff0e8;
}

.status-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-chip strong {
  color: #17384f;
  font-size: 1.35rem;
  line-height: 1;
}

.main-area {
  max-width: 1440px;
  margin: 0 auto;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.08fr) minmax(340px, 0.92fr);
  gap: 20px;
  align-items: start;
}

.map-panel,
.panel,
.problem-card,
.answer-card,
.mission-card,
.parent-hero {
  border: 1px solid rgba(223, 213, 197, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--soft-shadow);
}

.map-panel {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 18px 46px rgba(46, 75, 78, 0.18),
    inset 0 0 0 1px rgba(77, 188, 196, 0.22);
}

.map-heading,
.panel-title-row,
.canvas-toolbar,
.parent-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.map-heading {
  position: absolute;
  top: 24px;
  left: 28px;
  right: 22px;
  z-index: 12;
  display: block;
}

.map-heading > div {
  max-width: min(760px, calc(100% - 220px));
}

.map-heading .primary-button {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 168px;
  white-space: nowrap;
}

.eyebrow {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 4px 16px;
  border-radius: 4px;
  color: #7b4a18;
  background:
    linear-gradient(90deg, rgba(122, 74, 24, 0.16), transparent 16%, transparent 84%, rgba(122, 74, 24, 0.16)),
    #f1d69b;
  box-shadow: 0 4px 0 rgba(122, 74, 24, 0.12);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.quest-title {
  position: relative;
  display: inline-grid;
  justify-items: center;
  margin-top: 8px;
  padding: 0 13px 10px;
}

.parent-hero h1 {
  color: #0b2e5d;
  font-size: clamp(2.25rem, 4.45vw, 3.85rem);
  line-height: 0.96;
  letter-spacing: 0;
  -webkit-text-stroke: 1.2px rgba(255, 255, 255, 0.92);
  paint-order: stroke fill;
  text-shadow:
    0 4px 0 rgba(72, 128, 181, 0.18),
    0 12px 22px rgba(23, 72, 121, 0.18);
}

.quest-title-board {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(340px, 100%);
  min-width: 286px;
  justify-items: center;
  padding: 9px 24px 13px;
  transform: rotate(-1.2deg);
  border: 3px solid rgba(255, 239, 181, 0.96);
  border-radius: 10px;
  background:
    radial-gradient(circle at 13% 18%, rgba(255, 255, 255, 0.7) 0 7px, transparent 8px),
    radial-gradient(circle at 87% 18%, rgba(255, 255, 255, 0.58) 0 7px, transparent 8px),
    linear-gradient(180deg, rgba(255, 250, 227, 0.9), rgba(244, 206, 126, 0.94)),
    linear-gradient(90deg, #c58439, #f4ca6a 18%, #fff0b5 50%, #e2a74d 82%, #a86f32);
  box-shadow:
    inset 0 0 0 2px rgba(132, 82, 27, 0.13),
    0 5px 0 rgba(128, 85, 36, 0.32),
    0 13px 22px rgba(31, 89, 112, 0.2);
}

.quest-title-board::before,
.quest-title-board::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(122, 74, 24, 0.34);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 31%, #fff5c7 0 22%, #e6a84a 24% 62%, #98662b 64%);
  box-shadow: 0 2px 0 rgba(122, 74, 24, 0.18);
}

.quest-title-board::before {
  left: 13px;
}

.quest-title-board::after {
  right: 13px;
}

.quest-title-kicker {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 10px 1px;
  border-radius: 999px;
  color: #825018;
  background: rgba(255, 253, 236, 0.62);
  box-shadow: inset 0 0 0 1px rgba(138, 84, 28, 0.12);
  font-size: clamp(0.82rem, 1.05vw, 0.96rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: normal;
  white-space: nowrap;
}

.quest-title-main {
  margin: 0;
  overflow-wrap: normal;
  color: #092b58;
  font-size: clamp(2.15rem, 3.6vw, 3.1rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.9;
  -webkit-text-stroke: 0.55px rgba(255, 255, 255, 0.82);
  paint-order: stroke fill;
  text-shadow:
    0 2px 0 rgba(255, 253, 236, 0.9),
    0 5px 0 rgba(82, 130, 166, 0.2),
    0 10px 15px rgba(17, 57, 98, 0.14);
  white-space: nowrap;
  word-break: keep-all;
}

.quest-title-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  margin-top: -7px;
  padding: 4px 18px 5px;
  transform: rotate(-1.2deg);
  border: 2px solid rgba(255, 246, 190, 0.96);
  border-radius: 999px;
  color: #704313;
  background: linear-gradient(180deg, #fff0a8 0%, #f4c24a 58%, #d78d2e 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 4px 0 rgba(137, 85, 27, 0.24),
    0 8px 14px rgba(137, 85, 27, 0.16);
  font-size: clamp(0.9rem, 1.15vw, 1.04rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: normal;
  white-space: nowrap;
}

.quest-title-badge::before,
.quest-title-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 24px;
  transform: translateY(-50%);
  background: #d89934;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.quest-title-badge::before {
  left: -13px;
  transform: translateY(-50%) rotate(180deg);
}

.quest-title-badge::after {
  right: -13px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(180deg, #35b879, #137f65);
  box-shadow:
    0 8px 0 rgba(10, 88, 69, 0.38),
    0 14px 24px rgba(29, 119, 107, 0.22);
}

.secondary-button {
  padding: 0 16px;
  border-color: rgba(36, 180, 178, 0.32);
  color: #116b66;
  background: #eefdf7;
  box-shadow: 0 6px 0 rgba(21, 139, 132, 0.13);
}

.ghost-button {
  padding: 0 14px;
  border-color: rgba(36, 49, 47, 0.14);
  background: rgba(255, 255, 255, 0.52);
}

.icon-button {
  display: grid;
  min-width: 44px;
  padding: 0 10px;
  place-items: center;
  border-color: rgba(36, 49, 47, 0.14);
  background: #fff8e2;
}

.icon-button.is-active {
  color: #fff;
  background: var(--teal);
}

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.ghost-button:not(:disabled):active,
.icon-button:not(:disabled):active,
.stage-node:not(.is-locked):active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.52;
}

.adventure-map {
  position: relative;
  min-height: 720px;
  margin-top: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04)),
    url("./assets/island-map.png") center / cover no-repeat,
    linear-gradient(135deg, #b8ecff, #f7e9b7 54%, #98d9be);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.adventure-map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 26%),
    radial-gradient(circle at 13% 67%, rgba(255, 255, 208, 0.55), transparent 17%),
    radial-gradient(circle at 78% 33%, rgba(255, 236, 105, 0.5), transparent 13%);
}

.map-path {
  position: absolute;
  inset: 10% 4% 8%;
  z-index: 3;
  width: 92%;
  height: 82%;
  fill: none;
}

.map-path path {
  stroke: rgba(119, 72, 34, 0.72);
  stroke-width: 26;
  stroke-linecap: round;
  stroke-dasharray: 2 42;
}

.map-decoration {
  position: absolute;
  z-index: 3;
  display: block;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 9px 0 rgba(94, 74, 38, 0.12)) drop-shadow(0 14px 22px rgba(36, 49, 47, 0.16));
}

.map-decoration.ship {
  left: 2%;
  top: 17%;
  width: clamp(68px, 8vw, 108px);
  transform: rotate(-5deg);
}

.map-decoration.chest {
  left: 30%;
  top: 62%;
  z-index: 5;
  width: clamp(66px, 6.8vw, 102px);
  transform: rotate(-4deg);
}

.map-decoration.bird {
  right: 8%;
  top: 54%;
  width: clamp(72px, 8vw, 122px);
  transform: rotate(8deg);
}

.stage-node {
  position: absolute;
  z-index: 4;
  display: grid;
  width: clamp(126px, 13vw, 166px);
  min-height: 154px;
  padding: 12px;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #fff5d7);
  box-shadow:
    0 10px 0 rgba(145, 99, 40, 0.2),
    0 18px 32px rgba(38, 92, 96, 0.26);
}

.stage-node strong {
  font-size: 1.08rem;
  color: #6b4c11;
}

.stage-node small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.stage-glyph {
  display: block;
  width: 104px;
  height: 104px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stage-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 7px 0 rgba(94, 74, 38, 0.16));
}

.stage-node.boss {
  color: #fff;
  border-color: #fff1ae;
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 228, 111, 0.18), transparent 34%),
    linear-gradient(180deg, #b763df 0%, #6d49ba 56%, #3f2b84 100%);
  box-shadow:
    0 10px 0 rgba(82, 45, 125, 0.3),
    0 0 0 6px rgba(255, 236, 105, 0.34),
    0 18px 34px rgba(82, 45, 125, 0.32);
}

.stage-node.boss strong {
  color: #fff2c4;
  text-shadow:
    0 2px 0 rgba(53, 32, 111, 0.62),
    0 0 12px rgba(255, 220, 94, 0.34);
}

.stage-node.boss small {
  color: #ffffff;
  text-shadow:
    0 2px 0 rgba(53, 32, 111, 0.56),
    0 0 10px rgba(255, 255, 255, 0.18);
}

.stage-node.boss .stage-glyph {
  width: 118px;
  height: 118px;
}

.stage-node.boss.is-boss-ready {
  box-shadow:
    0 10px 0 rgba(82, 45, 125, 0.3),
    0 0 0 6px rgba(255, 236, 105, 0.28),
    0 0 26px rgba(255, 224, 98, 0.32),
    0 18px 34px rgba(82, 45, 125, 0.32);
}

.stage-node.is-locked {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.stage-node.is-next {
  animation: stageGlow 1.8s ease-in-out infinite;
}

.stage-node.event {
  border-color: #fff0a8;
  background: linear-gradient(180deg, #fff9df, #ffe1a8);
  box-shadow:
    0 10px 0 rgba(166, 99, 37, 0.24),
    0 0 0 7px rgba(255, 238, 114, 0.28),
    0 18px 34px rgba(75, 97, 96, 0.26);
}

.stage-node.event .stage-glyph {
  width: 88px;
  height: 88px;
}

@keyframes stageGlow {
  0%,
  100% {
    box-shadow:
      0 10px 0 rgba(145, 99, 40, 0.2),
      0 18px 32px rgba(38, 92, 96, 0.26),
      0 0 0 0 rgba(255, 232, 91, 0.58);
  }
  50% {
    box-shadow:
      0 10px 0 rgba(145, 99, 40, 0.2),
      0 18px 32px rgba(38, 92, 96, 0.26),
      0 0 0 10px rgba(255, 232, 91, 0.24);
  }
}

.map-area {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 9px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 253, 238, 0.86);
  box-shadow: 0 6px 12px rgba(54, 78, 64, 0.12);
  color: #5c4518;
  font-size: 0.78rem;
  font-weight: 900;
  pointer-events: none;
}

.map-area.is-locked {
  opacity: 0.36;
  filter: grayscale(0.45);
}

.map-area.is-unlocked {
  background: linear-gradient(180deg, #fff7c8, #f3c95d);
}

.route-step {
  position: absolute;
  z-index: 4;
  display: block;
  width: clamp(18px, 2.6vw, 30px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.76) 0 18%, transparent 20%),
    linear-gradient(180deg, #f7d89b, #b98748);
  box-shadow:
    0 5px 0 rgba(101, 69, 35, 0.18),
    0 9px 16px rgba(45, 73, 66, 0.16);
  pointer-events: none;
}

.route-step.is-locked {
  opacity: 0.22;
  filter: grayscale(0.45);
}

.route-step.is-cleared {
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.76) 0 18%, transparent 20%),
    linear-gradient(180deg, #e6f5d0, #82ae58);
}

.route-step.is-current {
  border-color: #fff7be;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.82) 0 18%, transparent 20%),
    linear-gradient(180deg, #ffe998, #e0a63a);
  box-shadow:
    0 5px 0 rgba(112, 72, 27, 0.2),
    0 0 0 5px rgba(255, 237, 113, 0.25),
    0 10px 18px rgba(45, 73, 66, 0.16);
}

.route-step.is-next {
  border-color: #fffbe0;
  animation: routeStepGlow 1.65s ease-in-out infinite;
}

@keyframes routeStepGlow {
  0%,
  100% {
    box-shadow:
      0 5px 0 rgba(112, 72, 27, 0.18),
      0 0 0 3px rgba(255, 237, 113, 0.32),
      0 9px 16px rgba(45, 73, 66, 0.16);
  }
  50% {
    box-shadow:
      0 5px 0 rgba(112, 72, 27, 0.18),
      0 0 0 10px rgba(255, 237, 113, 0.2),
      0 9px 16px rgba(45, 73, 66, 0.16);
  }
}

.map-landmark {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.map-landmark.river {
  right: -7%;
  bottom: 3%;
  width: 36%;
  height: 28%;
  border-radius: 50% 0 0 0;
  background: rgba(114, 166, 217, 0.52);
  transform: rotate(-10deg);
}

.map-landmark.tower {
  right: 13%;
  top: 5%;
  width: 72px;
  height: 118px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #d9bd8c, #a97f58);
  box-shadow: inset 0 -20px rgba(0, 0, 0, 0.08);
}

.map-landmark.tower::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -38px;
  width: 92px;
  height: 52px;
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: var(--coral);
}

.map-landmark.camp {
  left: 9%;
  bottom: 13%;
  width: 92px;
  height: 64px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #e8a457;
}

.map-companion {
  position: absolute;
  z-index: 6;
  display: flex;
  max-width: min(360px, 72%);
  align-items: center;
  gap: 10px;
  --route-x: -18%;
  --route-y: -52%;
  transform: translate(var(--route-x), var(--route-y));
}

.map-companion.is-east {
  --route-x: -84%;
  flex-direction: row-reverse;
}

.map-companion.is-mid {
  --route-x: -58%;
  --route-y: -52%;
  max-width: min(300px, 76%);
}

.map-companion.is-mid .companion-speech {
  flex: 0 1 170px;
  min-width: min(150px, 44vw);
  max-width: 170px;
}

.map-companion.is-moving {
  animation: routeCompanionMove 950ms cubic-bezier(0.2, 0.86, 0.2, 1) both;
}

@keyframes routeCompanionMove {
  0% {
    left: var(--from-left);
    top: var(--from-top);
    transform: translate(var(--route-x), var(--route-y)) scale(0.96);
  }
  48% {
    transform: translate(var(--route-x), calc(var(--route-y) - 12px)) scale(1.03);
  }
  100% {
    left: var(--to-left);
    top: var(--to-top);
    transform: translate(var(--route-x), var(--route-y)) scale(1);
  }
}

.companion-speech,
.practice-companion,
.companion-card-mini,
.companion-parent-body {
  border: 1px solid rgba(36, 49, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--soft-shadow);
}

.companion-speech {
  display: grid;
  flex: 0 1 250px;
  gap: 2px;
  min-width: min(190px, 52vw);
  max-width: 250px;
  padding: 10px 12px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.companion-speech span,
.companion-card-mini span,
.companion-parent-body span,
.practice-companion span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.companion-avatar {
  position: relative;
  display: grid;
  width: 132px;
  height: 142px;
  flex: 0 0 auto;
  place-items: center;
  --lumi-scale: 1;
}

.companion-avatar.brand {
  width: 54px;
  height: 58px;
}

.companion-avatar.mini {
  width: 74px;
  height: 82px;
}

.companion-avatar.practice {
  width: 68px;
  height: 72px;
}

.companion-avatar.parent {
  width: 86px;
  height: 94px;
}

.companion-shadow {
  position: absolute;
  left: 22%;
  right: 18%;
  bottom: 3%;
  height: 15%;
  border-radius: 50%;
  background: rgba(36, 49, 47, 0.18);
  filter: blur(1px);
  animation: lumiShadow 4.2s ease-in-out infinite;
}

.companion-motion {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  transform-origin: 50% 90%;
  animation: lumiIdle 4.2s ease-in-out infinite;
}

.companion-stage-shell {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  transform: scale(var(--lumi-scale));
  transform-origin: 50% 88%;
}

.companion-fox-sprite {
  position: relative;
  z-index: 2;
  width: 132%;
  height: 132%;
  object-fit: contain;
  object-position: center bottom;
  transform-origin: 50% 88%;
  filter: drop-shadow(0 10px 12px rgba(52, 65, 45, 0.18));
}

.brand-mark img {
  transform: translateY(6%) scale(1.1);
}

.companion-avatar.stage-2 {
  --lumi-scale: 1.04;
}

.companion-avatar.stage-3 {
  --lumi-scale: 1.09;
}

.companion-avatar.stage-4,
.companion-avatar.stage-5 {
  --lumi-scale: 1.14;
}

.companion-avatar.form-lake .companion-fox-sprite {
  filter: drop-shadow(0 10px 12px rgba(52, 65, 45, 0.18)) hue-rotate(22deg) saturate(1.04);
}

.companion-avatar.form-tower .companion-fox-sprite,
.companion-avatar.form-crystal .companion-fox-sprite {
  filter: drop-shadow(0 10px 12px rgba(52, 65, 45, 0.18)) hue-rotate(320deg) saturate(1.08);
}

.companion-avatar.form-snow .companion-fox-sprite,
.companion-avatar.form-winter .companion-fox-sprite {
  filter: drop-shadow(0 10px 12px rgba(52, 65, 45, 0.18)) saturate(0.88) brightness(1.06);
}

.companion-item-badge {
  position: absolute;
  z-index: 4;
  display: block;
  width: 24%;
  aspect-ratio: 1;
  border: 3px solid #fff8d8;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff5b8, #d99433);
  box-shadow: 0 5px 10px rgba(67, 49, 25, 0.18);
}

.companion-item-badge.compass {
  right: -2%;
  top: 27%;
}

.companion-item-badge.compass::before {
  content: "";
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  border: 2px solid #217e8a;
}

.companion-item-badge.crown {
  left: 37%;
  top: -5%;
  height: 20%;
  border-radius: 6px 6px 50% 50%;
  clip-path: polygon(50% 0, 63% 38%, 100% 25%, 78% 100%, 22% 100%, 0 25%, 37% 38%);
}

.companion-item-badge.lantern {
  left: -1%;
  bottom: 18%;
  border-radius: 8px;
  background: linear-gradient(180deg, #e8fff7, #45b79f);
}

.companion-equip {
  position: absolute;
  z-index: 4;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 4px 5px rgba(49, 43, 30, 0.2));
  animation: companionEquipPop 620ms cubic-bezier(0.2, 1.4, 0.42, 1) both;
}

.companion-equip.cloak {
  z-index: 1;
  left: 19%;
  top: 43%;
  width: 68%;
  height: 46%;
  transform: rotate(5deg);
  border-radius: 44% 12% 52% 38%;
  background:
    radial-gradient(circle at 68% 26%, rgba(255, 237, 137, 0.48) 0 5%, transparent 6%),
    linear-gradient(135deg, rgba(41, 84, 141, 0.9), rgba(78, 140, 154, 0.78));
  clip-path: polygon(22% 0, 100% 12%, 78% 100%, 0 78%);
}

.companion-equip.scarf {
  left: 31%;
  top: 58%;
  width: 42%;
  height: 11%;
  transform: rotate(2deg);
  border: 2px solid rgba(255, 249, 210, 0.88);
  border-radius: 999px 999px 50% 50%;
  background:
    radial-gradient(circle at 25% 42%, #ffe870 0 7%, transparent 8%),
    radial-gradient(circle at 48% 37%, #ffe870 0 6%, transparent 7%),
    linear-gradient(135deg, #1c8075, #2aa38f);
}

.companion-equip.scarf::after {
  content: "";
  position: absolute;
  right: -20%;
  bottom: -52%;
  width: 34%;
  height: 68%;
  transform: rotate(-22deg);
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, #2aa38f, #145f56);
}

.companion-equip.spyglass {
  right: 1%;
  top: 57%;
  width: 34%;
  height: 10%;
  transform: rotate(-12deg);
  border-radius: 999px;
  background:
    radial-gradient(circle at 88% 50%, #51d7e5 0 16%, #185b78 18% 28%, transparent 30%),
    linear-gradient(90deg, #8a5524 0 18%, #efb44e 19% 42%, #8a5524 43% 58%, #efb44e 59% 100%);
  border: 2px solid #6b3f1f;
}

.companion-equip.compass {
  left: 45%;
  bottom: 13%;
  width: 20%;
  aspect-ratio: 1;
  border: 3px solid #fff4c2;
  border-radius: 50%;
  background:
    conic-gradient(from 35deg, #d94735 0 10%, #fff7ca 10% 25%, #206a88 25% 38%, #fff7ca 38% 100%),
    #e3a843;
  box-shadow: inset 0 0 0 3px #c27b2e;
}

.companion-equip.pin {
  left: 46%;
  top: 24%;
  width: 18%;
  aspect-ratio: 1;
  border: 3px solid #fff4bd;
  border-radius: 50%;
  background:
    radial-gradient(circle, #42d0d6 0 28%, transparent 30%),
    conic-gradient(from 18deg, #f4ce4f, #fff3a8, #d99228, #f4ce4f);
}

.companion-equip.lantern {
  left: 4%;
  bottom: 18%;
  width: 22%;
  aspect-ratio: 0.82;
  border: 3px solid #654321;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 54%, rgba(255, 255, 206, 0.92) 0 26%, transparent 28%),
    linear-gradient(180deg, #52bca8, #1f7f75);
}

.companion-equip.lantern::before {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  top: -22%;
  height: 26%;
  border: 3px solid #654321;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.companion-body {
  position: relative;
  display: block;
  width: 72%;
  height: 78%;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 45% 45% 38% 38%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95) 0 8%, transparent 9%),
    linear-gradient(160deg, #ffe18a, #f7a75f);
  box-shadow:
    inset -12px -12px 0 rgba(0, 0, 0, 0.08),
    var(--shadow);
}

.companion-avatar.stage-2 .companion-body {
  width: 76%;
  height: 82%;
}

.companion-avatar.stage-3 .companion-body {
  width: 80%;
  height: 84%;
}

.companion-avatar.stage-4 .companion-body,
.companion-avatar.stage-5 .companion-body {
  width: 84%;
  height: 86%;
}

.companion-face {
  position: absolute;
  left: 19%;
  top: 22%;
  width: 62%;
  height: 42%;
  border-radius: 46%;
  background: rgba(255, 253, 248, 0.84);
}

.companion-eye {
  position: absolute;
  top: 36%;
  width: 10%;
  height: 14%;
  border-radius: 50%;
  background: #24312f;
}

.companion-eye.left {
  left: 27%;
}

.companion-eye.right {
  right: 27%;
}

.companion-smile {
  position: absolute;
  left: 36%;
  bottom: 23%;
  width: 28%;
  height: 15%;
  border-bottom: 3px solid #24312f;
  border-radius: 50%;
}

.companion-cloak {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -7%;
  height: 35%;
  border-radius: 12px 12px 42% 42%;
  background: linear-gradient(135deg, var(--teal), #49a890);
  box-shadow: inset -8px -7px rgba(0, 0, 0, 0.1);
}

.companion-avatar.form-lake .companion-cloak {
  background: linear-gradient(135deg, var(--sky), #5cc8c2);
}

.companion-avatar.form-tower .companion-cloak {
  background: linear-gradient(135deg, #8a7cc8, #d7a85f);
}

.companion-avatar.form-beach .companion-cloak,
.companion-avatar.form-summer .companion-cloak {
  background: linear-gradient(135deg, #f5c85b, #fb7a5c);
}

.companion-avatar.form-book .companion-cloak,
.companion-avatar.form-crystal .companion-cloak {
  background: linear-gradient(135deg, #7b6fb6, #72a6d9);
}

.companion-avatar.form-snow .companion-cloak,
.companion-avatar.form-winter .companion-cloak {
  background: linear-gradient(135deg, #d9f2ff, #72a6d9);
}

.companion-avatar.form-star .companion-cloak,
.companion-avatar.form-moon .companion-cloak {
  background: linear-gradient(135deg, #405a9c, #f5c85b);
}

.companion-gear {
  position: absolute;
  z-index: 3;
  display: block;
  border: 3px solid #24312f;
  background: #fffdf8;
}

.math-gear {
  right: -7%;
  top: 34%;
  width: 28%;
  height: 12%;
  transform: rotate(-28deg);
  border-radius: 999px;
}

.word-gear {
  left: -8%;
  bottom: 20%;
  width: 26%;
  height: 24%;
  border-radius: 5px;
  box-shadow: inset 6px 0 0 #f5c85b;
}

.boss-gear {
  left: 50%;
  top: -11%;
  width: 34%;
  height: 22%;
  transform: translateX(-50%);
  border-radius: 50% 50% 8px 8px;
  background: linear-gradient(180deg, #fff2a3, #f5c85b);
  clip-path: polygon(50% 0, 63% 38%, 100% 26%, 78% 100%, 22% 100%, 0 26%, 37% 38%);
}

.companion-avatar.boss-ready .companion-spark {
  background: #ffe66f;
  box-shadow: 0 0 0 4px rgba(255, 246, 190, 0.7), 0 0 18px rgba(245, 200, 91, 0.8);
}

.companion-spark {
  position: absolute;
  z-index: 4;
  display: block;
  width: 12%;
  aspect-ratio: 1;
  transform: rotate(45deg);
  border-radius: 3px;
  background: #fff4a3;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.65);
  animation: lumiSparkle 1.8s ease-in-out infinite;
}

.companion-spark.one {
  right: 8%;
  top: 13%;
}

.companion-spark.two {
  left: 8%;
  top: 21%;
  width: 8%;
  background: #ccefdc;
  animation-delay: 0.45s;
}

.companion-avatar.mood-proud .companion-motion {
  animation:
    lumiProud 900ms ease-out both,
    lumiIdle 4.2s ease-in-out 900ms infinite;
}

.companion-avatar.mood-retry .companion-motion {
  animation: lumiRetry 2.8s ease-in-out infinite;
}

.companion-avatar.mood-boss .companion-motion {
  animation:
    lumiBoss 1.8s ease-in-out infinite,
    lumiIdle 4.2s ease-in-out infinite;
}

.companion-avatar.mood-boss .companion-stage-shell {
  filter: drop-shadow(0 0 14px rgba(255, 227, 102, 0.42));
}

.companion-avatar.mood-retry .companion-cloak {
  background: linear-gradient(135deg, #7aa95c, #f5c85b);
}

.companion-avatar.mood-retry .companion-fox-sprite {
  filter: drop-shadow(0 10px 12px rgba(52, 65, 45, 0.18)) saturate(0.96);
}

@keyframes lumiIdle {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  45% {
    transform: translateY(-4px) rotate(-0.7deg) scale(1.015);
  }
  72% {
    transform: translateY(-1px) rotate(0.45deg) scale(1.006);
  }
}

@keyframes lumiShadow {
  0%,
  100% {
    transform: scaleX(1);
    opacity: 0.95;
  }
  45% {
    transform: scaleX(0.86);
    opacity: 0.72;
  }
}

@keyframes lumiProud {
  0% {
    transform: translateY(0) scale(1);
  }
  34% {
    transform: translateY(-13px) scale(1.04);
  }
  62% {
    transform: translateY(2px) scale(0.985);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes lumiRetry {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }
  35% {
    transform: translateX(-2px) rotate(-1.5deg);
  }
  70% {
    transform: translateX(2px) rotate(1deg);
  }
}

@keyframes lumiBoss {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 227, 102, 0));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(255, 227, 102, 0.55));
  }
}

@keyframes lumiSparkle {
  0%,
  100% {
    transform: rotate(45deg) scale(0.86);
    opacity: 0.72;
  }
  48% {
    transform: rotate(45deg) scale(1.18);
    opacity: 1;
  }
}

@keyframes companionEquipPop {
  0% {
    opacity: 0;
    filter: drop-shadow(0 4px 5px rgba(49, 43, 30, 0.2)) brightness(1.4);
  }
  100% {
    opacity: 1;
    filter: drop-shadow(0 4px 5px rgba(49, 43, 30, 0.2)) brightness(1);
  }
}

.side-stack,
.dashboard-grid {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.side-stack {
  gap: 18px;
}

.side-stack .panel {
  border: 3px solid rgba(255, 255, 255, 0.84);
  box-shadow: 0 14px 30px rgba(46, 75, 78, 0.14);
}

.panel.compact {
  padding: 14px;
}

.panel h2,
.answer-card h2,
.problem-card h2 {
  font-size: clamp(1rem, 2vw, 1.24rem);
  line-height: 1.28;
}

.mini-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #e7f6ed;
  font-size: 0.76rem;
  font-weight: 900;
}

.upload-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(227, 251, 255, 0.88), rgba(232, 255, 243, 0.94)),
    radial-gradient(circle at 7% 9%, rgba(122, 169, 92, 0.34), transparent 12rem);
}

.upload-panel::before {
  content: "";
  position: absolute;
  right: -22px;
  top: -16px;
  width: 118px;
  height: 88px;
  transform: rotate(-10deg);
  border-radius: 0 0 60px 60px;
  background:
    linear-gradient(90deg, #7aa95c 0 12px, transparent 13px),
    radial-gradient(ellipse at 50% 100%, #7aa95c 0 58%, transparent 60%);
  opacity: 0.9;
}

.upload-panel .panel-title-row {
  position: relative;
  z-index: 1;
}

.upload-panel h2,
.panel h2 {
  color: #0b3c55;
}

.upload-treasure {
  position: absolute;
  right: 8px;
  bottom: -3px;
  width: 86px;
  height: 86px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 0 rgba(126, 90, 38, 0.1));
}

.upload-panel .panel-note {
  position: relative;
  z-index: 1;
  padding-right: 74px;
}

.upload-drop {
  display: block;
  margin: 12px 0;
  cursor: pointer;
}

.upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.homework-preview,
.homework-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 3px dashed rgba(36, 180, 178, 0.5);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.84);
}

.homework-preview {
  display: block;
  object-fit: cover;
}

.homework-placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  color: #166b67;
  font-size: 1.05rem;
  font-weight: 900;
}

.homework-placeholder > * {
  display: block;
}

.placeholder-icon {
  width: min(34%, 132px);
  height: auto;
  filter: drop-shadow(0 9px 0 rgba(37, 184, 178, 0.14));
  object-fit: contain;
}

.upload-actions,
.practice-actions,
.tool-buttons,
.self-grade-buttons,
.review-controls,
.answer-mode-tabs {
  display: flex;
  gap: 8px;
}

.upload-actions > button,
.practice-actions > button {
  flex: 1;
}

.panel-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.course-panel,
.homework-review-card,
.paper-answer-panel,
.ai-answer-panel,
.ai-confirm-card,
.weekly-report-panel {
  display: grid;
  gap: 12px;
}

.course-grid {
  display: grid;
  gap: 9px;
}

.course-option {
  display: grid;
  gap: 3px;
  min-height: 82px;
  padding: 12px;
  border: 2px solid rgba(29, 119, 107, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.88);
  text-align: left;
  box-shadow: 0 5px 0 rgba(36, 49, 47, 0.08);
}

.course-option.is-recommended {
  border-color: rgba(245, 200, 91, 0.75);
  background: #fff7d7;
}

.course-option span,
.course-option small,
.paper-note span,
.weekly-lines span {
  color: var(--muted);
  font-weight: 800;
}

.homework-review-card {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(36, 180, 178, 0.32);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
}

.review-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.review-stats span,
.paper-note,
.answer-reveal,
.ai-confirm-card,
.weekly-lines p {
  padding: 10px;
  border-radius: var(--radius);
  background: #f7f2e8;
}

.review-stats strong,
.answer-reveal strong {
  display: block;
  color: #0b3c55;
  font-size: 1.2rem;
}

.review-warning {
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #774412;
  background: #fff2bd;
  font-size: 0.88rem;
  font-weight: 900;
}

.review-controls button,
.answer-mode-tabs button,
.self-grade-buttons button {
  flex: 1;
  min-height: 38px;
  border: 1px solid rgba(36, 49, 47, 0.13);
  border-radius: var(--radius);
  background: #fffdf8;
  font-weight: 900;
}

.review-controls button.is-active,
.answer-mode-tabs button.is-active,
.self-grade-buttons button.is-active {
  color: #fff;
  background: var(--teal);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 900;
}

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

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

.skill-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px 2px;
}

.skill-row span:last-child {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.subject-dot {
  display: grid;
  width: 42px;
  height: 42px;
  margin-top: 1px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.subject-dot img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 5px 0 rgba(42, 68, 69, 0.08));
}

.subject-dot.math,
.subject-pill.math {
  background: #e9f6ff;
  color: #225c91;
}

.subject-dot.math {
  background: transparent;
}

.subject-dot.japanese,
.subject-pill.japanese {
  background: #fff0ea;
  color: #9c432f;
}

.subject-dot.japanese {
  background: transparent;
}

.skill-progress {
  display: block;
  height: 9px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e2d4;
}

.skill-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--violet));
}

.reward-title {
  display: block;
  font-size: 1.25rem;
}

.companion-card-mini,
.companion-parent-body,
.practice-companion {
  display: flex;
  align-items: center;
  gap: 10px;
}

.companion-card-mini {
  margin-top: 12px;
  padding: 10px;
}

.xp-track {
  height: 11px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ddcf;
}

.xp-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--leaf), var(--gold));
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge-row span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff2bd;
  font-size: 0.82rem;
  font-weight: 900;
}

.story-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.story-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(29, 42, 40, 0.26);
  backdrop-filter: blur(4px);
}

.story-modal {
  width: min(520px, 100%);
  border: 4px solid rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  background:
    radial-gradient(circle at 84% 12%, rgba(255, 229, 112, 0.34), transparent 28%),
    linear-gradient(180deg, #fffdf8, #fff2d1);
  box-shadow: 0 28px 70px rgba(34, 49, 47, 0.28);
  padding: 18px;
}

.story-modal-tag,
.coin-wallet {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  color: #765019;
  background: #fff1b8;
  font-size: 0.82rem;
  font-weight: 900;
}

.story-modal-body {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0 18px;
}

.story-modal h2 {
  color: #0b2e5d;
  font-size: clamp(1.55rem, 4vw, 2.2rem);
  line-height: 1.08;
}

.story-modal p,
.story-modal small {
  color: var(--muted);
  font-weight: 800;
}

.story-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.reward-modal {
  display: grid;
  justify-items: center;
  text-align: center;
}

.reward-chest {
  width: 128px;
  margin: 4px auto 8px;
  animation: chestPop 520ms ease-out both;
}

.reward-chest img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 14px rgba(77, 56, 30, 0.18));
}

.reward-gains {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}

.reward-gains span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e9fbf3;
  color: #116b66;
  font-weight: 900;
}

@keyframes chestPop {
  0% {
    transform: translateY(10px) scale(0.9);
    opacity: 0;
  }
  70% {
    transform: translateY(-5px) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.story-page {
  display: grid;
  gap: 18px;
}

.story-page-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(223, 213, 197, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--soft-shadow);
}

.story-page-hero h1 {
  color: #0b2e5d;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 1;
}

.story-page-hero p {
  color: var(--muted);
  font-weight: 800;
}

.coin-wallet {
  min-height: 48px;
  gap: 8px;
  background: #e9fbf3;
  color: #116b66;
}

.coin-wallet strong {
  font-size: 1.65rem;
}

.story-page-grid,
.album-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.shop-companion-panel,
.album-companion-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shop-grid {
  display: grid;
  gap: 12px;
}

.shop-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(223, 213, 197, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--soft-shadow);
}

.shop-item h2 {
  font-size: 1.12rem;
}

.shop-item p {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.shop-item-icon {
  display: grid;
  width: 60px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 16px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(145deg, #fff0a8, #e0a03c);
  box-shadow: inset -8px -8px 0 rgba(117, 76, 21, 0.1);
}

.shop-item-icon::before {
  content: "";
  display: block;
  width: 48%;
  aspect-ratio: 1;
  border: 4px solid #1d776b;
  border-radius: 50%;
}

.shop-item-icon.slot-cloak::before,
.shop-item-icon.slot-neck::before {
  border-radius: 12px 12px 50% 50%;
}

.shop-item-icon.slot-lamp::before {
  border-radius: 8px;
  background: #74d5c3;
}

.shop-item-icon.slot-badge::before {
  border-radius: 6px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.secondary-button.is-active {
  color: #fff;
  background: var(--teal);
}

.album-layout .wide {
  grid-column: 1 / -1;
}

.fragment-grid,
.area-list,
.chapter-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.fragment-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.fragment-grid span,
.area-list span,
.chapter-list article {
  padding: 12px;
  border-radius: var(--radius);
  background: #fff7d9;
  font-weight: 900;
}

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

.area-list .is-locked {
  color: var(--muted);
  background: #eee6d8;
}

.chapter-list article {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.chapter-list span {
  color: var(--muted);
  font-size: 0.88rem;
}

.practice-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mission-rail {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 12px;
}

.back-button {
  width: 100%;
}

.mission-card {
  padding: 16px;
}

.mission-card h1 {
  font-size: 1.4rem;
  line-height: 1.1;
}

.progress-track,
.boss-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ddcf;
}

.progress-track {
  margin: 14px 0 8px;
}

.progress-track span,
.boss-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--leaf), var(--gold), var(--coral));
}

.problem-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.problem-dots button {
  min-height: 42px;
  border: 1px solid rgba(36, 49, 47, 0.12);
  border-radius: var(--radius);
  background: var(--paper);
  font-weight: 900;
}

.problem-dots button.is-current {
  color: #fff;
  background: var(--teal);
}

.problem-dots button.correct {
  background: #dff3dc;
}

.problem-dots button.wrong {
  background: #ffe0d8;
}

.problem-dots button.partial {
  background: #fff2bd;
}

.problem-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.problem-card,
.answer-card {
  padding: clamp(16px, 2vw, 22px);
}

.problem-card h2 {
  margin-top: 14px;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}

.problem-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.subject-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.problem-context {
  margin-top: 14px;
  padding: 14px;
  border-left: 5px solid var(--gold);
  border-radius: var(--radius);
  background: #fff8df;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
}

.visual-card {
  display: block;
  width: 100%;
  max-height: 280px;
  margin-top: 18px;
  border: 1px solid rgba(36, 49, 47, 0.1);
  border-radius: var(--radius);
  background: #fffaf0;
}

.fraction-visual {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 20px;
}

.fraction-visual span {
  min-height: 86px;
  border: 2px solid #caa870;
  background: #fffdf8;
}

.fraction-visual span.filled {
  background: var(--gold);
}

.geometry-visual line,
.geometry-visual path,
.graph-visual line,
.solid-visual polygon {
  stroke: #31443e;
  stroke-width: 7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.geometry-visual path {
  stroke: var(--coral);
  stroke-width: 5;
}

.geometry-visual text,
.graph-visual text,
.solid-visual text {
  fill: #31443e;
  font-size: 26px;
  font-weight: 900;
  text-anchor: middle;
}

.graph-visual rect {
  fill: #72a6d9;
  rx: 5;
}

.solid-visual polygon {
  fill: rgba(114, 166, 217, 0.2);
}

.numberline-visual {
  max-height: none;
  padding: 12px 8px 6px;
}

.numberline-visual .axis {
  stroke: #31443e;
  stroke-width: 4;
  stroke-linecap: round;
}

.numberline-visual .tick {
  stroke: #31443e;
  stroke-width: 3;
  stroke-linecap: round;
}

.numberline-visual .tick.major {
  stroke-width: 4;
}

.numberline-visual .axis-label {
  fill: #31443e;
  font-size: 22px;
  font-weight: 800;
  text-anchor: middle;
}

.numberline-visual .mark line {
  stroke: var(--coral, #e85a4f);
  stroke-width: 4;
  stroke-linecap: round;
}

.numberline-visual .mark polygon {
  fill: var(--coral, #e85a4f);
  stroke: none;
}

.numberline-visual .mark text {
  fill: #31443e;
  font-size: 24px;
  font-weight: 900;
  text-anchor: middle;
}

.numberline-visual .mark.blank rect {
  fill: #fff;
  stroke: var(--coral, #e85a4f);
  stroke-width: 3;
}

.numberline-visual .mark.value text {
  fill: #1f6f4a;
}

.hint-box {
  min-height: 0;
  margin-top: 14px;
  padding: 0;
  border-radius: var(--radius);
  color: #6b4c11;
  background: #fff4c8;
  font-weight: 800;
}

.hint-box.is-open {
  min-height: 48px;
  padding: 12px;
}

.answer-card {
  display: grid;
  gap: 12px;
}

.practice-companion {
  padding: 9px 10px;
  background: #fff8df;
}

.canvas-toolbar p {
  color: var(--muted);
  font-size: 0.86rem;
}

.answer-canvas {
  width: 100%;
  height: min(38vh, 420px);
  min-height: 260px;
  touch-action: none;
  border: 2px solid rgba(36, 49, 47, 0.16);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.typed-answer-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.typed-answer-label input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(36, 49, 47, 0.16);
  border-radius: var(--radius);
  background: #fff;
}

.paper-answer-panel,
.ai-answer-panel {
  align-content: start;
}

.paper-note {
  display: grid;
  gap: 3px;
  background: #eef8f2;
}

.answer-reveal {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(245, 200, 91, 0.5);
  background: #fff8df;
}

.answer-reveal span,
.self-grade-panel > span,
.ai-confirm-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.self-grade-panel {
  display: grid;
  gap: 7px;
}

.self-grade-buttons button.correct {
  background: #edf9e9;
}

.self-grade-buttons button.partial {
  background: #fff7d7;
}

.self-grade-buttons button.wrong {
  background: #fff0ea;
}

.self-grade-buttons button.is-active {
  color: #fff;
  background: var(--teal);
}

.ai-confirm-card {
  border: 1px solid rgba(245, 200, 91, 0.58);
  background: #fff7d7;
}

.result-box {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.result-box.correct {
  border-color: rgba(122, 169, 92, 0.35);
  background: #edf9e9;
}

.result-box.partial {
  border-color: rgba(245, 200, 91, 0.55);
  background: #fff7d7;
}

.result-box.wrong {
  border-color: rgba(251, 122, 92, 0.42);
  background: #fff0ea;
}

.result-box details {
  margin-top: 8px;
}

.weekly-lines {
  display: grid;
  gap: 8px;
}

.weekly-lines p {
  display: grid;
  gap: 4px;
  background: #f7fbf4;
}

.parent-layout {
  display: grid;
  gap: 16px;
}

.parent-hero {
  padding: clamp(16px, 3vw, 26px);
}

.parent-hero p {
  max-width: 720px;
  color: var(--muted);
}

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

.dashboard-grid .panel {
  min-height: 190px;
}

.dashboard-grid .wide {
  grid-column: span 2;
}

.stat-panel {
  display: grid;
  gap: 12px;
}

.stat-panel strong {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.retention-list {
  display: grid;
  gap: 8px;
}

.retention-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  background: #f7f2e8;
}

.companion-parent-panel {
  display: grid;
  gap: 12px;
}

.companion-parent-body {
  padding: 10px;
  background: #f7fbf4;
}

.companion-parent-body strong,
.companion-parent-body span {
  display: block;
}

.album-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.album-strip span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #fff2bd;
  color: #6b4c11;
  font-size: 0.78rem;
  font-weight: 900;
}

.weakness-table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.weakness-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 0.9fr) minmax(170px, 1.4fr) minmax(90px, 0.7fr) 42px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: #f8f3e8;
}

.weakness-row meter {
  width: 100%;
  height: 12px;
}

.safety-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.safety-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: #eef8f2;
}

.safety-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  display: grid;
  min-height: 52vh;
  place-items: center;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  right: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 30;
  display: none;
  width: min(94vw, 520px);
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  transform: translateX(50%);
  border: 1px solid rgba(223, 213, 197, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  display: grid;
  min-height: 56px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.bottom-nav button.is-active {
  color: #fff;
  background: var(--teal);
}

.nav-icon {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 3px solid currentColor;
}

.camera-icon {
  border-radius: 7px;
}

.chart-icon {
  border-radius: 50%;
}

@media (max-width: 1160px) {
  .map-layout,
  .practice-layout,
  .problem-workspace {
    grid-template-columns: 1fr;
  }

  .mission-rail {
    position: static;
  }

  .problem-dots {
    grid-template-columns: repeat(10, minmax(34px, 1fr));
  }

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

@media (max-width: 760px) {
  .app-shell {
    padding: 10px 10px 92px;
  }

  .topbar {
    top: 6px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-subtitle,
  .status-chip.recovery {
    display: none;
  }

  .topbar-status {
    gap: 6px;
  }

  .status-chip {
    min-width: 58px;
    padding: 5px 6px;
  }

  .map-heading,
  .parent-hero,
  .canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .map-heading {
    top: 18px;
    left: 18px;
    right: 16px;
  }

  .map-heading > div {
    max-width: calc(100% - 122px);
  }

  .map-heading .primary-button {
    min-width: 112px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .quest-title {
    margin-top: 6px;
    padding: 0 8px 8px;
  }

  .quest-title-board {
    width: min(230px, 100%);
    min-width: 0;
    padding: 7px 16px 10px;
  }

  .quest-title-board::before,
  .quest-title-board::after {
    top: 9px;
    width: 10px;
    height: 10px;
  }

  .quest-title-board::before {
    left: 9px;
  }

  .quest-title-board::after {
    right: 9px;
  }

  .quest-title-kicker {
    min-height: 18px;
    padding: 1px 8px;
    font-size: 0.76rem;
  }

  .quest-title-main {
    font-size: clamp(1.58rem, 7vw, 2rem);
    line-height: 0.92;
  }

  .quest-title-badge {
    min-height: 28px;
    margin-top: -6px;
    padding: 3px 12px 4px;
    font-size: 0.78rem;
  }

  .quest-title-badge::before,
  .quest-title-badge::after {
    width: 12px;
    height: 18px;
  }

  .quest-title-badge::before {
    left: -9px;
  }

  .quest-title-badge::after {
    right: -9px;
  }

  .map-panel {
    min-height: 0;
  }

  .adventure-map {
    min-height: 520px;
  }

  .map-decoration.ship {
    left: 3%;
    top: 20%;
    width: 56px;
  }

  .map-decoration.chest {
    left: 42%;
    top: 76%;
    width: 56px;
  }

  .map-decoration.bird {
    right: 3%;
    top: 48%;
    width: 66px;
  }

  .map-companion {
    left: 12%;
    top: 51%;
    max-width: 82%;
  }

  .companion-avatar.map {
    width: 104px;
    height: 112px;
  }

  .companion-speech {
    max-width: 190px;
    padding: 8px 9px;
  }

  .stage-node {
    width: 94px;
    min-height: 96px;
    padding: 8px;
  }

  .stage-glyph {
    width: 34px;
    height: 34px;
  }

  .stage-node.event .stage-glyph {
    width: 42px;
    height: 42px;
  }

  .map-area {
    min-height: 22px;
    padding: 2px 7px;
    font-size: 0.68rem;
  }

  .route-step {
    width: 18px;
    border-width: 2px;
  }

  .area-bridge {
    left: 28% !important;
    top: 58% !important;
  }

  .area-cave {
    left: 49% !important;
    top: 43% !important;
  }

  .area-lighthouse {
    left: 68% !important;
    top: 28% !important;
  }

  .area-port {
    left: 80% !important;
    top: 78% !important;
  }

  .story-overlay {
    align-items: end;
    padding: 12px;
  }

  .story-modal {
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 14px;
  }

  .story-modal-body,
  .shop-companion-panel,
  .album-companion-panel {
    align-items: flex-start;
  }

  .story-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .story-page-hero,
  .story-page-grid,
  .album-layout,
  .shop-item {
    grid-template-columns: 1fr;
  }

  .shop-item {
    align-items: stretch;
  }

  .shop-item-icon {
    width: 52px;
  }

  .album-layout .wide {
    grid-column: auto;
  }

  .area-list {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .dashboard-grid .wide,
  .safety-grid {
    grid-template-columns: 1fr;
  }

  .review-stats,
  .self-grade-buttons,
  .answer-mode-tabs,
  .review-controls {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .dashboard-grid .wide {
    grid-column: auto;
  }

  .weakness-row {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: grid;
  }

  .problem-dots {
    grid-template-columns: repeat(5, minmax(34px, 1fr));
  }

  .answer-canvas {
    min-height: 300px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .companion-motion,
  .companion-shadow,
  .companion-spark,
  .companion-equip,
  .map-companion.is-moving,
  .route-step.is-next,
  .stage-node.is-next,
  .reward-chest {
    animation: none !important;
  }
}
