:root {
  --screen-blue: #1014c7;
  --screen-text: #fff05a;
  --screen-red: #c22c2c;
  --frame-dark: #101116;
  --frame-light: #71757d;
  --card-white: #fff;
  --card-red: #c8282e;
  --cabinet-width: 884px;
  --screen-padding: 9px;
  font-family: Arial, Helvetica, sans-serif;
  color: white;
  background: #070707;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
}

button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #fff05a; outline-offset: 3px; }
button:disabled { cursor: default; }

.cabinet {
  position: relative;
  width: var(--cabinet-width);
  max-width: 100%;
  padding: 10px 7px 0;
  border-radius: 8px;
  background: radial-gradient(ellipse at 50% 45%, #0000 35%, #0005 100%), var(--frame-dark);
  box-shadow: inset 0 2px 5px #000b, inset 1px 0 2px #0008, inset -1px 0 2px #0008, 0 1px 0 #ffffff0d;
}

.play-area {
  width: 760px;
  max-width: 100%;
  margin-inline: auto;
}

.monitor {
  position: relative;
  overflow: hidden;
  width: 600px;
  margin-inline: auto;
  padding: var(--screen-padding);
  border: 5px solid var(--frame-light);
  border-radius: 12px 12px 5px 5px;
  background: radial-gradient(ellipse at 50% 44%, #2028f4 0%, var(--screen-blue) 65%, #060b78 100%);
  background-clip: padding-box;
  box-shadow: inset 0 0 20px 5px #050530;

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, #0000 0 2px, #0002 3px 4px),
      radial-gradient(ellipse, #fff1 0%, #0000 57%, #0008 100%);
    mix-blend-mode: multiply;
  }
}

.paytable {
  border: 2px solid var(--screen-text);
  background: #252525;
  box-shadow: 0 0 0 2px #191919, 0 2px 9px #0009;
  color: var(--screen-text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;

  table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  col.hand-column { width: 44%; }
  th:first-child, td:first-child { width: 43%; text-align: left; }
  th:not(:first-child), td:not(:first-child) { width: 11.4%; text-align: right; border-left: 1px solid #c5c5c5; padding-right: 6px; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  tbody tr { height: 14px; }
  tbody tr.winner { color: #fff; background: #743000; }
  tbody td.selected-column, thead th.selected-column { background: var(--screen-red); color: #fff987; }
  tbody tr.winner td.selected-column { color: inherit; }
  .hand-name { display: flex; align-items: center; gap: 3px; padding-left: 6px; white-space: nowrap; }
  .hand-name::after { content: ""; flex: 1; border-bottom: 2px dotted currentColor; }
}

.message {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffef4f;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 2px 2px #770404, 0 0 8px #ffcf1a;

  &.winning { animation: pulse 700ms ease-in-out 3; }
}

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  min-height: 164px;
}

.card {
  position: relative;
  height: 155px;
  overflow: hidden;
  border: 2px solid #f9f9f9;
  border-radius: 6px;
  color: #111;
  background: var(--card-white);
  box-shadow: 2px 3px 0 #0006;
  user-select: none;

  &.red { color: var(--card-red); }
  &.held { box-shadow: 0 0 0 3px #ffe341, 2px 3px 0 #0006; }
  &.empty { color: #c8d0ff; background: linear-gradient(135deg, #222589, #161857); border-color: #ced2f8; }
  .corner { position: absolute; top: 3px; left: 6px; display: grid; line-height: 0.95; font-size: 34px; font-weight: 900; }
  .corner small { margin-top: -8px; font-size: 44px; font-weight: normal; }
  .center-suit { position: absolute; left: 0; right: 0; bottom: 8px; height: 88px; display: grid; place-items: center; font-family: Georgia, serif; font-size: 115px; line-height: 1; transform: scale(0.8); }
  .court-art { position: absolute; top: 8px; right: 4px; width: 68px; height: 68px; object-fit: contain; }
  .back-mark { position: absolute; inset: 10px; display: grid; place-items: center; border: 2px solid #a7a9e4; color: #eef0ff; font-size: 42px; font-weight: 900; letter-spacing: -5px; }
  .hold-tag { position: absolute; right: 4px; bottom: 4px; padding: 1px 4px; background: #f3de1a; color: #111; font-size: 12px; font-weight: 900; }
}

.meters {
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;

  .meter { display: flex; align-items: baseline; gap: 6px; color: var(--screen-text); font-size: 22px; font-weight: 900; letter-spacing: 1px; text-shadow: 2px 2px var(--screen-red), -1px -1px var(--screen-red); }
}

.button-tray {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 79px;
  margin-top: 10px;
  padding: 8px 19px;
  border-top: 1px solid #303238;

  .hold-buttons { display: flex; flex: 1; gap: 6px; }
  .bet-button, .max-button, .deal-button { flex: 0 0 80px; }
}

.side-panel {
  position: absolute;
  top: 14px;
  right: 16px;
  bottom: 92px;
  width: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  border: 1px solid #303238;
  border-radius: 6px;
  background: #17191e;
  box-shadow: inset 0 2px 5px #000a, inset 1px 0 #ffffff12;

  .sound-control { display: flex; flex-direction: column; align-items: center; gap: 15px; }
  .setting-button, .reset-button { flex: none; width: 82px; height: 43px; border-radius: 6px; font-size: 12px; }
  .sound-levels {
    display: grid;
    gap: 10px;
    width: 84px;
    color: #c9cbd0;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.6px;

    > div { display: flex; align-items: center; gap: 9px; }
    .led { width: 12px; height: 12px; flex: none; border: 1px solid #050505; border-radius: 50%; background: #514b36; box-shadow: inset 0 2px 3px #000b; }
    .active { color: #fff0a7; }
    .active .led { background: #ffdf63; box-shadow: inset 0 1px #fff8b9, 0 0 7px #ffe56b9c; }
  }
}

.machine-button {
  --button-face: linear-gradient(#fff, #e9e9e9 35%, #b8bbc2 84%, #6d7078);
  --button-edge: #82848a;
  --button-light: #fff;
  --button-glow: 0 0 0 transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 49px;
  min-width: 0;
  padding: 2px;
  border: 2px solid var(--button-edge);
  border-radius: 6px;
  background: var(--button-face);
  color: #121212;
  box-shadow: 0 4px 0 #020202, inset 0 2px 0 var(--button-light), var(--button-glow);
  font-size: 13px;
  font-weight: 900;
  line-height: 0.95;
  text-align: center;

  small { margin-top: 3px; font-size: 9px; font-weight: 700; color: #555; }
  &.active {
    --button-face: linear-gradient(#fffdd6, #ffeb70 40%, #e6bc3c 90%);
    --button-edge: #d8b54f;
    --button-light: #fffbd6;
    --button-glow: 0 0 9px #ffe15b66;

    small { color: #5a470d; }
  }
  &:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #020202, inset 0 2px 4px #0004, var(--button-glow); }
  &:disabled { opacity: 0.48; }
  &.deal-button { --button-face: linear-gradient(#fffbc1, #fff18e 40%, #d8af42 90%); }
}

@keyframes pulse { 50% { color: white; text-shadow: 0 0 12px white, 2px 2px #b00000; } }

@media (prefers-reduced-motion: reduce) { .message.winning { animation: none; } }

@media (max-width: 883px) {
  .side-panel {
    position: static;
    width: min(600px, 100%);
    margin: 10px auto;
    flex-direction: row;
    justify-content: space-around;
    gap: 20px;

    .sound-control { flex-direction: row; }
  }
}
