:root {
  --bg-top: #085d59;
  --bg-mid: #0a6f68;
  --bg-bottom: #0b4743;
  --gold: #ffd94a;
  --blue1: #21489a;
  --blue2: #3568c8;
  --red1: #c3311a;
  --red2: #f15a2a;
  --green-btn: #2ba64f;
  --green-btn-dark: #127734;
  --blue-btn: #2c66bf;
  --blue-btn-dark: #1a4381;
  --purple1: #7b3de0;
  --purple2: #b27aff;
  --text: #ffffff;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #0f756f, #042d2a 70%);
  min-height: 100vh;
  user-select: none;
}

.game-shell {
  width: 80vw;
  max-width: 1240px;
  min-width: 980px;
  margin: 8px auto;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-mid) 55%, var(--bg-bottom));
  border: 4px solid #1a1a1a;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.top-row {
  display: grid;
  grid-template-columns: 270px 1fr 170px;
  gap: 12px;
  align-items: stretch;
}

.left-panel,
.main-panel,
.right-panel,
.bottom-bar {
  border: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.left-panel {
  background: linear-gradient(180deg, #0f0f0f, #1a1a1a);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 740px;
}

.power-title {
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
  color: #ffd859;
  font-size: 2.5rem;
  text-shadow: 0 2px 0 #a96f00;
  margin-bottom: 10px;
}

.power-copy {
  color: #ff71be;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1rem;
  margin-bottom: 10px;
}

.power-desc {
  color: #ffe158;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
  text-transform: uppercase;
}

.paytable {
  margin-top: 12px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  padding: 12px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.paytable-header,
.paytable-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.paytable-header {
  color: #ffed89;
  font-weight: 900;
  font-size: 1.15rem;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.paytable-row {
  padding: 4px 0;
  font-size: 1.1rem;
  font-weight: 900;
}

.paytable-row.active {
  color: #ffe05c;
  text-shadow: 0 0 10px rgba(255, 224, 92, 0.65);
}

.status-box {
  border-top: 2px solid rgba(255, 255, 255, 0.12);
  margin-top: 14px;
  padding-top: 14px;
  display: grid;
  gap: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-line {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
}

.status-value {
  color: #ffe15c;
}

.main-panel {
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  height: 740px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-height: 0;
}

.game-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 4rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.logo .power {
  color: #f35e27;
  -webkit-text-stroke: 2px #ffd84f;
  text-shadow: 0 3px 0 #8d2c0e;
  transform: skewX(-8deg);
}

.logo .keno {
  color: #ffd84f;
  -webkit-text-stroke: 2px #1f60bd;
  text-shadow: 0 3px 0 #7b6200;
}

.last-ball-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.last-ball-label {
  font-size: 1.1rem;
  text-transform: uppercase;
  font-weight: 800;
  color: #ffea83;
}

.last-ball {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6a46, #cb2b09 68%, #8a1200 100%);
  border: 3px solid rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.3), 0 6px 12px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
}

.grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
  height: 100%;
}

.cell {
  border: 2px solid rgba(255, 255, 255, 0.42);
  background: linear-gradient(180deg, var(--blue2), var(--blue1));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  font-size: clamp(1rem, 1.15vw, 1.45rem);
  font-weight: 900;
  cursor: pointer;
  transition: filter 0.08s ease, opacity 0.12s ease, background 0.12s ease;
  padding: 0;
  color: #000;
}

.cell:hover {
  filter: brightness(1.1);
}

.cell.selected {
  background: linear-gradient(180deg, #ffe46e, #e3a90f);
  color: #1e2c7a;
  border-color: #fff5bc;
}

.cell.hit {
  background: linear-gradient(180deg, var(--red2), var(--red1));
  border-color: #ffc0b1;
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 87, 50, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.24);
}

.cell.extra-hit {
  background: linear-gradient(180deg, #ffe866, #d4a600);
  color: #193a8f;
  border-color: #fff0a0;
  box-shadow: 0 0 16px rgba(255, 232, 102, 0.68), inset 0 2px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

.cell.miss {
  background: linear-gradient(180deg, #8a8f94, #696e73);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
  opacity: 0.96;
}

.cell.locked {
  cursor: default;
}

.right-panel {
  height: 740px;
  background: linear-gradient(180deg, #1d6f57, #114937);
  padding: 12px 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.balls-title {
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #ffe15e;
  margin: 6px 0 12px;
  text-align: center;
}

.ball-column {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 58px;
  gap: 8px 10px;
  align-content: start;
  min-height: 0;
}

.ball-slot {
  width: 52px;
  height: 52px;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3f3f3, #c5c5c5 62%, #8d8d8d 100%);
  border: 2px solid rgba(0, 0, 0, 0.2);
  color: #111;
  font-size: 1.15rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.5), 0 3px 5px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
  transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.ball-slot.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ball-slot.base {
  background: radial-gradient(circle at 35% 30%, #f3f3f3, #c5c5c5 62%, #8d8d8d 100%);
  color: #111;
}

.ball-slot.hit-ball {
  background: radial-gradient(circle at 35% 30%, #ff7c57, #cf2c08 68%, #8a1200 100%);
  color: #fff;
  box-shadow: inset 0 3px 6px rgba(255, 255, 255, 0.3), 0 0 12px rgba(255, 70, 30, 0.55);
}

.ball-slot.extra {
  background: radial-gradient(circle at 35% 30%, #fff8ae, #f3c520 62%, #b17b00 100%);
  color: #6a0d00;
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.5), 0 0 12px rgba(255, 211, 58, 0.72);
}

.bottom-bar {
  margin-top: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.35));
  padding: 10px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 1fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.readout,
.stake-box {
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, #151515, #080808);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 10px;
  min-height: 94px;
}

.readout-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #ffe45f;
  font-weight: 800;
  margin-bottom: 4px;
}

.readout-value {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.stake-label {
  text-align: center;
  font-size: 0.95rem;
}

.stake-controls {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
}

.stake-value {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
}

.bet-note {
  margin-top: 6px;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  font-weight: 700;
}

.mini-btn {
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: linear-gradient(180deg, #39a840, #18712a);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  cursor: pointer;
  min-height: 58px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18), inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.mini-btn:disabled,
.action-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 94px;
  border-radius: 8px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  font-size: 2rem;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.chip.purple {
  background: linear-gradient(180deg, var(--purple2), var(--purple1));
}

.action-btn {
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  min-height: 94px;
  font-size: 1.05rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  color: white;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.18), inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.blue-btn {
  background: linear-gradient(180deg, var(--blue-btn), var(--blue-btn-dark));
}

.green-btn {
  background: linear-gradient(180deg, var(--green-btn), var(--green-btn-dark));
}

.message-bar {
  margin-top: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.26));
  border: 2px solid rgba(255, 255, 255, 0.16);
  padding: 12px 14px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff7bd;
}

.message-bar.win {
  color: #ffe66b;
  text-shadow: 0 0 12px rgba(255, 230, 107, 0.55);
}

.message-bar.lose {
  color: #ffc2b3;
}

.footer-note {
  margin-top: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

@media (max-width: 1020px) {
  body {
    min-width: 1020px;
  }
}

.cell.extra-hit {
  background: radial-gradient(circle at 30% 30%, #ff6a6a, #b30000);
  color: #fff;
  border: 2px solid #ffcc66;
  box-shadow: 0 0 12px rgba(255, 80, 80, 0.9);
  animation: extraHitPulse 0.4s ease;
}

@keyframes extraHitPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}