:root {
  --bg: #eff7ff;
  --ink: #4d3218;
  --muted: #7a6857;
  --card: #fffaf0;
  --shadow: 0 20px 45px rgba(88, 112, 142, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Nunito", sans-serif;
  background: linear-gradient(180deg, #edf8ff 0%, #fff7e9 100%);
  color: var(--ink);
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  height: 100dvh;
  overflow: hidden;
}

.screen-track {
  display: flex;
  width: 200%;
  height: 100%;
  transform: translateX(0);
  transition: transform 0.38s ease;
}

.app-shell.show-task .screen-track {
  transform: translateX(-50%);
}

.screen {
  width: 50%;
  height: 100%;
}

.screen-map {
  position: relative;
  padding: 10px 16px 16px;
}

.kicker {
  margin: 0 0 4px;
  color: #ff7d57;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
  font-size: 0.78rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  line-height: 1;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.topbar-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

.map-header {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 4;
  width: min(72%, 420px);
}

.map-header-card {
  padding: 10px 14px;
  border-radius: 20px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

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

.status-pill,
.ghost-button,
.back-button {
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--shadow);
  border: none;
  font-weight: 900;
}

.ghost-button,
.back-button {
  cursor: pointer;
}

.map-stage-wrap {
  height: 100%;
  display: grid;
  place-items: center;
}

.map-stage {
  position: relative;
  width: min(calc(100vw - 32px), calc(100dvh - 32px));
  height: min(calc(100vw - 32px), calc(100dvh - 32px));
  max-width: 100%;
  max-height: 100%;
}

.map-background {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
}

.path-board {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.task-node {
  position: absolute;
  width: 12.8%;
  aspect-ratio: 1;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.task-node[disabled] {
  cursor: default;
}

.task-node img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 10px rgba(100, 86, 45, 0.14));
}

.task-node-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8dc;
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: clamp(1.2rem, 3vw, 2.6rem);
  text-shadow: 0 3px 0 rgba(128, 78, 8, 0.25);
}

.task-node.is-intro .task-node-label {
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  line-height: 1.05;
  text-align: center;
}

.task-node.is-complete .task-node-label {
  font-size: clamp(1.2rem, 3vw, 2.8rem);
}

.screen-task {
  padding: 20px;
}

.map-character {
  position: absolute;
  right: 11.8%;
  bottom: 7.4%;
  width: 20.4%;
  z-index: 2;
  user-select: none;
  pointer-events: none;
}

.task-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.task-card {
  flex: 1;
  min-height: 0;
  background: linear-gradient(180deg, #fffdf7 0%, #fff5df 100%);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.task-body {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: center;
}

.task-badge {
  width: min(34vw, 260px);
  height: min(34vw, 260px);
  max-width: 100%;
  max-height: 260px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffe97d 0%, #ffbd3a 100%);
  color: #fff;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.5rem, 8vw, 6rem);
  text-shadow: 0 4px 0 rgba(177, 108, 15, 0.25);
  box-shadow: inset 0 0 0 10px rgba(255, 246, 181, 0.75);
}

.task-description,
.task-helper p {
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--muted);
}

.task-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.primary-button {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  background: linear-gradient(180deg, #ffa340 0%, #ff8318 100%);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(255, 138, 36, 0.24);
}

.primary-button.secondary {
  background: linear-gradient(180deg, #9be65a 0%, #5bc332 100%);
  box-shadow: 0 12px 22px rgba(95, 189, 56, 0.24);
}

.task-helper {
  padding: 18px 20px;
  border-radius: 24px;
  background: #fff3cf;
}

@media (max-width: 900px) {
  .screen-map {
    padding-top: 10px;
  }

  .map-stage {
    width: min(calc(100vw - 20px), calc(100dvh - 112px));
    height: min(calc(100vw - 20px), calc(100dvh - 112px));
  }

  .map-header {
    width: min(82%, 360px);
    top: 8px;
  }

  .task-body {
    grid-template-columns: 1fr;
  }

  .task-badge {
    width: min(48vw, 220px);
    height: min(48vw, 220px);
  }
}

@media (max-width: 640px) {
  .screen-map,
  .screen-task {
    padding: 10px;
  }

  .task-card {
    padding: 18px;
  }

  .task-node {
    width: 14.8%;
  }

  .map-header-card {
    padding: 8px 10px;
    border-radius: 18px;
  }

  .header-actions {
    flex-direction: row;
  }

  .task-actions {
    flex-direction: column;
  }

  .task-actions .primary-button,
  .back-button {
    width: 100%;
  }
}
