:root {
  --bg: #12141a;
  --panel: #1b1e27;
  --fg: #e8eaf0;
  --muted: #8b90a0;
  --accent: #d64550;
  --accent-dim: #7a2930;
  --line: #2a2e3a;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
}

.game {
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
}

.mute {
  position: absolute;
  top: calc(1.6rem * 0.56 + 4px);
  right: 0;
  transform: translateY(-50%);
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 0.5rem;
  cursor: pointer;
}

.mute:hover {
  border-color: var(--accent);
}

.mute.is-muted {
  color: var(--muted);
  opacity: 0.7;
}

.title {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hidden {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  font-size: 0.95rem;
}

.bullets-input {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

output {
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 1.2ch;
}

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

.status {
  font-size: 1.05rem;
  margin: 0;
  min-height: 1.4em;
}

.odds {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.result {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: transform 0.05s ease, opacity 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: #3a56d4;
}

.btn-danger {
  background: var(--accent);
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  color: var(--fg);
}

/* Cylinder */
.cylinder {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #2b2f3a, #191b22 72%);
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 8px rgba(0, 0, 0, 0.2);
}

.chamber {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #23262f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--muted);
}

.chamber.spent {
  background: #14161c;
  border-color: #1d2029;
}

.chamber.fired {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
}

.chamber.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 69, 80, 0.25);
}

/* Coin */
.coin {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f0d178, #b8892b);
  color: #4a370c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
}

.coin.flip {
  animation: flip 0.25s linear infinite;
}

@keyframes flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(180deg);
  }
  100% {
    transform: rotateX(360deg);
  }
}

.footer {
  font-size: 0.8rem;
}

/* Controls help (collapsible) */
.controls {
  width: 100%;
  max-width: 420px;
  font-size: 0.85rem;
}

.controls summary {
  cursor: pointer;
  text-align: center;
  list-style-position: inside;
  padding: 0.35rem;
  border-radius: 8px;
}

.controls summary:hover {
  color: var(--fg);
}

.controls-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--fg);
  background: #23262f;
  border: 1px solid var(--line);
  border-radius: 5px;
}

/* Animations */
.cylinder.spinning {
  animation: cyl-spin 0.7s ease-out;
}

@keyframes cyl-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.game.recoil {
  animation: recoil 0.28s ease-out;
}

@keyframes recoil {
  0% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-12px) scale(1.02);
  }
  60% {
    transform: translateY(4px);
  }
  100% {
    transform: translateY(0);
  }
}

.game.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-3px);
  }
  20%,
  80% {
    transform: translateX(5px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-9px);
  }
  40%,
  60% {
    transform: translateX(9px);
  }
}

.flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}

.flash.active {
  animation: flash 0.35s ease-out;
}

@keyframes flash {
  0% {
    opacity: 0;
  }
  8% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cylinder.spinning,
  .game.recoil,
  .game.shake,
  .flash.active {
    animation: none;
  }
}

/* Easter egg: "1978" sepia theme (The Deer Hunter) */
body.deer-hunter {
  filter: sepia(0.65) contrast(1.05) brightness(0.95);
}

.egg-tag {
  position: fixed;
  bottom: 0.75rem;
  left: 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

body.deer-hunter .egg-tag {
  opacity: 0.85;
}

.egg-hint {
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
