/* Cowboy slot-machine vibes: warm browns, leather, wood, rope accents */
:root {
  --bg: #1e1308;
  --panel: #2b1b0f;
  --wood: #5a3b22;
  --gold: #c7a36a;
  --rope: #d4b88c;
  --accent: #b86b35;
  --success: #3fbf6b;
  --danger: #e05d5d;
  --light: #f7eddc;
  --shadow: rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--light);
  font-family: ui-rounded, system-ui, Segoe UI, Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, #2d1b10, #1f140c);
  border-bottom: 4px solid var(--wood);
  box-shadow: 0 4px 20px var(--shadow);
}

.title {
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 #000;
}

.scores {
  display: flex;
  gap: 1rem;
}

.score,
.highscore {
  background: var(--panel);
  padding: .5rem .75rem;
  border: 2px solid var(--wood);
  border-radius: 12px;
}

.game {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
}

.controls {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  /* centered */
  background: var(--panel);
  border: 2px solid var(--wood);
  border-radius: 16px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}

.controls label {
  font-weight: 600;
}

.controls select {
  background: var(--wood);
  color: var(--light);
  border: 1px solid var(--rope);
  border-radius: 8px;
  padding: .25rem .5rem;
}

/* Visual + functional disable during round */
.controls select:disabled,
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .6rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7a3f1f;
  font-weight: 700;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7a3f1f;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7a3f1f;
}

.btn.lever {
  background: linear-gradient(180deg, #d48242, #b25b2b);
}

/* Disabled visuals for selects & lever during round */
.control-select:disabled,
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.btn.accent {
  background: var(--gold);
  color: #3a2a17;
  box-shadow: 0 4px 0 #8a6a3f;
}

.btn.hidden {
  display: none;
}

.machine {
  background: radial-gradient(ellipse at top, #3a2415, #1c120a);
  border: 4px solid var(--wood);
  border-radius: 24px;
  padding: 1rem;
  box-shadow: inset 0 0 40px #0007, 0 10px 30px var(--shadow);
}

.reels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

/* centered */
.reel {
  background: #140c07;
  border: 2px solid var(--wood);
  border-radius: 18px;
  padding: .75rem;
  min-width: 360px;
}

.reel-label {
  font-size: .9rem;
  color: var(--rope);
  margin-bottom: .35rem;
  letter-spacing: .5px;
}

.gap {
  width: 28px;
  height: 64px;
  background: repeating-linear-gradient(90deg, #cfae7b, #cfae7b 4px, #9c7b4e 4px, #9c7b4e 8px);
  border: 2px solid var(--wood);
  border-radius: 12px;
  box-shadow: inset 0 0 10px #0006;
}

/* Bits line stays on one row on mobile, scrolls if needed */
.bits {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Liberation Mono", Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow-x: auto;
}
.bits::-webkit-scrollbar{        /* Chrome/Safari */
  display: none;
}

.bit {
  display: inline-block;
  padding: .15rem .12rem;
  margin: 0 .03rem;
  min-width: .9ch;
  border-radius: 6px;
  background: #2a1a10;
  border: 1px solid #3b2719;
  box-shadow: inset 0 -2px 0 #0006;
}

.bit.on {
  background: #4a2f1c;
  border-color: #624227;
}

.bit.stop {
  animation: pop .28s ease-out;
}

@keyframes pop {
  0% {
    transform: scale(0.8);
  }

  80% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

.bitwidths {
  text-align: center;
  margin-top: .75rem;
  color: var(--gold);
  font-weight: 700;
}

/* —— NEW: One-line Mantissa + Exponent row (no wooden gap) —— */
.bit-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin: .75rem 0;
  background: var(--panel);
  border: 2px solid var(--wood);
  border-radius: 16px;
  padding: .75rem 1rem;
}

.bit-block {
  min-width: 0;
  flex: 1;
}

.bit-label {
  font-size: .9rem;
  color: var(--rope);
  margin-bottom: .25rem;
}

/* Stage */
.stage {
  margin-top: 1rem;
  background: var(--panel);
  border: 2px solid var(--wood);
  border-radius: 16px;
  padding: 1rem;
  min-height: 120px;
  box-shadow: inset 0 0 20px #0006;
}

.stage .question {
  font-size: 1.15rem;
  margin-bottom: .5rem;
}

.stage .answers {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.stage .answers .btn {
  background: #6c3f21;
}

.stage .answers .btn.correct {
  background: var(--success);
}

.stage .answers .btn.wrong {
  background: var(--danger);
}

/* Inline feedback under questions */
.feedback {
  min-height: 1.25rem;
}

.feedback.inline-feedback {
  margin-top: .3rem;
  margin-bottom: .6rem;
}


/* Reusable hidden utility so we can hide stage during decimal step */
.hidden {
  display: none !important;
}

/* Keypad — keep the newer compact version */
.keypad-section {
  margin-top: 1rem;
  background: var(--panel);
  border: 2px solid var(--wood);
  border-radius: 16px;
  padding: .75rem;
}

.keypad-section.hidden {
  display: none;
}

.input-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}

#decimalInput {
  flex: 1;
  font-size: 1rem;
  padding: .45rem .6rem;
  border-radius: 10px;
  border: 2px solid var(--rope);
  background: #130c07;
  color: var(--light);
}

.keypad {
  display: flex;
  flex-wrap: wrap;
  /* wrap if screen is narrow */
  gap: .4rem;
  align-items: center;
}

.key {
  padding: .5rem .6rem;
  border-radius: 10px;
  border: 1px solid var(--rope);
  background: #3c2616;
  color: #fff;
  font-size: .95rem;
  cursor: pointer;
  min-width: 44px;
  /* tap target */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.key.wide {
  grid-column: span 1;
}

.key.accent {
  background: var(--gold);
  color: #2b1d10;
  font-weight: 800;
}

.key[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* Hide the legacy submit button beside input */
#submitDecimal {
  display: none !important;
}

.footer {
  text-align: center;
  padding: 1rem;
  color: #cbb89b;
}

.bump {
  animation: scorebump .35s ease-out;
}

@keyframes scorebump {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

/* A11y helpers */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Mobile font/spacing nudge so both fit on one line */
@media (max-width: 480px) {
  .bit-label {
    font-size: .85rem;
  }

  .bits {
    font-size: 1.15rem;
  }
}