:root {
  color-scheme: dark;
  --bg: #0a0c18;
  --panel: #12152a;
  --line: #262b52;
  --text: #dfe3ff;
  --muted: #8f97c8;
  --accent: #ffe81a;
  --blue: #2440ff;
  --good: #3ddc84;
  --bad: #ff4b3e;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --head: 'Archivo Black', 'Arial Black', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 56px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, sans-serif;
  padding: 0 16px max(24px, env(safe-area-inset-bottom));
}
main { max-width: 980px; margin: 0 auto; display: grid; gap: 16px; }

.top {
  max-width: 980px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 0 10px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}
h1 { margin: 0; font: 24px var(--head); color: var(--accent); letter-spacing: 0.02em; }
h2 { margin: 0 0 10px; font: 18px var(--head); color: var(--accent); }
h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 560px; }
.links, .previews { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 12px;
  color: #aab3ff;
  background: #0d1030;
  border: 1px solid #2a37b8;
  padding: 6px 10px;
  border-radius: 99px;
  text-decoration: none;
  white-space: nowrap;
}
.pill:hover { background: #1a2060; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 980px;
  margin: 0 auto 12px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0;
  background: var(--bg);
  scrollbar-width: none;
}
.tabs a {
  flex: none;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}
.note { color: var(--muted); font-size: 13px; margin: 8px 0; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Paytable choice */
.paytables { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pt {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #0d1030;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.pt b { font: 18px var(--head); color: #fff; }
.pt span { font: 600 13px var(--mono); color: var(--muted); }
.pt[aria-checked="true"] { border-color: var(--accent); background: #1b2fd8; }
.pt[aria-checked="true"] span { color: var(--accent); }
.rtp {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0d1030;
  font: 500 14px/1.6 var(--mono);
}
.rtp .total { font-weight: 700; color: #fff; }
.rtp .warn { color: var(--bad); font-weight: 700; }
.rtp .ok { color: var(--good); font-weight: 700; }
.more { margin-top: 10px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* Forms */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
select, input {
  width: 100%;
  font: 600 15px var(--mono);
  color: #fff;
  background: #0d1030;
  border: 1px solid #2a37b8;
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 42px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.invalid { border-color: var(--bad); outline-color: var(--bad); }
input.num { width: 96px; min-height: 36px; padding: 6px 8px; text-align: right; }

/* Tables */
table { border-collapse: collapse; width: 100%; font: 500 13px var(--mono); }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th.l { text-align: left; }
th { color: var(--muted); font: 600 11px system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.05em; }
td.name { font-family: system-ui, sans-serif; font-weight: 700; }
td.good { color: var(--good); }
td.bad { color: var(--bad); }
.pays td:nth-child(2) { color: var(--accent); }
.games td { font-size: 12px; }
.games .cards { text-align: left; letter-spacing: 0.02em; }
.games .red { color: #ff6b5e; }
.suit { display: inline-block; width: 1.1em; text-align: center; }
.suit.red { color: #ff4b3e; }

.jp-table td input { margin-left: auto; display: block; }
.jp-table .live { color: #fff; font-weight: 700; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.actions .label { font-size: 13px; color: var(--muted); }
.force { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  font: 700 13px system-ui, sans-serif;
  padding: 10px 14px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid #2a37b8;
  background: #1b2fd8;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { background: #2238ee; }
.btn.danger { background: #3a0f12; border-color: #8a1c1c; color: #ffb3ad; }
.btn.danger:hover { background: #5a1418; }
.btn.armed { background: var(--accent); color: #000; border-color: var(--accent); }
.status { font-size: 13px; color: var(--accent); }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font: 500 13px var(--mono); }
.feed li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; background: #0d1030; border-radius: 6px; }
.feed .who { color: var(--muted); }
.feed .you { color: var(--accent); font-weight: 700; }
.feed .empty { color: var(--muted); justify-content: center; }

.rtp-check {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0d1030;
  font: 500 13px/1.6 var(--mono);
}
.rtp-check b { color: #fff; }
.rtp-check .in { color: var(--good); }
.rtp-check .out { color: var(--bad); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--accent);
  color: #000;
  font: 700 13px system-ui, sans-serif;
  box-shadow: 0 8px 30px #000a;
}
.toast[hidden] { display: none; }

@media (max-width: 560px) {
  h1 { font-size: 20px; }
  .panel { padding: 12px; border-radius: 10px; }
  .paytables { grid-template-columns: repeat(2, 1fr); }
}
