* {
  box-sizing: border-box;
}

:root {
  --bg: #efe4d3;
  --bg-soft: rgba(255, 249, 240, 0.7);
  --surface: rgba(255, 248, 238, 0.82);
  --surface-strong: rgba(255, 249, 242, 0.96);
  --surface-line: rgba(103, 74, 52, 0.14);
  --ink: #2e231d;
  --ink-soft: rgba(46, 35, 29, 0.68);
  --accent: #9b5d34;
  --accent-strong: #6f3f22;
  --accent-soft: rgba(155, 93, 52, 0.14);
  --glow: rgba(203, 140, 84, 0.28);
  --success: #2f7a57;
  --danger: #a1452e;
  --shadow: 0 20px 45px rgba(60, 37, 18, 0.12);
  --shadow-soft: 0 10px 24px rgba(60, 37, 18, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --app-width: 1080px;
}

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

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 252, 247, 0.7), transparent 30%),
    radial-gradient(circle at bottom right, rgba(212, 153, 101, 0.16), transparent 25%),
    linear-gradient(180deg, #f7efe4 0%, #eee0c9 100%);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.background-glow {
  position: fixed;
  inset: auto;
  width: 48vw;
  height: 48vw;
  border-radius: 999px;
  filter: blur(36px);
  pointer-events: none;
  z-index: 0;
}

.background-glow--left {
  top: -10vw;
  left: -10vw;
  background: rgba(224, 165, 121, 0.24);
}

.background-glow--right {
  right: -8vw;
  bottom: 5vh;
  background: rgba(150, 178, 137, 0.18);
}

.app-frame {
  position: relative;
  z-index: 1;
  width: min(100%, var(--app-width));
  margin: 0 auto;
}

.view {
  display: none;
  gap: 18px;
}

.view--active {
  display: grid;
}

.hero-card,
.levels-panel,
.scene-panel,
.objects-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 250, 244, 0.94), rgba(251, 244, 235, 0.84)),
    linear-gradient(125deg, rgba(255, 255, 255, 0.32), transparent 45%);
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card,
.levels-panel,
.objects-panel {
  padding: 22px;
}

.scene-panel {
  padding: 14px;
}

.hero-card::before,
.levels-panel::before,
.scene-panel::before,
.objects-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.45), transparent 24%),
    linear-gradient(180deg, transparent, rgba(155, 93, 52, 0.035));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  margin: 0;
  line-height: 0.96;
}

h1 {
  font-size: clamp(3rem, 10vw, 5.6rem);
  letter-spacing: -0.05em;
}

h2 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: -0.04em;
}

h3 {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  letter-spacing: -0.035em;
}

.hero-copy,
.panel-copy,
#levelMeta,
#completionCopy {
  margin: 0;
  line-height: 1.6;
  color: var(--ink-soft);
}

.hero-copy {
  margin-top: 14px;
  max-width: 34rem;
  font-size: 1.02rem;
}

.hero-layout {
  display: grid;
  gap: 24px;
}

.hero-main {
  display: grid;
  align-content: start;
}

.hero-showcase {
  position: relative;
  min-height: 260px;
  padding-top: 10px;
}

.hero-showcase__card {
  position: absolute;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(103, 74, 52, 0.12);
  box-shadow: 0 22px 46px rgba(60, 37, 18, 0.18);
  background: rgba(255, 250, 244, 0.9);
}

.hero-showcase__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-showcase__card--large {
  right: 6px;
  top: 12px;
  width: min(100%, 270px);
  aspect-ratio: 4 / 5;
  transform: rotate(5deg);
}

.hero-showcase__card--top {
  left: 10px;
  top: 0;
  width: 34%;
  min-width: 110px;
  aspect-ratio: 4 / 5;
  transform: rotate(-8deg);
}

.hero-showcase__card--bottom {
  left: 22%;
  bottom: 8px;
  width: 38%;
  min-width: 120px;
  aspect-ratio: 4 / 5;
  transform: rotate(-2deg);
}

.hero-showcase__plaque {
  position: absolute;
  left: 6px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(33, 24, 18, 0.82);
  color: rgba(255, 249, 242, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 36px rgba(36, 24, 16, 0.2);
}

.hero-showcase__plaque span {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-actions,
.scene-toolbar,
.scene-toolbar__cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  margin-top: 20px;
}

.hero-actions--tight {
  margin-top: 22px;
}

.primary-button,
.ghost-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    opacity 180ms ease;
}

.primary-button {
  color: white;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, white), var(--accent-strong));
  box-shadow: 0 16px 34px rgba(111, 63, 34, 0.22);
  font-weight: 700;
}

.ghost-button {
  background: rgba(255, 250, 245, 0.74);
  color: var(--ink);
  border: 1px solid rgba(103, 74, 52, 0.14);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}

.primary-button--small,
.ghost-button--small {
  padding: 11px 14px;
  font-size: 0.94rem;
}

.primary-button:hover,
.primary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.ghost-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 3px;
}

.hero-stats,
.difficulty-bar,
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-stats {
  margin-top: 18px;
}

.stat-chip,
.difficulty-bar span,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 252, 249, 0.7);
  border: 1px solid rgba(103, 74, 52, 0.11);
  color: var(--ink-soft);
}

.difficulty-bar {
  padding: 0 6px;
}

.difficulty-bar span {
  background: rgba(255, 248, 238, 0.58);
  font-size: 0.84rem;
  font-weight: 700;
}

.panel-heading {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-heading--compact {
  margin-bottom: 16px;
}

.panel-copy--compact {
  font-size: 0.95rem;
}

.levels-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.level-card {
  display: grid;
  gap: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(103, 74, 52, 0.12);
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.94), rgba(247, 239, 229, 0.84));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 44%, white);
  box-shadow: 0 18px 34px rgba(79, 48, 28, 0.15);
}

.level-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 3px;
}

.level-card__art {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(161, 117, 77, 0.4), rgba(104, 133, 114, 0.32)),
    url("./assets/ui/placeholder-scene.svg") center / cover no-repeat;
}

.level-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.level-card__badge-row,
.level-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.level-card__badge,
.level-card__meta span {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.9);
  border: 1px solid rgba(103, 74, 52, 0.1);
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.level-card__title {
  display: grid;
  gap: 8px;
}

.level-card__copy {
  margin: 0;
  line-height: 1.55;
  color: var(--ink-soft);
}

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

.level-card__bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(103, 74, 52, 0.08);
  overflow: hidden;
}

.level-card__bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, white));
}

.game-header {
  display: grid;
  gap: 14px;
  align-items: start;
}

.game-header__copy {
  display: grid;
  gap: 8px;
}

.scene-toolbar {
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 12px;
}

.scene-stage {
  position: relative;
  overflow: hidden;
  width: min(100%, 520px, calc(78vh * 0.8));
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(47, 31, 21, 0.08), rgba(18, 11, 7, 0.2)),
    url("./assets/ui/placeholder-scene.svg") center / cover no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -32px 64px rgba(18, 11, 7, 0.14);
  touch-action: none;
}

.scene-stage__canvas {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.scene-stage__canvas img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-stage__markers,
.scene-stage__pulse {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.found-marker {
  position: absolute;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  margin-top: -15px;
  border-radius: 999px;
  border: 2px solid rgba(255, 250, 240, 0.92);
  background:
    radial-gradient(circle, rgba(255, 250, 240, 0.98) 0, rgba(255, 250, 240, 0.12) 48%, transparent 70%);
  box-shadow:
    0 0 0 8px rgba(255, 250, 240, 0.1),
    0 0 28px rgba(255, 250, 240, 0.4);
  animation: markerReveal 460ms ease;
}

.scene-stage__pulse::before {
  content: "";
  position: absolute;
  left: var(--pulse-x, 50%);
  top: var(--pulse-y, 50%);
  width: 76px;
  height: 76px;
  margin-left: -38px;
  margin-top: -38px;
  border-radius: 999px;
  border: 2px solid rgba(255, 245, 227, 0.96);
  box-shadow:
    0 0 0 12px rgba(255, 244, 232, 0.08),
    0 0 32px rgba(255, 239, 213, 0.35);
  animation: pulseHint 1.3s ease 2;
}

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

.scene-stage__badge {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(35, 24, 17, 0.48);
  color: rgba(255, 249, 241, 0.95);
  font-size: 0.84rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.scene-stage__badge--soft {
  background: rgba(255, 247, 236, 0.78);
  color: rgba(35, 24, 17, 0.76);
}

.status-strip {
  margin-top: 14px;
}

.status-pill--success {
  color: var(--success);
  background: rgba(47, 122, 87, 0.1);
}

.status-pill--warn {
  color: var(--accent-strong);
  background: rgba(155, 93, 52, 0.12);
}

.status-pill--danger {
  color: var(--danger);
  background: rgba(161, 69, 46, 0.12);
}

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

.object-card {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 14px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.94), rgba(248, 241, 233, 0.88));
  border: 1px solid rgba(103, 74, 52, 0.12);
  box-shadow: var(--shadow-soft);
}

.object-card__index {
  display: inline-flex;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 0.84rem;
}

.object-card__name {
  font-weight: 800;
  line-height: 1.3;
}

.object-card__hint {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.object-card--found {
  background:
    linear-gradient(180deg, rgba(240, 252, 244, 0.95), rgba(232, 248, 238, 0.9));
  border-color: rgba(47, 122, 87, 0.18);
}

.object-card--found .object-card__index {
  background: rgba(47, 122, 87, 0.12);
  color: var(--success);
}

.object-card--found .object-card__name {
  color: var(--success);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  min-width: min(90vw, 320px);
  max-width: min(90vw, 420px);
  padding: 14px 16px;
  border-radius: 18px;
  color: white;
  background: rgba(30, 22, 17, 0.88);
  box-shadow: 0 18px 40px rgba(18, 12, 8, 0.24);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  z-index: 20;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.completion-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.completion-dialog::backdrop {
  background: rgba(29, 18, 11, 0.42);
  backdrop-filter: blur(8px);
}

.completion-card {
  width: min(92vw, 480px);
  padding: 24px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.97), rgba(248, 239, 226, 0.96));
  color: var(--ink);
  box-shadow: 0 28px 56px rgba(36, 22, 12, 0.22);
}

@keyframes markerReveal {
  from {
    opacity: 0;
    transform: scale(0.4);
  }

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

@keyframes pulseHint {
  0% {
    opacity: 0.95;
    transform: scale(0.4);
  }

  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@media (min-width: 700px) {
  .hero-card,
  .levels-panel,
  .objects-panel {
    padding: 26px;
  }

  .hero-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    align-items: center;
  }

  .hero-showcase {
    min-height: 340px;
  }

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

  .objects-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-header {
    grid-template-columns: auto 1fr;
    gap: 18px;
  }
}

@media (min-width: 980px) {
  .hero-card {
    padding: 30px;
  }

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

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