:root {
  --bg: #10151f;
  --bg-soft: rgba(16, 21, 31, 0.78);
  --panel: rgba(15, 22, 34, 0.88);
  --panel-border: rgba(214, 185, 110, 0.22);
  --ink: #eef4fb;
  --muted: #b3c0d2;
  --gold: #d8b469;
  --gold-strong: #f5d78f;
  --accent: #4ab0d9;
  --danger: #e36d5c;
  --success: #5ab783;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-title: "Cinzel", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(62, 104, 155, 0.36), transparent 38%),
    linear-gradient(180deg, #0f1520, #151b28 48%, #0a0e15);
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
}

.hidden {
  display: none !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}

#splash {
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: auto;
}

.sky-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(74, 176, 217, 0.3), transparent 24%),
    radial-gradient(circle at 76% 10%, rgba(216, 180, 105, 0.16), transparent 20%);
  pointer-events: none;
}

.splash-panel {
  position: relative;
  width: min(780px, 100%);
  padding: 42px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--gold);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-title);
}

h1 {
  font-size: clamp(3rem, 10vw, 5.5rem);
  line-height: 0.95;
}

.subtitle {
  margin: 8px 0 18px;
  font-size: 1.1rem;
  color: var(--gold-strong);
}

.intro-copy {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 60ch;
}

.menu-grid,
.option-grid,
.palette-picker,
.resource-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-button,
.ghost-button,
.option-chip,
.slot-chip,
.palette-swatch,
.action-bar button,
.side-buttons button {
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.hero-button {
  background: linear-gradient(135deg, #d8b469, #b98729);
  color: #15110a;
  font-weight: 800;
}

.ghost-button,
.option-chip,
.slot-chip,
.action-bar button,
.side-buttons button {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-button:hover,
.ghost-button:hover,
.option-chip:hover,
.slot-chip:hover,
.palette-swatch:hover,
.action-bar button:hover,
.side-buttons button:hover {
  transform: translateY(-1px);
}

.option-chip.is-active,
.slot-chip.is-active,
.palette-swatch.is-active {
  border-color: rgba(245, 215, 143, 0.75);
  background: rgba(216, 180, 105, 0.18);
}

.save-slot-summary {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

#creator {
  padding: 18px;
  overflow: auto;
}

.creator-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px;
}

.creator-header,
.creator-grid {
  display: grid;
  gap: 18px;
}

.creator-header {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.creator-grid {
  grid-template-columns: minmax(300px, 1.1fr) minmax(260px, 0.9fr);
}

.inset-panel {
  padding: 18px;
  border-radius: var(--radius-md);
}

.field {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.field span {
  color: var(--gold-strong);
  font-weight: 700;
}

.field input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
}

.palette-swatch {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
}

.creator-preview {
  display: grid;
  gap: 16px;
  justify-items: center;
}

#creator-preview-canvas {
  width: min(100%, 320px);
  max-width: 320px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(74, 176, 217, 0.2), transparent 32%),
    linear-gradient(180deg, rgba(27, 38, 57, 0.9), rgba(13, 18, 28, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.creator-summary {
  width: 100%;
  color: var(--muted);
  line-height: 1.6;
}

#game-screen {
  background: #090d13;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.hud {
  position: absolute;
  z-index: 2;
}

.topbar {
  top: 12px;
  left: 12px;
  right: 216px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: rgba(8, 12, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  backdrop-filter: blur(8px);
}

.status-block,
.resource-pill {
  display: grid;
}

.resource-pill {
  min-width: 96px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
}

.resource-pill span,
.status-block span {
  color: var(--muted);
  font-size: 0.84rem;
}

.quest-tracker {
  top: 78px;
  left: 12px;
  width: min(280px, calc(100vw - 100px));
  padding: 12px;
  background: rgba(9, 14, 22, 0.84);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.quest-focus {
  top: 148px;
  left: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(9, 14, 22, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
}

.minimap-shell {
  top: 12px;
  right: 12px;
  width: 190px;
  padding: 8px;
  background: rgba(8, 12, 18, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
}

#minimap-canvas {
  width: 174px;
  height: 174px;
  border-radius: 14px;
  display: block;
  image-rendering: pixelated;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #10161e;
}

#minimap-caption {
  margin-top: 8px;
  text-align: center;
}

.action-bar {
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(9, 14, 22, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.action-bar button {
  min-width: 74px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.side-buttons {
  top: 214px;
  right: 12px;
  display: grid;
  gap: 8px;
}

.interaction-hint {
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(9, 14, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.overlay-panel {
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 18px;
  background: rgba(8, 12, 18, 0.92);
}

.overlay-panel h3 {
  margin-bottom: 12px;
}

.overlay-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card-list {
  display: grid;
  gap: 12px;
}

.card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.toast-stack {
  position: absolute;
  right: 14px;
  bottom: 86px;
  z-index: 4;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 28px));
}

.toast {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(12, 18, 30, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.toast strong {
  display: block;
  color: var(--gold-strong);
}

.mobile-stick {
  position: absolute;
  left: 18px;
  bottom: 24px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  display: none;
  z-index: 2;
}

.mobile-stick__thumb {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: rgba(216, 180, 105, 0.28);
}

.small {
  font-size: 0.88rem;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(74, 176, 217, 0.14);
  color: #9fdaf0;
}

.reward-list,
.stat-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

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

  .topbar {
    display: grid;
    justify-content: stretch;
    border-radius: 22px;
    right: 12px;
  }

  .action-bar {
    bottom: 12px;
    width: calc(100vw - 24px);
    justify-content: center;
    overflow-x: auto;
    transform: translateX(-50%);
  }

  .action-bar button {
    min-width: 76px;
  }

  .side-buttons {
    top: auto;
    right: 12px;
    bottom: 132px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .minimap-shell {
    width: 150px;
    padding: 6px;
  }

  #minimap-canvas {
    width: 136px;
    height: 136px;
  }

  .quest-tracker {
    width: min(240px, calc(100vw - 24px));
  }

  .quest-focus {
    top: 138px;
  }

  .mobile-stick {
    display: block;
  }
}
