:root {
  --side-panel-width: clamp(420px, 24vw, 520px);
  --ink: #162237;
  --muted: #657186;
  --paper: #fff8ea;
  --panel: rgba(255, 252, 241, 0.94);
  --line: rgba(22, 34, 55, 0.16);
  --teal: #2e9f87;
  --coral: #e25d4f;
  --blue: #4768b5;
  --gold: #f4c95d;
  --green: #3c8c62;
  --shadow: 0 22px 60px rgba(25, 33, 46, 0.22);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #203049;
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:disabled {
  cursor: default;
}

.is-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-panel-width);
  height: 100vh;
  height: 100dvh;
  min-height: 640px;
  overflow: hidden;
}

.world-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: linear-gradient(180deg, #bfe8ec 0%, #eef2d1 58%, #d7b98b 100%);
}

#cityCanvas {
  display: block;
  width: min(100%, calc(100dvh * 1.4474));
  height: auto;
  max-height: 100%;
  aspect-ratio: 1100 / 760;
  touch-action: manipulation;
}

.world-overlay {
  position: absolute;
  inset: 18px 18px auto 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.status-strip,
.prompt-chip {
  border: 1px solid rgba(255, 255, 255, 0.56);
  background: rgba(255, 248, 234, 0.9);
  box-shadow: 0 10px 30px rgba(25, 33, 46, 0.16);
  backdrop-filter: blur(12px);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
}

.status-strip span {
  min-width: 74px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.prompt-chip {
  max-width: 340px;
  padding: 13px 16px;
  border-radius: 18px;
  color: #26384f;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 28px clamp(24px, 2vw, 34px);
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 248, 234, 0.96), rgba(238, 242, 209, 0.96)),
    var(--paper);
  box-shadow: -20px 0 50px rgba(25, 33, 46, 0.16);
}

.brand-block h1,
.selected-place h2,
.mission-list h2,
.word-bank h2,
.task-header h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 2.35rem;
}

.brand-block p,
.selected-place p,
.empty-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.48;
}

.guide-strip {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 96px;
  margin-top: 16px;
  padding: 12px 14px 12px 116px;
  overflow: hidden;
  border: 1px solid rgba(22, 34, 55, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(228, 246, 239, 0.92), rgba(255, 240, 219, 0.84)),
    #fff;
}

.guide-strip img {
  position: absolute;
  bottom: -18px;
  width: 64px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 9px 12px rgba(25, 33, 46, 0.18));
}

.guide-strip img:first-child {
  left: 10px;
}

.guide-strip img:nth-child(2) {
  left: 48px;
  transform: scaleX(-1);
}

.guide-strip span {
  color: #26384f;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.35;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title h2,
.panel-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.section-title span,
.panel-heading span,
.mission-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(46, 159, 135, 0.12);
  color: #287b6d;
  font-size: 0.75rem;
  font-weight: 900;
}

.avatar-picker,
.selected-place,
.mission-list,
.prototype-list,
.word-bank {
  padding: 16px;
  border: 1px solid rgba(22, 34, 55, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

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

.avatar-option {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 96px;
  padding: 8px 6px;
  border: 1px solid rgba(22, 34, 55, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #26384f;
  font-size: 0.74rem;
  font-weight: 850;
}

.avatar-option.is-selected {
  border-color: var(--teal);
  background: #e8f8f3;
  box-shadow: 0 0 0 2px rgba(46, 159, 135, 0.16);
}

.avatar-option img {
  width: 44px;
  height: 64px;
  object-fit: contain;
}

.place-guide,
.coach-note,
.universe-intro,
.mini-game-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}

.place-guide img,
.coach-note img,
.universe-intro img,
.mini-game-header img {
  width: 54px;
  height: 74px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(25, 33, 46, 0.16));
}

.place-guide div,
.coach-note div,
.universe-intro div,
.mini-game-header div {
  display: grid;
  gap: 4px;
}

.place-guide strong,
.coach-note strong,
.universe-intro strong,
.mini-game-header strong {
  color: #26384f;
}

.place-guide span,
.coach-note span,
.universe-intro span,
.mini-game-header span,
.mission-card span,
.prototype-card span,
.path-card small {
  color: var(--muted);
  line-height: 1.35;
}

.mission-cards,
.prototype-cards,
.word-list,
.path-card-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.mission-card,
.prototype-card,
.path-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  width: 100%;
  padding: 13px;
  border: 1px solid rgba(22, 34, 55, 0.13);
  border-left: 6px solid var(--accent, var(--teal));
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 20px rgba(25, 33, 46, 0.08);
}

.mission-card.is-active,
.path-card.is-done {
  background: #f1fbf7;
  box-shadow: 0 0 0 2px rgba(46, 159, 135, 0.16);
}

.mission-avatar,
.path-card img {
  grid-row: 1 / 5;
  width: 54px;
  height: 64px;
  object-fit: contain;
}

.mission-meta {
  font-size: 0.76rem;
  font-weight: 850;
}

.mission-card strong,
.prototype-card strong,
.path-card span {
  color: #26384f;
  font-size: 0.98rem;
}

.prototype-card {
  display: grid;
  grid-template-columns: 1fr;
  border-left-color: var(--blue);
}

.word-list {
  display: flex;
  flex-wrap: wrap;
}

.word-chip,
.reward-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  color: #26384f;
  font-size: 0.8rem;
  font-weight: 850;
}

.reset-progress {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(226, 93, 79, 0.11);
  color: #9e3a31;
  font-weight: 900;
}

.task-panel,
.universe-panel {
  position: absolute;
  inset: 20px calc(var(--side-panel-width) + 20px) 20px 20px;
  z-index: 20;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.97);
  box-shadow: var(--shadow);
}

.task-panel.is-hidden,
.universe-panel.is-hidden {
  display: none;
}

.task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-header h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #26384f;
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1;
}

.task-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 34, 55, 0.1);
}

.task-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 220ms ease;
}

.task-body,
.universe-body {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.mission-scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 42%);
  gap: 18px;
  min-height: 230px;
  padding: 18px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(191, 232, 236, 0.88), rgba(244, 201, 93, 0.28));
}

.scene-copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.scene-copy span {
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scene-copy strong {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

.scene-copy p,
.intro-text {
  color: var(--muted);
  line-height: 1.5;
}

.scene-art-stack {
  position: relative;
  min-height: 220px;
}

.scene-art {
  position: absolute;
  inset: auto 0 0 auto;
  max-width: 100%;
  max-height: 210px;
  object-fit: contain;
}

.scene-guide {
  position: absolute;
  right: 10px;
  bottom: -10px;
  width: 110px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(25, 33, 46, 0.2));
}

.reward-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.dialogue-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 54px 14px 14px;
  border: 1px solid rgba(22, 34, 55, 0.12);
  border-radius: 8px;
  background: #fff;
}

.dialogue-card > img:first-child {
  width: 58px;
  height: 78px;
  object-fit: contain;
}

.dialogue-card span {
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 900;
}

.dialogue-card p {
  margin: 5px 0 0;
  color: #26384f;
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.35;
}

.dialogue-icon {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.option-grid,
.piece-grid,
.picture-grid,
.word-tile-path {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.btn {
  min-height: 46px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #26384f;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(25, 33, 46, 0.08);
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-ghost {
  background: rgba(22, 34, 55, 0.08);
}

.btn-listen {
  background: var(--blue);
  color: #fff;
}

.btn-option,
.btn-piece {
  min-height: 62px;
  border: 1px solid rgba(22, 34, 55, 0.13);
}

.btn.is-correct,
.picture-card.is-correct {
  background: #e7f7ef;
  color: #246c4c;
  box-shadow: 0 0 0 2px rgba(60, 140, 98, 0.18);
}

.btn.is-wrong,
.picture-card.is-wrong {
  background: #fff0ee;
  color: #a94238;
  box-shadow: 0 0 0 2px rgba(226, 93, 79, 0.16);
}

.sentence-answer,
.target-chip {
  min-height: 56px;
  margin-bottom: 12px;
  padding: 14px;
  border: 2px dashed rgba(22, 34, 55, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: #26384f;
  font-weight: 900;
  line-height: 1.35;
}

.answer-input {
  width: 100%;
  min-height: 130px;
  padding: 14px;
  border: 1px solid rgba(22, 34, 55, 0.16);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.feedback {
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid rgba(22, 34, 55, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: #26384f;
}

.feedback:empty {
  display: none;
}

.feedback.is-good,
.feedback.is-try {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.feedback.is-good {
  border-color: rgba(60, 140, 98, 0.28);
  background: #e7f7ef;
}

.feedback.is-try {
  border-color: rgba(226, 93, 79, 0.24);
  background: #fff0ee;
}

.feedback img {
  width: 42px;
  height: 54px;
  object-fit: contain;
}

.feedback p {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.result-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
}

.result-layout img {
  width: 96px;
  height: 140px;
  object-fit: contain;
}

.result-badge {
  display: grid;
  gap: 6px;
}

.result-badge strong {
  font-size: 2rem;
}

.universe-map {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #bfe8ec, #eaf1c8 55%, #d7b98b);
}

.universe-bg-art {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 70%;
  object-fit: cover;
  opacity: 0.55;
}

.universe-place-art {
  position: absolute;
  right: 8%;
  bottom: 18%;
  width: min(34%, 220px);
  max-height: 210px;
  object-fit: contain;
}

.universe-player {
  position: absolute;
  z-index: 3;
  width: 76px;
  height: 118px;
  object-fit: contain;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 10px 14px rgba(25, 33, 46, 0.2));
}

.universe-path-line {
  position: absolute;
  left: 13%;
  right: 18%;
  bottom: 34%;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.72);
  transform: rotate(-11deg);
}

.path-node {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 3px solid #fff8ea;
  border-radius: 50%;
  background: var(--teal);
  transform: translate(-50%, -50%);
  box-shadow: 0 9px 18px rgba(25, 33, 46, 0.18);
}

.path-node img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.path-node span {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
}

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

.universe-intro {
  margin: 14px 0;
}

.mini-game {
  display: grid;
  gap: 14px;
}

.picture-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 138px;
  padding: 14px;
  border: 1px solid rgba(22, 34, 55, 0.13);
  border-radius: 8px;
  background: #fff;
  color: #26384f;
  font-weight: 900;
}

.picture-card img {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.word-tile-path .btn {
  min-height: 70px;
}

@media (max-width: 980px) {
  :root {
    --side-panel-width: min(100%, 420px);
  }

  .game-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .world-panel {
    min-height: 58dvh;
  }

  #cityCanvas {
    width: 100%;
  }

  .world-overlay {
    inset: 10px;
    flex-direction: column;
  }

  .prompt-chip {
    max-width: none;
  }

  .side-panel {
    height: auto;
    min-height: 0;
    border-left: 0;
    box-shadow: none;
  }

  .task-panel,
  .universe-panel {
    position: fixed;
    inset: 10px;
  }

  .mission-scene {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .world-panel {
    min-height: 48dvh;
  }

  .status-strip {
    border-radius: 8px;
  }

  .status-strip span {
    min-width: 0;
    font-size: 0.76rem;
  }

  .side-panel {
    gap: 12px;
    padding: 16px;
  }

  .brand-block h1 {
    font-size: 2rem;
  }

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

  .mission-card,
  .path-card {
    grid-template-columns: 1fr;
  }

  .mission-avatar,
  .path-card img {
    grid-row: auto;
  }

  .task-panel,
  .universe-panel {
    padding: 14px;
  }

  .task-header h2 {
    font-size: 1.45rem;
  }

  .option-grid,
  .piece-grid,
  .picture-grid,
  .word-tile-path {
    grid-template-columns: 1fr;
  }
}
