:root {
  color-scheme: dark;
  --bg: #07111d;
  --panel: rgba(14, 30, 46, .88);
  --panel-strong: #10283c;
  --line: rgba(154, 206, 225, .16);
  --text: #edf8fb;
  --muted: #8eabb8;
  --cyan: #75d8e9;
  --mint: #8ee0bf;
  --gold: #f0c979;
  --danger: #ff8d93;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(32, 122, 159, .25), transparent 35%),
    radial-gradient(circle at 86% 18%, rgba(45, 123, 92, .16), transparent 28%),
    linear-gradient(155deg, #07111d 0%, #091725 52%, #061019 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .22;
}

.ambient-a { width: 320px; height: 320px; background: #39a8c1; top: -160px; left: -80px; }
.ambient-b { width: 360px; height: 360px; background: #46a47c; right: -180px; bottom: -180px; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 42px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 52px;
  place-items: center;
  border-radius: 15px;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 12px 32px rgba(52, 159, 188, .24);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand p, .brand h1 { margin: 0; }
.brand p { color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.brand h1 { margin-top: 3px; font-size: 20px; letter-spacing: .04em; }
.brand .ghost { margin-left: auto; }

.hidden { display: none !important; }

.state-card, .form-card, .hero-card, .content-card, .table-card {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(17, 40, 60, .92), rgba(9, 24, 38, .88));
  box-shadow: 0 28px 70px rgba(0, 0, 0, .22);
  backdrop-filter: blur(18px);
}

.state-card {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  border-radius: 28px;
  text-align: center;
}

.state-card h2 { margin: 22px 0 8px; }
.state-card p { margin: 0; color: var(--muted); }

.loader {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(117, 216, 233, .18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.login-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 22px;
  align-items: stretch;
}

.hero-card, .form-card { min-height: 480px; border-radius: 30px; padding: 44px; }

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(135deg, rgba(11, 36, 56, .95), rgba(10, 53, 55, .8)),
    var(--panel);
}

.eyebrow { color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.hero-card h2 { margin: 16px 0 20px; max-width: 560px; font-size: clamp(38px, 6vw, 68px); line-height: 1.02; }
.hero-card p { max-width: 620px; margin: 0; color: #b4cad3; font-size: 16px; line-height: 1.8; }

.hero-points { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 34px; }
.hero-points span, .limit, .status-dot {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: #b9d4dc;
  padding: 8px 12px;
  font-size: 12px;
}

.form-card { display: grid; align-content: center; }
.form-card h2 { margin: 12px 0 32px; font-size: 28px; }
.step { color: var(--mint); font-size: 12px; font-weight: 900; letter-spacing: .18em; }
label { display: block; margin: 16px 0 9px; color: #aac2cb; font-size: 13px; font-weight: 700; }
input, select {
  width: 100%;
  border: 1px solid rgba(153, 207, 226, .2);
  border-radius: 15px;
  outline: none;
  background: rgba(4, 14, 23, .65);
  color: var(--text);
  padding: 15px 16px;
}
input:focus, select:focus { border-color: rgba(117, 216, 233, .65); box-shadow: 0 0 0 3px rgba(117, 216, 233, .09); }

.primary, .game-action, .danger {
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  padding: 0 20px;
  font-weight: 800;
}

.primary { width: 100%; margin-top: 18px; background: linear-gradient(135deg, #83dcec, #79d5b7); color: #082631; }
.primary:disabled, .game-action:disabled, .danger:disabled { cursor: wait; opacity: .55; }
.text-button, .ghost, .round-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: #c4d8df;
}
.text-button { width: 100%; margin-top: 12px; border: 0; background: transparent; padding: 10px; }
.ghost { border-radius: 999px; padding: 9px 15px; }
.round-button { width: 44px; height: 44px; border-radius: 50%; font-size: 22px; }
.form-hint { min-height: 42px; color: var(--muted); line-height: 1.6; }
.error-text { color: var(--danger); font-size: 13px; line-height: 1.6; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.telegram-login {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(117, 216, 233, .3);
  border-radius: 15px;
  background: rgba(41, 169, 235, .1);
  color: var(--text);
  padding: 10px 16px;
  text-align: left;
}
.telegram-login:disabled { cursor: wait; opacity: .55; }
.telegram-login strong, .telegram-login small { display: block; }
.telegram-login small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.telegram-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #279bd6; color: white; }
.tg-login-progress {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3, 13, 22, .42);
  padding: 14px;
}
.tg-login-progress > strong { font-size: 13px; }
.tg-login-progress p { margin: 6px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.tg-login-actions { display: flex; align-items: center; gap: 12px; }
.tg-login-actions a { color: var(--cyan); font-size: 12px; font-weight: 700; text-decoration: none; }
.tg-login-actions .text-button { width: auto; margin: 0; margin-left: auto; padding: 4px; font-size: 12px; }

.welcome { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.welcome h2 { margin: 8px 0 6px; font-size: clamp(30px, 5vw, 52px); }
.welcome p { margin: 0; color: var(--muted); }

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3, 13, 22, .45);
  padding: 4px;
}
.tab { border: 0; border-radius: 11px; background: transparent; color: var(--muted); padding: 10px 18px; }
.tab.active { background: rgba(117, 216, 233, .13); color: var(--text); }
.panel { display: none; }
.panel.active { display: block; }

.metric-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; margin-bottom: 16px; }
.metric {
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(13, 31, 47, .75);
  padding: 26px;
}
.metric.featured { background: linear-gradient(135deg, rgba(27, 96, 115, .64), rgba(17, 60, 63, .58)); }
.metric span, .metric small { color: var(--muted); }
.metric strong { display: block; margin: 18px 0 10px; font-size: clamp(36px, 7vw, 62px); letter-spacing: -.04em; }

.content-card, .table-card { border-radius: 24px; padding: 26px; }
.exchange-card { margin-bottom: 16px; }
.transfer-card { margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-head h3 { margin: 4px 0 0; font-size: 21px; }
.exchange-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 24px; border-radius: 14px; background: rgba(3, 13, 22, .5); padding: 5px; }
.direction { border: 0; border-radius: 10px; background: transparent; color: var(--muted); padding: 11px; }
.direction.active { background: rgba(117, 216, 233, .13); color: var(--text); }
.amount-field { position: relative; }
.amount-field input { padding-right: 65px; font-size: 19px; font-weight: 800; }
.amount-field span { position: absolute; right: 16px; top: 16px; color: var(--muted); }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-amounts button { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: #bcd4dc; padding: 7px 13px; }
#exchange-note { color: var(--muted); font-size: 13px; line-height: 1.7; }
.transfer-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.transfer-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.transfer-summary { margin: 20px 0; border-top: 1px solid var(--line); }
.transfer-summary div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.transfer-summary dt { color: var(--muted); }
.transfer-summary dd { margin: 0; font-weight: 800; text-align: right; }
.transfer-summary div:nth-child(3) dd { color: var(--gold); }

.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.record-list { margin-top: 16px; }
.record { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid rgba(154, 206, 225, .1); }
.record div { min-width: 0; }
.record strong, .record span { display: block; }
.record strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.record span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.record b { white-space: nowrap; }
.positive { color: var(--mint); }
.negative { color: var(--danger); }
.empty, .waiting-copy { color: var(--muted); }

.table-card {
  min-height: 500px;
  background:
    radial-gradient(circle at 50% 35%, rgba(28, 116, 96, .32), transparent 38%),
    linear-gradient(150deg, rgba(12, 39, 55, .96), rgba(8, 27, 36, .94));
}
.table-top { display: flex; align-items: center; justify-content: space-between; }
.status-dot.live { color: var(--mint); }
.table-card h2 { margin: 80px 0 14px; font-size: clamp(34px, 6vw, 58px); }
.table-card > p { max-width: 620px; color: var(--muted); line-height: 1.7; }
.start-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 520px; }
.start-row .primary { margin: 0; }
.game-ante-field { position: relative; }
.game-ante-field input { padding-right: 64px; }
.game-ante-field span { position: absolute; right: 16px; top: 16px; color: var(--muted); pointer-events: none; }
.last-result { margin-top: 28px !important; }
.pot { margin: 34px 0 24px; text-align: center; }
.pot span, .pot small { display: block; color: var(--muted); }
.pot strong { display: block; margin: 4px 0; color: var(--gold); font-size: 52px; }
.players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.player { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 15px; background: rgba(3, 13, 22, .42); padding: 12px; }
.player.self { border-color: rgba(117, 216, 233, .48); }
.player.folded { opacity: .48; }
.player div { min-width: 0; }
.player strong, .player small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player small { margin-top: 4px; color: var(--muted); }
.player-title { display: flex; align-items: center; gap: 7px; }
.player-title strong { min-width: 0; }
.seen-mark { flex: 0 0 auto; border: 1px solid rgba(142, 224, 191, .35); border-radius: 999px; background: rgba(142, 224, 191, .11); color: var(--mint); padding: 2px 7px; font-size: 10px; font-weight: 800; }
.hand { margin: 18px 0; border: 1px solid rgba(240, 201, 121, .28); border-radius: 16px; background: rgba(89, 63, 22, .18); padding: 16px; text-align: center; }
.hand span, .hand small { display: block; color: #c6ad7e; }
.hand strong { display: block; margin: 8px 0; color: var(--gold); font-size: 26px; }
.turn-line { margin: 20px 0 12px; color: #bbd3dc; text-align: center; }
.game-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.game-action { background: rgba(117, 216, 233, .13); color: var(--text); }
.danger { background: rgba(255, 100, 112, .13); color: #ffb7bb; }
.game-guide { margin-top: 16px; }
.game-guide h3 { margin: 8px 0; }
.game-guide p { margin-bottom: 0; color: var(--muted); line-height: 1.7; }

.toast {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100% - 48px));
  border: 1px solid rgba(142, 224, 191, .28);
  border-radius: 15px;
  background: #133128;
  color: #d9f8eb;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  padding: 14px 18px;
}
.toast.error { border-color: rgba(255, 141, 147, .32); background: #3a1d25; color: #ffd9dc; }
.spinning { animation: spin .8s linear infinite; }

.modal-open { overflow: hidden; }
.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(2, 8, 14, .76);
  backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: min(480px, 100%);
  border: 1px solid rgba(117, 216, 233, .28);
  border-radius: 24px;
  background: linear-gradient(150deg, #133047, #0a1d2d);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .55);
  padding: 30px;
}
.modal-card h2 { margin: 12px 0; font-size: 27px; }
.modal-card p { margin: 0; color: var(--muted); line-height: 1.75; }
.modal-link { display: grid; place-items: center; text-decoration: none; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 620px); padding-top: 18px; }
  .brand { margin-bottom: 24px; }
  .login-grid, .metric-grid, .two-columns, .transfer-form-grid { grid-template-columns: 1fr; }
  .hero-card, .form-card { min-height: auto; padding: 28px; }
  .hero-card { min-height: 380px; }
  .hero-card h2 { font-size: 42px; }
  .players { grid-template-columns: 1fr; }
  .table-card { min-height: 460px; padding: 20px; }
  .start-row { grid-template-columns: 1fr; }
  .welcome h2 { font-size: 34px; }
  .metric { min-height: 145px; }
  .toast { right: 12px; bottom: 12px; }
  .modal-card { padding: 24px; }
}
