:root {
  --bg: #0e0f12;
  --surface: #17191e;
  --surface-hi: #20232a;
  --line: rgba(226, 182, 89, 0.22);
  --gold: #e2b659;
  --gold-hi: #f4d58d;
  --text: #f2ede2;
  --text-muted: #c1bbae;
  --ink: #18130a;
  --danger: #ff9a8f;
  --win: #7fd9a2;
  --shell-bg: var(--bg);
  --shell-fg: var(--text);
  --shell-muted: var(--text-muted);
  --shell-accent: var(--gold-hi);
  --shell-accent-ink: var(--ink);
  --shell-line: var(--line);
}

body {
  background: var(--bg);
  color: var(--text);
}

.brand {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(40px, 8vw, 64px);
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--gold-hi);
}

.brand--small {
  font-size: 22px;
}

.auth {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth__panel {
  width: min(100%, 400px);
}

.auth__lead {
  margin: 12px 0 28px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-muted);
}

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  color: var(--gold-hi);
  border-bottom-color: var(--gold);
}

.form {
  display: grid;
  gap: 16px;
}

.form__field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.form__field input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  transition: border-color 150ms ease;
}

.form__field input:hover {
  border-color: var(--gold);
}

.form__field input:focus-visible,
.tab:focus-visible,
.button:focus-visible,
.game:focus-visible,
.topbar__link:focus-visible {
  outline: 3px solid var(--gold-hi);
  outline-offset: 2px;
}

.form__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.form__error {
  margin: 0;
  font-size: 14px;
  color: var(--danger);
}

.button {
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, transform 100ms ease, opacity 150ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.button--primary {
  background: var(--gold);
  color: var(--ink);
}

.button--primary:hover:not(:disabled) {
  background: var(--gold-hi);
}

.button--ghost {
  height: 38px;
  padding: 0 16px;
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
  font-weight: 500;
}

.button--ghost:hover {
  background: var(--surface-hi);
}

.lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 8px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar__spacer {
  flex: 1;
}

.topbar__link {
  color: var(--gold-hi);
  font-size: 14px;
  text-underline-offset: 4px;
}

.topbar__user {
  font-size: 14px;
  color: var(--text-muted);
}

.topbar__balance {
  display: grid;
  justify-items: end;
  line-height: 1.15;
}

.topbar__balance small {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar__balance strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.lobby__main {
  width: min(100%, 1160px);
  margin: 0 auto;
  padding: 32px 24px 56px;
  display: grid;
  gap: 44px;
}

.jackpot {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 20px;
  border-block: 1px solid var(--line);
  text-align: center;
}

.jackpot__title {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--gold);
}

.jackpot__amount {
  margin: 0;
  font-size: clamp(48px, 11vw, 96px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}

.jackpot__note {
  margin: 6px 0 0;
  max-width: 52ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}

.section-title {
  margin: 0 0 18px;
  font-family: "Noto Serif TC", serif;
  font-size: 24px;
  font-weight: 700;
}

.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 300px;
  overflow: hidden;
  border-radius: 20px;
  background: var(--tile);
  color: var(--tile-text);
  text-decoration: none;
  box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 260ms ease;
}

.game:hover {
  transform: translateY(-6px);
  box-shadow: 0 34px 48px -24px rgba(0, 0, 0, 0.95), inset 0 0 0 2px var(--tile-accent);
}

.game__art {
  display: grid;
  place-items: center;
  padding: 28px 28px 8px;
}

.game__art svg {
  width: min(62%, 170px);
  height: auto;
  transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.game:hover .game__art svg {
  transform: scale(1.1) rotate(-4deg);
}

.game__body {
  padding: 0 22px 22px;
}

.game__name {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--tile-accent);
}

.game__blurb {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--tile-text);
}

.game.is-closed {
  filter: saturate(0.25);
  pointer-events: none;
}

.game__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
}

.game--classic {
  --tile: #3b0f16;
  --tile-accent: #f0cf7a;
  --tile-text: #ead9bd;
}

.game--video {
  --tile: #0a2b29;
  --tile-accent: #ffd98a;
  --tile-text: #c6ded7;
}

.game--baccarat {
  --tile: #12402f;
  --tile-accent: #f0d28a;
  --tile-text: #d4e3cf;
}

.game--fruit {
  --tile: #1b2a6b;
  --tile-accent: #ffd23f;
  --tile-text: #d5dcf5;
}

.table-wrap {
  overflow-x: auto;
}

.history {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.history th {
  padding: 0 12px 10px 0;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.history td {
  padding: 10px 12px 10px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.history .num {
  text-align: right;
  padding-right: 0;
  white-space: nowrap;
}

.history td.is-win {
  color: var(--win);
  font-weight: 700;
}

.history__empty {
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .topbar {
    gap: 10px;
    padding: 8px 16px;
  }

  .topbar__user {
    display: none;
  }

  .lobby__main {
    padding: 24px 16px 48px;
    gap: 36px;
  }

  .game {
    min-height: 240px;
  }
}
