:root {
  color-scheme: dark;
  --gold: #ffd35a;
  --gold-2: #e8b23a;
  --plum: #1c0b2e;
  --plum-2: #2c1247;
  --ink: #1a0630;
  --game-h: 100dvh;
  --hud-h: 44px;
  --rew-h: 38px;
  --cab: 360px;
  --cabh: 362px;
  --pay-h: 0px;
  --rowa-h: 42px;
  --rowb-h: 84px;
  --cell: 60px;
  --btn: clamp(30px, 9vw, 40px);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, sans-serif;
  color: #fff;
  background: var(--plum);
  overflow: hidden;
}
html.is-half,
html.is-half body {
  background: transparent;
}
html.is-half body {
  pointer-events: none;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #fff4be;
  outline-offset: 2px;
}
button:disabled {
  cursor: default;
}
[hidden] {
  display: none !important;
}
img {
  -webkit-user-drag: none;
  user-select: none;
}
.ink {
  text-shadow: -1.5px 0 var(--ink), 1.5px 0 var(--ink), 0 -1.5px var(--ink), 0 1.5px var(--ink), 0 2px 0 #0008;
}

/* ---- frame ---- */
#game {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 500px);
  height: var(--game-h);
  padding: max(3px, env(safe-area-inset-top)) 8px max(3px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  overflow: hidden;
  background: url(assets/art/bg.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) center / cover var(--plum);
  pointer-events: auto;
}
html.is-half #game {
  padding-top: 5px;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px #00000090;
}
.hud {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: var(--hud-h);
}
.hud-actions {
  display: flex;
  gap: 4px;
  flex: none;
}
.round-btn {
  position: relative;
  flex: none;
  width: var(--btn);
  height: var(--btn);
  background: url(assets/art/round-btn.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) center / 100% 100% no-repeat;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 2px 2px #00000070);
}
.round-btn:active {
  transform: scale(0.94);
}
.round-btn svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.round-btn svg circle {
  fill: var(--gold);
  stroke-width: 1;
}
.round-btn > img {
  width: 66%;
  height: 66%;
  object-fit: contain;
}
.round-btn .ico-collapse,
.round-btn .ico-off {
  display: none;
}
#view[aria-pressed="true"] .ico-expand,
#sound[aria-pressed="true"] .ico-on {
  display: none;
}
#view[aria-pressed="true"] .ico-collapse,
#sound[aria-pressed="true"] .ico-off {
  display: block;
}
[dir="rtl"] #exit svg {
  transform: scaleX(-1);
}
.title {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: calc(var(--hud-h) - 8px);
  max-width: 150px;
  margin-inline: auto;
  display: grid;
  place-items: center;
}
.title img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.title strong {
  position: relative;
  font-size: clamp(13px, 4vw, 17px);
  letter-spacing: 0.02em;
  color: var(--gold);
  direction: ltr;
  white-space: nowrap;
  text-shadow: 0 1px 0 #000a, 0 0 8px #ffb30080;
}

/* ---- reward bar ---- */
.reward {
  flex: none;
  align-self: center;
  width: min(100%, var(--cab));
  height: var(--rew-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--gold-2);
  background: linear-gradient(#4a1f72, #1d0a33);
  box-shadow: inset 0 2px 4px #ffffff30, inset 0 -3px 6px #00000070, 0 2px 6px #0008;
}
.reward .lab {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ffd98a;
}
.reward b {
  flex: 1;
  text-align: end;
  font-size: clamp(16px, 5.2vw, 22px);
  color: #fff;
  direction: ltr;
  unicode-bidi: isolate;
  text-shadow: 0 0 10px #ffc94d90, 0 2px 0 #0008;
  font-variant-numeric: tabular-nums;
}
.reward .total {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffb52e;
  color: #3a1500;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.reward .total.capped {
  background: #ff5a4e;
  color: #fff;
}
.reward .total.muted {
  background: #ffffff22;
  color: #e9d7ff;
  font-weight: 700;
}

/* ---- cabinet ---- */
.cabinet {
  position: relative;
  flex: none;
  align-self: center;
  width: var(--cab);
  height: var(--cabh);
  direction: ltr; /* the stage is never mirrored */
}
.cabinet .frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}
.window {
  position: absolute;
  left: 17.13%;
  top: 24.72%;
  width: 65.74%;
  height: 50.06%;
  z-index: 1;
  overflow: hidden;
  border-radius: 4px;
  background: radial-gradient(ellipse at 50% 40%, #3b1a63, #12051f 80%);
}
.reels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  min-width: 0;
  min-height: 0;
}
.col.bonus {
  border-inline-start: 2px solid #e8b23a90;
  background: linear-gradient(#ffffff10, transparent 40%, #00000030);
}
.col.rolling .cell .s {
  opacity: 0.88;
}
.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
}
.cell .s {
  position: absolute;
  inset: 6%;
  width: 88%;
  height: 88%;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px #0008);
}
.cell .t {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  pointer-events: none;
  font-size: calc(var(--cell) * 0.3);
  text-shadow: -1px 0 #000a, 1px 0 #000a, 0 -1px #000a, 0 1px #000a;
}
.cell.k-seven .t {
  font-size: calc(var(--cell) * 0.52);
}
.cell.k-seventy .t {
  font-size: calc(var(--cell) * 0.4);
  color: #ffe58a;
}
.cell.k-triple .t {
  font-size: calc(var(--cell) * 0.3);
  color: #6a1400;
  text-shadow: 0 1px 0 #fff8;
}
.cell.k-unknown .t {
  font-size: calc(var(--cell) * 0.5);
  color: #ffb3b3;
}
.cell.kb1,
.cell[class*="kbx"] .t {
  font-size: calc(var(--cell) * 0.3);
}
.cell.kbrespin .t {
  display: none;
}
.payline {
  position: absolute;
  left: 0;
  right: 0;
  top: 33.33%;
  height: 33.34%;
  border-block: 1px solid #ffd35a55;
  background: linear-gradient(90deg, #ffd35a14, #ffd35a2a, #ffd35a14);
  pointer-events: none;
}
.window.is-lit .payline {
  border-color: #ffe58a;
  background: linear-gradient(90deg, #ffd35a30, #ffd35a66, #ffd35a30);
  box-shadow: 0 0 14px #ffc94d;
}
.cell.lit .s {
  filter: drop-shadow(0 0 7px #ffd35a) drop-shadow(0 0 2px #fff);
  animation: lit 0.7s ease-in-out infinite alternate;
}
.cell.pop .s,
.col.bonus .cell.pop:nth-child(2) .s {
  animation: pop 0.35s ease-out;
}
@keyframes lit {
  to {
    transform: scale(1.1);
  }
}
@keyframes pop {
  from {
    transform: scale(1.3);
  }
}
.arrow {
  position: absolute;
  z-index: 4;
  width: 5.5%;
  top: 47.5%;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px #0008);
}
.arrow.l {
  left: 11.5%;
}
.arrow.r {
  right: 11.5%;
  transform: scaleX(-1);
}
.blabel {
  position: absolute;
  z-index: 4;
  top: 17.2%;
  left: calc(17.13% + 65.74% * 0.75);
  width: calc(65.74% / 4);
  text-align: center;
  font-size: clamp(8px, calc(var(--cab) * 0.026), 11px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffe9a8;
  text-shadow: 0 1px 1px #000c;
  pointer-events: none;
}
.cabinet.is-chain .blabel {
  color: #ff9d7a;
}

/* ---- paytable ---- */
.pay {
  flex: none;
  align-self: center;
  width: var(--cab);
  height: var(--pay-h);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px 6px;
  padding: 10% 7%;
  background: url(assets/art/paytable.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) center / 100% 100% no-repeat;
  direction: ltr;
}
.it {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.it .ico {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  max-height: 34px;
}
.it .ico img {
  height: 100%;
  max-height: 34px;
  aspect-ratio: 1;
  object-fit: contain;
}
.it .ico img + img {
  margin-inline-start: -10px;
}
.it .ico .txt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 900;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}
.it .ico .txt.k-triple {
  font-size: 10px;
  color: #6a1400;
  text-shadow: 0 1px 0 #fff8;
}
.it .ico .txt.k-seventy {
  color: #ffe58a;
}
.it b {
  font-size: 15px;
  color: var(--gold);
  text-shadow: 0 1px 2px #000;
}
.it .ico.mix-bar img,
.it .ico.mix-seven img {
  max-height: 26px;
}
.it .ico.mix-bar img + img {
  margin-inline-start: -12px;
}
.is-compact .it .ico img {
  max-height: 26px;
}

/* ---- dock ---- */
.dock {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.row-a {
  height: var(--rowa-h);
  display: flex;
  align-items: center;
  gap: 4px;
}
.wallet {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-inline: 12px 10px;
}
.wallet .bar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.wallet .coin {
  position: relative;
  width: calc(var(--rowa-h) * 0.55);
  height: calc(var(--rowa-h) * 0.55);
}
.wallet b {
  position: relative;
  font-size: clamp(12px, 3.8vw, 16px);
  direction: ltr;
  unicode-bidi: isolate;
  text-shadow: 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chips {
  flex: none;
  display: flex;
  gap: 2px;
}
.chip {
  position: relative;
  width: var(--rowa-h);
  height: var(--rowa-h);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 2px 2px #0008);
}
.chip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.chip b {
  position: relative;
  font-size: calc(var(--rowa-h) * 0.3);
  color: #fff;
  text-shadow: -1px 0 #000b, 1px 0 #000b, 0 -1px #000b, 0 1px #000b;
}
.chip[aria-pressed="true"] {
  transform: translateY(-3px) scale(1.1);
  filter: drop-shadow(0 0 8px #ffd35a) drop-shadow(0 2px 2px #0008);
}
.chip.dim {
  opacity: 0.55;
}
.row-b {
  height: var(--rowb-h);
  display: grid;
  grid-template-columns: 1fr var(--rowb-h) 1fr;
  align-items: center;
  gap: 8px;
  direction: ltr;
}
[dir="rtl"] .row-b {
  direction: rtl;
}
.pill {
  position: relative;
  justify-self: center;
  width: min(100%, calc(var(--rowb-h) * 1.5));
  aspect-ratio: 384 / 190;
  display: grid;
  place-items: center;
}
.pill img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: drop-shadow(0 2px 2px #0008);
}
.pill span,
.spin span {
  position: relative;
  font-weight: 900;
  font-size: clamp(11px, 3.5vw, 15px);
  letter-spacing: 0.04em;
  text-shadow: -1px 0 #0009, 1px 0 #0009, 0 -1px #0009, 0 1px #0009;
}
.pill[aria-pressed="true"] img {
  filter: drop-shadow(0 0 9px #fff3a0) brightness(1.15);
}
.pill:active,
.spin:active:not(:disabled) {
  transform: scale(0.95);
}
.spin {
  position: relative;
  width: var(--rowb-h);
  height: var(--rowb-h);
  display: grid;
  place-items: center;
}
.spin img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 4px #000a);
}
.spin span {
  font-size: clamp(13px, 4.2vw, 18px);
}
.spin:disabled img {
  filter: grayscale(0.55) brightness(0.8);
}

/* ---- feedback ---- */
.feedback {
  position: absolute;
  z-index: 20;
  left: 10px;
  right: 10px;
  top: calc(var(--hud-h) + 8px);
  display: grid;
  gap: 4px;
  pointer-events: none;
}
.feedback > * {
  pointer-events: auto;
}
.connection,
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 2px solid var(--gold-2);
  box-shadow: 0 4px 12px #00000070;
}
.connection {
  background: #2c1247ee;
  justify-content: center;
  font-size: 12px;
  text-align: center;
}
.notice {
  background: #fff1cf;
  color: #3a1a05;
}
.notice p {
  flex: 1;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.notice button,
.loading button,
.panel-retry {
  min-height: 40px;
  padding: 4px 14px;
  border-radius: 10px;
  border: 1.5px solid #fff0b0;
  background: linear-gradient(#ffb52e, #d2691a);
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 0 #6a2f00;
}

/* ---- loading ---- */
.loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  text-align: center;
  background: linear-gradient(#1c0b2e99, #1c0b2ee6), url(assets/art/bg.webp?v=2ab444fbdec84a690c3daeb20e73c36114c6eded8af2c0b8081769dde5729c9d) center / cover;
}
.load-title {
  position: relative;
  width: 220px;
  height: 72px;
  display: grid;
  place-items: center;
}
.load-title img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.load-title strong {
  position: relative;
  font-size: 30px;
  color: var(--gold);
  direction: ltr;
  text-shadow: 0 2px 0 #000a, 0 0 12px #ffb300a0;
}
.load-emblem {
  width: 110px;
  height: 110px;
  animation: float 3s ease-in-out infinite alternate;
}
@keyframes float {
  to {
    transform: translateY(-6px) rotate(6deg);
  }
}
.loading p {
  font-size: 15px;
  margin: 0;
}
.loading progress {
  width: 70%;
  height: 14px;
  accent-color: #ffb32e;
}
.loading small {
  color: #d9c3f5;
  font-size: 12px;
  margin-top: 8px;
}
.loading.failed .load-emblem {
  animation: none;
  filter: grayscale(1);
}
#exited {
  z-index: 50;
}

/* ---- panel ---- */
#panel-mask {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #0a0314a0;
}
dialog {
  position: absolute;
  inset: 12px;
  margin: auto;
  width: calc(100% - 24px);
  max-width: 450px;
  max-height: calc(100% - 24px);
  padding: 0;
  border: 3px solid var(--gold-2);
  border-radius: 16px;
  background: #25103b;
  color: #f6ecff;
  box-shadow: 0 6px 22px #000c;
  overflow: hidden;
  z-index: 41;
}
dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog::backdrop {
  background: transparent;
}
dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  padding: 6px 14px;
  background: linear-gradient(#6a2ea8, #3a1566);
  color: #ffe9a8;
}
dialog h2 {
  margin: 0;
  font-size: 19px;
  text-shadow: 0 1px 0 #000a;
}
dialog header button {
  min-width: 44px;
  min-height: 44px;
  font-size: 28px;
  color: #ffe9a8;
}
#panel-tabs {
  display: flex;
  flex: none;
  gap: 4px;
  padding: 6px 8px 0;
  background: #170826;
  overflow-x: auto;
}
#panel-tabs button {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px 10px 0 0;
  font-size: 13px;
  font-weight: 800;
  color: #bfa5e0;
}
#panel-tabs button[aria-selected="true"] {
  background: #25103b;
  color: var(--gold);
}
#panel-body {
  padding: 14px;
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
#panel-body p {
  font-size: 14px;
  line-height: 1.6;
}
#panel-body label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  margin: 12px 0;
}
#panel-body input[type="range"] {
  min-height: 44px;
  min-width: 0;
  width: 46%;
  accent-color: #ffb32e;
}
#panel-body select {
  max-width: 58%;
  min-height: 44px;
  background: #3a1a58;
  color: #fff;
  border: 1px solid #8a63b8;
  border-radius: 6px;
}
#panel-body ol {
  padding-inline-start: 24px;
  font-size: 14px;
  line-height: 1.65;
}
#panel-body .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #4b2d6e;
  padding: 8px 0;
  font-size: 14px;
}
#panel-body .paygrid .row {
  justify-content: flex-start;
}
#panel-body .paygrid .it {
  flex: none;
  width: 118px;
  justify-content: space-between;
}
#panel-body .paygrid .ico {
  max-height: 30px;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}
.badge img {
  width: 30px;
  height: 30px;
}
#panel-body .record {
  padding: 8px 0;
  border-bottom: 1px solid #4b2d6e;
}
.record .icons {
  display: inline-flex;
  gap: 4px;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.record .mini {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
}
.record .mini img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.record .mini .txt {
  position: absolute;
  font-style: normal;
  font-weight: 900;
  font-size: 11px;
  text-shadow: 0 1px 2px #000;
}
#panel-body input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin: 0;
  flex: none;
  cursor: pointer;
}
#panel-body input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 44px;
  height: 24px;
  background: #5b4378;
  border-radius: 16px;
}
#panel-body input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff6da;
}
#panel-body input[type="checkbox"]:checked::before {
  background: #e8921a;
}
#panel-body input[type="checkbox"]:checked::after {
  left: 24px;
}
#panel-body output {
  min-width: 40px;
  text-align: end;
  direction: ltr;
  unicode-bidi: isolate;
}
.record-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.record-values span {
  font-size: 11px;
  display: block;
  color: #bfa5e0;
}
.record-values b {
  display: block;
  font-size: 16px;
  overflow-wrap: anywhere;
  direction: ltr;
  unicode-bidi: isolate;
}
.record > strong {
  direction: ltr;
  unicode-bidi: isolate;
}
.my-ranking {
  background: #3a1a58;
  border-radius: 8px;
  padding: 8px;
}

/* ---- height tiers (set by layoutFor from the height the game actually has) ---- */
.is-tiny {
  --btn: 30px;
}
.is-tiny .reward .lab {
  display: none;
}
.is-compact .chip b {
  font-size: calc(var(--rowa-h) * 0.28);
}
@media (max-width: 359px) {
  .title strong {
    font-size: 12px;
  }
  .wallet {
    padding-inline: 8px 6px;
  }
  .wallet .coin {
    display: none;
  }
}
.low-motion *,
.low-motion *::before,
.low-motion *::after {
  animation: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Reserve disjoint touch targets even when the artwork scales down. */
.hud {
  min-height: 44px;
}
.hud button {
  min-width: 44px;
  min-height: 44px;
}

.hud .title {
  overflow: hidden;
}
.hud .title img {
  max-width: 100%;
  object-fit: contain;
}
