:root {
  --paper: #f3eadb;
  --paper-strong: #ebdeca;
  --ink: #18212a;
  --muted: #5e635f;
  --olive: #69704d;
  --terracotta: #b4583d;
  --terracotta-deep: #8d422d;
  --sky: #b8d0d9;
  --night: #1c2a36;
  --shadow: 0 28px 60px rgba(28, 42, 54, 0.18);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --panel-border: rgba(24, 33, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 208, 217, 0.7), transparent 32%),
    radial-gradient(circle at bottom right, rgba(180, 88, 61, 0.18), transparent 28%),
    linear-gradient(140deg, #efe6d7 0%, #e9dfcd 45%, #e7ddcb 100%);
}

body.scene-open {
  overflow: hidden;
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  padding: 24px;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  align-items: start;
}

.story-panel {
  order: 2;
  position: relative;
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
  padding: 24px;
  display: grid;
  gap: 14px;
  border: 1px solid rgba(24, 33, 42, 0.08);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.16)),
    rgba(243, 234, 219, 0.84);
  backdrop-filter: blur(14px);
  overflow-x: hidden;
  overflow-y: auto;
}

.story-panel::-webkit-scrollbar {
  width: 10px;
}

.story-panel::-webkit-scrollbar-thumb {
  background: rgba(24, 33, 42, 0.16);
  border-radius: 999px;
}

.story-glow {
  position: absolute;
  inset: auto auto 12% -8%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(180, 88, 61, 0.18), transparent 68%);
  pointer-events: none;
}

.hero,
.journey-card,
.cast-card,
.dialogue-card,
.ending-card,
.footer-note {
  position: relative;
  z-index: 1;
}

.hero h1,
.journey-card h2,
.cast-card h2,
.dialogue-card h2,
.map-topline h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 0.95;
  max-width: none;
}

.hero-copy,
.journey-copy,
.dialogue-text,
.map-note {
  margin: 0;
  line-height: 1.6;
  color: rgba(24, 33, 42, 0.78);
}

.hero-copy {
  max-width: 34ch;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--terracotta-deep);
}

.panel-tag {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(24, 33, 42, 0.06);
  color: rgba(24, 33, 42, 0.68);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.stat-card,
.journey-card,
.cast-card,
.dialogue-card,
.ending-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.74));
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 16px 18px;
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(24, 33, 42, 0.56);
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
  font-weight: 800;
}

.journey-card,
.cast-card,
.dialogue-card,
.ending-card {
  padding: 18px;
}

.journey-heading,
.cast-heading,
.map-topline {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}

.progress-block {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  color: rgba(24, 33, 42, 0.68);
}

.source-pill,
.encounter-counter {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(105, 112, 77, 0.12);
  color: var(--olive);
  font-size: 0.8rem;
  font-weight: 700;
}

.progress-rail {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: rgba(24, 33, 42, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--terracotta), #d38b58);
  transition: width 180ms ease-out;
}

.controls {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.mobile-map-controls {
  display: none;
  gap: 10px;
}

.move-button,
.ghost-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.move-button {
  background: #e7dbc4;
  color: var(--ink);
}

.move-button--accent {
  background: var(--terracotta);
  color: #fff8f2;
}

.ghost-button {
  background: rgba(24, 33, 42, 0.06);
  color: var(--ink);
}

.move-button:hover,
.ghost-button:hover,
.move-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(28, 42, 54, 0.12);
}

.move-button:disabled,
.ghost-button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.help-text,
.footer-note {
  color: rgba(24, 33, 42, 0.62);
  font-size: 0.92rem;
  line-height: 1.55;
}

.location-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(180, 88, 61, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 248, 242, 0.98), rgba(255, 243, 233, 0.86)),
    rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 28px rgba(141, 66, 45, 0.08);
}

.location-action__eyebrow,
.location-action__title,
.location-action__copy {
  margin: 0;
}

.location-action__eyebrow {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta-deep);
}

.location-action__title {
  margin-top: 4px;
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.location-action__copy {
  margin-top: 6px;
  color: rgba(24, 33, 42, 0.68);
  line-height: 1.5;
}

.cast-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 10px;
}

.cast-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(24, 33, 42, 0.06);
  text-align: left;
}

button.cast-item {
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button.cast-item:hover,
button.cast-item:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(28, 42, 54, 0.12);
  border-color: rgba(180, 88, 61, 0.32);
  background: rgba(255, 250, 245, 0.95);
}

button.cast-item:disabled {
  cursor: default;
  transform: none;
  box-shadow: none;
  opacity: 0.72;
}

.cast-meta {
  display: grid;
  gap: 4px;
}

.cast-jump {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(24, 33, 42, 0.5);
}

.cast-avatar,
.dialogue-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-deep));
}

.cast-name {
  margin: 0;
  font-weight: 800;
}

.cast-role,
.dialogue-role {
  margin: 4px 0 0;
  color: rgba(24, 33, 42, 0.62);
  font-size: 0.9rem;
}

.cast-state {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cast-state--waiting {
  background: rgba(184, 208, 217, 0.35);
  color: var(--night);
}

.cast-state--done {
  background: rgba(105, 112, 77, 0.16);
  color: var(--olive);
}

.cast-state--active {
  background: rgba(180, 88, 61, 0.14);
  color: var(--terracotta-deep);
}

.dialogue-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
}

.dialogue-options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.dialogue-option {
  border: 1px solid rgba(24, 33, 42, 0.08);
  border-radius: var(--radius-md);
  background: #fffaf5;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
}

.dialogue-option:hover,
.dialogue-option:focus-visible {
  border-color: rgba(180, 88, 61, 0.4);
  box-shadow: 0 10px 24px rgba(180, 88, 61, 0.12);
}

.dialogue-option strong {
  display: block;
  margin-bottom: 4px;
}

.dialogue-option span {
  display: block;
  line-height: 1.5;
  color: rgba(24, 33, 42, 0.66);
}

.is-hidden {
  display: none;
}

.map-panel {
  order: 1;
  min-height: calc(100vh - 48px);
  padding: 0;
  display: grid;
  align-items: start;
}

.map-frame {
  width: min(100%, calc(100vh - 48px));
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  justify-self: center;
  border-radius: 34px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(24, 33, 42, 0.94), rgba(24, 33, 42, 0.78)),
    radial-gradient(circle at 10% 10%, rgba(184, 208, 217, 0.2), transparent 34%);
  box-shadow: var(--shadow);
}

.map-topline {
  color: #f8efe1;
  align-items: center;
}

.map-topline .eyebrow {
  color: #d6ae88;
}

.map-note {
  max-width: 30ch;
  color: rgba(248, 239, 225, 0.76);
}

.map-canvas {
  min-height: 0;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0f1821;
}

.npc-pin,
.terminal-pin {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px rgba(24, 33, 42, 0.22);
}

.player-pin {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  border: 2px solid rgba(255, 248, 242, 0.92);
  background: linear-gradient(145deg, #ffb46a, #b4583d 72%);
  box-shadow: 0 14px 28px rgba(24, 33, 42, 0.28);
  transform-origin: center bottom;
  filter: drop-shadow(0 16px 24px rgba(24, 33, 42, 0.22));
  animation: playerIdle 2.2s ease-in-out infinite;
}

.player-pin::before {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: #b4583d;
  border-radius: 4px;
  transform: translateX(-50%) rotate(45deg);
}

.player-pin::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 26px;
  border: 1px solid rgba(255, 180, 106, 0.5);
  animation: pulse 2.4s infinite;
}

.player-pin__emoji {
  font-size: 28px;
  line-height: 1;
  transform: translateY(-1px);
}

.player-pin__label {
  position: absolute;
  top: -8px;
  right: -10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff8f2;
  color: var(--terracotta-deep);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.player-pin--walking {
  animation: playerWalkBounce 180ms ease-in-out infinite;
}

.player-pin--walking::before {
  transform: translateX(-50%) rotate(45deg);
}

.bar-pin {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 2px solid rgba(255, 248, 242, 0.94);
  background: linear-gradient(180deg, #6f3828, #2f1b17);
  box-shadow: 0 12px 24px rgba(24, 33, 42, 0.24);
  font-size: 22px;
  line-height: 1;
}

.bar-pin--active {
  transform: scale(1.08);
  box-shadow: 0 16px 30px rgba(180, 88, 61, 0.36);
}

.panel-tag--dark {
  background: rgba(255, 248, 242, 0.14);
  color: rgba(255, 248, 242, 0.82);
}

.bar-scene {
  position: fixed;
  inset: 0;
  z-index: 5000;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at top, rgba(237, 169, 120, 0.24), transparent 22%),
    rgba(16, 13, 18, 0.74);
  backdrop-filter: blur(12px);
}

.bar-scene__panel {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 34px;
  color: #f8efe1;
  background:
    radial-gradient(circle at top, rgba(255, 195, 134, 0.14), transparent 30%),
    linear-gradient(180deg, #2d1714 0%, #201111 48%, #160d10 100%);
  box-shadow: 0 30px 80px rgba(9, 6, 9, 0.48);
}

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

.bar-scene__header h2,
.bar-card h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.bar-scene__header h2 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.bar-scene__lede {
  max-width: 44ch;
  margin: 12px 0 0;
  color: rgba(248, 239, 225, 0.76);
  line-height: 1.6;
}

.bar-scene__close {
  color: #fff8f2;
  background: rgba(255, 248, 242, 0.12);
}

.bar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-top: 22px;
}

.bar-floor-wrap {
  display: grid;
  gap: 12px;
}

.bar-floor {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(255, 248, 242, 0.08);
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 208, 149, 0.1), transparent 18%),
    linear-gradient(135deg, rgba(60, 31, 24, 0.98), rgba(39, 21, 18, 0.98)),
    repeating-linear-gradient(
      90deg,
      rgba(151, 90, 63, 0.12) 0,
      rgba(151, 90, 63, 0.12) 14px,
      rgba(78, 43, 33, 0.12) 14px,
      rgba(78, 43, 33, 0.12) 28px
    );
}

.bar-floor::before {
  content: "";
  position: absolute;
  inset: 18px 20px auto 20px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 218, 166, 0.08), rgba(255, 218, 166, 0.22));
}

.bar-floor__counter {
  position: absolute;
  top: 36px;
  right: 28px;
  bottom: 36px;
  width: clamp(96px, 15vw, 148px);
  border-radius: 30px;
  border: 1px solid rgba(255, 230, 197, 0.1);
  background:
    linear-gradient(180deg, rgba(127, 70, 50, 0.96), rgba(72, 35, 29, 0.96));
  box-shadow:
    inset 10px 0 18px rgba(255, 220, 176, 0.08),
    inset -10px 0 18px rgba(17, 8, 9, 0.12);
}

.bar-floor__counter span {
  position: absolute;
  left: 50%;
  top: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgba(26, 13, 12, 0.28);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bar-floor__door {
  position: absolute;
  left: 34px;
  bottom: 28px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 232, 196, 0.12);
  background: rgba(23, 12, 11, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
}

.bar-floor__table {
  position: absolute;
  width: clamp(88px, 13vw, 132px);
  height: clamp(88px, 13vw, 132px);
  border-radius: 999px;
  border: 1px solid rgba(255, 236, 205, 0.12);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 221, 186, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(120, 67, 48, 0.94), rgba(70, 36, 30, 0.94));
  box-shadow: inset 0 14px 24px rgba(255, 231, 201, 0.06);
}

.bar-floor__table::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: inherit;
  border: 1px dashed rgba(255, 239, 214, 0.1);
}

.bar-floor__table--one {
  top: 13%;
  left: 8%;
}

.bar-floor__table--two {
  top: 15%;
  left: 39%;
}

.bar-floor__table--three {
  top: 49%;
  left: 11%;
}

.bar-floor__table--four {
  top: 52%;
  left: 44%;
}

.bar-floor__table--five {
  top: 37%;
  left: 68%;
}

.bar-floor__ambient,
.bar-floor__actors {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.bar-floor__ambient-guest,
.bar-floor__actor {
  position: absolute;
  display: grid;
  justify-items: center;
  transform: translate(-50%, -50%);
}

.bar-floor__ambient-guest {
  gap: 6px;
}

.bar-floor__ambient-emoji {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 248, 242, 0.12);
  border: 1px solid rgba(255, 248, 242, 0.06);
  font-size: 1.2rem;
}

.bar-floor__ambient-label {
  font-size: 0.74rem;
  color: rgba(248, 239, 225, 0.56);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bar-floor__actor {
  appearance: none;
  gap: 8px;
  min-width: 94px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.bar-floor__actor-emoji {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 2px solid rgba(255, 248, 242, 0.92);
  background: linear-gradient(180deg, #d38b58, #8d422d);
  box-shadow: 0 14px 26px rgba(10, 4, 7, 0.24);
  font-size: 1.6rem;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.bar-floor__actor-label {
  max-width: 13ch;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.bar-floor__actor:hover .bar-floor__actor-emoji,
.bar-floor__actor:focus-visible .bar-floor__actor-emoji,
.bar-floor__actor.is-selected .bar-floor__actor-emoji {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(255, 231, 193, 1);
  box-shadow: 0 18px 32px rgba(218, 144, 91, 0.24);
}

.bar-floor__hint {
  margin: 0;
  color: rgba(248, 239, 225, 0.68);
  line-height: 1.5;
}

.bar-sidebar {
  display: grid;
  gap: 18px;
}

.bar-card {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(255, 248, 242, 0.08);
  background: rgba(255, 248, 242, 0.06);
}

.bar-card--focus {
  background:
    linear-gradient(180deg, rgba(255, 248, 242, 0.08), rgba(255, 248, 242, 0.04)),
    rgba(255, 248, 242, 0.04);
}

.bar-dialogue-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.bar-dialogue-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #d38b58, #8d422d);
  font-size: 1.55rem;
}

.bar-dialogue-role,
.bar-dialogue-text,
.bar-mission-card p,
.bar-mission-log__reward {
  margin: 0;
}

.bar-dialogue-role {
  color: rgba(248, 239, 225, 0.66);
  font-size: 0.88rem;
}

.bar-dialogue-text {
  margin-top: 14px;
  color: rgba(248, 239, 225, 0.84);
  line-height: 1.65;
}

.bar-dialogue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.bar-dialogue-actions .move-button {
  width: 100%;
}

.bar-mission-status,
.bar-mission-log {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar-mission-card,
.bar-mission-log__item,
.bar-mission-log__empty {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 248, 242, 0.08);
  border: 1px solid rgba(255, 248, 242, 0.08);
}

.bar-mission-card--available {
  background: rgba(211, 139, 88, 0.12);
}

.bar-mission-card--quiet {
  background: rgba(255, 248, 242, 0.05);
}

.bar-mission-card__eyebrow,
.bar-mission-log__title {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bar-mission-card h4 {
  margin: 10px 0 8px;
  font-family: "Fraunces", serif;
  font-size: 1.16rem;
  font-weight: 700;
}

.bar-mission-card__progress,
.bar-mission-card__reward,
.bar-mission-log__reward,
.bar-mission-log__empty {
  margin-top: 10px;
  color: rgba(248, 239, 225, 0.72);
  line-height: 1.5;
}

.npc-pin {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 16px;
  background: var(--night);
  font-size: 20px;
  line-height: 1;
}

.npc-pin--visited {
  background: var(--olive);
}

.terminal-pin {
  background: #d6ae88;
}

@keyframes pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.8;
  }
  70% {
    transform: scale(1.25);
    opacity: 0;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

@keyframes playerIdle {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-3px) rotate(2deg);
  }
}

@keyframes playerWalkBounce {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .page-shell {
    height: auto;
    min-height: 100dvh;
    padding: 18px;
    grid-template-columns: 1fr;
  }

  .story-panel {
    order: 2;
    height: auto;
    border-right: none;
    overflow: visible;
  }

  .map-panel {
    order: 1;
    min-height: auto;
  }

  .map-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: min(68vh, 560px);
  }

  .bar-scene {
    padding: 18px;
  }

  .bar-scene__panel {
    padding: 22px;
  }

  .bar-layout {
    grid-template-columns: 1fr;
  }

  .bar-floor {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 14px;
    gap: 12px;
  }

  .story-panel {
    padding: 16px;
    gap: 12px;
    border-radius: 26px;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 8vw, 2.35rem);
    line-height: 0.98;
  }

  .journey-card,
  .cast-card,
  .dialogue-card,
  .ending-card {
    padding: 14px;
    border-radius: 22px;
  }

  .map-frame {
    height: calc(100dvh - 28px);
    min-height: calc(100dvh - 28px);
    max-height: calc(100dvh - 28px);
    aspect-ratio: auto;
    padding: 12px;
    gap: 10px;
    border-radius: 26px;
  }

  .map-topline h2 {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
  }

  .map-canvas {
    min-height: 0;
    height: 100%;
    border-radius: 18px;
  }

  .map-note {
    max-width: none;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .journey-heading,
  .cast-heading,
  .map-topline,
  .progress-meta {
    flex-direction: column;
  }

  .controls--desktop {
    display: none;
  }

  .mobile-map-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-map-controls .move-button,
  .dialogue-card .move-button {
    width: 100%;
  }

  .location-action {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .location-action .move-button {
    width: 100%;
  }

  .cast-item {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px;
  }

  .cast-state {
    grid-column: 2;
    justify-self: start;
  }

  .cast-avatar,
  .dialogue-avatar {
    width: 42px;
    height: 42px;
    font-size: 22px;
  }

  .dialogue-shell {
    gap: 12px;
  }

  .dialogue-option {
    padding: 12px 14px;
  }

  .help-text,
  .footer-note,
  .cast-role,
  .dialogue-role {
    font-size: 0.88rem;
  }

  .bar-scene {
    padding: 10px;
  }

  .bar-scene__panel {
    padding: 16px;
    border-radius: 24px;
  }

  .bar-layout {
    gap: 14px;
  }

  .bar-scene__header {
    flex-direction: column;
  }

  .bar-scene__close {
    width: 100%;
  }

  .bar-floor {
    min-height: 500px;
    border-radius: 24px;
  }

  .bar-floor__counter {
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: 104px;
  }

  .bar-floor__counter span {
    top: 12px;
    font-size: 0.66rem;
  }

  .bar-floor__door {
    left: 18px;
    bottom: 18px;
  }

  .bar-floor__actor-emoji {
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }

  .bar-floor__actor-label,
  .bar-floor__ambient-label {
    font-size: 0.68rem;
  }

  .bar-card {
    padding: 16px;
  }

  .bar-dialogue-shell {
    gap: 12px;
  }

  .bar-dialogue-avatar {
    width: 46px;
    height: 46px;
    font-size: 1.35rem;
  }
}

@media (max-width: 420px) {
  .page-shell {
    padding:
      max(10px, env(safe-area-inset-top))
      10px
      max(10px, env(safe-area-inset-bottom))
      10px;
  }

  .story-panel {
    padding: 14px;
  }

  .map-frame {
    height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

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

  .mobile-map-controls {
    grid-template-columns: 1fr;
  }

  .cast-item {
    grid-template-columns: 1fr;
  }

  .cast-avatar {
    width: 40px;
    height: 40px;
  }

  .cast-state {
    grid-column: auto;
  }

  .bar-floor {
    min-height: 430px;
  }

  .bar-floor__counter {
    width: 88px;
  }

  .bar-floor__actor {
    min-width: 72px;
  }

  .bar-floor__ambient-label,
  .bar-floor__actor-label {
    display: none;
  }
}
