* { box-sizing: border-box; }

:root {
  --gold: #f2ce5c;
  --gold2: #aa781b;
  --red: #c31717;
  --green: #0b2a19;
  --screen: #020806;
  --line: #3e6b4d;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  font-family: "Arial Narrow", Arial, Helvetica, sans-serif;
  color: #fff;
  background:
    radial-gradient(circle at 50% 0%, #19492b 0%, #07150d 47%, #020604 100%);
}

button { font: inherit; }

.machine {
  width: min(1280px, 100%);
  margin: auto;
  padding: 22px;
  border: 5px solid var(--gold2);
  border-radius: 26px;
  background: linear-gradient(#13291b, #07110b);
  box-shadow:
    0 0 0 3px #332105,
    0 0 45px rgba(239, 194, 69, .16);
}

.machine-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 2px solid #5e4520;
  padding-bottom: 16px;
}

.brand {
  color: var(--gold);
  font-size: clamp(30px, 5vw, 56px);
  font-weight: 1000;
  letter-spacing: 4px;
  text-shadow: 0 3px 0 #5d3e00;
}

.mode {
  letter-spacing: 3px;
  opacity: .6;
  font-size: 12px;
}

.jp-box {
  min-width: 210px;
  text-align: center;
  padding: 10px 18px;
  background: #180808;
  border: 2px solid #8d2828;
  border-radius: 12px;
  box-shadow: inset 0 0 15px #000;
}

.jp-value {
  color: #ff5d5d;
  font-size: 30px;
  font-weight: 900;
  font-family: ui-monospace, monospace;
}

.mini-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  opacity: .64;
  margin-bottom: 4px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.display {
  min-height: 67px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--screen);
  border-radius: 8px;
  box-shadow: inset 0 0 14px #000;
}

.display strong {
  color: #a9ff9a;
  font-family: ui-monospace, monospace;
  font-size: 22px;
}

.center-grid {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
}

.paytable {
  background: #050a06;
  border: 2px solid #765719;
  border-radius: 10px;
  padding: 12px;
}

.paytable h2 {
  text-align: center;
  margin: 0 0 10px;
  color: var(--gold);
  letter-spacing: 2px;
  font-size: 19px;
}

.pay-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid #253628;
  font-size: 13px;
}

.pay-row strong { color: #ffe477; }

.pay-note {
  text-align: center;
  font-size: 10px;
  opacity: .55;
  margin-top: 9px;
}

.play-area {
  min-width: 0;
}

.status {
  min-height: 52px;
  border: 1px solid #315e3e;
  border-radius: 8px;
  background: var(--screen);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bdffc5;
  padding: 10px;
  text-align: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 26px 0;
}

.card {
  position: relative;
  aspect-ratio: .70;
  perspective: 1000px;
  min-width: 0;
}

.slot {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: #161006;
  background: var(--gold);
  border: 2px solid #fff0aa;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  transition: transform .42s cubic-bezier(.2,.8,.2,1);
}

.card.revealed .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  backface-visibility: hidden;
  border: 2px solid #d4bd68;
  overflow: hidden;
}

.card-back {
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, transparent 44%, #e7bf53 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #e7bf53 45% 55%, transparent 56%),
    #711010;
  background-size: 24px 24px;
}

.card-back::after {
  content: "BT";
  width: 55%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 3px solid #ffdf70;
  color: #ffdf70;
  background: #6a0909;
  font-weight: 1000;
  font-size: clamp(14px, 2vw, 28px);
}

.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #fff, #e9e6dc);
  color: #111;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 7px;
}

.card-front.red { color: #c20d16; }

.corner {
  font-size: clamp(13px, 1.7vw, 25px);
  font-weight: 900;
  line-height: .9;
}

.corner.bottom {
  transform: rotate(180deg);
  align-self: flex-end;
}

.big-suit {
  align-self: center;
  font-size: clamp(28px, 4.6vw, 68px);
  line-height: 1;
}

.joker-card {
  background: linear-gradient(145deg, #171717, #303030);
  color: #f5ce60;
  text-align: center;
  justify-content: center;
  gap: 7px;
}

.joker-card .big-suit {
  font-size: clamp(20px, 3vw, 45px);
}

.result-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-panel > div {
  min-height: 70px;
  border-radius: 8px;
  border: 1px solid #53552f;
  background: #060806;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-panel strong {
  font-size: 22px;
  color: #ffe26b;
}

.bet-selector {
  margin: 14px auto;
  width: 260px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 8px;
  text-align: center;
  align-items: stretch;
}

.bet-selector > div {
  background: #020806;
  border: 1px solid #49644b;
  border-radius: 8px;
  padding: 8px;
}

.bet-selector strong {
  color: #8cff83;
  font-size: 20px;
  font-family: ui-monospace, monospace;
}

.small-btn {
  border: 1px solid #71591e;
  background: #1c1608;
  color: #ffe071;
  font-size: 28px;
  font-weight: 900;
  border-radius: 8px;
  cursor: pointer;
}

.controls {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
}

.controls button {
  border: 0;
  border-radius: 10px;
  padding: 17px;
  font-size: 25px;
  font-weight: 1000;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: inset 0 -5px rgba(0,0,0,.22);
}

.controls button:active { transform: translateY(2px); }
.controls button:disabled { opacity: .4; cursor: not-allowed; }

.bet-button {
  color: #1d1603;
  background: linear-gradient(#ffe56f, #cf9617);
}

.fold-button {
  color: #fff;
  background: linear-gradient(#ef4a4a, #991212);
}

.new-button {
  grid-column: 1 / -1;
  display: none;
  color: #fff;
  background: linear-gradient(#4c89ef, #174c9d);
}

.shortcut {
  text-align: center;
  margin-top: 10px;
  font-size: 11px;
  opacity: .5;
}

footer {
  text-align: center;
  margin-top: 16px;
  font-size: 11px;
  opacity: .55;
}

.flash-win {
  animation: flashWin .35s alternate 6;
}

@keyframes flashWin {
  from { box-shadow: 0 0 0 rgba(255,224,85,0); }
  to { box-shadow: 0 0 35px rgba(255,224,85,.9); }
}

@media (max-width: 900px) {
  .center-grid { grid-template-columns: 1fr; }
  .paytable { order: 2; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .card:nth-child(5) { grid-column: 1; }
}

@media (max-width: 560px) {
  body { padding: 7px; }
  .machine { padding: 12px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .machine-header { align-items: stretch; flex-direction: column; }
  .jp-box { min-width: 0; }
  .cards { gap: 6px; }
  .controls { grid-template-columns: 1fr; }
  .new-button { grid-column: 1; }
}
