:root {
  --font-pixel: "Press Start 2P", cursive;
  --font-ui: "Trebuchet MS", "Segoe UI", sans-serif;
  --grass-top: #8ab85b;
  --grass-bottom: #4d7c36;
  --path: rgba(96, 66, 29, 0.68);
  --card-top: #f7e6a7;
  --card-bottom: #e7c26a;
  --card-border: #6c4823;
  --card-shadow: rgba(78, 54, 25, 0.28);
  --drawer-top: #fff8de;
  --drawer-bottom: #f3e1ad;
  --text-strong: #3f2914;
  --text-soft: #6f4d20;
  --copy-top: #f4b248;
  --copy-bottom: #db8524;
  --success-top: #83d874;
  --success-bottom: #4ea843;
  --error-top: #ffca9b;
  --error-bottom: #ff9264;
  --hud-top: rgba(47, 31, 16, 0.82);
  --hud-bottom: rgba(78, 49, 22, 0.86);
  --hud-border: rgba(255, 234, 166, 0.46);
  --keycap-top: #fff0b9;
  --keycap-bottom: #eec56e;
  --panther-glow: rgba(105, 246, 232, 0.34);
  --gemini-top: #352744;
  --gemini-bottom: #21172a;
  --gemini-glow: rgba(135, 240, 231, 0.34);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  font-family: var(--font-ui);
  color: var(--text-strong);
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.24), transparent 28%),
    radial-gradient(circle at 18% 84%, rgba(255, 216, 120, 0.12), transparent 20%),
    radial-gradient(circle at 82% 20%, rgba(255, 243, 195, 0.1), transparent 18%),
    linear-gradient(180deg, var(--grass-top) 0%, var(--grass-bottom) 100%);
}

body.drawer-open {
  overflow: hidden;
}

button {
  font: inherit;
}

.pixel-text {
  font-family: var(--font-pixel);
}

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

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.map-view {
  position: relative;
  width: min(100%, 1366px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 2.6vw, 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}

.adventure-hud {
  position: absolute;
  top: clamp(18px, 2.4vw, 28px);
  left: clamp(18px, 2.4vw, 28px);
  z-index: 3;
  width: min(310px, calc(50vw - 70px));
  min-width: 240px;
  padding: 16px 16px 18px;
  border: 3px solid var(--hud-border);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--hud-top) 0%, var(--hud-bottom) 100%);
  box-shadow:
    0 12px 0 rgba(43, 24, 10, 0.22),
    0 0 0 4px rgba(255, 250, 234, 0.08);
  color: #fff7d2;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.32s ease,
    transform 0.32s ease,
    visibility 0.32s ease;
}

.adventure-hud.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
  visibility: hidden;
}

.hud-title,
.hud-status {
  margin: 0;
  line-height: 1.6;
}

.hud-title {
  font-size: clamp(0.54rem, 0.8vw, 0.68rem);
}

.hud-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.music-toggle {
  min-height: 40px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(255, 234, 166, 0.5);
  border-radius: 12px;
  background: rgba(255, 234, 166, 0.08);
  color: #fff7d2;
  font-size: clamp(0.46rem, 0.74vw, 0.6rem);
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  touch-action: manipulation;
}

.music-toggle:hover,
.music-toggle:focus-visible {
  outline: none;
  background: rgba(255, 234, 166, 0.16);
  border-color: rgba(255, 234, 166, 0.75);
}

.music-toggle.is-on {
  background: rgba(143, 243, 230, 0.18);
  border-color: rgba(143, 243, 230, 0.55);
  color: #d8fff7;
}

.music-toggle .music-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.music-toggle .music-label {
  letter-spacing: 0.5px;
}

.hud-keys {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keycap {
  min-width: 48px;
  min-height: 48px;
  padding: 10px 12px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(95, 59, 24, 0.95);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--keycap-top) 0%, var(--keycap-bottom) 100%);
  color: #553717;
  font-size: 0.58rem;
  line-height: 1;
  box-shadow: 0 4px 0 rgba(60, 36, 14, 0.28);
}

.keycap-wide {
  min-width: 104px;
}

.hud-copy {
  margin: 14px 0 0;
  font-size: 0.96rem;
  line-height: 1.55;
}

.hud-status {
  margin-top: 14px;
  font-size: clamp(0.48rem, 0.78vw, 0.62rem);
  color: #8ff3e6;
}

.help-toggle {
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 2.3vh, 24px);
  z-index: 5;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(95, 59, 24, 0.95);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff0b9 0%, #e9bd5d 100%);
  box-shadow:
    0 8px 0 rgba(60, 36, 14, 0.3),
    0 0 0 4px rgba(255, 250, 234, 0.14);
  color: #553717;
  font-size: 0.86rem;
  line-height: 1;
  cursor: pointer;
  transform: translateX(-50%);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  touch-action: manipulation;
}

.help-toggle:hover,
.help-toggle:focus-visible,
.help-toggle.is-active {
  outline: none;
  background: linear-gradient(180deg, #d8fff7 0%, #8ff3e6 100%);
}

.help-toggle:active {
  transform: translateX(-50%) translateY(2px);
  box-shadow:
    0 5px 0 rgba(60, 36, 14, 0.3),
    0 0 0 4px rgba(255, 250, 234, 0.14);
}

.touch-pad,
.touch-action {
  display: none;
}

body.has-touch .touch-pad {
  position: absolute;
  bottom: clamp(14px, 2.4vh, 24px);
  left: clamp(14px, 2.4vw, 24px);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--hud-top) 0%, var(--hud-bottom) 100%);
  border: 3px solid var(--hud-border);
  box-shadow:
    0 8px 0 rgba(43, 24, 10, 0.22),
    0 0 0 4px rgba(255, 250, 234, 0.08);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

body.has-touch .touch-action {
  position: absolute;
  bottom: clamp(20px, 3vh, 32px);
  right: clamp(14px, 2.4vw, 24px);
  z-index: 5;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(95, 59, 24, 0.95);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--copy-top) 0%, var(--copy-bottom) 100%);
  box-shadow:
    0 8px 0 rgba(60, 36, 14, 0.32),
    0 0 0 4px rgba(255, 250, 234, 0.14);
  color: #3f2914;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

body.has-touch .touch-action:active,
body.has-touch .touch-action.is-pressed {
  transform: translateY(3px);
  box-shadow:
    0 5px 0 rgba(60, 36, 14, 0.32),
    0 0 0 4px rgba(255, 250, 234, 0.14);
}

.touch-key {
  display: grid;
  place-items: center;
  border: 3px solid rgba(95, 59, 24, 0.95);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--keycap-top) 0%, var(--keycap-bottom) 100%);
  color: #553717;
  font-size: 0.86rem;
  line-height: 1;
  box-shadow: 0 4px 0 rgba(60, 36, 14, 0.28);
  cursor: pointer;
  touch-action: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.touch-key:focus-visible {
  outline: 3px solid #8ff3e6;
  outline-offset: 2px;
}

.touch-key.is-pressed {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(60, 36, 14, 0.28);
  background: linear-gradient(180deg, var(--keycap-bottom) 0%, var(--keycap-top) 100%);
}

.touch-key--up {
  grid-column: 2;
  grid-row: 1;
}

.touch-key--left {
  grid-column: 1;
  grid-row: 2;
}

.touch-key--right {
  grid-column: 3;
  grid-row: 2;
}

.touch-key--down {
  grid-column: 2;
  grid-row: 3;
}

body.has-touch.drawer-open .touch-pad,
body.has-touch.drawer-open .touch-action {
  display: none;
}

.map-path {
  position: absolute;
  left: 50%;
  top: clamp(150px, 22vh, 184px);
  bottom: clamp(92px, 15vh, 128px);
  width: 0;
  transform: translateX(-50%);
  border-left: 6px dotted var(--path);
  filter: drop-shadow(0 3px 0 rgba(255, 246, 202, 0.35));
  pointer-events: none;
}

.handoff-path-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.handoff-path {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transition: opacity 0.22s ease, filter 0.22s ease;
}

.handoff-path.is-visible {
  opacity: 0.88;
}

.handoff-path.is-complete {
  opacity: 0.34;
}

.handoff-path--to-machine {
  stroke: rgba(135, 240, 231, 0.96);
  stroke-dasharray: 12 14;
  filter: drop-shadow(0 0 10px rgba(135, 240, 231, 0.26));
}

.handoff-path--to-forge {
  stroke: rgba(255, 232, 147, 0.96);
  stroke-dasharray: 10 12;
  filter: drop-shadow(0 0 10px rgba(255, 232, 147, 0.24));
}

.gemini-machine {
  position: absolute;
  top: clamp(184px, 27vh, 290px);
  right: clamp(18px, 6vw, 84px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 12px rgba(17, 10, 24, 0.26));
}

.gemini-machine::before {
  content: "";
  position: absolute;
  inset: auto 14px -8px;
  height: 14px;
  border-radius: 999px;
  background: rgba(23, 14, 10, 0.18);
  filter: blur(1px);
}

.gemini-machine-sprite {
  position: relative;
  z-index: 1;
  width: clamp(92px, 10vw, 124px);
  height: auto;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.gemini-machine-label {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 8px 10px;
  border: 3px solid rgba(102, 77, 42, 0.78);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(60, 43, 28, 0.92) 0%, rgba(42, 28, 17, 0.92) 100%);
  color: #f5f0cf;
  font-size: clamp(0.46rem, 0.72vw, 0.58rem);
  line-height: 1.5;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.26);
}

.gemini-machine.is-processing .gemini-machine-sprite {
  animation: machine-pulse 760ms steps(2, end) 2;
  filter: drop-shadow(0 0 16px var(--gemini-glow));
}

.gemini-machine.is-processing .gemini-machine-label {
  color: #d8fff7;
}

.handoff-avatar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-120px, -120px, 0);
  transition: opacity 0.14s linear;
  filter: drop-shadow(0 8px 10px rgba(23, 13, 11, 0.18));
}

.handoff-avatar:not([hidden]) {
  opacity: 1;
}

.handoff-avatar-sprite {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.handoff-wireframe,
.handoff-gemini,
.handoff-prototype {
  transform-origin: center;
  transition: opacity 0.18s linear, transform 0.18s ease;
}

.handoff-gemini,
.handoff-prototype {
  opacity: 0;
  transform: scale(0.84);
}

.handoff-label {
  position: absolute;
  left: 50%;
  top: 52px;
  min-width: max-content;
  padding: 6px 8px;
  border: 2px solid rgba(63, 41, 20, 0.78);
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.95);
  color: #3f2914;
  font-size: 0.42rem;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 4px 0 rgba(78, 54, 25, 0.18);
}

.handoff-avatar.is-transformed {
  filter:
    drop-shadow(0 8px 14px rgba(66, 133, 244, 0.26))
    drop-shadow(0 0 10px rgba(251, 188, 4, 0.2));
}

.handoff-avatar.is-transformed .handoff-wireframe {
  opacity: 0;
  transform: scale(0.82);
}

.handoff-avatar.is-transformed .handoff-gemini {
  opacity: 1;
  transform: scale(1);
}

.handoff-avatar.is-prototype {
  filter:
    drop-shadow(0 8px 14px rgba(246, 192, 19, 0.3))
    drop-shadow(0 0 10px rgba(143, 243, 230, 0.22));
}

.handoff-avatar.is-prototype .handoff-wireframe,
.handoff-avatar.is-prototype .handoff-gemini {
  opacity: 0;
  transform: scale(0.82);
}

.handoff-avatar.is-prototype .handoff-prototype {
  opacity: 1;
  transform: scale(1);
}

.map-foliage {
  position: absolute;
  display: flex;
  gap: clamp(6px, 1vw, 10px);
  font-size: clamp(1.65rem, 2vw, 2.25rem);
  line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(63, 43, 19, 0.18));
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.corner-top-left {
  top: clamp(14px, 2vw, 22px);
  left: clamp(14px, 2vw, 22px);
}

.corner-top-right {
  top: clamp(18px, 2.6vw, 28px);
  right: clamp(14px, 2vw, 22px);
}

.corner-bottom-left {
  bottom: clamp(18px, 2.6vw, 28px);
  left: clamp(18px, 2.8vw, 28px);
}

.corner-bottom-right {
  right: clamp(18px, 2.8vw, 28px);
  bottom: clamp(18px, 2.6vw, 28px);
}

.zone-column {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 18px);
  padding-block: clamp(40px, 6vh, 64px) clamp(92px, 14vh, 128px);
}

.start-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff6b6;
  text-align: center;
  text-shadow: 0 2px 0 rgba(75, 47, 13, 0.7);
  user-select: none;
}

.start-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border: 3px solid rgba(114, 72, 30, 0.7);
  border-radius: 999px;
  background: rgba(92, 63, 27, 0.38);
  font-size: clamp(0.5rem, 0.86vw, 0.68rem);
  line-height: 1.5;
}

.start-arrow {
  font-size: clamp(0.75rem, 1vw, 0.86rem);
}

.zone-card {
  position: relative;
  width: min(100%, 360px);
  min-height: 96px;
  padding: 14px 20px 16px;
  border: 4px solid var(--card-border);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
  box-shadow: 0 10px 0 var(--card-shadow);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "index index"
    "emoji name"
    "emoji tagline";
  column-gap: 16px;
  row-gap: 6px;
  align-items: center;
  text-align: left;
  color: var(--text-strong);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.zone-card:focus-visible,
.zone-card:active {
  outline: none;
  transform: translateY(-2px);
  box-shadow:
    0 14px 0 var(--card-shadow),
    0 0 0 4px rgba(255, 244, 192, 0.45);
}

.zone-card.is-active {
  border-color: #fff4c4;
  background: linear-gradient(180deg, #fdeeb6 0%, #f0cd7d 100%);
  box-shadow:
    0 14px 0 var(--card-shadow),
    0 0 0 4px rgba(255, 244, 192, 0.45);
}

.zone-card.is-nearby {
  border-color: #c0fff8;
  box-shadow:
    0 14px 0 var(--card-shadow),
    0 0 0 6px rgba(105, 246, 232, 0.18),
    0 0 24px var(--panther-glow);
  animation: zone-breathing 1.6s ease-in-out infinite;
}

@keyframes zone-breathing {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 14px 0 var(--card-shadow),
      0 0 0 6px rgba(105, 246, 232, 0.18),
      0 0 24px var(--panther-glow);
  }
  50% {
    transform: translateY(-3px) scale(1.012);
    box-shadow:
      0 16px 0 var(--card-shadow),
      0 0 0 8px rgba(105, 246, 232, 0.32),
      0 0 36px rgba(135, 240, 231, 0.5);
  }
}

.zone-card.is-guided {
  border-color: #8ff3e6;
  box-shadow:
    0 14px 0 var(--card-shadow),
    0 0 0 6px rgba(105, 246, 232, 0.24),
    0 0 32px rgba(135, 240, 231, 0.3);
}

.zone-card.is-pulsing {
  animation: zone-pulse 300ms ease;
}

.zone-index {
  grid-area: index;
  font-size: clamp(0.5rem, 0.84vw, 0.66rem);
  line-height: 1.55;
  color: #7a5420;
}

.zone-emoji {
  grid-area: emoji;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(74, 54, 30, 0.14));
}

.zone-name {
  grid-area: name;
  font-size: clamp(0.62rem, 0.98vw, 0.8rem);
  line-height: 1.55;
}

.zone-tagline {
  grid-area: tagline;
  font-size: clamp(0.52rem, 0.9vw, 0.7rem);
  line-height: 1.5;
  color: #5f4319;
}

.zone-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 48px;
  min-height: 48px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #4d8c3a;
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 4px 0 rgba(33, 70, 29, 0.28);
}

.zone-badge[hidden] {
  display: none;
}

body.is-quest-complete .zone-badge {
  background: linear-gradient(180deg, #f6c013 0%, #e09120 100%);
  color: #3f2914;
  box-shadow:
    0 4px 0 rgba(78, 54, 25, 0.4),
    0 0 18px rgba(246, 192, 19, 0.55);
  animation: badge-victory 1.8s ease-in-out infinite;
}

@keyframes badge-victory {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.08);
    filter: brightness(1.15);
  }
}

.panther-avatar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  filter: drop-shadow(0 8px 12px rgba(18, 9, 22, 0.22));
}

.panther-avatar.is-facing-left .panther-sprite {
  transform: scaleX(-1);
}

.panther-avatar.is-walking .panther-sprite-wrap {
  animation: panther-bob 250ms steps(2, end) infinite;
}

.panther-shadow {
  position: absolute;
  bottom: 9px;
  width: 48px;
  height: 12px;
  border-radius: 999px;
  background: rgba(26, 15, 9, 0.2);
  filter: blur(1px);
}

.panther-sprite-wrap {
  position: relative;
  z-index: 1;
}

.panther-sprite {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
  transform-origin: center;
}

.drawer-layer {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: end;
  pointer-events: none;
  z-index: 10;
}

.drawer-layer.is-open {
  pointer-events: auto;
}

.drawer-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 24, 15, 0.34);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-layer.is-open .drawer-scrim {
  opacity: 1;
}

.drawer {
  position: relative;
  width: min(100%, 820px);
  height: 100vh;
  max-height: 100vh;
  margin-inline: auto;
  border: 4px solid var(--card-border);
  border-radius: 0;
  background: linear-gradient(180deg, var(--drawer-top) 0%, var(--drawer-bottom) 100%);
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.drawer-layer.is-open .drawer {
  transform: translateY(0);
}

.drawer-handle {
  width: 92px;
  height: 10px;
  margin: 14px auto 0;
  border-radius: 999px;
  background: rgba(96, 66, 29, 0.25);
  flex-shrink: 0;
}

.drawer-header {
  padding: 18px 20px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 2px solid rgba(107, 71, 38, 0.16);
}

.drawer-heading {
  display: grid;
  gap: 10px;
}

.drawer-kicker {
  margin: 0;
  font-size: clamp(0.5rem, 0.8vw, 0.64rem);
  line-height: 1.55;
  color: var(--text-soft);
}

.drawer-title {
  margin: 0;
  font-size: clamp(0.68rem, 1vw, 0.9rem);
  line-height: 1.65;
}

.drawer-close {
  min-width: 48px;
  min-height: 48px;
  padding: 10px;
  border: 3px solid var(--card-border);
  border-radius: 16px;
  background: linear-gradient(180deg, #f7d98c 0%, #ecbe66 100%);
  color: var(--text-strong);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  touch-action: manipulation;
}

.drawer-close:focus-visible,
.drawer-close:active,
.copy-button:focus-visible,
.copy-button:active {
  outline: none;
  transform: translateY(-1px);
}

.drawer-content {
  padding: 0 20px 20px;
  flex: 1;
  overflow-y: auto;
}

.drawer-section {
  padding: 18px 0;
  border-bottom: 2px solid rgba(107, 71, 38, 0.12);
}

.drawer-section:last-child {
  border-bottom: 0;
}

.drawer-section h3 {
  margin: 0 0 12px;
  font-size: clamp(0.5rem, 0.8vw, 0.66rem);
  line-height: 1.6;
  color: var(--text-soft);
}

.drawer-summary,
.instructions-list {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
}

.instructions-list {
  padding-left: 1.35rem;
  display: grid;
  gap: 12px;
}

.prompt-preview {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: #2b241b;
  color: #fff2ba;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.drawer-footer {
  padding: 18px 20px 22px;
  border-top: 2px solid rgba(107, 71, 38, 0.12);
  background: rgba(255, 250, 232, 0.88);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 4px solid var(--card-border);
  border-radius: 18px;
  background: linear-gradient(180deg, #bde2ff 0%, #4a8fd6 100%);
  box-shadow: 0 8px 0 rgba(24, 62, 112, 0.28);
  color: #0f2742;
  font-size: clamp(0.56rem, 0.86vw, 0.72rem);
  line-height: 1.45;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  touch-action: manipulation;
}

.link-button:focus-visible,
.link-button:hover {
  outline: none;
  transform: translateY(-1px);
  background: linear-gradient(180deg, #d1ecff 0%, #5aa0e3 100%);
}

.copy-button {
  width: 100%;
  min-height: 56px;
  padding: 16px 18px;
  position: relative;
  border: 4px solid var(--card-border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--copy-top) 0%, var(--copy-bottom) 100%);
  box-shadow: 0 8px 0 rgba(123, 71, 11, 0.22);
  color: #2d1d0a;
  font-family: var(--font-pixel);
  font-size: clamp(0.58rem, 0.9vw, 0.76rem);
  line-height: 1.45;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  touch-action: manipulation;
}

.copy-button.is-copied {
  background: linear-gradient(180deg, var(--success-top) 0%, var(--success-bottom) 100%);
  box-shadow: 0 8px 0 rgba(40, 99, 37, 0.22);
}

.copy-button.is-error {
  background: linear-gradient(180deg, var(--error-top) 0%, var(--error-bottom) 100%);
  box-shadow: 0 8px 0 rgba(175, 86, 48, 0.2);
}

.copy-button.is-inert {
  background: linear-gradient(180deg, #d8e8d0 0%, #9fc29d 100%);
  box-shadow: 0 8px 0 rgba(68, 105, 61, 0.22);
}

.link-button[data-keyhint]::after,
.copy-button[data-keyhint]::after {
  content: attr(data-keyhint);
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 28px;
  min-height: 28px;
  padding: 3px 5px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(56, 37, 16, 0.82);
  border-radius: 10px;
  background: rgba(255, 249, 230, 0.68);
  color: #3b2612;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(70, 46, 19, 0.18);
}

@keyframes zone-pulse {
  0% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
      0 16px 0 var(--card-shadow),
      0 0 0 10px rgba(255, 246, 202, 0);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes panther-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes machine-pulse {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

@media (max-width: 980px) {
  .adventure-hud {
    left: 50%;
    width: min(340px, calc(100% - 28px));
    min-width: 0;
    transform: translateX(-50%);
  }

  .gemini-machine {
    right: clamp(10px, 2vw, 22px);
  }
}

@media (max-width: 720px) {
  .map-view {
    padding: 14px;
  }

  .adventure-hud {
    top: 10px;
    padding: 12px 12px 14px;
    border-radius: 18px;
  }

  .hud-copy {
    font-size: 0.88rem;
  }

  .keycap {
    min-width: 42px;
    min-height: 42px;
    padding: 8px 10px;
  }

  .keycap-wide {
    min-width: 92px;
  }

  .help-toggle {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 0.76rem;
  }

  .map-foliage {
    font-size: 1.45rem;
    opacity: 0.9;
  }

  .zone-column {
    width: min(100%, 340px);
    gap: 12px;
    padding-block: 38px 96px;
  }

  .map-path {
    top: 132px;
    bottom: 82px;
  }

  .gemini-machine {
    top: 188px;
    right: 6px;
    gap: 6px;
  }

  .gemini-machine-sprite {
    width: 82px;
  }

  .gemini-machine-label {
    padding: 6px 8px;
    font-size: 0.42rem;
  }

  .link-button[data-keyhint]::after,
  .copy-button[data-keyhint]::after {
    top: 8px;
    right: 8px;
    min-width: 24px;
    min-height: 24px;
    font-size: 0.38rem;
  }

  .zone-card {
    min-height: 92px;
    padding: 12px 16px 14px;
    border-radius: 20px;
    column-gap: 14px;
  }

  .panther-avatar {
    width: 76px;
    height: 76px;
  }

  .panther-sprite {
    width: 60px;
    height: 60px;
  }

  body.has-touch .touch-pad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 4px;
    padding: 8px;
    bottom: 86px;
  }

  body.has-touch .touch-action {
    width: 76px;
    height: 76px;
    font-size: 0.84rem;
    bottom: 86px;
  }

  .handoff-avatar {
    width: 50px;
    height: 50px;
  }

  .handoff-avatar-sprite {
    width: 44px;
    height: 44px;
  }

  .drawer {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .drawer-header,
  .drawer-content,
  .drawer-footer {
    padding-inline: 16px;
  }

  .drawer-summary,
  .instructions-list,
  .prompt-preview {
    font-size: 0.94rem;
  }
}

@media (max-height: 720px) {
  .adventure-hud {
    padding: 12px 14px;
  }

  .hud-copy {
    font-size: 0.88rem;
  }

  .zone-column {
    gap: 10px;
    padding-block: 28px 88px;
  }

  .map-path {
    top: 118px;
    bottom: 94px;
  }

  .gemini-machine {
    top: 156px;
  }

  .zone-card {
    min-height: 86px;
    padding: 10px 16px 12px;
  }

  .start-marker {
    gap: 8px;
  }

  .map-foliage {
    font-size: 1.45rem;
  }
}

.teacher-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 32px);
  background: rgba(23, 14, 8, 0.78);
  backdrop-filter: blur(4px);
}

.teacher-panel[hidden] {
  display: none;
}

.teacher-panel-inner {
  width: min(100%, 480px);
  padding: clamp(20px, 4vw, 32px);
  border: 4px solid var(--hud-border);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--hud-top) 0%, var(--hud-bottom) 100%);
  box-shadow:
    0 16px 0 rgba(23, 14, 8, 0.4),
    0 0 0 4px rgba(255, 250, 234, 0.08);
  color: #fff7d2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.teacher-panel-title {
  margin: 0;
  font-size: clamp(0.7rem, 1.4vw, 1rem);
  line-height: 1.5;
}

.teacher-panel-sub {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(255, 247, 210, 0.7);
}

.teacher-zone-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.teacher-zone-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 247, 210, 0.06);
  border: 2px solid rgba(255, 234, 166, 0.2);
  font-size: 0.92rem;
  line-height: 1.4;
}

.teacher-zone-item.is-done {
  border-color: rgba(143, 243, 230, 0.38);
  background: rgba(143, 243, 230, 0.08);
}

.teacher-zone-status {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.teacher-zone-name {
  font-weight: 600;
  color: #fff7d2;
}

.teacher-zone-tagline {
  font-size: 0.85rem;
  color: rgba(255, 247, 210, 0.6);
}

.teacher-tally {
  margin: 0;
  font-size: clamp(0.52rem, 0.9vw, 0.68rem);
  color: #8ff3e6;
}

.teacher-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.teacher-actions .copy-button {
  flex: 1;
  min-width: 140px;
}

.teacher-close {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 10px 20px;
  border: 3px solid rgba(255, 234, 166, 0.5);
  border-radius: 14px;
  background: rgba(255, 234, 166, 0.08);
  color: #fff7d2;
  font-size: clamp(0.46rem, 0.74vw, 0.6rem);
  cursor: pointer;
  transition: background 0.18s ease;
  touch-action: manipulation;
}

.teacher-close:hover,
.teacher-close:focus-visible {
  outline: none;
  background: rgba(255, 234, 166, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
