/* ---------------------------------------------------------------- tokens */
:root {
  /* warm neutrals, tinted a few percent toward the accent hue */
  --bg: #100e0b;
  --bg-2: #17140f;
  --surface: #1e1a15;
  --surface-2: #262118;
  --surface-3: #322b20;
  --line: #3b3327;
  --line-soft: #2b251c;

  --text: #f1ece1;
  --text-2: #bdb4a3;
  --text-3: #8b8375;

  --accent: #dfa94a;
  --accent-soft: #a97f36;
  --accent-dim: #4a3a1d;
  --accent-ink: #201a10;

  --danger: #c9503a;
  --ok: #78a34a;

  --shadow-1: 0 1px 0 rgba(0, 0, 0, .5);
  --shadow-2: 0 6px 22px -8px rgba(10, 7, 3, .85);
  --shadow-3: 0 18px 60px -20px rgba(8, 5, 2, .9);

  --r: 2px;
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 110ms;
  --t: 180ms;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --hud-shadow: 2px 2px 0 rgba(0, 0, 0, .58);
  --slot: 52px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { touch-action: none; }

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #0b1a2b;
  image-rendering: auto;
}

[hidden] { display: none !important; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- brand */
.brand { text-align: center; user-select: none; }

.brand__word {
  display: block;
  font-weight: 800;
  letter-spacing: .26em;
  text-indent: .26em;
  color: var(--text);
  text-shadow:
    0 2px 0 #6b4f1f,
    0 4px 0 #4a3617,
    0 5px 18px rgba(0, 0, 0, .7);
}

.brand--lg .brand__word { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; }
.brand--xl .brand__word { font-size: clamp(2.8rem, 11vw, 5.5rem); line-height: 1.05; }

.brand__sub {
  display: block;
  margin-top: .85rem;
  font-size: .8rem;
  letter-spacing: .34em;
  text-indent: .34em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: var(--hud-shadow);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .6rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-shadow: var(--shadow-1);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 247, 230, .07), var(--shadow-2);
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out), color var(--t-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: linear-gradient(180deg, #3d3426, var(--surface-3)); border-color: var(--accent-soft); }
}

.btn:active { transform: scale(.985); }

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: linear-gradient(180deg, #e7b75a, var(--accent-soft));
  border-color: #eec978;
  color: var(--accent-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: linear-gradient(180deg, #f3c76c, #bb8e3c); border-color: #f6d68f; }
}

.btn--wide { width: 100%; }

.btn--danger { border-color: #7a3527; color: #f0b7ab; }
@media (hover: hover) and (pointer: fine) {
  .btn--danger:hover { background: linear-gradient(180deg, #5b291d, #3c1c14); border-color: var(--danger); }
}

/* ---------------------------------------------------------------- screens */
.screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  animation: screen-in var(--t) var(--ease-out) both;
}

.screen--solid { background: radial-gradient(120% 90% at 50% 0%, #1b1710 0%, var(--bg) 70%); z-index: 90; }

.screen--veil {
  background:
    radial-gradient(90% 70% at 50% 40%, rgba(12, 9, 5, .45), rgba(8, 6, 3, .82) 75%),
    rgba(9, 7, 4, .35);
  backdrop-filter: blur(6px) saturate(.85);
}

/* the pause menu sits over the frozen game, keep it readable but not opaque */
#pause.screen--veil,
#death.screen--veil {
  background: rgba(8, 6, 3, .42);
  backdrop-filter: blur(2px);
}

@keyframes screen-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel {
  width: min(760px, 100%);
  max-height: min(86dvh, 900px);
  overflow: auto;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(38, 33, 24, .97), rgba(22, 19, 14, .97));
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 246, 228, .06);
  animation: panel-in var(--t) var(--ease-out) both;
}

.panel--narrow { width: min(460px, 100%); }
.panel--inv { width: min(620px, 100%); }

@keyframes panel-in {
  from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.985); }
  to { opacity: 1; transform: none; }
}

.panel__title {
  margin: 0 0 1.1rem;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-shadow: var(--hud-shadow);
}

.panel__note {
  margin: 1rem 0 0;
  color: var(--text-3);
  font-size: .82rem;
  line-height: 1.55;
}

.panel__footer {
  display: flex;
  gap: .6rem;
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}

.panel__footer .btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .screen, .panel { animation-duration: 1ms; }
  * { transition-duration: 1ms !important; }
}
