:root {
  --bg-night: #080a0d;
  --bg-soot: rgba(4, 5, 7, 0.84);
  --panel: rgba(23, 18, 12, 0.8);
  --panel-strong: rgba(38, 28, 18, 0.9);
  --line: rgba(255, 221, 150, 0.18);
  --text: #f4ead2;
  --muted: #ceb88b;
  --accent: #d68239;
  --accent-soft: #9d5124;
  --danger: #f0d1a4;
  --shadow: rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 14%, rgba(240, 185, 88, 0.06), transparent 24%),
    linear-gradient(180deg, #0b0f13 0%, #050608 72%);
  color: var(--text);
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

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

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

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#gameCanvas:active {
  cursor: grabbing;
}

#hud {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(280px, 360px);
  align-content: start;
  gap: 0.8rem;
  padding: 1.1rem;
  pointer-events: none;
}

.panel {
  width: min(36vw, 360px);
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(70, 47, 24, 0.16), transparent 52%),
    var(--panel);
  box-shadow: 0 20px 60px var(--shadow);
  backdrop-filter: blur(8px);
}

.title-panel {
  padding-top: 1rem;
}

.panel h1,
.panel h2,
.panel p {
  margin: 0;
}

.title-panel h1 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 0.92;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.panel-copy,
.status-text,
.odds-text,
.respin-text,
.hint-text,
.dialog p {
  margin-top: 0.45rem;
  line-height: 1.35;
  color: var(--text);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.controls-panel {
  pointer-events: auto;
  text-align: center;
}

.action-button {
  appearance: none;
  border: 1px solid rgba(255, 216, 154, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 184, 93, 0.28), rgba(118, 57, 24, 0.92));
  color: #fff5e5;
  padding: 0.8rem 1rem;
  min-width: 11rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.action-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.action-button.secondary {
  background:
    linear-gradient(180deg, rgba(147, 118, 78, 0.22), rgba(58, 44, 31, 0.94));
}

.controls-panel .action-button + .action-button {
  margin-top: 0.7rem;
}

.controls-panel .action-button {
  display: block;
  margin-inline: auto;
}

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

#subtitle {
  position: absolute;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  width: min(92vw, 920px);
  padding: 0.85rem 1rem;
  text-align: center;
  line-height: 1.35;
  border: 1px solid rgba(255, 223, 168, 0.16);
  background: linear-gradient(180deg, rgba(42, 25, 12, 0.18), rgba(10, 8, 6, 0.9));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  font-size: clamp(0.96rem, 2vw, 1.12rem);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.68);
  pointer-events: auto;
}

.result-overlay {
  background: rgba(0, 0, 0, 0.18);
  place-items: start center;
  padding-top: clamp(1rem, 4vh, 2.5rem);
  pointer-events: none;
}

.overlay.hidden {
  display: none;
}

.dialog {
  width: min(92vw, 560px);
  padding: 1.35rem 1.4rem;
  border: 1px solid rgba(255, 224, 163, 0.18);
  background:
    radial-gradient(circle at 50% 0%, rgba(249, 177, 87, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(44, 29, 19, 0.96), rgba(13, 10, 8, 0.96));
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.52);
}

.dialog h2 {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: center;
}

.mode-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  margin-bottom: 1rem;
}

.mode-button {
  appearance: none;
  border: 1px solid rgba(255, 220, 160, 0.18);
  background: linear-gradient(180deg, rgba(96, 69, 42, 0.45), rgba(36, 25, 18, 0.96));
  color: var(--text);
  padding: 0.72rem 1rem;
  min-width: 11rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
}

.mode-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.mode-button.is-selected {
  border-color: rgba(255, 216, 154, 0.42);
  background: linear-gradient(180deg, rgba(220, 137, 60, 0.42), rgba(98, 48, 20, 0.96));
}

.start-overlay {
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 199, 111, 0.12), transparent 28%),
    rgba(3, 4, 5, 0.9);
}

.start-dialog,
.result-dialog {
  text-align: center;
}

.result-dialog {
  pointer-events: auto;
}

#blackout {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  #hud {
    grid-template-columns: 1fr;
  }

  .panel {
    width: min(92vw, 420px);
  }

  .controls-panel .action-button {
    width: 100%;
  }

  #subtitle {
    bottom: 1rem;
  }
}
