:root {
  --gold-1: #ffe08a;
  --gold-2: #ffc83d;
  --gold-3: #e8930c;
  --gold-deep: #a35f00;
  --teal-1: #37d6b8;
  --teal-2: #0fa88c;
  --wood-1: #a9713d;
  --wood-2: #7a4a21;
  --wood-3: #4c2c12;
  --danger-1: #ff6b5e;
  --danger-2: #d63c2f;
  --ink: #20140a;
  --ink-soft: #3c2a16;
  --paper: #fff6df;
  --paper-dim: #f2e3bd;
  --night-1: #10233a;
  --night-2: #071320;
  --glass: rgba(10, 22, 36, 0.72);
  --glass-line: rgba(255, 214, 120, 0.28);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font-main: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif;
  --font-display: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--font-main);
  color: var(--paper);
  background:
    radial-gradient(1200px 700px at 75% -10%, #1d3a57 0%, transparent 60%),
    radial-gradient(900px 600px at 10% 110%, #14352e 0%, transparent 55%),
    linear-gradient(160deg, var(--night-1), var(--night-2) 70%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mix-blend-mode: overlay;
}

button { font-family: inherit; touch-action: manipulation; }

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

#app { height: 100%; height: 100dvh; position: relative; }

.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

.ic { display: inline-flex; width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
.ic svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.ic[data-icon]:empty::after { content: "?"; }

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55em;
  border: none; cursor: pointer;
  font-weight: 800; letter-spacing: 0.06em;
  color: var(--ink);
  padding: 0.72em 1.5em;
  border-radius: 999px;
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28), 0 10px 24px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  min-height: 44px;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.28); }
.btn:focus-visible { outline: 3px solid var(--gold-1); outline-offset: 3px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.5); }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 45%, var(--gold-3));
  color: #4a2c00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-teal {
  background: linear-gradient(180deg, #6ff0d9, var(--teal-1) 40%, var(--teal-2));
  color: #03302a;
}
.btn-wood {
  background: linear-gradient(180deg, #c98d52, var(--wood-1) 45%, var(--wood-2));
  color: #fff3dc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.btn-danger {
  background: linear-gradient(180deg, #ff9d92, var(--danger-1) 45%, var(--danger-2));
  color: #40060a;
}
.btn-big { font-size: clamp(1rem, 2.4vw, 1.25rem); padding: 0.85em 2em; }
.btn-small { font-size: 0.78rem; padding: 0.5em 1.1em; box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.btn-round {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  padding: 0; border-radius: 50%;
  background: linear-gradient(180deg, #2c4a68, #16293f);
  color: var(--gold-1);
  box-shadow: 0 4px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-round .ic { width: 20px; height: 20px; }

.panel-pop {
  background: linear-gradient(175deg, rgba(23, 42, 64, 0.96), rgba(10, 21, 34, 0.97));
  border: 2px solid var(--glass-line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: pop-in 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes pop-in {
  from { transform: scale(0.82) translateY(18px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 200, 61, 0.5)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 200, 61, 0.95)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--gold-2), var(--gold-3)); border-radius: 99px; border: 2px solid rgba(0,0,0,.25); }
