:root {
  color-scheme: dark;
  --yellow: #ffe600;
  --yellow-hot: #fff56a;
  --yellow-deep: #c9a900;
  --amber: #ffad00;
  --black: #050505;
  --panel: rgba(8, 8, 6, 0.96);
  --muted: #8d895f;
  --danger: #ff5b32;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050505;
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
}

body {
  display: grid;
  place-items: center;
}

button {
  font: inherit;
}

#gameShell {
  position: relative;
  width: min(100vw, calc(100dvh * 0.5625));
  height: min(100dvh, calc(100vw * 1.7777778));
  max-width: 540px;
  max-height: 960px;
  overflow: hidden;
  isolation: isolate;
  background: #050505;
  border-inline: 1px solid rgba(255, 230, 0, 0.12);
}

#gameShell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.014) 0,
    rgba(255, 255, 255, 0.014) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: screen;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #050505;
  cursor: crosshair;
}

.top-controls {
  position: absolute;
  z-index: 12;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.top-controls.active {
  opacity: 1;
  pointer-events: auto;
}

.icon-button {
  width: 42px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 230, 0, 0.55);
  color: var(--yellow);
  background: rgba(7, 7, 5, 0.82);
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 0 16px rgba(255, 230, 0, 0.08);
}

.icon-button:active {
  color: #050505;
  background: var(--yellow);
}

.pulse-button {
  position: absolute;
  z-index: 12;
  right: 14px;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 76px;
  height: 76px;
  display: none;
  place-content: center;
  gap: 2px;
  border: 2px solid #5d582b;
  border-radius: 50%;
  color: #6c6739;
  background: radial-gradient(circle, rgba(255, 230, 0, 0.08), rgba(0, 0, 0, 0.9) 68%);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  box-shadow: inset 0 0 18px #000;
  transition: transform 100ms ease, color 160ms ease, border-color 160ms ease;
}

.pulse-button b {
  font-size: 13px;
}

.pulse-button.active {
  color: var(--yellow-hot);
  border-color: var(--yellow);
  box-shadow:
    0 0 22px rgba(255, 230, 0, 0.48),
    inset 0 0 18px rgba(255, 230, 0, 0.18);
  animation: pulseReady 1s ease-in-out infinite alternate;
}

.pulse-button:active {
  transform: scale(0.92);
}

.pulse-button.visible {
  display: grid;
}

@keyframes pulseReady {
  to {
    box-shadow:
      0 0 34px rgba(255, 230, 0, 0.72),
      inset 0 0 22px rgba(255, 230, 0, 0.26);
  }
}

.overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 230, 0, 0.08), transparent 42%),
    rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#menu {
  background:
    linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.86)),
    repeating-linear-gradient(90deg, transparent 0 53px, rgba(255, 230, 0, 0.035) 53px 54px),
    repeating-linear-gradient(0deg, transparent 0 53px, rgba(255, 230, 0, 0.035) 53px 54px),
    radial-gradient(circle at 50% 31%, rgba(255, 230, 0, 0.17), transparent 34%),
    #050505;
  backdrop-filter: none;
}

.panel {
  position: relative;
  width: min(100%, 430px);
  padding: 30px 24px;
  color: #fffbd2;
  border: 1px solid rgba(255, 230, 0, 0.52);
  background:
    linear-gradient(135deg, rgba(255, 230, 0, 0.055), transparent 23%),
    var(--panel);
  box-shadow:
    0 0 0 1px #050505,
    0 0 0 2px rgba(255, 230, 0, 0.16),
    0 24px 70px rgba(0, 0, 0, 0.76),
    inset 0 0 48px rgba(255, 230, 0, 0.025);
  clip-path: polygon(0 13px, 13px 0, calc(100% - 13px) 0, 100% 13px, 100% calc(100% - 13px), calc(100% - 13px) 100%, 13px 100%, 0 calc(100% - 13px));
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 48px;
  height: 4px;
  background: var(--yellow);
  box-shadow: 0 0 14px rgba(255, 230, 0, 0.75);
}

.panel::before {
  top: 0;
  left: 24px;
}

.panel::after {
  right: 24px;
  bottom: 0;
}

.hero-panel {
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--yellow);
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.26em;
}

.eyebrow.danger {
  color: var(--danger);
}

.title-mark {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-block: 8px 15px;
}

.title-mark span {
  width: 3px;
  height: 50px;
  background: var(--yellow);
  transform: skew(-24deg);
  box-shadow: 0 0 16px var(--yellow);
}

.title-mark span:last-child {
  height: 30px;
  opacity: 0.55;
}

.title-mark i {
  width: 31px;
  height: 64px;
  border: 5px solid var(--yellow);
  border-top-color: transparent;
  transform: skew(-15deg);
  box-shadow: 0 0 18px rgba(255, 230, 0, 0.55), inset 0 0 12px rgba(255, 230, 0, 0.32);
}

h1,
h2,
p {
  cursor: default;
}

h1 {
  margin: 0;
  color: #fffbd2;
  font-size: clamp(45px, 12vw, 70px);
  font-weight: 300;
  line-height: 0.76;
  letter-spacing: -0.065em;
  text-shadow: 0 0 24px rgba(255, 230, 0, 0.13);
}

h1 strong {
  color: var(--yellow);
  font-weight: 950;
  letter-spacing: -0.08em;
}

h2 {
  margin: 0 0 8px;
  color: var(--yellow-hot);
  font-size: clamp(25px, 6vw, 34px);
  font-weight: 900;
  letter-spacing: -0.035em;
}

.tagline {
  margin: 25px 0 19px;
  color: #d7d39e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.21em;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 22px;
  color: #918c57;
  font-family: Consolas, "Courier New", monospace;
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: 0.08em;
}

.feature-row span {
  padding-top: 9px;
  border-top: 1px solid #393718;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  border: 0;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0.13em;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px 0 23px;
  color: #090900;
  background: var(--yellow);
  box-shadow: 0 0 26px rgba(255, 230, 0, 0.24);
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}

.primary-button:hover,
.primary-button:focus-visible {
  background: #fff47b;
  box-shadow: 0 0 36px rgba(255, 230, 0, 0.48);
}

.primary-button:active {
  transform: translateY(2px);
}

.primary-button b {
  font-size: 22px;
}

.secondary-button {
  margin-top: 10px;
  color: #9e985c;
  border: 1px solid #4b471d;
  background: transparent;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  color: var(--yellow);
  border-color: var(--yellow);
}

.instructions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 19px;
  gap: 5px;
}

.instructions div {
  display: grid;
  gap: 5px;
  color: #7e794d;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

kbd {
  color: #c8c37f;
  font-family: Consolas, monospace;
  font-size: 9px;
}

.best-score {
  margin: 18px 0 0;
  color: #5f5b39;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  letter-spacing: 0.13em;
}

.choice-panel {
  width: min(100%, 460px);
  text-align: left;
}

.panel-subtitle {
  margin: 0 0 19px;
  color: #8d895f;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.choice-cards {
  display: grid;
  gap: 10px;
}

.choice-card {
  position: relative;
  width: 100%;
  min-height: 112px;
  display: grid;
  grid-template-columns: 54px 1fr 22px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  color: #d7d39e;
  text-align: left;
  border: 1px solid #46421a;
  background: rgba(255, 230, 0, 0.025);
  cursor: pointer;
}

.choice-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--card-color, var(--yellow));
  box-shadow: 0 0 14px var(--card-color, var(--yellow));
}

.choice-card:hover,
.choice-card:focus-visible {
  color: #fffbd2;
  border-color: var(--card-color, var(--yellow));
  background: rgba(255, 230, 0, 0.07);
  transform: translateX(3px);
}

.choice-card .card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--card-color, var(--yellow));
  border: 1px solid currentColor;
  font-size: 21px;
  box-shadow: inset 0 0 15px rgba(255, 230, 0, 0.06);
  clip-path: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%);
}

.choice-card h3 {
  margin: 0 0 5px;
  color: var(--card-color, var(--yellow-hot));
  font-size: 15px;
  letter-spacing: 0.06em;
}

.choice-card p {
  margin: 0;
  color: #8d895f;
  font-size: 11px;
  line-height: 1.45;
}

.choice-card .arrow {
  color: var(--card-color, var(--yellow));
  font-size: 18px;
}

.compact-panel {
  width: min(100%, 380px);
  text-align: center;
}

.compact-panel h2 {
  margin-bottom: 22px;
}

.final-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 6px 0 18px;
  background: #3a3718;
  border: 1px solid #3a3718;
}

.final-stats div {
  display: grid;
  gap: 6px;
  padding: 14px 10px;
  background: #090907;
}

.final-stats span {
  color: #6f6b43;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.final-stats b {
  color: var(--yellow-hot);
  font-family: Consolas, "Courier New", monospace;
  font-size: 19px;
}

.new-best {
  display: none;
  margin: 0 0 16px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
  animation: pulseReady 700ms ease-in-out infinite alternate;
}

.new-best.visible {
  display: block;
}

.toast {
  position: absolute;
  z-index: 16;
  top: 130px;
  left: 50%;
  min-width: 190px;
  padding: 10px 16px;
  opacity: 0;
  color: #080800;
  background: var(--yellow);
  font-size: 10px;
  font-weight: 950;
  text-align: center;
  letter-spacing: 0.13em;
  transform: translate(-50%, -14px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-height: 720px) {
  .panel {
    padding: 22px 20px;
  }

  .title-mark {
    height: 50px;
    margin-block: 2px 9px;
    transform: scale(0.78);
  }

  h1 {
    font-size: 43px;
  }

  .tagline {
    margin-block: 17px 13px;
  }

  .feature-row,
  .instructions {
    margin-bottom: 12px;
  }

  .choice-card {
    min-height: 93px;
  }
}

@media (hover: none) {
  .choice-card:hover {
    transform: none;
  }
}

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