:root {
  --bg-page: #dff7e6;
  --surface: #ffffff;
  --line: #d7e2ea;
  --ink: #0b4259;
  --ink-soft: #4c6775;
  --blue: #1ba9eb;
  --blue-strong: #1196d2;
  --blue-soft: #d8effd;
  --green: #89d86d;
  --green-dark: #5bbf47;
  --danger: #ff5f78;
  --shadow-soft: 0 10px 28px rgba(10, 57, 82, 0.15);
  --shadow-card: 0 8px 16px rgba(8, 73, 104, 0.09);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shell-height: min(900px, calc(100svh - 24px));
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family: "M PLUS Rounded 1c", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.7) 0, transparent 24%),
    radial-gradient(circle at 80% 90%, rgba(112, 215, 255, 0.3) 0, transparent 26%),
    linear-gradient(180deg, #f3f8ff 0%, var(--bg-page) 36%, #cdeef8 100%);
}

#app {
  width: 100%;
  height: 100svh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
  overflow: hidden;
}

.mobile-shell {
  width: 100%;
  max-width: 430px;
  height: var(--shell-height);
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.screen {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.top-safe {
  height: 10px;
}

.status-row {
  padding: 8px 16px 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.resource-pill {
  flex: 1;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 -2px 8px rgba(255, 255, 255, 0.5);
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
}

.resource-label {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  color: #3d5f6e;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.resource-label i {
  font-style: normal;
}

.plus-btn {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #27b8f8 0%, #0197da 100%);
  color: #fff;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  padding: 0;
  cursor: pointer;
}

.adventure-main {
  padding: 8px 16px 76px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.35) 0 18%, transparent 19%),
    radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.3) 0 20%, transparent 21%),
    linear-gradient(180deg, #8adf6f 0%, #8de36f 38%, #7bd85e 100%);
  min-height: 100%;
}

.stage-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.stage-progress {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid #e8f1f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stage-select {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid #e8f1f5;
  padding: 10px 12px 8px;
}

.stage-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-label {
  color: #184f67;
  font-size: 16px;
  font-weight: 800;
}

.stage-index {
  color: #5a7f90;
  font-family: "Nunito", sans-serif;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.stage-slider {
  width: 100%;
  margin: 0;
  accent-color: #1ba9eb;
  cursor: pointer;
}

.stage-slider-wrap {
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-step-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #27b8f8 0%, #0197da 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.stage-step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stage-slider-meta {
  display: flex;
  justify-content: space-between;
  color: #7f9aa7;
  font-size: 12px;
  font-weight: 700;
}

.stage-progress {
  min-height: 52px;
  padding: 0 16px;
}

.stage-progress-value {
  color: #2d6f86;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
}

.map-area {
  position: relative;
  border-radius: 20px;
  min-height: 585px;
  overflow: hidden;
}

.path-line {
  position: absolute;
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  width: 116px;
  height: 520px;
  border-radius: 60px;
  background: linear-gradient(180deg, #e6cf97 0%, #d7ba75 50%, #ccab62 100%);
  opacity: 0.92;
}

.path-dotline {
  position: absolute;
  width: 100%;
  left: 0;
  border-top: 4px dotted rgba(255, 255, 255, 0.8);
}

.path-dotline.top {
  top: 92px;
}

.path-dotline.mid {
  top: 350px;
}

.quest-node {
  position: absolute;
  left: 50%;
  width: 102px;
  height: 70px;
  transform: translateX(-50%);
  border: none;
  cursor: pointer;
  padding: 0;
  background: transparent;
}

.quest-node-core {
  width: 102px;
  height: 62px;
  border-radius: 999px;
  background: linear-gradient(180deg, #22b6f0 0%, #1499d5 100%);
  box-shadow: 0 8px 0 rgba(2, 106, 153, 0.25);
  border: 3px solid #1aa8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.quest-node.completed .quest-node-core {
  background: linear-gradient(180deg, #2dbf88 0%, #1fa871 100%);
  border-color: #1ea473;
}

.quest-node.current .quest-node-core {
  animation: pulse-node 1.8s infinite;
}

.quest-node-label {
  position: absolute;
  top: -22px;
  left: 72px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #2c5262;
  white-space: nowrap;
}

.quest-node.q1 {
  top: 40px;
}

.quest-node.q2 {
  top: 175px;
}

.quest-node.q3 {
  top: 314px;
}

.quest-node.filler1 {
  top: 456px;
}

.quest-node.filler2 {
  top: 526px;
}

.book-node .quest-node-core {
  font-size: 25px;
}

.adventure-mascot {
  position: absolute;
  left: calc(50% - 18px);
  top: 82px;
  width: 58px;
  height: 94px;
  border-radius: 30px 30px 18px 18px;
  background: linear-gradient(180deg, #30114e 0%, #1c0f40 60%, #0b2452 100%);
  box-shadow: 0 8px 14px rgba(30, 20, 70, 0.3);
}

.adventure-mascot::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 8px;
  width: 42px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 24%, #5637a6 0%, #2a185e 70%);
}

.adventure-mascot::after {
  content: "✓";
  position: absolute;
  bottom: 10px;
  left: 21px;
  font-family: "Nunito", sans-serif;
  font-size: 18px;
  color: #9ae7ff;
}

.challenge-bear {
  position: absolute;
  left: 8px;
  top: 370px;
  width: 108px;
  height: 160px;
}

.bear-trunk {
  position: absolute;
  width: 88px;
  height: 56px;
  bottom: 0;
  left: 8px;
  background: linear-gradient(180deg, #c57b2e 0%, #975318 100%);
  border-radius: 20px 20px 10px 10px;
}

.bear {
  position: absolute;
  width: 64px;
  height: 70px;
  left: 20px;
  bottom: 38px;
  border-radius: 32px 32px 26px 26px;
  background: linear-gradient(180deg, #25cff9 0%, #00a8d8 100%);
}

.bear::before,
.bear::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #25cff9;
  top: -8px;
}

.bear::before {
  left: 9px;
}

.bear::after {
  right: 9px;
}

.bear-bubble {
  position: absolute;
  left: 0;
  top: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #c8d9df;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
  color: #416472;
}

.settings-float {
  position: absolute;
  right: 10px;
  top: 186px;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  border: none;
  background: #fff;
  box-shadow: var(--shadow-card);
  color: #21a9e4;
  font-size: 30px;
  cursor: pointer;
}

.quest-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 43, 56, 0.25);
  display: grid;
  place-items: center;
  padding: 20px;
}

.quest-popup {
  width: 100%;
  background: linear-gradient(180deg, #09ace8 0%, #038dc6 100%);
  border-radius: 22px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 16px 26px rgba(2, 91, 127, 0.35);
}

.quest-popup h3 {
  margin: 0;
  font-size: 39px;
  line-height: 1.1;
  font-weight: 800;
}

.quest-popup p {
  margin: 7px 0 16px;
  font-size: 19px;
  font-weight: 700;
}

.quest-popup button {
  width: 100%;
  border: none;
  height: 64px;
  border-radius: 999px;
  font-size: 32px;
  font-weight: 800;
  color: #279ac6;
  background: #fff;
  cursor: pointer;
}

.tab-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: #fff;
  border-top: 1px solid #dce8ee;
  height: 68px;
  z-index: 8;
}

.tab-item {
  border: none;
  background: transparent;
  color: #8499a6;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  gap: 3px;
  cursor: pointer;
}

.tab-item i {
  font-style: normal;
  font-size: 24px;
}

.tab-item.active {
  color: #22a2df;
}

.prep-screen {
  min-height: 100%;
  background: linear-gradient(180deg, #2b2f35 0%, #5ec4e0 18%, #d8f4ff 100%);
  display: flex;
  flex-direction: column;
  padding-bottom: 86px;
}

.prep-head-dark {
  background: #2a2b2f;
  padding: 8px 12px 14px;
}

.prep-main-card {
  margin: 18px 16px 0;
  border-radius: 14px;
  background: #ffffffec;
  border: 1px solid #d6e3eb;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.prep-main-head {
  background: linear-gradient(90deg, #22c3bb 0%, #289edd 100%);
  color: #fff;
  text-align: center;
  padding: 16px 10px;
  font-size: 26px;
  font-weight: 800;
}

.prep-options {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #d8e7ee;
}

.radio-like {
  color: #2f5565;
  font-weight: 700;
  font-size: 14px;
}

.audio-all-btn {
  margin-left: auto;
  border: 2px solid #8bbdd3;
  background: #fff;
  border-radius: 10px;
  color: #2a6f8a;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
}

.word-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.word-row {
  border-bottom: 1px solid #dde9ef;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
}

.word-info strong {
  display: block;
  color: #1290cd;
  font-family: "Nunito", sans-serif;
  font-size: 34px;
  line-height: 1;
}

.word-info span {
  color: #355a68;
  font-size: 21px;
  font-weight: 700;
}

.word-status {
  color: #80939f;
  font-size: 19px;
  font-weight: 700;
}

.prep-controls {
  margin-top: auto;
  padding: 18px 16px 8px;
}

.back-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: none;
  color: #33a5cf;
  background: #f5fdff;
  font-size: 30px;
  cursor: pointer;
}

.start-btn {
  margin-left: 14px;
  width: calc(100% - 86px);
  height: 66px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, #20c6bb 0%, #24a2e8 100%);
  color: #fff;
  font-size: 42px;
  font-weight: 800;
  cursor: pointer;
}

.quiz-screen {
  min-height: 100%;
  background: #f8fcff;
  padding: 14px 16px 26px;
}

.quiz-top {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: #235a70;
  font-size: 36px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #deebf2;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ec7ff 0%, #17a7e5 100%);
}

.life-count {
  color: var(--danger);
  font-family: "Nunito", sans-serif;
  font-size: 29px;
  font-weight: 800;
}

.speech-row {
  display: grid;
  grid-template-columns: 72px 1fr 50px;
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

.mini-mascot {
  width: 66px;
  height: 116px;
  border-radius: 28px 28px 18px 18px;
  background: linear-gradient(180deg, #2b1453 0%, #1f1045 56%, #0d2d5f 100%);
  box-shadow: 0 8px 16px rgba(36, 16, 78, 0.25);
  position: relative;
}

.mini-mascot::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 10px;
  width: 46px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 46% 30%, #5c3faf 0%, #2f1a66 70%);
}

.speech-bubble {
  background: #fff;
  border: 2px solid #e1ebf1;
  border-radius: 16px;
  padding: 13px 14px;
  color: #24556d;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  position: relative;
  min-height: 88px;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 18px;
  border-right: 9px solid #e1ebf1;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: -7px;
  top: 20px;
  border-right: 8px solid #fff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.settings-round {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: #e8f7ff;
  color: #3da7d2;
  font-size: 24px;
  cursor: pointer;
}

.prompt-wrap {
  margin-top: 4px;
}

.word-prompt {
  margin: 0 0 12px;
  text-align: center;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.4px;
  color: #14536d;
}

.prompt-with-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.audio-btn {
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(180deg, #24bbf7 0%, #0f9fda 100%);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.translation-pill {
  margin-left: auto;
  border: 1px solid #d6e4ec;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
  color: #6c8795;
}

.quiz-options {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.option-btn {
  width: 100%;
  min-height: 64px;
  border-radius: 999px;
  border: 3px solid #e0e8ee;
  background: #fff;
  color: #1e566d;
  font-family: "Nunito", sans-serif;
  font-size: 34px;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 20px;
}

.option-btn.selected {
  border-color: #75cff2;
  background: #d2eefc;
  color: #1f9cd2;
}

.option-btn.correct {
  border-color: #36c78f;
  background: #dff9ee;
  color: #1e9f69;
}

.option-btn.wrong {
  border-color: #ef8ca0;
  background: #ffe9ef;
  color: #cf3f62;
}

.image-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.image-card {
  border: 3px solid #e3e9ee;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.image-card img,
.image-placeholder {
  width: 100%;
  aspect-ratio: 1.35;
  object-fit: cover;
  display: block;
}

.image-placeholder {
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.6), transparent 35%),
    linear-gradient(135deg, #9fdaf7 0%, #69c2ee 40%, #5baed4 100%);
}

.image-card span {
  display: block;
  padding: 8px 10px;
  color: #fff;
  background: rgba(9, 11, 14, 0.52);
  font-size: 16px;
  font-weight: 700;
}

.image-card.selected {
  border-color: #32b4e8;
  box-shadow: 0 0 0 2px rgba(50, 180, 232, 0.22) inset;
}

.image-card.correct {
  border-color: #28c488;
}

.image-card.wrong {
  border-color: #f18ea0;
}

.typing-panel {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.speaker-main {
  width: 96px;
  height: 96px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #29bcf8 0%, #0d9fd8 100%);
  color: #fff;
  font-size: 44px;
  margin: 0 auto;
  cursor: pointer;
}

.sentence-box {
  border: 3px solid #e0e8ee;
  background: #fff;
  border-radius: 18px;
  padding: 14px;
}

.cloze-sentence {
  margin: 0;
  font-size: 26px;
  color: #234d60;
  line-height: 1.5;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
}

.blank-chip {
  display: inline-block;
  min-width: 88px;
  border-radius: 8px;
  padding: 2px 10px;
  background: #d2ebf7;
}

.jp-translation {
  margin-top: 9px;
  color: #5f7886;
  font-size: 16px;
  font-weight: 700;
}

.typing-row {
  display: grid;
  grid-template-columns: 1fr 52px 52px;
  gap: 8px;
  align-items: center;
}

.typing-row input {
  width: 100%;
  height: 52px;
  border-radius: 12px;
  border: 2px solid #d9e6ee;
  font-size: 22px;
  padding: 0 12px;
  color: #21495e;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
}

.typing-row button {
  height: 52px;
  border: none;
  border-radius: 50%;
  font-size: 26px;
  color: #fff;
  cursor: pointer;
}

.typing-check {
  background: linear-gradient(180deg, #2cb9f2 0%, #119dd7 100%);
}

.typing-clear {
  background: #253744;
}

.submit-large {
  width: 100%;
  height: 66px;
  border: none;
  border-radius: 999px;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: #d4dce2;
}

.submit-large.active {
  background: linear-gradient(180deg, #26baf2 0%, #129ed8 100%);
}

.result-panel {
  margin-top: 14px;
  border-radius: 0;
  background: #d7f1ff;
  border-top: 2px solid #bce3f7;
  padding: 12px 0 16px;
}

.result-status {
  padding: 0 14px;
  font-size: 34px;
  font-weight: 800;
  color: #1695cb;
}

.next-btn {
  margin: 10px 14px 0;
  width: calc(100% - 28px);
  height: 64px;
  border: none;
  border-radius: 999px;
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(180deg, #27bdf5 0%, #109bd5 100%);
  cursor: pointer;
}

.quiz-foot-spacer {
  height: 12px;
}

.summary-screen {
  min-height: 100%;
  padding: 16px 14px 84px;
  background:
    radial-gradient(circle at 15% 22%, rgba(255, 255, 255, 0.9) 0 15%, transparent 16%),
    linear-gradient(180deg, #e3f6ff 0%, #c5eefb 30%, #dff7e7 100%);
}

.summary-title {
  margin: 6px 0 14px;
  font-size: 31px;
  color: #1a5a73;
  font-weight: 800;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: #fff;
  border: 1px solid #d6e7ef;
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.stat-card h4 {
  margin: 0;
  color: #547582;
  font-size: 14px;
}

.stat-card p {
  margin: 6px 0 0;
  color: #12516a;
  font-family: "Nunito", sans-serif;
  font-size: 30px;
  font-weight: 800;
}

.recent-card {
  margin-top: 14px;
  background: #fff;
  border: 1px solid #d8e8ef;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 12px;
}

.recent-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #3f6473;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.recent-list li {
  border: 1px solid #e2ebf1;
  border-radius: 12px;
  padding: 8px 10px;
}

.recent-list strong {
  display: block;
  color: #1778ab;
  font-size: 20px;
  font-family: "Nunito", sans-serif;
}

.recent-list span {
  color: #486675;
  font-size: 15px;
}

.loading,
.error-box {
  min-height: 100%;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: #275265;
  text-align: center;
  padding: 24px;
}

@keyframes pulse-node {
  0% {
    transform: scale(1);
    box-shadow: 0 8px 0 rgba(2, 106, 153, 0.25);
  }
  50% {
    transform: scale(1.07);
    box-shadow: 0 10px 0 rgba(2, 106, 153, 0.18);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 8px 0 rgba(2, 106, 153, 0.25);
  }
}

@media (max-width: 460px) {
  #app {
    height: 100svh;
    padding: 0;
  }

  .mobile-shell {
    border-radius: 0;
    max-width: none;
    height: 100svh;
  }

  .adventure-main,
  .prep-screen,
  .quiz-screen,
  .summary-screen {
    min-height: 100%;
  }

  .word-info strong {
    font-size: 28px;
  }

  .word-info span {
    font-size: 17px;
  }

  .option-btn {
    font-size: 26px;
    min-height: 58px;
  }

  .cloze-sentence {
    font-size: 19px;
  }
}
