:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #080706;
  overflow-x: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
}

.bor-app {
  --bg: #080706;
  --panel: rgba(19, 15, 10, 0.92);
  --panel-2: rgba(38, 25, 12, 0.82);
  --line: rgba(255, 196, 88, 0.38);
  --line-strong: rgba(255, 211, 111, 0.78);
  --text: #f8ead2;
  --muted: rgba(248, 234, 210, 0.66);
  --gold: #f2b94b;
  --gold-hot: #ffd76b;
  --danger: #e55a3c;
  --green: #58e08f;
  --shadow: rgba(0, 0, 0, 0.52);
  isolation: isolate;
  min-height: 100vh;
  width: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(242, 185, 75, 0.16), transparent 31%),
    radial-gradient(circle at 84% 7%, rgba(255, 70, 40, 0.11), transparent 28%),
    linear-gradient(135deg, #080706 0%, #130f0b 46%, #060504 100%);
  padding: clamp(10px, 1.9vw, 22px);
  container-type: inline-size;
}

.bor-app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 204, 112, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 204, 112, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

.bor-app::after {
  content: "𓂀";
  position: fixed;
  right: -0.15em;
  bottom: -0.38em;
  z-index: -1;
  color: rgba(255, 220, 135, 0.035);
  font-size: min(68vw, 660px);
  line-height: 1;
  pointer-events: none;
}

.bor-topbar,
.bor-shell,
.bor-stage-card,
.bor-controls,
.bor-stat,
.bor-mode-box,
.bor-dialog {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(28, 21, 13, 0.92), rgba(12, 9, 7, 0.92));
  box-shadow: 0 22px 60px var(--shadow);
}

.bor-topbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  gap: clamp(10px, 1.6vw, 18px);
  align-items: stretch;
  padding: 12px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.bor-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bor-emblem {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #1d1305;
  background: linear-gradient(135deg, #f8db87, #b87219);
  border: 1px solid rgba(255, 242, 175, 0.7);
  box-shadow: inset 0 0 18px rgba(255, 250, 194, 0.24), 0 8px 24px rgba(0, 0, 0, 0.42);
  clip-path: polygon(50% 0, 100% 26%, 100% 74%, 50% 100%, 0 74%, 0 26%);
  font-size: 30px;
}

.bor-brand h1 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: clamp(22px, 3.4vw, 42px);
  line-height: 1;
  color: var(--gold-hot);
  text-shadow: 0 0 22px rgba(242, 185, 75, 0.42);
}

.bor-brand p {
  margin: 5px 0 0;
  color: var(--muted);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 11px;
}

.bor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
}

.bor-stat {
  min-width: 0;
  padding: 10px 12px;
  box-shadow: none;
  background: rgba(8, 7, 6, 0.58);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.bor-stat span,
.bor-total-bet span,
.bor-field span {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  white-space: nowrap;
}

.bor-stat strong {
  display: block;
  margin-top: 5px;
  color: var(--gold-hot);
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.bor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: clamp(10px, 1.6vw, 18px);
  margin-top: 14px;
  padding: clamp(10px, 1.6vw, 16px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}

.bor-stage-card,
.bor-controls {
  min-width: 0;
  padding: clamp(10px, 1.6vw, 16px);
}

.bor-stage-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(48, 31, 14, 0.68), rgba(12, 9, 7, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 204, 112, 0.04) 0 2px, transparent 2px 28px);
}

.bor-feature-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 215, 107, 0.42);
  background: rgba(73, 42, 13, 0.52);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.bor-feature-banner strong {
  color: var(--gold-hot);
  letter-spacing: 0.08em;
  font-size: 16px;
}

.bor-reel-stage {
  position: relative;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(8px, 1.4vw, 14px);
  border: 1px solid rgba(255, 215, 107, 0.46);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.52), rgba(255, 204, 112, 0.05), rgba(0, 0, 0, 0.52)),
    #090706;
  box-shadow: inset 0 0 30px rgba(255, 204, 112, 0.08), 0 16px 48px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.bor-reel-stage::before,
.bor-reel-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 5;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 107, 0.88), transparent);
  opacity: 0.65;
}

.bor-reel-stage::before { top: 0; }
.bor-reel-stage::after { bottom: 0; }

.bor-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(74px, 1fr));
  gap: clamp(5px, 0.8vw, 8px);
  aspect-ratio: 5 / 2.28;
  min-height: 250px;
}

.bor-cell {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(255, 215, 107, 0.25);
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 232, 153, 0.12), transparent 38%),
    linear-gradient(180deg, #1a120b, #070504);
  box-shadow: inset 0 0 18px rgba(255, 190, 70, 0.05);
  transform: translateZ(0);
}

.bor-cell::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 215, 107, 0.1);
  pointer-events: none;
}

.bor-symbol {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  transform: translateZ(0);
}

.bor-icon {
  display: block;
  font-size: clamp(30px, 6.1vw, 64px);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.55));
  transform-origin: center;
}

.bor-code {
  display: block;
  margin-top: 4px;
  color: rgba(248, 234, 210, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(9px, 1.1vw, 12px);
  font-weight: 700;
}

.bor-cell[data-symbol="explorer"] .bor-icon { color: #f1c46b; }
.bor-cell[data-symbol="mummy"] .bor-icon { color: #d9cab2; }
.bor-cell[data-symbol="statue"] .bor-icon { color: #7dd4ff; }
.bor-cell[data-symbol="scarab"] .bor-icon { color: #48d998; }
.bor-cell[data-symbol="book"] .bor-icon { color: #ffd76b; }
.bor-cell[data-symbol="ace"] .bor-icon,
.bor-cell[data-symbol="king"] .bor-icon,
.bor-cell[data-symbol="queen"] .bor-icon,
.bor-cell[data-symbol="jack"] .bor-icon,
.bor-cell[data-symbol="ten"] .bor-icon {
  font-weight: 900;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(33px, 6.8vw, 70px);
}

.bor-cell.is-winning {
  border-color: rgba(255, 226, 122, 0.92);
  animation: borWinPulse 960ms ease-in-out infinite alternate;
}

.bor-cell.is-expanded {
  border-color: rgba(88, 224, 143, 0.9);
  background:
    radial-gradient(circle at 50% 40%, rgba(88, 224, 143, 0.22), transparent 44%),
    linear-gradient(180deg, #1b2212, #070504);
}

.bor-cell.is-scatter {
  box-shadow: inset 0 0 24px rgba(255, 215, 107, 0.2), 0 0 22px rgba(255, 215, 107, 0.18);
}

.bor-cell.is-rolling .bor-symbol {
  animation: borRoll 128ms linear infinite;
}

.bor-line-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.bor-payline {
  fill: none;
  stroke: rgba(255, 223, 116, 0.94);
  stroke-width: 5;
  stroke-linejoin: bevel;
  stroke-linecap: square;
  filter: drop-shadow(0 0 8px rgba(255, 188, 66, 0.82));
  animation: borLineFlash 720ms ease-in-out infinite alternate;
}

.bor-payline:nth-child(2n) { stroke: rgba(88, 224, 143, 0.94); }
.bor-payline:nth-child(3n) { stroke: rgba(229, 90, 60, 0.96); }

.bor-win-burst {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 226, 122, 0.3), transparent 52%);
}

.bor-win-burst.is-active {
  animation: borBurst 650ms ease-out;
}

.bor-message-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-top: 10px;
}

.bor-message-row p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.bor-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(39, 25, 12, 0.96), rgba(10, 7, 5, 0.96));
}

.bor-control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.bor-field {
  display: grid;
  gap: 6px;
}

.bor-field select {
  width: 100%;
  min-height: 42px;
  appearance: none;
  border: 1px solid rgba(255, 215, 107, 0.36);
  border-radius: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 215, 107, 0.13), rgba(255, 215, 107, 0.02)),
    #0b0806;
  padding: 0 36px 0 12px;
  font-weight: 800;
  font-size: 15px;
  outline: none;
}

.bor-field::after {
  content: "▾";
  justify-self: end;
  align-self: end;
  margin: 0 12px 13px 0;
  color: var(--gold);
  pointer-events: none;
}

.bor-total-bet {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 215, 107, 0.28);
  background: rgba(0, 0, 0, 0.24);
}

.bor-total-bet strong {
  color: var(--gold-hot);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.bor-spin-btn,
.bor-risk-btn,
.bor-ghost-btn,
.bor-close-btn {
  border-radius: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease, border-color 140ms ease;
}

.bor-spin-btn {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 84px;
  border: 1px solid rgba(255, 238, 152, 0.76);
  color: #1e1203;
  background:
    linear-gradient(135deg, #fff1a6 0%, #f1b644 42%, #9e4d16 100%);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.32), 0 18px 44px rgba(0, 0, 0, 0.5);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  text-transform: uppercase;
}

.bor-spin-btn span {
  font-size: 26px;
  letter-spacing: 0.12em;
  font-weight: 1000;
}

.bor-spin-btn small {
  margin-top: -10px;
  letter-spacing: 0.16em;
  font-size: 10px;
  font-weight: 900;
  opacity: 0.72;
}

.bor-spin-btn:hover:not(:disabled),
.bor-risk-btn:hover:not(:disabled),
.bor-ghost-btn:hover:not(:disabled),
.bor-close-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.bor-spin-btn:active:not(:disabled),
.bor-risk-btn:active:not(:disabled),
.bor-ghost-btn:active:not(:disabled),
.bor-close-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.bor-spin-btn:disabled,
.bor-risk-btn:disabled,
.bor-ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.bor-risk-btn,
.bor-ghost-btn,
.bor-close-btn {
  min-height: 42px;
  border: 1px solid rgba(255, 215, 107, 0.34);
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 800;
}

.bor-risk-btn:not(:disabled) {
  border-color: rgba(229, 90, 60, 0.58);
  background: linear-gradient(135deg, rgba(229, 90, 60, 0.22), rgba(0, 0, 0, 0.25));
}

.bor-ghost-btn {
  padding: 0 14px;
  white-space: nowrap;
}

.bor-mode-box {
  padding: 12px;
  box-shadow: none;
  background: rgba(0, 0, 0, 0.26);
}

.bor-mode-box strong,
.bor-mode-box span {
  display: block;
}

.bor-mode-box strong {
  color: var(--gold-hot);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.bor-mode-box span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.bor-dialog {
  width: min(780px, calc(100vw - 24px));
  max-height: min(86vh, 760px);
  padding: 0;
  color: var(--text);
  border: 1px solid rgba(255, 215, 107, 0.56);
  background: linear-gradient(180deg, #1b120a, #080706);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
}

.bor-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(8px);
}

.bor-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 215, 107, 0.28);
}

.bor-dialog-head h2 {
  margin: 0;
  color: var(--gold-hot);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 18px;
}

.bor-close-btn {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.bor-rules,
.bor-dialog-note {
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.bor-table-wrap {
  overflow-x: auto;
  padding: 0 16px 14px;
}

.bor-paytable {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: 13px;
}

.bor-paytable th,
.bor-paytable td {
  border: 1px solid rgba(255, 215, 107, 0.24);
  padding: 9px 10px;
  text-align: right;
}

.bor-paytable th:first-child,
.bor-paytable td:first-child {
  text-align: left;
}

.bor-paytable th {
  color: var(--gold-hot);
  background: rgba(255, 215, 107, 0.11);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.bor-paytable td {
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
}

@keyframes borRoll {
  0% { transform: translateY(-18%); opacity: 0.18; filter: blur(4px); }
  35% { opacity: 1; filter: blur(2px); }
  100% { transform: translateY(18%); opacity: 0.2; filter: blur(4px); }
}

@keyframes borWinPulse {
  0% { box-shadow: inset 0 0 18px rgba(255, 215, 107, 0.12), 0 0 6px rgba(255, 215, 107, 0.2); }
  100% { box-shadow: inset 0 0 22px rgba(255, 215, 107, 0.28), 0 0 24px rgba(255, 215, 107, 0.48); }
}

@keyframes borLineFlash {
  0% { opacity: 0.42; }
  100% { opacity: 1; }
}

@keyframes borBurst {
  0% { opacity: 0; transform: scale(0.8); }
  26% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.26); }
}

@media (max-width: 860px) {
  .bor-topbar {
    grid-template-columns: 1fr;
  }

  .bor-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .bor-shell {
    grid-template-columns: 1fr;
  }

  .bor-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .bor-control-grid {
    grid-template-columns: 1fr 1fr;
    grid-column: 1 / -1;
  }

  .bor-spin-btn {
    min-height: 74px;
  }

  .bor-mode-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .bor-app {
    padding: 8px;
  }

  .bor-topbar {
    padding: 9px;
  }

  .bor-emblem {
    width: 42px;
    height: 42px;
    font-size: 23px;
  }

  .bor-brand h1 {
    font-size: 24px;
  }

  .bor-brand p {
    letter-spacing: 0.22em;
    font-size: 9px;
  }

  .bor-stats {
    grid-template-columns: 1fr 1fr;
  }

  .bor-free-stat:not([hidden]) {
    grid-column: 1 / -1;
  }

  .bor-shell {
    margin-top: 8px;
    padding: 8px;
    gap: 8px;
  }

  .bor-stage-card,
  .bor-controls {
    padding: 8px;
  }

  .bor-grid {
    min-height: 190px;
    aspect-ratio: 5 / 2.85;
    gap: 4px;
  }

  .bor-reel-stage {
    padding: 6px;
  }

  .bor-code {
    display: none;
  }

  .bor-message-row {
    min-height: 38px;
  }

  .bor-message-row p {
    font-size: 12px;
  }

  .bor-controls {
    grid-template-columns: 1fr 1fr;
    position: sticky;
    bottom: 8px;
    z-index: 20;
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.48);
  }

  .bor-control-grid {
    gap: 8px;
  }

  .bor-field select {
    min-height: 38px;
    font-size: 14px;
  }

  .bor-total-bet {
    min-height: 66px;
  }

  .bor-total-bet strong {
    font-size: 20px;
  }

  .bor-spin-btn {
    min-height: 66px;
  }

  .bor-spin-btn span {
    font-size: 21px;
  }

  .bor-spin-btn small {
    font-size: 9px;
  }

  .bor-risk-btn {
    min-height: 44px;
    grid-column: 1 / -1;
  }

  .bor-mode-box {
    display: none;
  }
}

@media (max-width: 390px) {
  .bor-stats {
    gap: 6px;
  }

  .bor-stat {
    padding: 8px;
  }

  .bor-grid {
    min-height: 170px;
  }

  .bor-icon {
    font-size: 30px;
  }

  .bor-cell[data-symbol="ace"] .bor-icon,
  .bor-cell[data-symbol="king"] .bor-icon,
  .bor-cell[data-symbol="queen"] .bor-icon,
  .bor-cell[data-symbol="jack"] .bor-icon,
  .bor-cell[data-symbol="ten"] .bor-icon {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bor-cell.is-rolling .bor-symbol,
  .bor-cell.is-winning,
  .bor-payline,
  .bor-win-burst.is-active {
    animation: none;
  }
}
