:root {
  color-scheme: dark;
  --gold: #ffd75f;
  --gold-deep: #8a5520;
  --amber: #ffae23;
  --red: #ff3038;
  --ruby: #9d1018;
  --blue: #20b8ff;
  --green: #aaff2c;
  --panel: #21100a;
  --ink: #fff4bd;
  --shadow: rgba(0, 0, 0, 0.45);
}

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

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 214, 92, 0.35), transparent 21rem),
    linear-gradient(155deg, #0d1a27 0%, #3a1d0d 38%, #170d08 100%);
  font-family: "Arial Rounded MT Bold", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.game-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(43, 23, 10, 0.92), rgba(126, 80, 29, 0.35) 10%, transparent 24%, transparent 76%, rgba(126, 80, 29, 0.35) 90%, rgba(43, 23, 10, 0.92)),
    radial-gradient(circle at 50% 12%, rgba(255, 233, 132, 0.32), transparent 24rem),
    linear-gradient(180deg, #1c1109 0%, #664018 48%, #27140a 100%);
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.7);
}

.game-shell::before,
.game-shell::after {
  content: "";
  position: absolute;
  top: 0;
  width: 70px;
  height: 90px;
  border-bottom: 3px solid rgba(80, 220, 255, 0.85);
  background: linear-gradient(140deg, rgba(17, 195, 255, 0.85), rgba(11, 70, 140, 0.15));
  filter: drop-shadow(0 0 12px rgba(48, 201, 255, 0.95));
  opacity: 0.78;
}

.game-shell::before {
  left: -18px;
  border-bottom-right-radius: 20px;
  transform: skewX(-28deg);
}

.game-shell::after {
  right: -18px;
  border-bottom-left-radius: 20px;
  transform: skewX(28deg);
}

.corner-button {
  position: absolute;
  top: max(11px, env(safe-area-inset-top));
  z-index: 6;
  min-width: 54px;
  min-height: 34px;
  padding: 5px 10px;
  border: 2px solid rgba(255, 239, 143, 0.92);
  border-radius: 8px;
  color: #fff7bb;
  background: linear-gradient(180deg, #2cd6ff, #0879d4 62%, #063a83);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.32), 0 0 14px rgba(56, 211, 255, 0.82), 0 4px 0 rgba(54, 30, 10, 0.92);
  font-size: 14px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(4, 35, 86, 0.8);
}

.back-button {
  left: 11px;
}

.intro-button {
  right: 11px;
}

.record-button {
  right: 76px;
}

.corner-button:active,
.intro-close:active,
.record-close:active {
  transform: translateY(2px) scale(0.97);
}

.top-bar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  gap: 8px;
  align-items: end;
  min-height: 104px;
  padding: 48px 8px 0;
}

.start-button,
.mini-button {
  position: relative;
  display: grid;
  place-items: center;
  user-select: none;
  transition: transform 130ms ease, filter 130ms ease;
}

.start-button:active,
.mini-button:active {
  transform: translateY(2px) scale(0.97);
}

.score-panel {
  min-width: 0;
}

.panel-label {
  display: block;
  margin: 0 0 6px;
  color: #fff6b5;
  font-size: clamp(17px, 4.4vw, 22px);
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 2px 0 #6b2600, 0 0 9px rgba(255, 235, 126, 0.72);
  white-space: nowrap;
}

.digital-number {
  font-family: "Courier New", monospace;
  font-weight: 900;
  letter-spacing: 0;
  color: #ff2635;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.78), 0 0 1px #ffecdd;
}

.score-panel .digital-number {
  display: block;
  min-height: 38px;
  padding: 7px 9px 6px;
  overflow: hidden;
  border: 3px solid #ffeb87;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 2px, transparent 2px, transparent 5px),
    #111720;
  box-shadow: inset 0 0 12px #03060c, 0 0 9px rgba(255, 233, 125, 0.72);
  font-size: clamp(20px, 6vw, 29px);
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.machine-frame {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  padding: 8px;
  border: 3px solid rgba(255, 226, 112, 0.78);
  border-radius: 11px;
  background:
    linear-gradient(145deg, rgba(255, 233, 151, 0.24), transparent 16%),
    linear-gradient(180deg, #5e3516, #2a160b);
  box-shadow: inset 0 0 22px rgba(255, 203, 78, 0.28), 0 12px 18px rgba(0, 0, 0, 0.28);
}

.reel-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  aspect-ratio: 1;
}

.symbol-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 238, 154, 0.86);
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.8), transparent 19%),
    linear-gradient(145deg, #fffbac, #c89541 58%, #7d471f);
  box-shadow: inset 0 -4px 0 rgba(104, 60, 21, 0.42), 0 2px 4px rgba(0, 0, 0, 0.35);
}

.symbol-cell.active {
  border-color: #ff302e;
  box-shadow: inset 0 0 13px rgba(255, 55, 25, 0.9), 0 0 15px rgba(255, 58, 24, 1);
  transform: scale(1.045);
  z-index: 3;
}

.symbol-cell.selected::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid #67e8ff;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(68, 226, 255, 0.9);
  pointer-events: none;
}

.symbol-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 2px;
  overflow: hidden;
  font-size: clamp(18px, 7vw, 31px);
  font-weight: 950;
  color: #9b110c;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55), 0 0 8px rgba(255, 248, 92, 0.52);
}

.symbol-icon.text-symbol {
  color: #f5292d;
  font-size: clamp(12px, 4.3vw, 18px);
  letter-spacing: 0;
  transform-origin: center;
}

.symbol-cell[data-symbol="lucky"] .symbol-icon {
  gap: 1px;
  padding: 4px 3px;
  transform: none;
}

.symbol-cell[data-symbol="bar"] .symbol-icon {
  gap: 1px;
  padding: 4px 3px;
  transform: none;
}

.symbol-cell[data-symbol="seven"] .symbol-icon {
  font-size: clamp(13px, 4.7vw, 20px);
}

.bar-mark,
.lucky-mark span {
  display: block;
  width: 100%;
  max-width: 38px;
  padding: 1px 2px;
  border: 1px solid rgba(255, 231, 92, 0.9);
  border-radius: 3px;
  color: #ffd82f;
  background: linear-gradient(180deg, #3b1b0b, #120806);
  font-size: clamp(8px, 3vw, 12px);
  line-height: 1;
  text-shadow: 0 1px 0 #7f0c10, 0 0 5px rgba(255, 226, 64, 0.8);
}

.lucky-mark {
  display: grid;
  gap: 1px;
  width: 100%;
  max-width: 38px;
}

.lucky-mark span {
  color: #b11216;
  background: linear-gradient(180deg, #fff9a8, #ffcb2c);
  font-size: clamp(7px, 2.5vw, 10px);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.74), 0 0 5px rgba(255, 226, 64, 0.55);
}

.cell-multiplier {
  position: absolute;
  right: 3px;
  bottom: 1px;
  color: #db1218;
  font-size: clamp(10px, 3vw, 14px);
  font-weight: 950;
  text-shadow: 0 1px 0 #fff4a7;
}

.center-stage {
  position: absolute;
  inset: calc(100% / 7 + 13px);
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 13px;
  border: 3px solid rgba(255, 232, 130, 0.58);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 247, 99, 0.35), transparent 7rem),
    repeating-conic-gradient(from -8deg, rgba(255, 204, 93, 0.2) 0 7deg, rgba(66, 32, 17, 0.12) 7deg 14deg),
    #2a1a10;
}

.center-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 197, 75, 0.24) 0 2px, transparent 3px);
  background-size: 31px 31px;
  opacity: 0.55;
}

.center-stage::after {
  content: "";
  position: absolute;
  inset: -35%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 232, 100, 0.2) 0deg 9deg, rgba(255, 128, 28, 0.04) 9deg 18deg),
    radial-gradient(circle, transparent 0 22%, rgba(255, 202, 59, 0.18) 23%, transparent 56%);
  opacity: 0;
  transform-origin: center;
  pointer-events: none;
}

.game-shell.is-spinning .center-stage::after {
  opacity: 0.86;
  animation: stageSpin 1.8s linear infinite;
}

.center-stage > * {
  position: relative;
  z-index: 1;
}

.marquee {
  position: relative;
  width: min(94%, 260px);
  min-height: 110px;
  display: grid;
  place-items: center;
  padding: 20px 14px 16px;
  clip-path: polygon(15% 0, 85% 0, 100% 50%, 85% 100%, 15% 100%, 0 50%);
  background: linear-gradient(160deg, #fff09b, #ffe04a 55%, #d88421);
  color: #b32009;
  text-align: center;
  text-shadow: 0 2px 0 #fff1a8, 0 0 6px rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 4px rgba(89, 38, 14, 0.85), 0 0 18px rgba(255, 213, 98, 0.9);
}

.marquee::after {
  content: "";
  position: absolute;
  inset: 6px;
  clip-path: inherit;
  border: 3px dotted #7a2a12;
  opacity: 0.65;
}

.marquee strong {
  position: relative;
  z-index: 3;
  max-width: 94%;
  overflow: hidden;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marquee small {
  position: relative;
  z-index: 3;
  margin-top: 5px;
  color: #7f2a08;
  font-size: 13px;
  font-weight: 900;
}

.fruit {
  position: absolute;
  z-index: 1;
  font-size: clamp(21px, 6vw, 30px);
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.36));
}

.fruit-a {
  left: 28%;
  top: -4px;
}

.fruit-b {
  right: 20%;
  top: 9px;
}

.fruit-c {
  right: 35%;
  bottom: -7px;
}

.bet-meter {
  position: relative;
  display: grid;
  gap: 5px;
  justify-items: center;
  min-width: 118px;
  margin-top: 18px;
  padding: 9px 13px;
  border: 3px solid rgba(255, 232, 143, 0.75);
  border-radius: 8px;
  background: linear-gradient(180deg, #1b2834, #071016);
  box-shadow: inset 0 0 12px #020308, 0 0 8px rgba(255, 228, 113, 0.35);
}

#statusText {
  max-width: 190px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bet-meter .digital-number {
  font-size: clamp(24px, 8vw, 38px);
  line-height: 1;
}

.start-button {
  width: 100%;
  min-height: 62px;
  border: 6px solid #ffd36c;
  border-radius: 12px;
  color: #fff2cc;
  background:
    radial-gradient(circle at 24% 22%, rgba(255, 255, 255, 0.75), transparent 12%),
    linear-gradient(180deg, #ff6970, #ed1c31 50%, #8b0a12);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), inset 0 -6px 0 rgba(57, 0, 0, 0.45), 0 8px 0 #6b3b18, 0 0 22px rgba(255, 23, 34, 0.9);
  font-size: clamp(22px, 6.6vw, 30px);
  font-weight: 950;
  text-shadow: 0 2px 0 #6f0a0d;
}

.start-button:disabled,
.bet-controls button:disabled {
  cursor: default;
  filter: grayscale(0.45) brightness(0.72);
}

.bet-controls {
  display: grid;
  grid-template-columns: 58px 58px minmax(72px, 1fr) 58px 58px;
  gap: 7px;
  align-items: center;
  width: 100%;
  margin: 14px 0 8px;
}

.start-row {
  position: relative;
  z-index: 2;
  margin: 12px 4px 14px;
}

.mini-button {
  min-height: 42px;
  border: 2px solid #ffdf77;
  border-radius: 7px;
  color: #ff3440;
  background: linear-gradient(180deg, #21313e, #070d13);
  box-shadow: inset 0 0 10px #010307, 0 4px 0 rgba(51, 24, 9, 0.95);
  font-size: 23px;
  font-weight: 950;
}

.mini-button.wide {
  font-size: 14px;
}

.bet-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 42px;
  padding: 6px 10px;
  border: 2px solid #ffdf77;
  border-radius: 7px;
  background: linear-gradient(180deg, #16232e, #070d13);
  box-shadow: inset 0 0 10px #010307;
}

.bet-readout span {
  color: #f7df91;
  font-size: 13px;
  font-weight: 900;
}

.bet-readout strong {
  overflow: hidden;
  font-size: 24px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stake-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.stake-card {
  position: relative;
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 0;
  min-height: 68px;
  padding: 7px 4px 5px;
  border: 2px solid rgba(255, 235, 130, 0.9);
  border-radius: 8px;
  color: #b81711;
  background:
    radial-gradient(circle at 34% 18%, rgba(255, 255, 255, 0.8), transparent 18%),
    linear-gradient(180deg, #fff8b4, #ffd15d 57%, #b86f24);
  box-shadow: inset 0 -5px 0 rgba(102, 51, 17, 0.28), 0 5px 0 rgba(53, 29, 9, 0.92);
}

.stake-card.active {
  border-color: #4eeaff;
  box-shadow: inset 0 -5px 0 rgba(102, 51, 17, 0.28), 0 0 14px rgba(65, 225, 255, 0.95), 0 5px 0 rgba(53, 29, 9, 0.92);
}

.stake-icon {
  min-height: 26px;
  max-width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: clamp(18px, 7vw, 30px);
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.stake-card[data-symbol="bar"] .stake-icon,
.stake-card[data-symbol="seven"] .stake-icon {
  font-size: clamp(18px, 6vw, 24px);
  transform: scaleX(0.86);
  transform-origin: center;
}

.stake-name,
.stake-odds {
  max-width: 100%;
  overflow: hidden;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stake-name {
  font-size: 11px;
}

.stake-odds {
  font-size: clamp(16px, 5.6vw, 24px);
}

.coin-pop {
  animation: coinPop 520ms ease;
}

.shake {
  animation: shake 360ms ease;
}

.win-flash {
  animation: winFlash 820ms ease;
}

.result-popup {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
}

.result-popup[hidden] {
  display: none;
}

.result-popup::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 47%, rgba(255, 221, 78, 0.3), rgba(0, 0, 0, 0.16) 35%, transparent 62%);
  animation: resultBackdrop 2.7s ease both;
}

.result-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  width: min(82vw, 310px);
  min-height: 150px;
  padding: 20px 18px 18px;
  border: 3px solid #fff09d;
  border-radius: 8px;
  color: #fff5b8;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.42), transparent 5rem),
    linear-gradient(180deg, #bc2f12, #5f140b 58%, #250d07);
  box-shadow: 0 0 28px rgba(255, 54, 28, 0.72), 0 18px 28px rgba(0, 0, 0, 0.48);
  text-align: center;
  text-shadow: 0 2px 0 rgba(60, 12, 0, 0.78), 0 0 10px rgba(255, 230, 78, 0.46);
  animation: resultLose 2.65s ease both;
}

.result-card.win {
  color: #6b1600;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.82), transparent 5rem),
    linear-gradient(180deg, #fff6a9, #ffc22f 58%, #d46815);
  box-shadow: 0 0 32px rgba(255, 231, 89, 0.95), 0 18px 28px rgba(0, 0, 0, 0.48);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.58), 0 0 10px rgba(255, 40, 0, 0.28);
  animation: resultWin 2.65s ease both;
}

.result-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #d1121d;
  background: linear-gradient(180deg, #fff8b7, #ffb52a);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.62), 0 0 18px rgba(255, 236, 76, 0.9);
  font-size: 29px;
  font-weight: 950;
  line-height: 1;
}

.result-card:not(.win) .result-badge {
  color: #fff0b5;
  background: linear-gradient(180deg, #ff6066, #a30e18);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.26), 0 0 16px rgba(255, 32, 42, 0.82);
}

#resultTitle {
  font-size: clamp(28px, 9vw, 42px);
  line-height: 1;
}

#resultDetail {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(16px, 5vw, 22px);
  font-weight: 950;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  padding: 18px;
}

.record-modal[hidden] {
  display: none;
}

.record-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 2, 0, 0.72);
  backdrop-filter: blur(5px);
}

.record-card {
  position: relative;
  width: min(100%, 374px);
  max-height: min(78dvh, 590px);
  overflow: hidden;
  border: 3px solid #ffec87;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(75, 220, 255, 0.24), transparent 12rem),
    linear-gradient(180deg, #36200f, #120b07);
  box-shadow: 0 0 24px rgba(61, 205, 255, 0.42), 0 18px 34px rgba(0, 0, 0, 0.54);
}

.record-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 229, 124, 0.25);
}

.record-header h2 {
  margin: 0;
  color: #fff1a7;
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 2px 0 #6b2600, 0 0 9px rgba(255, 235, 126, 0.72);
}

.record-close {
  width: 34px;
  height: 34px;
  border: 2px solid #ffea86;
  border-radius: 50%;
  color: #fff4bd;
  background: linear-gradient(180deg, #ff6066, #d81525 58%, #7d0710);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.32), 0 3px 0 rgba(54, 30, 10, 0.92);
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
}

.record-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  color: #ffec9f;
  font-size: 13px;
  font-weight: 950;
}

.record-summary span {
  min-width: 0;
  padding: 8px;
  border: 2px solid rgba(255, 226, 112, 0.62);
  border-radius: 7px;
  overflow: hidden;
  background: linear-gradient(180deg, #1d2a34, #080d12);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-list {
  display: grid;
  gap: 8px;
  max-height: calc(min(78dvh, 590px) - 116px);
  overflow: auto;
  padding: 0 12px 14px;
}

.record-empty {
  margin: 10px 0 0;
  color: #fff4c5;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.record-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 2px solid rgba(255, 226, 112, 0.58);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 236, 156, 0.16), rgba(20, 12, 7, 0.82));
}

.record-item.win {
  border-color: rgba(255, 241, 132, 0.88);
  box-shadow: 0 0 10px rgba(255, 219, 74, 0.35);
}

.record-icon {
  display: grid;
  place-items: center;
  gap: 1px;
  width: 38px;
  height: 38px;
  overflow: hidden;
  padding: 4px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8b7, #c67b22);
  color: #c61318;
  font-size: 21px;
  font-weight: 950;
}

.record-icon .bar-mark,
.record-icon .lucky-mark span {
  max-width: 30px;
  font-size: 8px;
}

.result-badge .bar-mark,
.result-badge .lucky-mark span {
  max-width: 34px;
  font-size: 9px;
}

.record-main,
.record-side {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.record-title,
.record-profit {
  overflow: hidden;
  color: #fff0a6;
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-meta,
.record-time {
  overflow: hidden;
  color: #d8c387;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-side {
  justify-items: end;
}

.record-profit.win {
  color: #9dff67;
}

.record-profit.lose {
  color: #ff7d7d;
}

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.intro-modal[hidden] {
  display: none;
}

.intro-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 2, 0, 0.72);
  backdrop-filter: blur(5px);
}

.intro-card {
  position: relative;
  width: min(100%, 360px);
  max-height: min(78dvh, 560px);
  overflow: hidden;
  border: 3px solid #ffec87;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 225, 98, 0.26), transparent 12rem),
    linear-gradient(180deg, #4a260e, #1b1009);
  box-shadow: 0 0 24px rgba(255, 214, 86, 0.52), 0 18px 34px rgba(0, 0, 0, 0.54);
}

.intro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 229, 124, 0.25);
}

.intro-header h2 {
  margin: 0;
  color: #fff1a7;
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 2px 0 #6b2600, 0 0 9px rgba(255, 235, 126, 0.72);
}

.intro-close {
  width: 34px;
  height: 34px;
  border: 2px solid #ffea86;
  border-radius: 50%;
  color: #fff4bd;
  background: linear-gradient(180deg, #ff6066, #d81525 58%, #7d0710);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.32), 0 3px 0 rgba(54, 30, 10, 0.92);
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
}

.intro-content {
  max-height: calc(min(78dvh, 560px) - 61px);
  overflow: auto;
  padding: 13px 16px 16px;
  color: #fff4c5;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.65;
}

.intro-content p {
  margin: 0 0 10px;
}

.intro-content ul {
  display: grid;
  gap: 7px;
  margin: 0 0 10px;
  padding-left: 19px;
}

@keyframes coinPop {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.11);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-2px);
  }
}

@keyframes winFlash {
  0%,
  100% {
    filter: brightness(1);
  }
  35% {
    filter: brightness(1.45) saturate(1.2);
  }
}

@keyframes stageSpin {
  from {
    transform: rotate(0deg) scale(1);
  }
  to {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes resultBackdrop {
  0%,
  100% {
    opacity: 0;
  }
  15%,
  76% {
    opacity: 1;
  }
}

@keyframes resultWin {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.68) rotate(-2deg);
  }
  18% {
    opacity: 1;
    transform: translateY(-8px) scale(1.12) rotate(1deg);
  }
  34% {
    transform: translateY(0) scale(0.98) rotate(0deg);
  }
  62% {
    filter: brightness(1.35) saturate(1.24);
  }
  100% {
    opacity: 0;
    transform: translateY(-12px) scale(1.02);
  }
}

@keyframes resultLose {
  0% {
    opacity: 0;
    transform: scale(0.78);
  }
  16% {
    opacity: 1;
    transform: scale(1.06) translateX(-3px);
  }
  25% {
    transform: scale(1) translateX(4px);
  }
  34% {
    transform: scale(1) translateX(-2px);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .result-popup::before,
  .result-card,
  .result-card.win {
    animation-duration: 1ms;
  }
}

@media (max-height: 760px) {
  .game-shell {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .top-bar {
    min-height: 74px;
    padding-top: 40px;
  }

  .panel-label {
    margin-bottom: 4px;
    font-size: clamp(14px, 4vw, 18px);
  }

  .score-panel .digital-number {
    min-height: 34px;
    padding: 6px 8px 5px;
    font-size: clamp(18px, 5.4vw, 25px);
  }

  .machine-frame {
    width: min(100%, 340px);
    margin-top: 5px;
    margin-right: auto;
    margin-left: auto;
    padding: 6px;
  }

  .center-stage {
    inset: calc(100% / 7 + 11px);
    padding: 10px;
  }

  .marquee {
    min-height: 92px;
    padding: 16px 12px 13px;
  }

  .marquee strong {
    font-size: clamp(22px, 6.2vw, 30px);
  }

  .bet-meter {
    margin-top: 12px;
    padding: 7px 11px;
  }

  .bet-meter .digital-number {
    font-size: clamp(22px, 7vw, 32px);
  }

  .bet-controls {
    grid-template-columns: 56px 56px minmax(68px, 1fr) 56px 56px;
    gap: 6px;
    margin: 10px 0 6px;
  }

  .mini-button,
  .bet-readout {
    min-height: 38px;
  }

  .start-button {
    min-height: 52px;
    border-width: 5px;
  }

  .start-row {
    margin: 9px 4px 9px;
  }

  .stake-row {
    gap: 6px;
    margin-top: 6px;
  }

  .stake-card {
    height: 54px;
    min-height: 54px;
    overflow: hidden;
    padding: 5px 4px 4px;
  }

  .stake-icon {
    min-height: 22px;
    font-size: clamp(16px, 5.8vw, 24px);
  }

  .stake-name {
    font-size: 10px;
  }

  .stake-odds {
    font-size: clamp(14px, 4.8vw, 20px);
  }
}

@media (max-height: 700px) {
  .game-shell {
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .corner-button {
    min-width: 48px;
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .record-button {
    right: 67px;
  }

  .top-bar {
    min-height: 62px;
    padding: 34px 6px 0;
  }

  .panel-label {
    margin-bottom: 3px;
    font-size: 13px;
  }

  .score-panel .digital-number {
    min-height: 28px;
    padding: 4px 7px;
    border-width: 2px;
    font-size: 19px;
  }

  .machine-frame {
    width: min(100%, 312px);
    margin-top: 4px;
    padding: 5px;
    border-width: 2px;
  }

  .reel-board {
    gap: 3px;
  }

  .symbol-cell {
    border-width: 1px;
    border-radius: 6px;
  }

  .symbol-icon {
    font-size: clamp(16px, 5.4vw, 24px);
  }

  .cell-multiplier {
    font-size: clamp(8px, 2.5vw, 11px);
  }

  .center-stage {
    inset: calc(100% / 7 + 8px);
    padding: 8px;
    border-width: 2px;
  }

  .marquee {
    width: min(94%, 220px);
    min-height: 78px;
    padding: 13px 10px 10px;
  }

  .marquee strong {
    font-size: clamp(20px, 5.5vw, 24px);
  }

  .marquee small {
    margin-top: 3px;
    font-size: 11px;
  }

  .fruit {
    font-size: clamp(17px, 5vw, 22px);
  }

  .bet-meter {
    gap: 3px;
    min-width: 104px;
    margin-top: 8px;
    padding: 5px 9px;
    border-width: 2px;
  }

  #statusText {
    max-width: 160px;
    font-size: 10px;
  }

  .bet-meter .digital-number {
    font-size: clamp(19px, 6vw, 27px);
  }

  .bet-controls {
    grid-template-columns: 52px 52px minmax(64px, 1fr) 52px 52px;
    gap: 5px;
    margin: 8px 0 5px;
  }

  .mini-button,
  .bet-readout {
    min-height: 34px;
  }

  .mini-button {
    font-size: 19px;
  }

  .mini-button.wide,
  .bet-readout span {
    font-size: 12px;
  }

  .bet-readout {
    padding: 5px 8px;
  }

  .bet-readout strong {
    font-size: 21px;
  }

  .start-row {
    margin: 7px 4px 7px;
  }

  .start-button {
    min-height: 46px;
    border-width: 5px;
    font-size: clamp(19px, 5.4vw, 24px);
  }

  .stake-row {
    gap: 5px;
    margin-top: 5px;
  }

  .stake-card {
    height: 44px;
    min-height: 44px;
    overflow: hidden;
    padding: 4px 3px 3px;
    border-width: 1px;
    border-radius: 6px;
  }

  .stake-icon {
    min-height: 18px;
    font-size: clamp(14px, 4.6vw, 20px);
  }

  .stake-name {
    font-size: 9px;
  }

  .stake-odds {
    font-size: clamp(12px, 4vw, 17px);
  }
}

@media (max-height: 620px) {
  .top-bar {
    min-height: 56px;
    padding-top: 31px;
  }

  .machine-frame {
    width: min(100%, 288px);
  }

  .marquee {
    min-height: 66px;
    padding: 10px 9px 8px;
  }

  .marquee strong {
    font-size: clamp(19px, 6vw, 26px);
  }

  .bet-meter {
    margin-top: 6px;
  }

  .start-button {
    min-height: 42px;
  }

  .stake-card {
    height: 39px;
    min-height: 39px;
  }
}

@media (max-width: 360px) {
  .game-shell {
    padding-left: 7px;
    padding-right: 7px;
  }

  .top-bar {
    gap: 5px;
    padding-left: 5px;
    padding-right: 5px;
  }

  .corner-button {
    min-width: 48px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .record-button {
    right: 67px;
  }

  .reel-board {
    gap: 4px;
  }

  .start-button {
    min-height: 54px;
  }
}

@media (max-width: 360px) and (max-height: 700px) {
  .reel-board {
    gap: 3px;
  }

  .start-button {
    min-height: 44px;
  }

  .stake-card {
    height: 42px;
    min-height: 42px;
  }
}
