@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #050505;
  color: #f4f4f4;
  font-family: Consolas, "Courier New", monospace;
}

body {
  padding: 16px 12px 28px;
}

.cabinet {
  width: min(960px, 100%);
  margin: 0 auto;
  background: #000;
  border: 5px solid #e01818;
  box-shadow: 0 0 0 2px #7a0000, 0 12px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
}

#view {
  display: block;
  width: 100%;
  height: auto;
  background: #20b820;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#view.racing {
  min-height: 0;
}

.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 0;
  margin: 6px 8px 0;
  border: 3px solid #ff2020;
  background: #000;
  min-height: 320px;
}

.board[hidden] { display: none; }

.board-main {
  display: flex;
  flex-direction: column;
  padding: 6px 10px 8px;
  min-width: 0;
}

.odds-title {
  margin: 2px 0 10px;
  text-align: center;
  color: #ffe14a;
  font-family: "Press Start 2P", Consolas, monospace;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: 0 0 8px rgba(255, 225, 74, 0.35);
}

.odds-grid {
  display: grid;
  grid-template-columns: 28px repeat(5, minmax(0, 1fr));
  gap: 3px;
  flex: 1;
}

.colh, .rowh {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
}

/* 原版轴色：上 6 青、5 黄、4 绿、3 青、2 红；左列蓝 */
.c6, .c3 { color: #3ee0ff; }
.c5 { color: #ffe14a; }
.c4 { color: #3dff3d; }
.c2 { color: #ff3b3b; }
.rowh { color: #3a7bff; }

.cell, .blank, .corner {
  min-height: 52px;
  background: #000;
}

.cell {
  border: 1px solid #1a3a8a;
  color: #ffe14a;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
}

.cell:hover:not([aria-disabled="true"]) { border-color: #ffe14a; }
.cell[aria-disabled="true"] { cursor: default; }
.cell.has-bet { border-color: #ff3030; box-shadow: inset 0 0 0 1px #ff3030; }
.cell.winner {
  background: #3a0000;
  border-color: #ff2020;
}

.cell .odd {
  display: block;
  font-size: clamp(14px, 2.4vw, 22px);
  font-weight: 800;
  line-height: 1;
  color: #ffe14a;
}

.cell .stake {
  min-height: 14px;
  color: #3a7bff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
}

.roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.starter { color: #ff4ad8; }
.finisher { color: #ff3030; }
.sprinter { color: #ffe14a; }
.roles span { color: #fff; margin-left: 6px; }

.legal {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #d8d8d8;
}

.legal span { color: #3dff3d; }

.results {
  border-left: 3px solid #ff2020;
  padding: 8px 8px 8px 10px;
}

.results h2 {
  margin: 0 0 10px;
  color: #ff4ad8;
  font-family: "Press Start 2P", Consolas, monospace;
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-align: center;
  font-weight: 400;
}

#history {
  list-style: none;
  margin: 0;
  padding: 0;
}

#history li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #2a1038;
  font-size: 18px;
  font-weight: 800;
}

.hp { color: #f4f4f4; }
.ho { color: #ffe14a; }
#history .empty {
  color: #666;
  font-size: 13px;
  border: 0;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px 10px;
  background: #000;
  border-top: 2px solid #3a0000;
}

.meter {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.meter b { color: #ff4ad8; margin-right: 6px; }
.meter span { color: #fff; }
.meter.stake b { color: #ffe14a; }
.meter.betnow {
  color: #ffe14a;
  font-family: "Press Start 2P", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.coin { margin-left: auto; }
.coin b { color: #ff4ad8; }

.chip, .text-btn, #start {
  font: inherit;
  font-weight: 800;
  border: 2px solid #ffe14a;
  background: #000;
  color: #ffe14a;
  min-width: 42px;
  min-height: 36px;
  padding: 4px 8px;
  cursor: pointer;
}

.chip.active, .text-btn.active {
  background: #ffe14a;
  color: #000;
}

#start {
  background: #ff2020;
  border-color: #ff2020;
  color: #fff;
  min-width: 88px;
  padding: 4px 14px;
}

#start:disabled {
  background: #444;
  border-color: #444;
  color: #bbb;
  cursor: default;
}

.text-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.help {
  width: min(960px, 100%);
  margin: 8px auto 0;
  color: #8a8a8a;
  font-size: 13px;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 720px) {
  .board { grid-template-columns: 1fr; }
  .results {
    border-left: 0;
    border-top: 3px solid #ff2020;
  }
  .odds-title { font-size: 12px; letter-spacing: 0.04em; }
  .cell .odd, .colh, .rowh { font-size: 16px; }
  .cell, .blank, .corner { min-height: 44px; }
  .coin { margin-left: 0; }
  .meter.betnow { display: none; }
}
