* { box-sizing: border-box; }

:root {
  --bg: #10151c;
  --panel: #1a2230;
  --panel-2: #212c3d;
  --line: #2c3a4f;
  --gold: #f0c05a;
  --gold-2: #d99a2b;
  --text: #e9e4d8;
  --muted: #93a1b5;
  --danger: #e05c5c;
  --green: #57c785;
}

html, body { margin: 0; padding: 0; min-height: 100%; height: 100%; }
#app { min-height: 100%; }
html.is-game, html.is-game body, #app.is-game,
#app:has(.game-shell) {
  height: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--app-h, 100vh);
  max-height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  max-height: var(--app-h, 100vh);
  overflow: hidden;
}

body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -10%, #22304655, transparent),
    radial-gradient(900px 500px at 0% 110%, #3a2a1a44, transparent),
    var(--bg);
  color: var(--text);
}

button, select {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  color: #241a06;
  background: linear-gradient(160deg, var(--gold), var(--gold-2));
  box-shadow: 0 4px 14px #00000066, inset 0 1px 0 #ffffff55;
}

button:hover:not(:disabled) { filter: brightness(1.07); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
button.ghost:hover { border-color: var(--gold); color: var(--gold); }
button.danger {
  background: linear-gradient(160deg, #e06a6a, #b23a3a);
  color: #fff;
}
button.big { font-size: 17px; padding: 14px 26px; }
button.small { padding: 6px 12px; font-size: 13px; }
button.cancel { background: linear-gradient(160deg, #8aa0bd, #5d7088); color: #fff; }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #101826;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #f0c05a22; }

a { color: var(--gold); text-decoration: none; }

.card {
  background: linear-gradient(170deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 10px 30px #00000055;
}
.title { font-weight: 900; letter-spacing: 0.5px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
tr:last-child td { border-bottom: none; }
.win { color: var(--green); font-weight: 700; }
.loss { color: var(--danger); font-weight: 700; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: #131a2566;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dice { font-size: 30px; }
.brand-name { color: var(--gold); font-size: 20px; }
.userbox { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.online-pill, .coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
}
.online-pill { background: #57c78518; border: 1px solid #57c78544; color: #9fe3bd; }
.coin-pill { background: #f0c05a18; border: 1px solid #f0c05a44; color: var(--gold); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.uname { font-weight: 700; }
.rating { color: var(--gold); font-weight: 700; }

.lobby, .admin, .tournaments {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.lobby { display: flex; flex-direction: column; gap: 18px; }
.play-area, .side, .admin, .tournaments { display: flex; flex-direction: column; gap: 16px; }
.btn-row, .ai-row, .over-actions, .setting-input, .t-actions { display: flex; gap: 10px; align-items: center; }
.ai-row select { max-width: 180px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.stats { display: flex; gap: 18px; }
.stat { flex: 1; text-align: center; background: #10182666; border-radius: 14px; padding: 14px 8px; }
.stat .val { font-size: 28px; font-weight: 900; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.logo { text-align: center; margin-bottom: 8px; }
.logo-dice { font-size: 44px; }
.auth-card h1 { margin: 4px 0; color: var(--gold); }
.auth-card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.err, .msg.err {
  background: #e05c5c22;
  border: 1px solid #e05c5c55;
  color: #ffb4b4;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}
.msg.ok { background: #57c78522; border: 1px solid #57c78555; color: #b6f0cf; border-radius: 10px; padding: 8px 12px; }

.game-shell {
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--app-h, 100vh);
  max-height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  max-height: var(--app-h, 100%);
  overflow: hidden;
  box-sizing: border-box;
  display: grid;
  margin: 0;
  padding: 8px;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "lobby mode"
    "board board"
    "tools tools";
}
.g-lobby { grid-area: lobby; justify-self: start; }
.g-mode {
  grid-area: mode;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}
.g-board, .table-wrap { grid-area: board; min-width: 0; min-height: 0; }
.g-tools {
  grid-area: tools;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.game-shell-wait {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.gamebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.matchup {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(170deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 22px;
}
.player { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
.pname { font-weight: 800; }
.psub { font-size: 12px; color: var(--gold); }
.vs { color: var(--muted); font-size: 13px; }
.mode-pill { font-size: 12.5px; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.mode-pill.online { color: #9fe3bd; border-color: #57c78555; background: #57c78515; }
.mode-pill.tournament { color: var(--gold); border-color: #f0c05a66; background: #f0c05a15; font-weight: 700; }
.table-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.status-row, .status-side { display: flex; align-items: center; gap: 14px; }
.status-row { justify-content: space-between; }
.turn-indicator {
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.turn-indicator.my {
  color: #241a06;
  background: linear-gradient(160deg, var(--gold), var(--gold-2));
  border-color: transparent;
}
.timer-pill {
  font-size: 14px;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #10182688;
}
.timer-pill.urgent { color: #ffd7d7; border-color: #e05c5c88; background: #4a1f1f; }
.roll-prompt { cursor: pointer; }
.roll-prompt-bg { filter: drop-shadow(0 4px 10px #00000088); }
.roll-prompt-txt { fill: #241a06; font-size: 30px; font-weight: 800; font-family: Vazirmatn, Tahoma, sans-serif; pointer-events: none; }
.board-wrap {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1320 / 800;
  flex: 0 0 auto;
}
@supports (width: 1cqh) {
  .board-wrap { container-type: size; }
  .board {
    width: min(100%, calc(100cqh * 1320 / 800));
    height: min(100%, calc(100cqw * 800 / 1320));
  }
}

@media (orientation: landscape) {
  .game-shell {
    grid-template-columns: minmax(0, 1fr) 4.25rem;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "board lobby"
      "board mode"
      "board tools";
    padding: 2px 2px;
    gap: 2px 3px;
    align-items: stretch;
  }
  .g-lobby, .g-mode, .g-tools {
    justify-self: stretch;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .g-lobby {
    align-self: start;
    white-space: nowrap;
    overflow: hidden;
    font-size: 12px;
    padding: 6px 4px;
    text-align: center;
    line-height: 1.2;
  }
  .g-mode { align-self: start; align-items: stretch; }
  .g-tools {
    align-self: start;
    flex-direction: column;
    align-items: stretch;
  }
  .game-shell .matchup {
    flex-direction: column;
    padding: 6px 8px;
    gap: 2px;
  }
  .game-shell .player { min-width: 0; }
  .game-shell .mode-pill,
  .game-shell .timer-pill,
  .game-shell .pip {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (orientation: landscape) {
  [dir="rtl"] .game-shell, html[dir="rtl"] .game-shell {
    padding-left: 12px;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .game-shell { padding: 4px 6px; gap: 4px 6px; }
  [dir="rtl"] .game-shell, html[dir="rtl"] .game-shell { padding-left: 12px; }
  .game-shell .matchup { display: none; }
  .g-lobby { padding: 6px 4px; font-size: 12px; white-space: nowrap; }
  .timer-pill { font-size: 12.5px; padding: 4px 10px; }
  .mode-pill { font-size: 11.5px; padding: 4px 10px; text-align: center; }
  .pip { font-size: 11px; text-align: center; }
}
.ptnum { fill: var(--pt-num, #ffffff66); font-size: 13px; font-family: Vazirmatn, Tahoma, sans-serif; }
.traylabel { fill: var(--tray-label, #93a1b5); font-size: 14px; font-family: Vazirmatn, Tahoma, sans-serif; }
.stackcount { font-size: 22px; font-weight: 800; font-family: Vazirmatn, Tahoma, sans-serif; }
.stackcount.light, .offcount.light { fill: #2a2416; }
.stackcount.dark, .offcount.dark { fill: #f4efe4; }
.offcount { font-size: 18px; font-weight: 800; font-family: Vazirmatn, Tahoma, sans-serif; }
.hitarea { fill: transparent; }
.hitarea.cursor-ok { cursor: pointer; }
.movable-top { stroke: var(--sel, #f0c05a); stroke-width: 4px; }
.selected { stroke: var(--sel, #f0c05a); stroke-width: 5px; }
.sel-bar { pointer-events: none; }
.sel-ring { pointer-events: none; }
.hint-tri { pointer-events: none; }
.hint-badge { pointer-events: none; }
.hint-die { fill: var(--hint-die, #241a06); font-size: 20px; font-weight: 800; font-family: Vazirmatn, Tahoma, sans-serif; }
.sound-btn { min-width: 42px; padding: 6px 8px; font-size: 16px; line-height: 1; }
.die.used { opacity: 0.38; }
.die.rolling { transform-origin: center; animation: spin .7s linear; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.flying { pointer-events: none; filter: drop-shadow(0 10px 12px #00000099); }
.toast-zone {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.toast { padding: 10px 22px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px #0008; }
.toast.info { background: #1c2a3ae8; border: 1px solid var(--line); }
.toast.err { background: #4a1f1fe8; border: 1px solid #e05c5c66; color: #ffc4c4; }
.overlay { position: fixed; inset: 0; background: #060a10cc; display: grid; place-items: center; z-index: 100; }
.over-card { width: 360px; max-width: 92vw; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.over-card h2 { margin: 0; font-size: 24px; }
.trophy { font-size: 52px; }
.win-text { color: var(--green); }
.loss-text { color: var(--danger); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field.span2 { grid-column: span 2; }
.date-row { display: flex; gap: 8px; }
.setting-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.setting-input { width: 280px; }
.setting-input input { max-width: 120px; }
.role-pill, .status-pill, .joined-pill, .winner-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
}
.role-pill.admin, .st-running { color: var(--gold); border-color: #f0c05a66; }
.st-registration { color: #9fc4ff; border-color: #6ea2ff55; }
.st-finished { color: var(--green); border-color: #57c78555; }
.st-cancelled { color: var(--danger); border-color: #e05c5c55; }
.t-head { display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.t-title, .t-meta, .t-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.t-body { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; }
.players { list-style: none; margin: 0; padding: 0; }
.players li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.round { margin-bottom: 12px; }
.round-label { color: var(--gold); font-weight: 700; margin-bottom: 6px; }
.match { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.match.live { color: var(--gold); }
.mw { color: var(--green); font-weight: 700; }
.chev { margin-right: auto; color: var(--muted); }

@media (max-width: 900px) {
  .lobby, .detail-grid, .form-grid { grid-template-columns: 1fr; }
  .field.span2 { grid-column: auto; }
  .matchup { display: none; }
  .topbar { flex-direction: column; align-items: stretch; }
}

.coin-pill.clickable { cursor: pointer; transition: filter .15s, transform .15s; user-select: none; }
.coin-pill.clickable:hover { filter: brightness(1.25); transform: translateY(-1px); }
.coin-pill .plus { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); color: #1a1205; font-size: 12px; line-height: 1; }
.shop { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; display: flex; flex-direction: column; gap: 16px; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }
.plan { background: #10182699; border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; transition: border-color .15s, transform .15s; }
.plan:hover { border-color: #f0c05a88; transform: translateY(-2px); }
.plan-title { font-weight: 900; font-size: 17px; }
.plan-coins { color: var(--gold); font-size: 26px; font-weight: 900; }
.plan-coins span { font-size: 14px; font-weight: 500; }
.plan-price { color: var(--muted); font-size: 15px; }
.plan button { width: 100%; }
.pay-paid { color: var(--green); border-color: #57c78555; }
.pay-failed { color: var(--danger); border-color: #e05c5c55; }
.pay-pending { color: #9fc4ff; border-color: #6ea2ff55; }
.sub-title { margin: 18px 0 10px; font-size: 15px; color: var(--gold); }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.check input { width: auto; }
.setting-input.wide input, .setting-input.wide textarea { max-width: 100%; width: 100%; font-family: monospace; }
.setting-input.wide textarea { resize: vertical; min-height: 74px; font-size: 12.5px; line-height: 1.5; }
button.danger-text { color: #ffb4b4; }
button.danger-text:hover { border-color: var(--danger); color: var(--danger); }

/* SMS (OTP) login */
.otp-input { text-align: center; font-size: 26px; letter-spacing: 10px; font-family: monospace; }
.phone-login { text-align: center; font-size: 18px; letter-spacing: 2px; }
.otp-note { margin: 4px 0; line-height: 1.9; font-size: 14px; }
.otp-note a { margin-inline-start: 6px; font-size: 13px; }
.small-note { font-size: 13px; }
.ok-text { color: #7fd48a; }
.err-text { color: #ff9b9b; }
.phone-cell { display: inline-flex; gap: 6px; align-items: center; }
.phone-input { width: 130px; font-family: monospace; padding: 5px 8px; font-size: 13px; }

@media (orientation: landscape) and (max-height: 900px) {
  .topbar { padding: 8px 18px; }
  .userbox { gap: 8px; }
  .lobby, .admin, .tournaments, .shop { padding: 10px 16px 16px; }
  .card { padding: 14px; }
  .divider { margin: 8px 0; }
  button.big { font-size: 15px; padding: 10px 18px; }
  .play-area, .side, .admin, .tournaments { gap: 10px; }
  .lobby { gap: 12px; }
  .stat { padding: 8px 6px; }
  .stat .val { font-size: 22px; }
  .brand-name { font-size: 18px; }
  .brand-dice { font-size: 24px; }
}

.online-pill .online-plus,
.online-plus {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #9fe3bd;
  color: #102418;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.online-pill { cursor: pointer; user-select: none; }
.rules-overlay, .online-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #060a10f2;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 14px;
  box-sizing: border-box;
}
.rules-panel, .online-panel {
  width: min(820px, 100%);
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.rules-head, .online-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.rules-head h2, .online-head h2 { margin: 0; font-size: 18px; color: var(--gold); }
.rules-body, .online-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 18px 24px;
  flex: 1;
  min-height: 0;
}
.rules-body h3 { color: var(--gold); margin: 16px 0 8px; font-size: 15.5px; }
.rules-body h3:first-child { margin-top: 4px; }
.rules-body p, .rules-body li { line-height: 1.85; font-size: 14.5px; color: var(--text, #e8eef6); }
.rules-body ul { padding-right: 18px; margin: 0 0 8px; }
.online-list { list-style: none; margin: 0; padding: 0; }
.online-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}
.online-list .ou-name { font-weight: 700; }
.st-game { color: var(--gold); }
.st-queue { color: #9fe3bd; }
.st-lobby { color: var(--muted); }
.admin-tabs, .lobby-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
}
.admin-tab, .lobby-tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
}
.admin-tab.active, .lobby-tab.active {
  color: #241a06;
  background: linear-gradient(160deg, var(--gold), var(--gold-2));
  border-color: transparent;
  font-weight: 700;
}
@media (orientation: landscape) and (max-height: 500px) {
  .rules-overlay, .online-overlay { padding: 6px 8px 8px; }
  .rules-head, .online-head { padding: 6px 10px; }
  .rules-head h2, .online-head h2 { font-size: 16px; }
  .rules-body, .online-body { padding: 8px 14px 16px; }
  .rules-body h3 { font-size: 14px; margin: 10px 0 6px; }
  .rules-body p, .rules-body li { font-size: 13px; line-height: 1.7; }
}

main.settings { padding: 18px 22px 32px; max-width: 1180px; margin: 0 auto; }
.theme-section .theme-h { margin: 18px 0 10px; font-size: 16px; color: var(--gold); }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2, #161c26);
  color: inherit;
  cursor: pointer;
  text-align: center;
  font: inherit;
}
.theme-card:hover { border-color: #f0c05a88; }
.theme-card.selected {
  border-color: var(--gold, #f0c05a);
  box-shadow: 0 0 0 2px #f0c05a66;
}
.theme-card .theme-thumb, .theme-card svg.theme-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 1320 / 800;
  display: block;
  border-radius: 8px;
  pointer-events: none;
}
.theme-card .theme-name { font-size: 13px; font-weight: 700; line-height: 1.4; }
@media (orientation: landscape) and (max-height: 500px) {
  main.settings { padding: 8px 12px 20px; }
  .theme-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .theme-section .theme-h { margin: 10px 0 6px; font-size: 14px; }
  .theme-card { padding: 6px; border-radius: 10px; }
  .theme-card .theme-name { font-size: 12px; }
}

.lobby-main { max-width: 820px; width: 100%; margin: 0 auto; }
.lobby-tabs { margin: 0 0 16px; }
.lobby-sub { margin: 18px 0 10px; font-size: 15px; color: var(--gold); }
.lobby-scroll { overflow: auto; max-height: min(60vh, 560px); -webkit-overflow-scrolling: touch; }
.pw-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.pw-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.pw-form input { width: 100%; }
.captcha-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.captcha-img { display: block; height: 58px; width: 180px; object-fit: contain; border-radius: 10px; background: #e8e2d0; border: 1px solid var(--line); }
.captcha-refresh { flex: 0 0 auto; }
@media (orientation: landscape) and (max-height: 500px) {
  .lobby-tabs { margin: 0 0 8px; gap: 4px; flex-wrap: nowrap; }
  .lobby-tab { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
  .lobby-scroll { max-height: calc(100dvh - 150px); }
  .lobby-main { padding: 12px; }
  .lobby-sub { margin: 10px 0 6px; font-size: 14px; }
  .captcha-img { height: 48px; width: 150px; }
}
/* Landing page */
.lp-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(960px 520px at 88% -6%, #d99a2b1c, transparent 65%),
    radial-gradient(840px 540px at 8% 18%, #26405a3b, transparent 62%),
    radial-gradient(700px 420px at 50% 85%, #462a1626, transparent 70%);
}
.lp-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #10151cd9;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #f0c05a28;
}
.lp-nav-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.lp-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.lp-brand-dice {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px #f0c05a44);
}
.lp-brand-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.lp-brand-txt strong { color: var(--gold); font-size: 18px; }
.lp-brand-txt small { color: var(--muted); font-size: 11.5px; letter-spacing: 0.3px; }
.lp-links {
  display: flex;
  align-items: center;
  gap: 22px;
}
.lp-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.18s ease;
}
.lp-links a:hover { color: var(--gold); }
.lp-nav-btn {
  padding: 9px 18px;
  font-size: 14px;
  border-radius: 10px;
  white-space: nowrap;
}

.lp-main {
  flex: 1;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 22px 64px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.lp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.08fr);
  align-items: center;
  gap: 36px;
  padding-top: 8px;
}
.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f0c05a14;
  border: 1px solid #f0c05a40;
  color: #f6d584;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.lp-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
.lp-h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.32;
  color: #f6f1e4;
}
.lp-gold { color: var(--gold); }
.lp-lead {
  margin: 0 0 24px;
  color: #b8c4d4;
  font-size: 16px;
  line-height: 1.85;
  max-width: 560px;
}
.lp-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
}
.lp-cta-primary {
  min-width: 165px;
  box-shadow: 0 8px 24px #d99a2b3d, inset 0 1px 0 #ffffff66;
  transition: transform 0.16s ease, filter 0.16s ease;
}
.lp-cta-primary:hover { transform: translateY(-1px); }
.lp-cta-secondary {
  border-color: #f0c05a4d;
  color: #f5ebd4;
}

.lp-specs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.lp-spec {
  background: linear-gradient(170deg, #171f2ce6, #111823e6);
  border: 1px solid #2b394f;
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}
.lp-spec-val {
  color: var(--gold);
  font-size: 15.5px;
  margin-bottom: 3px;
}
.lp-spec-lbl {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.lp-board-frame {
  background: linear-gradient(160deg, #1d2636, #131a26);
  border: 1px solid #f0c05a44;
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 22px 60px #00000080, 0 0 40px #f0c05a14;
}
.lp-board-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 10px;
}
.lp-board-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #d9f6e5;
  background: #57c78518;
  border: 1px solid #57c78544;
  border-radius: 999px;
  padding: 4px 12px;
}
.lp-board-canvas {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #00000055;
}
.lp-board-canvas svg.theme-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 1320 / 800;
  display: block;
}
.lp-board-switcher {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}
.lp-theme-pill {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: #111824;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  transition: all 0.16s ease;
}
.lp-theme-pill:hover { border-color: var(--gold); color: var(--gold); }
.lp-theme-pill.active {
  background: linear-gradient(160deg, var(--gold), var(--gold-2));
  color: #241a06;
  border-color: transparent;
}

.lp-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-margin-top: 76px;
}
.lp-sec-head {
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}
.lp-sec-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: #f0c05a14;
  border: 1px solid #f0c05a38;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.lp-h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.5vw, 30px);
  color: #f6f1e4;
}

.lp-feat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.lp-feat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.lp-feat-card:hover {
  transform: translateY(-3px);
  border-color: #f0c05a66;
}
.lp-feat-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: #f0c05a16;
  border: 1px solid #f0c05a38;
  margin-bottom: 4px;
}
.lp-feat-card h3 {
  margin: 0;
  font-size: 16.5px;
  color: var(--gold);
}
.lp-feat-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.8;
}

.lp-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.lp-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
}
.lp-step-num {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: #241a06;
  background: linear-gradient(160deg, var(--gold), var(--gold-2));
  margin-bottom: 4px;
}
.lp-step h3 { margin: 0; font-size: 16.5px; color: #f6f1e4; }
.lp-step p { margin: 0; font-size: 13.5px; line-height: 1.8; }

.lp-themes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.lp-theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(170deg, var(--panel), var(--panel-2));
  color: var(--text);
  box-shadow: 0 8px 24px #00000044;
  text-align: center;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.lp-theme-card:hover { transform: translateY(-2px); border-color: #f0c05a88; }
.lp-theme-card.active { border-color: var(--gold); box-shadow: 0 0 0 2px #f0c05a55; }
.lp-theme-card svg.theme-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 1320 / 800;
  border-radius: 10px;
  display: block;
}
.lp-theme-title { font-size: 13px; font-weight: 700; color: #ece5d5; }

.lp-faq-list {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lp-faq-item {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(170deg, var(--panel), #161d29);
  overflow: hidden;
  transition: border-color 0.18s ease;
}
.lp-faq-item.open { border-color: #f0c05a66; }
.lp-faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  color: #f4efe0;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
}
.lp-faq-q:hover:not(:disabled) { filter: none; color: var(--gold); }
.lp-faq-ico {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f0c05a18;
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}
.lp-faq-a {
  padding: 0 18px 16px;
  color: #b8c4d4;
  font-size: 14px;
  line-height: 1.85;
}

.lp-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 30px;
  border-color: #f0c05a55;
  background:
    radial-gradient(500px 260px at 10% 50%, #f0c05a1f, transparent),
    linear-gradient(160deg, #1d2636, #141c28);
}
.lp-cta-text h2 { margin: 0 0 6px; font-size: 24px; color: var(--gold); }
.lp-cta-text p { margin: 0; font-size: 14.5px; }

.lp-footer {
  border-top: 1px solid var(--line);
  background: #0d1219;
}
.lp-footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.lp-footer-brand { display: flex; align-items: center; gap: 10px; }
.lp-footer-brand strong { color: var(--gold); font-size: 16px; }
.lp-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13.5px;
}
.lp-footer-links a { color: var(--muted); }
.lp-footer-links a:hover { color: var(--gold); }
.lp-auth-back { margin: 6px 0 0; }

@keyframes lpFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.lp-anim { animation: lpFadeUp 0.45s ease both; }
.lp-anim-d1 { animation-delay: 0.08s; }
@media (prefers-reduced-motion: reduce) {
  .lp-anim { animation: none; }
  .lp-feat-card, .lp-theme-card, .lp-cta-primary { transition: none; }
}

@media (max-width: 960px) {
  .lp-hero { grid-template-columns: 1fr; gap: 26px; }
  .lp-feat-grid, .lp-steps, .lp-themes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-links { display: none; }
  .lp-cta-banner { flex-direction: column; text-align: center; }
}
@media (max-width: 600px) {
  .lp-nav-inner { padding: 10px 14px; }
  .lp-main { padding: 20px 14px 44px; gap: 46px; }
  .lp-h1 { font-size: 26px; }
  .lp-lead { font-size: 14.5px; }
  .lp-hero-cta { flex-direction: column; }
  .lp-hero-cta button { width: 100%; }
  .lp-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-feat-grid, .lp-steps, .lp-themes-grid { grid-template-columns: 1fr; }
  .lp-board-frame { padding: 10px; border-radius: 16px; }
  .lp-cta-banner { padding: 22px 18px; }
  .lp-cta-actions, .lp-cta-actions button { width: 100%; }
  .lp-footer-inner { justify-content: center; text-align: center; }
  .lp-footer-links { justify-content: center; }
}
