/* Omnitronix instant-game client — clean dark theme, system fonts only. */

:root {
  --bg: #0f1420;
  --panel: #1a2233;
  --panel-edge: #2a3550;
  --text: #e6ebf5;
  --text-dim: #93a0b8;
  --accent: #4f8cff;
  --accent-dark: #3468c8;
  --win: #35c46f;
  --lose: #e5534b;
  --gold: #e8b93e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 48px;
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--panel-edge);
  margin-bottom: 16px;
}

.game-name {
  font-weight: 700;
  font-size: 17px;
}

.topbar-right {
  display: flex;
  gap: 14px;
  align-items: center;
}

.balance {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--gold);
}

.conn {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}

.conn-up {
  background: rgba(53, 196, 111, 0.15);
  color: var(--win);
}

.conn-down {
  background: rgba(229, 83, 75, 0.15);
  color: var(--lose);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.fatal p {
  color: var(--text-dim);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: #232e47;
  color: var(--text);
  padding: 8px 14px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent-dark);
  font-weight: 700;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

button.secondary {
  background: transparent;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* --- Bet panel ------------------------------------------------------------ */

.bet-panel {
  margin-bottom: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-width: 62px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.chip.selected {
  background: var(--accent);
  border-color: var(--accent-dark);
  font-weight: 700;
}

.bet-input-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.bet-input {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: #101728;
  color: var(--text);
  width: 140px;
}

/* --- Mines ---------------------------------------------------------------- */

.mines-info {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.mines-info .multiplier {
  color: var(--gold);
  font-weight: 700;
}

.mines-info .potential-win {
  color: var(--win);
  font-weight: 700;
}

.mines-grid {
  display: grid;
  gap: 8px;
}

.tile {
  aspect-ratio: 1;
  padding: 0;
  font-size: 20px;
  background: #232e47;
}

.tile:hover:not(:disabled) {
  border-color: var(--accent);
}

.tile.safe {
  background: rgba(53, 196, 111, 0.18);
  border-color: var(--win);
  color: var(--win);
}

.tile.mine {
  background: rgba(232, 185, 62, 0.12);
  border-color: var(--gold);
  color: var(--gold);
}

.tile.bust {
  background: rgba(229, 83, 75, 0.25);
  border-color: var(--lose);
  color: var(--lose);
}

/* --- Keno ----------------------------------------------------------------- */

.game.keno {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
}

@media (max-width: 640px) {
  .game.keno {
    grid-template-columns: 1fr;
  }
}

.keno-board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.keno-number {
  padding: 6px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: #101728;
}

.keno-number.picked {
  background: var(--accent);
  border-color: var(--accent-dark);
  font-weight: 700;
}

.keno-number.drawn {
  border-color: var(--gold);
  color: var(--gold);
}

.keno-number.matched {
  background: var(--win);
  border-color: var(--win);
  color: #08130c;
  font-weight: 700;
}

.keno-picks-info {
  color: var(--text-dim);
  margin-bottom: 10px;
  font-size: 13px;
}

/* --- Keno 3D board -------------------------------------------------------- */

.keno-play {
  position: relative;
}

.view-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font-size: 12px;
  padding: 4px 10px;
}

.keno-3d-host {
  margin-bottom: 14px;
}

.keno-3d-stage {
  height: 420px;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 20%, #16213a 0%, #0a0f1e 70%);
}

.keno-3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.paytable-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--panel-edge);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

/* --- Plinko --------------------------------------------------------------- */

.plinko-risk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.plinko-risk-label {
  color: var(--text-dim);
  font-size: 13px;
}

.plinko-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
}

.plinko-pin-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.plinko-pin {
  color: var(--panel-edge);
  line-height: 1;
}

.plinko-pin.hit {
  color: var(--accent);
  font-weight: 700;
}

.plinko-slots {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.plinko-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 0;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: #101728;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.plinko-slot.empty {
  color: var(--text-dim);
}

.plinko-slot.hit-win {
  background: var(--win);
  border-color: var(--win);
  color: #08130c;
  font-weight: 700;
}

.plinko-slot.hit-lose {
  background: rgba(229, 83, 75, 0.25);
  border-color: var(--lose);
  color: var(--lose);
  font-weight: 700;
}

.plinko-slot-index {
  color: inherit;
  opacity: 0.6;
}

.plinko-path {
  margin: 10px 0 12px;
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Anchor for the shared absolutely-positioned .view-toggle. */
.plinko-play {
  position: relative;
}

/* 3D pegboard host: fixed aspect so the canvas has layout before mount. */
.plinko-3d-host {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  overflow: hidden;
  background: #0b101c;
}

.plinko-3d-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Scratch --------------------------------------------------------------- */

.game.scratch {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
}

@media (max-width: 640px) {
  .game.scratch {
    grid-template-columns: 1fr;
  }
}

.scratch-placeholder {
  margin: 0 0 14px;
  padding: 18px;
  border: 1px dashed var(--panel-edge);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.scratch-card-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 14px;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  overflow: hidden;
}

.scratch-cells {
  display: grid;
  background: #101728;
}

.scratch-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.scratch-cell.prize {
  border-color: rgba(53, 196, 111, 0.6);
  color: var(--win);
  font-weight: 700;
  font-size: 15px;
}

.scratch-cell.revealed {
  transform: scale(1.06);
}

.scratch-cell.prize.revealed {
  background: rgba(53, 196, 111, 0.15);
}

.scratch-foil {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  touch-action: none;
  border-radius: 10px;
  transition: opacity 0.35s ease;
}

.scratch-foil.cleared {
  opacity: 0;
  pointer-events: none;
}

.scratch-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.scratch-progress-bar {
  width: 110px;
  height: 6px;
  border-radius: 999px;
  background: #101728;
  overflow: hidden;
}

.scratch-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.scratch-progress-text {
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.paytable-row.hit {
  background: rgba(53, 196, 111, 0.15);
  color: var(--win);
  font-weight: 700;
}

/* --- Over-under ------------------------------------------------------------ */

.ou-info {
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

.ou-directions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ou-direction.selected {
  background: var(--accent);
  border-color: var(--accent-dark);
  font-weight: 700;
}

.ou-target-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ou-target-label {
  color: var(--text-dim);
}

.ou-target {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: #101728;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ou-odds {
  display: flex;
  gap: 10px;
  align-items: baseline;
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}

.ou-multiplier {
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
}

.ou-dice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 46px;
}

.ou-die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  background: rgba(232, 185, 62, 0.12);
  color: var(--gold);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ou-sum {
  margin: 10px 0 4px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}

/* --- Shared ---------------------------------------------------------------- */

.result-banner {
  margin-top: 14px;
  font-weight: 700;
  min-height: 22px;
}

.result-banner.won {
  color: var(--win);
}

.result-banner.lost {
  color: var(--lose);
}

.result-banner.info {
  color: var(--text-dim);
  font-weight: 400;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 18px;
  border-radius: 10px;
  background: #2a3550;
  border: 1px solid var(--panel-edge);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.toast-error {
  border-color: var(--lose);
  color: #ffb4ae;
}

.toast-info {
  border-color: var(--win);
  color: #b9ecd0;
}

/* --- Dice ------------------------------------------------------------------ */

.dice-info {
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

.dice-directions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.dice-direction.selected {
  background: var(--accent);
  border-color: var(--accent-dark);
  font-weight: 700;
}

.dice-target-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dice-target-label {
  color: var(--text-dim);
}

.dice-target {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: #101728;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  width: 110px;
}

.dice-odds {
  display: flex;
  gap: 10px;
  align-items: baseline;
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}

.dice-multiplier {
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
}

.dice-roll {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 46px;
}

.dice-roll-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  background: rgba(232, 185, 62, 0.12);
  color: var(--gold);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
