:root {
  color-scheme: dark;
  font-family:
    "Trebuchet MS",
    "Segoe UI",
    system-ui,
    sans-serif;
  background: #10201d;
  color: #fff7de;
  --amber: #f5b84b;
  --amber-dark: #8e4f1b;
  --teal: #2ee6dc;
  --teal-dark: #0a5c60;
  --moss: #66884a;
  --red: #b9452e;
  --ink: #1b211f;
  --paper: #fff2ca;
  --paper-ink: #2b2418;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  touch-action: manipulation;
}

button {
  font: inherit;
}

.launchScreen,
.introScreen,
.rewardScreen {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: end;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  overflow: hidden;
  background: #111f1d;
}

.launchScreen {
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.transitionScreen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(46, 230, 220, 0.18), transparent 38%),
    linear-gradient(180deg, #17231f, #07100f);
  color: #fff7de;
}

.transitionMist {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 22% 40%, rgba(255, 209, 112, 0.14), transparent 28%),
    radial-gradient(circle at 72% 56%, rgba(46, 230, 220, 0.14), transparent 34%);
  filter: blur(22px);
  animation: transitionBreathe 900ms ease-in-out infinite alternate;
}

.transitionPanel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100% - 36px));
  padding: clamp(22px, 5vw, 42px);
  border: 1px solid rgba(255, 231, 166, 0.46);
  border-radius: 8px;
  background: rgba(13, 22, 19, 0.78);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
  backdrop-filter: blur(10px);
}

.transitionPanel h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.launchBackdrop,
.introBackdrop,
.rewardArt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.launchScreen::after,
.introScreen::after,
.rewardScreen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 19, 17, 0.1), rgba(10, 19, 17, 0.5)),
    linear-gradient(90deg, rgba(9, 22, 19, 0.72), rgba(9, 22, 19, 0.14) 42%, rgba(9, 22, 19, 0.32));
}

.launchPanel,
.introPanel,
.rewardPanel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  padding: clamp(18px, 4vw, 34px);
  border: 2px solid rgba(255, 231, 166, 0.6);
  border-radius: 8px;
  background: rgba(31, 30, 23, 0.82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}

.launchPanel {
  width: min(640px, 100%);
  text-align: center;
}

.launchPanel h1,
.introPanel h1,
.rewardPanel h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 7vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.launchPanel p,
.introPanel p,
.rewardPanel p {
  max-width: 34rem;
  margin: 0 0 18px;
  font-size: clamp(1.08rem, 2.6vw, 1.45rem);
  line-height: 1.35;
}

.launchPanel .primaryButton {
  min-width: min(260px, 100%);
}

.eyebrow {
  margin: 0 0 6px;
  color: #9cf2e9;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primaryButton,
.secondaryButton,
.choices button {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  color: #241606;
  background: linear-gradient(180deg, #ffe48c, var(--amber));
  box-shadow: 0 7px 0 var(--amber-dark), 0 14px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  font-weight: 900;
}

.primaryButton {
  padding: 14px 22px;
}

.secondaryButton {
  padding: 14px 18px;
  margin-right: 8px;
  color: #fff7de;
  background: rgba(18, 27, 23, 0.76);
  border: 1px solid rgba(255, 231, 166, 0.38);
  box-shadow: none;
  cursor: pointer;
  font-weight: 900;
}

.primaryButton:active,
.choices button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--amber-dark), 0 10px 22px rgba(0, 0, 0, 0.22);
}

.menuScreen {
  height: 100dvh;
  padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(16px, 3vw, 28px);
  background:
    radial-gradient(circle at 20% 12%, rgba(46, 230, 220, 0.16), transparent 34%),
    radial-gradient(circle at 82% 20%, rgba(245, 184, 75, 0.16), transparent 32%),
    linear-gradient(180deg, #10201d, #0b1513 62%, #15120e);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.menuHeader {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding-top: clamp(8px, 2.8vh, 26px);
}

.menuHeader h1 {
  margin: 0 0 8px;
  font-size: clamp(2.4rem, 8vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.menuHeader p {
  margin: 0;
  max-width: 36rem;
  color: #fff2ca;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  line-height: 1.35;
}

.levelGrid {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2.2vw, 22px);
  align-content: start;
}

.levelTile {
  position: relative;
  min-height: clamp(190px, 24vw, 270px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 231, 166, 0.42);
  border-radius: 8px;
  background: #14211e;
  color: #fff7de;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

.levelTile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.levelTileShade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 13, 12, 0.88), rgba(6, 13, 12, 0.58) 44%, rgba(6, 13, 12, 0.12)),
    linear-gradient(180deg, rgba(6, 13, 12, 0.02), rgba(6, 13, 12, 0.38));
}

.levelTileText {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(58%, 620px);
  display: grid;
  align-content: center;
  gap: 9px;
  padding: clamp(18px, 3vw, 34px);
}

.levelTileText strong {
  font-size: clamp(1.75rem, 4vw, 3.2rem);
  line-height: 0.98;
}

.levelTileText span:last-child {
  max-width: 34rem;
  color: #fff2ca;
  font-size: clamp(1rem, 1.9vw, 1.24rem);
  line-height: 1.28;
}

.levelBadge {
  width: max-content;
  padding: 6px 9px;
  border: 1px solid rgba(46, 230, 220, 0.62);
  border-radius: 999px;
  color: #9cf2e9;
  background: rgba(8, 20, 19, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
}

.levelTile:hover img,
.levelTile:focus-visible img {
  transform: scale(1.035);
}

.levelTile:focus-visible {
  outline: 3px solid rgba(46, 230, 220, 0.82);
  outline-offset: 3px;
}

.emptyMenu {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(255, 231, 166, 0.34);
  border-radius: 8px;
  background: rgba(14, 22, 20, 0.86);
}

.menuError {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 113, 93, 0.52);
  border-radius: 8px;
  color: #ffe4dc;
  background: rgba(70, 20, 16, 0.74);
  font-weight: 900;
}

.loadingScreen {
  place-items: center;
}

.gameShell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0b1513;
}

.menuReturnButton {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  top: max(12px, env(safe-area-inset-top));
  z-index: 8;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 231, 166, 0.34);
  border-radius: 8px;
  color: #fff7de;
  background: rgba(10, 18, 16, 0.62);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.menuReturnButton:hover,
.menuReturnButton:focus-visible {
  outline: 2px solid rgba(46, 230, 220, 0.72);
  outline-offset: 2px;
  background: rgba(12, 28, 26, 0.82);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(255, 231, 166, 0.28);
  border-radius: 8px;
  background: rgba(12, 24, 22, 0.86);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.12rem, 2.4vw, 1.9rem);
  line-height: 1.05;
}

.stageViewport {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #1d3028;
  cursor: default;
  user-select: none;
}

.worldTrack {
  position: absolute;
  inset: 0;
  width: calc(var(--world-scale) * 100%);
  height: 100%;
  transform: translateX(calc(var(--camera-percent) * -1%));
  transition: none;
  transform-origin: left top;
}

.worldArt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.forestMist {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 44%, rgba(18, 28, 22, 0.18) 50%, transparent 56%),
    linear-gradient(180deg, transparent 62%, rgba(19, 12, 7, 0.16));
  pointer-events: none;
}

.pathDebugOverlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  font: 700 18px/1 system-ui, sans-serif;
}

.pathDebugEditable {
  pointer-events: auto;
}

.pathDebugEditable .debugDraggableNode circle {
  pointer-events: auto;
  cursor: grab;
}

.pathDebugEditable .debugDraggableNode:active circle,
.pathDebugEditable .debugDraggableObject [data-object-drag]:active {
  cursor: grabbing;
}

.pathDebugEditable .debugDraggableObject [data-object-drag] {
  pointer-events: auto;
  cursor: grab;
}

.debugPathEdge {
  stroke: rgba(255, 236, 153, 0.95);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 16 12;
  fill: none;
}

.debugWalkNode circle {
  fill: rgba(10, 18, 16, 0.86);
  stroke: rgba(255, 236, 153, 0.96);
  stroke-width: 4;
}

.debugApproachNode circle {
  fill: rgba(46, 230, 220, 0.86);
  stroke: rgba(10, 18, 16, 0.9);
  stroke-width: 5;
}

.debugObjectRadius {
  fill: rgba(46, 230, 220, 0.1);
  stroke: rgba(46, 230, 220, 0.95);
  stroke-width: 5;
}

.debugObjectCenter {
  fill: rgba(255, 87, 87, 0.95);
  stroke: #fff7de;
  stroke-width: 2;
}

.debugObjectRadiusHandle {
  fill: rgba(255, 204, 108, 0.96);
  stroke: rgba(10, 18, 16, 0.92);
  stroke-width: 3;
}

.pathDebugOverlay text {
  paint-order: stroke;
  stroke: rgba(10, 18, 16, 0.92);
  stroke-width: 5;
  fill: #fff7de;
}

.walkPathEditorPanel {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 7;
  display: grid;
  gap: 6px;
  width: min(540px, calc(100vw - 24px));
  max-height: min(560px, calc(58dvh - 12px));
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(156, 242, 233, 0.46);
  border-radius: 8px;
  color: #fff7de;
  background: rgba(10, 18, 16, 0.88);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
  font-size: 0.82rem;
  pointer-events: auto;
}

.walkPathEditorPanel strong {
  color: #9cf2e9;
}

.walkPathEditorPanel ol {
  margin: 0;
  padding-left: 18px;
}

.walkPathEditorPanel li {
  margin: 2px 0;
}

.walkPathEditorPanel [class^="walkPathStatus"] {
  width: fit-content;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 231, 166, 0.24);
  background: rgba(255, 242, 202, 0.1);
  font-weight: 900;
}

.developerToolMode,
.developerToolUnavailable,
.developerToolReadOnly {
  width: fit-content;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 231, 166, 0.24);
  background: rgba(255, 242, 202, 0.1);
  font-weight: 900;
}

.developerToolMode {
  color: #9cf2e9;
}

.developerToolUnavailable,
.developerToolReadOnly {
  color: #ffe28a;
}

.walkPathStatusModified {
  color: #ffe28a;
}

.walkPathStatusApplied,
.walkPathStatusClean,
.walkPathStatusReverted {
  color: #9cf2e9;
}

.walkPathStatusError {
  color: #ffb4a8;
}

.audioEditorSection {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.audioEditorSection strong,
.audioEditorSfx > span {
  color: #ffd06d;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.audioEditorSfx {
  display: grid;
  gap: 7px;
}

.audioEditorRow {
  display: grid;
  grid-template-columns: minmax(96px, 0.9fr) minmax(110px, 1.2fr) 42px auto;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}

.audioEditorRow input {
  min-width: 0;
  accent-color: #ffd06d;
}

.audioEditorRow output {
  color: rgba(255, 247, 222, 0.78);
  font-variant-numeric: tabular-nums;
}

.audioTestButton {
  min-width: 48px;
  border: 1px solid rgba(255, 231, 166, 0.38);
  border-radius: 6px;
  padding: 5px 8px;
  color: #fff7de;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
  cursor: pointer;
}

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

.walkPathEditorActions button {
  min-height: 32px;
  border: 1px solid rgba(255, 231, 166, 0.34);
  border-radius: 6px;
  color: #fff7de;
  background: rgba(255, 242, 202, 0.12);
  font-weight: 800;
  cursor: pointer;
}

.walkPathEditorActions button:disabled {
  opacity: 0.48;
  cursor: default;
}

.walkPathEditorPanel p {
  margin: 0;
  color: rgba(255, 247, 222, 0.82);
}

.verbBar {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.verbButton {
  min-height: 48px;
  min-width: 96px;
  border: 1px solid rgba(255, 231, 166, 0.42);
  border-radius: 8px;
  color: #fff2ca;
  background: rgba(18, 27, 23, 0.9);
  cursor: pointer;
  font-weight: 900;
}

.verbActive {
  border-color: rgba(46, 230, 220, 0.9);
  color: #071817;
  background: linear-gradient(180deg, #9cf2e9, #2ee6dc);
}

.progressPills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pill,
.counter,
.miniHint,
.badge,
.stats span {
  border-radius: 999px;
  border: 1px solid rgba(255, 231, 166, 0.34);
  background: rgba(255, 242, 202, 0.11);
  color: #fff2ca;
  padding: 7px 10px;
  font-weight: 800;
  white-space: nowrap;
}

.pillDone {
  border-color: rgba(46, 230, 220, 0.95);
  background: rgba(46, 230, 220, 0.2);
  color: #bafbf7;
}

.stage {
  position: relative;
  width: min(1280px, 100%);
  aspect-ratio: 16 / 9;
  min-height: 360px;
  max-height: calc(100vh - 210px);
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid rgba(255, 231, 166, 0.38);
  border-radius: 8px;
  background: #22322b;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.stageArt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sunGlow {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(21, 13, 8, 0.18));
  pointer-events: none;
}

.gate {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 15%;
  min-width: 94px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  color: transparent;
  background: radial-gradient(circle, rgba(46, 230, 220, 0.34), rgba(46, 230, 220, 0.04) 58%, transparent 62%);
  box-shadow: 0 0 26px rgba(46, 230, 220, 0.35);
  opacity: 0.9;
}

.gateIsOpen {
  animation: openPulse 1.1s ease-in-out infinite alternate;
}

.runeHotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  appearance: none;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background: radial-gradient(circle, rgba(46, 230, 220, 0.08), rgba(46, 230, 220, 0.03) 34%, transparent 62%);
  box-shadow: 0 0 16px rgba(46, 230, 220, 0.12);
  cursor: pointer;
  font-size: 0;
}

.runeHotspot strong,
.worldHotspot strong {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  min-width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff7de;
  background: rgba(10, 18, 16, 0.58);
  border: 1px solid rgba(255, 231, 166, 0.22);
  font-size: 0.78rem;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0.88;
}

.runeHotspot::after {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  border: 1px solid rgba(156, 242, 233, 0.14);
  animation: runeBreath 1.8s ease-in-out infinite, runeShimmer 3.2s linear infinite;
}

.worldHotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  appearance: none;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background:
    radial-gradient(circle, rgba(255, 228, 140, 0.06), rgba(255, 228, 140, 0.02) 42%, transparent 68%);
  box-shadow: 0 0 14px rgba(255, 228, 140, 0.08);
  cursor: pointer;
  font-size: 0;
}

.worldHotspot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  opacity: 0.88;
}

.hotspot-character {
  border-color: rgba(46, 230, 220, 0.54);
  background: rgba(23, 55, 58, 0.42);
}

.hotspot-path {
  border-radius: 999px;
}

.hotspot-path strong {
  left: auto;
  right: 0;
  transform: none;
}

.hotspot-gate {
  border-radius: 50%;
}

.worldHotspot:disabled,
.runeHotspot:disabled {
  cursor: default;
}

.worldHotspot[hidden],
.runeHotspot[hidden] {
  display: none;
}

.worldHotspot:hover,
.worldHotspot:focus-visible,
.runeHotspot:hover,
.runeHotspot:focus-visible {
  outline: 0;
  border-color: rgba(255, 231, 166, 0.92);
  box-shadow:
    0 0 0 5px rgba(255, 228, 140, 0.12),
    0 0 36px rgba(46, 230, 220, 0.54);
}

.runeDone {
  background: transparent;
  box-shadow: none;
}

.runeDone::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 236, 153, 0.86), rgba(46, 230, 220, 0.58) 56%, rgba(25, 84, 69, 0.18) 72%, transparent 76%);
  box-shadow:
    0 0 0 8px rgba(255, 228, 140, 0.1),
    0 0 38px rgba(255, 228, 140, 0.7);
}

.runeJustCompleted {
  animation: runeComplete 780ms ease-out both;
}

.svenInWorld {
  position: absolute;
  z-index: 2;
  --sven-direction: 1;
  width: auto;
  height: clamp(168px, 24dvh, 218px);
  transform: translate(-50%, -100%) scaleX(var(--sven-direction));
  transform-origin: 50% 100%;
  transition: none;
  filter: drop-shadow(0 14px 9px rgba(0, 0, 0, 0.35));
  will-change: left, top, transform;
  pointer-events: none;
}

.svenSprite {
  display: block;
  width: auto;
  height: 100%;
}

.sven-facing-left {
  --sven-direction: -1;
}

.sven-idle {
  animation: none;
}

.sven-walking {
  animation: none;
}

.sven-thinking {
  animation: none;
  filter: drop-shadow(0 14px 10px rgba(0, 0, 0, 0.38));
}

.sven-looking,
.sven-talking,
.sven-activating {
  animation: none;
}

.sven-celebrating {
  animation: none;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.38));
}

.sven-arrived {
  animation: none;
}

.dialogue {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 6;
  width: min(980px, calc(100% - 24px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255, 231, 166, 0.32);
  border-radius: 8px;
  background: rgba(14, 22, 20, 0.86);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
}

.portrait {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(46, 230, 220, 0.5);
}

.speech p {
  margin: 0;
  font-size: clamp(0.98rem, 2vw, 1.18rem);
  line-height: 1.24;
}

.speech .speaker {
  margin-bottom: 3px;
  color: #9cf2e9;
  font-size: 0.85rem;
  font-weight: 900;
}

.adventureTeamBar {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 6;
  width: min(1180px, calc(100% - 32px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(16px, 2.4vw, 30px);
  align-items: center;
  min-height: clamp(78px, 10dvh, 96px);
  padding: 10px 20px 10px clamp(242px, 24vw, 320px);
  border: 1px solid rgba(255, 218, 138, 0.52);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% -50%, rgba(255, 204, 108, 0.2), transparent 35%),
    linear-gradient(180deg, rgba(31, 32, 25, 0.91), rgba(7, 14, 13, 0.93));
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 247, 222, 0.14);
  backdrop-filter: blur(12px);
  cursor: default;
  pointer-events: auto;
}

.teamPortraits {
  position: absolute;
  left: clamp(12px, 2vw, 24px);
  bottom: -4px;
  display: flex;
  gap: clamp(6px, 1.2vw, 12px);
  align-items: flex-end;
  width: clamp(230px, 21vw, 310px);
  cursor: default;
  pointer-events: none;
}

.teamPortrait {
  position: relative;
  width: clamp(58px, 7.4dvh, 76px);
  height: clamp(70px, 8.6dvh, 88px);
  margin: 0;
  display: grid;
  place-items: end center;
  overflow: hidden;
  border: 1px solid rgba(255, 231, 166, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 231, 166, 0.14), transparent 62%),
    rgba(255, 247, 222, 0.06);
  transition: width 180ms ease, height 180ms ease, filter 180ms ease, opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.teamPortrait img {
  width: 112%;
  height: 112%;
  object-fit: contain;
  object-position: center bottom;
  transform: translateY(8%);
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.38));
}

.teamPortrait figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.teamPortraitActive {
  width: clamp(154px, 13vw, 210px);
  height: clamp(178px, 17vw, 250px);
  overflow: visible;
  border-color: transparent;
  background: transparent;
  opacity: 1;
  filter: saturate(1.06) brightness(1.06) drop-shadow(0 0 10px rgba(255, 211, 122, 0.2));
  transform: translateY(-24px);
  box-shadow: none;
}

.teamPortraitActive img {
  width: 100%;
  height: 100%;
  transform: translateY(6%);
  filter:
    drop-shadow(0 15px 16px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 12px rgba(255, 204, 108, 0.18));
}

.teamPortraitInactive {
  opacity: 0.56;
  filter: saturate(0.72) brightness(0.7);
}

.teamSpeech {
  position: relative;
  min-width: 0;
  padding: 2px 0 3px clamp(28px, 3vw, 42px);
  color: #fff7de;
  cursor: pointer;
}

.teamPaw {
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 199, 99, 0.82);
  box-shadow:
    0 -9px 0 -5px rgba(255, 199, 99, 0.82),
    -8px -4px 0 -5px rgba(255, 199, 99, 0.82),
    8px -4px 0 -5px rgba(255, 199, 99, 0.82);
}

.teamMeta,
.teamSpeaker,
.teamMessage {
  margin: 0;
}

.teamMeta {
  margin-top: 5px;
  color: rgba(255, 247, 222, 0.5);
  font-size: 0.72rem;
  font-weight: 800;
}

.teamSpeaker {
  color: #ffd06d;
  font-size: clamp(1.18rem, 2.2vw, 1.65rem);
  font-weight: 900;
}

.teamMessage {
  margin-top: 2px;
  max-width: 48rem;
  font-size: clamp(1.18rem, 2.45vw, 1.62rem);
  line-height: 1.14;
  text-wrap: balance;
}

.adventureTeamBar .primaryButton {
  pointer-events: auto;
}

.rewardScreen .rewardPanel {
  z-index: 7;
  margin-bottom: clamp(88px, 13dvh, 112px);
}

.modalLayer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 15, 14, 0.62);
}

.runeLayer {
  place-items: end center;
  padding-bottom: clamp(96px, 17vh, 150px);
  background:
    radial-gradient(circle at var(--rune-screen-x) var(--rune-screen-y), rgba(46, 230, 220, 0.42), rgba(46, 230, 220, 0.12) 18%, transparent 34%),
    linear-gradient(180deg, rgba(8, 15, 14, 0.12), rgba(8, 15, 14, 0.52));
  pointer-events: none;
}

.runePanelLeft {
  place-items: end start;
  padding-left: clamp(18px, 7vw, 96px);
}

.runePanelRight {
  place-items: end end;
  padding-right: clamp(18px, 7vw, 96px);
}

.runeLayer .challengeBox,
.runeLayer button {
  pointer-events: auto;
}

.runeFocusSpark {
  position: absolute;
  left: var(--rune-screen-x);
  top: var(--rune-screen-y);
  width: clamp(74px, 9vw, 118px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(172, 255, 246, 0.72);
  background: radial-gradient(circle, rgba(46, 230, 220, 0.62), rgba(16, 62, 61, 0.2) 62%, transparent 72%);
  box-shadow:
    0 0 0 14px rgba(46, 230, 220, 0.08),
    0 0 68px rgba(46, 230, 220, 0.72);
  animation: runeFocusPulse 1.4s ease-in-out infinite alternate;
  pointer-events: none;
}

.runeFocusCorrect {
  animation: runeComplete 780ms ease-out both, runeFocusPulse 1.2s ease-in-out infinite alternate;
}

.challengeBox {
  position: relative;
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
  padding: clamp(16px, 4vw, 28px);
  border: 2px solid rgba(255, 231, 166, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 242, 202, 0.98), rgba(244, 221, 166, 0.98));
  color: var(--paper-ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.runeChallengeBox {
  width: min(620px, calc(100% - 24px));
  border-color: rgba(103, 255, 241, 0.72);
  background:
    radial-gradient(circle at 18% 0%, rgba(46, 230, 220, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(25, 45, 40, 0.88), rgba(14, 26, 24, 0.9));
  color: #fff7de;
  backdrop-filter: blur(7px);
  box-shadow:
    0 0 0 1px rgba(46, 230, 220, 0.22),
    0 22px 70px rgba(0, 0, 0, 0.48),
    0 0 52px rgba(46, 230, 220, 0.18);
}

.runeChallengeBox::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -46px;
  width: 2px;
  height: 46px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(156, 242, 233, 0.86));
  box-shadow: 0 0 18px rgba(46, 230, 220, 0.7);
}

.challengeHeader {
  display: grid;
  grid-template-columns: clamp(88px, 16vw, 124px) minmax(0, 1fr);
  gap: clamp(12px, 2.4vw, 18px);
  align-items: center;
}

.challengeHeader img {
  width: 100%;
  height: clamp(92px, 17vw, 132px);
  object-fit: cover;
  object-position: center 18%;
  border-radius: 8px;
  border: 2px solid rgba(156, 242, 233, 0.48);
  background: rgba(6, 26, 24, 0.56);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.28),
    0 0 28px rgba(46, 230, 220, 0.18);
}

.challengeHeader h2,
.successBox h2 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.9rem);
  line-height: 1;
  letter-spacing: 0;
}

.challengeCharacterSpeech p:last-child {
  margin: 6px 0 0;
  color: #fff0bc;
  font-size: clamp(1rem, 2.3vw, 1.25rem);
  font-weight: 850;
  line-height: 1.22;
}

.feedback {
  min-height: 2.6em;
  margin: 18px 0 8px;
  color: #4c3216;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  font-weight: 800;
  line-height: 1.3;
}

.runeChallengeBox .feedback {
  color: #fff0bc;
}

.sum {
  margin: 8px 0 18px;
  font-size: clamp(1.55rem, 7vw, 3rem);
  font-weight: 1000;
  line-height: 1.05;
}

.runeWhisper {
  margin: -8px 0 14px;
  color: #9cf2e9;
  font-size: 0.95rem;
  font-weight: 900;
}

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

.choices button {
  min-height: 74px;
  font-size: clamp(1.45rem, 6vw, 2.5rem);
}

.runeChallengeBox .answerStone {
  color: #eafffb;
  background:
    radial-gradient(circle at 50% 22%, rgba(46, 230, 220, 0.34), transparent 50%),
    linear-gradient(180deg, #24423e, #142b29);
  border: 2px solid rgba(156, 242, 233, 0.72);
  box-shadow: 0 7px 0 #061a18, 0 14px 28px rgba(0, 0, 0, 0.32);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.successBox {
  text-align: center;
}

.runeBurst {
  width: 96px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--teal), var(--teal-dark));
  box-shadow: 0 0 42px rgba(46, 230, 220, 0.75);
}

.badge {
  display: inline-flex;
  margin: 4px 0 14px;
  border-color: rgba(46, 230, 220, 0.8);
  background: rgba(46, 230, 220, 0.18);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

@keyframes runeBreath {
  0% {
    transform: scale(0.94);
    opacity: 0.35;
  }
  100% {
    transform: scale(1.08);
    opacity: 0.85;
  }
}

@keyframes transitionBreathe {
  from {
    opacity: 0.72;
    transform: scale(1);
  }

  to {
    opacity: 1;
    transform: scale(1.03);
  }
}

@keyframes runeShimmer {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(156, 242, 233, 0);
  }
  45% {
    box-shadow: 0 0 24px rgba(156, 242, 233, 0.46);
  }
}

@keyframes runeFocusPulse {
  0% {
    filter: brightness(0.96);
    opacity: 0.82;
  }
  100% {
    filter: brightness(1.24);
    opacity: 1;
  }
}

@keyframes openPulse {
  0% {
    box-shadow: 0 0 26px rgba(46, 230, 220, 0.45);
    opacity: 0.8;
  }
  100% {
    box-shadow: 0 0 70px rgba(255, 228, 140, 0.95);
    opacity: 1;
  }
}

@keyframes svenIdle {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scaleX(var(--sven-direction));
  }
  50% {
    transform: translateX(-50%) translateY(-2px) scaleX(var(--sven-direction));
  }
}

@keyframes svenStep {
  0% {
    transform: translateX(-50%) translateY(0) rotate(-2deg) scaleX(var(--sven-direction));
  }
  100% {
    transform: translateX(-50%) translateY(-5px) rotate(2deg) scaleX(var(--sven-direction));
  }
}

@keyframes svenThink {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) rotate(0deg) scaleX(var(--sven-direction));
  }
  35% {
    transform: translateX(-52%) translateY(-1px) rotate(-2deg) scaleX(var(--sven-direction));
  }
  70% {
    transform: translateX(-48%) translateY(0) rotate(2deg) scaleX(var(--sven-direction));
  }
}

@keyframes svenAttend {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) rotate(0deg) scaleX(var(--sven-direction));
  }
  50% {
    transform: translateX(-50%) translateY(-1px) rotate(1deg) scaleX(var(--sven-direction));
  }
}

@keyframes svenCelebrate {
  0% {
    transform: translateX(-50%) translateY(0) scale(1) scaleX(var(--sven-direction));
  }
  42% {
    transform: translateX(-50%) translateY(-18px) scale(1.07) scaleX(var(--sven-direction));
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1) scaleX(var(--sven-direction));
  }
}

@keyframes svenArrive {
  0% {
    transform: translateX(-50%) translateY(-4px) scaleX(var(--sven-direction));
  }
  100% {
    transform: translateX(-50%) translateY(0) scaleX(var(--sven-direction));
  }
}

@keyframes runeComplete {
  0% {
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
  45% {
    transform: translate(-50%, -50%) scale(1.2);
    filter: brightness(1.45);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1.1);
  }
}

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

@media (orientation: portrait) {
  .gameShell {
    min-height: 100dvh;
    grid-template-rows: auto auto auto auto;
    align-content: start;
  }

  .stage,
  .stageViewport {
    max-height: none;
  }
}

@media (max-width: 780px) {
  .levelTile {
    min-height: 220px;
  }

  .levelTileShade {
    background:
      linear-gradient(180deg, rgba(6, 13, 12, 0.08), rgba(6, 13, 12, 0.86)),
      linear-gradient(90deg, rgba(6, 13, 12, 0.48), transparent 70%);
  }

  .levelTileText {
    inset: auto 0 0;
    width: auto;
    align-content: end;
    padding: 18px;
  }

  .gameShell {
    grid-template-rows: auto auto auto;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .progressPills {
    justify-content: flex-start;
  }

  .stage {
    min-height: 340px;
    max-height: none;
  }

  .stageViewport {
    min-height: 340px;
    max-height: none;
  }

  .dialogue {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .adventureTeamBar {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 92px;
    padding: 10px 12px 10px 156px;
  }

  .teamPortrait {
    width: 46px;
    height: 58px;
  }

  .teamPortraitActive {
    width: 104px;
    height: 128px;
    transform: translateY(-12px);
  }

  .teamPortraits {
    left: 10px;
    bottom: -3px;
    width: 142px;
    gap: 5px;
  }

  .teamMeta {
    margin-top: 4px;
    font-size: 0.68rem;
  }

  .teamSpeaker {
    font-size: 1.03rem;
  }

  .teamMessage {
    max-width: 100%;
    font-size: clamp(1rem, 3.5vw, 1.28rem);
    line-height: 1.14;
  }

  .dialogue .primaryButton,
  .adventureTeamBar .primaryButton,
  .miniHint {
    grid-column: 1 / -1;
    justify-self: stretch;
    text-align: center;
  }

  .runePanelLeft,
  .runePanelRight {
    place-items: end center;
    padding-left: 16px;
    padding-right: 16px;
  }

  .portrait {
    width: 56px;
    height: 56px;
  }

  .svenInWorld {
    height: clamp(150px, 24dvh, 206px);
  }

  .runeHotspot {
    min-width: 0;
  }

  .worldHotspot {
    min-width: 0;
  }

  .choices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .stage {
    aspect-ratio: 4 / 5;
  }

  .stageViewport {
    aspect-ratio: 4 / 5;
  }

  .stageArt {
    object-position: 50% center;
  }

  .gate {
    top: 46%;
  }

  .runeHotspot {
    min-width: 0;
  }
}
