/* =====================================================================
   Gwop — layout & screens (clean)
   ===================================================================== */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; padding-top: var(--inset-top, env(safe-area-inset-top, 0px)); }
/* desktop: everything drawn bigger (the factor comes from uiScale() in app.js) */
.ui-scaled .app { inset: auto; top: 0; left: 0; width: calc(100% / var(--ui-z)); height: calc(100% / var(--ui-z));
  transform: scale(var(--ui-z)); transform-origin: 0 0; }
.ui-scaled .modal, .ui-scaled .result-in, .ui-scaled .toast { zoom: var(--ui-z); }
/* the only scrolling element outside of games */
.view { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; max-width: 1200px; margin: 0 auto; padding: 16px 16px 24px;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sidebar { display: none; }

/* ---------- mobile chrome ---------- */
.topbar { position: relative; flex: none; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: var(--bar-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.app.booting .topbar, .app.booting .tabbar { display: none; }
.logo { font-family: var(--f-display); font-weight: 900; font-size: 23px; letter-spacing: -.05em; line-height: 1; text-transform: lowercase; }
.logo span { color: var(--acc); margin-left: .1em; }
.logo .logo-dot { font-style: normal; color: var(--acc); }
.top-right { display: flex; align-items: center; gap: 8px; }
.fs-btn { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--panel-2); color: var(--muted); display: grid; place-items: center; transition: color .15s, background .15s; }
.fs-btn svg, .fs-item svg { width: 18px; height: 18px; }
.fs-btn:hover { color: var(--ink); background: var(--panel-3); }
body.in-game .table-head .fs-btn { width: 34px; height: 34px; border-radius: 10px; }
.fs-item { gap: 12px; }
#conn-lost { position: fixed; z-index: 300; left: 50%; top: calc(12px + var(--inset-top, 0px)); transform: translateX(-50%); width: min(92vw, 420px);
  display: grid; gap: 2px; padding: 12px 16px; border-radius: 14px; background: #2a0d14; box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), .7), 0 16px 40px -12px #000;
  text-align: center; animation: up .25s; }
#conn-lost b { color: #ff5c7a; font-size: 15px; }
#conn-lost span { color: var(--muted); font-size: 13px; }
.ui-scaled #conn-lost { zoom: var(--ui-z); }
/* wide screens: the toggle sits alone in the top-right corner (below Telegram's own buttons) */
#fs-corner { display: none; }
@media (min-width: 960px) {
  #fs-corner { display: block; position: fixed; z-index: 30; top: calc(16px + var(--inset-top, 0px)); right: 20px; }
  body.in-game #fs-corner, body.on-table #fs-corner { display: none; }
  body:not(.in-game):not(.on-table) .page-head { padding-right: 52px; }  /* keep header buttons clear of the corner toggle */
}
.balance-chip { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 12px; border-radius: 12px; background: var(--panel-2); }
.balance-chip .amount { color: var(--green); font-size: 15px; }
.balance-chip { border-radius: 999px; }
.balance-chip .amount { font-family: var(--f-display); font-weight: 800; }
.balance-chip .add { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--acc); color: var(--acc-ink); }
.balance-chip .add .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.tabbar { position: relative; flex: none; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + var(--inset-bottom, env(safe-area-inset-bottom, 0px))); background: var(--bar-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 5px; border-radius: 12px; color: #6a6a6a;
  font-family: var(--f-text); font-size: 11px; font-weight: 600; text-transform: lowercase; position: relative; transition: color .15s; }
.tab-ic { position: relative; display: grid; place-items: center; }
.tab .ic { width: 23px; height: 23px; transition: color .15s; }
.tab.active { color: var(--ink); }
.tab.active .ic { color: var(--acc); }
.tab .tdot { position: absolute; top: -2px; right: -5px; width: 7px; height: 7px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 2px var(--bar-bg); }
.tab.live:not(.active) .tdot { animation: tabLive 1.6s ease-in-out infinite; }
@keyframes tabLive { 50% { opacity: .15; } }
[data-theme="light"] body:not(.in-game) .tab { color: #9a9a98; }
[data-theme="light"] body:not(.in-game) .tab.active { color: var(--ink); }
.tab .dot { position: absolute; top: 4px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- desktop sidebar ---------- */
@media (min-width: 960px) {
  .topbar, .tabbar { display: none !important; }
  .sidebar { display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; width: 236px; padding: calc(22px + var(--inset-top, 0px)) 12px 22px; z-index: 10;
    background: var(--bg-2); border-right: 1px solid var(--line); }
  .app.booting .sidebar { display: none; }
  /* a game takes the whole window: no side menu while playing */
  body.in-game .sidebar { display: none; }
  body.in-game .view { margin-left: 0; width: 100%; }
  .view { margin-left: 236px; width: calc(100% - 236px); padding: 24px 32px 48px; max-width: none; }
}
.sidebar .logo { font-size: 26px; padding: 0 10px 22px; }
.side-user { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 16px; border-radius: 16px; background: var(--panel); cursor: pointer; }
.side-user .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 13px; }
.side-user .amount { color: var(--green); }
.nav-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; margin-bottom: 2px; border-radius: 14px; color: var(--muted); font-weight: 600; font-size: 15px; text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--panel); color: var(--ink); }
.nav-item { font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; }
.nav-item.active { color: var(--acc-ink); background: var(--acc); box-shadow: none; }
.nav-item .badge { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); }
.nav-item.active .badge { background: var(--acc-ink); }
.side-bottom { margin-top: auto; }
.side-bottom .nav-item { font-size: 13px; padding: 10px 14px; }

/* ---------- common blocks ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; margin: 2px 0 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 40px; text-transform: lowercase; min-width: 0; }
.page-head > .btn { flex: none; }
@media (min-width: 960px) { .page-head h1 { font-size: 52px; } }
.page-head .back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); flex: none; }
.panel { padding: 18px; border-radius: var(--r-lg); background: var(--panel); }
.panel h3 { font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel h3 .link { font-size: 13px; color: var(--red); font-weight: 700; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 12px; }
.section-title h2 { font-size: 19px; }
.section-title small { color: var(--muted); font-weight: 600; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--panel); }
.seg { border-radius: 999px; }
.seg button { height: 36px; padding: 0 18px; border-radius: 999px; font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; font-size: 13px; color: var(--muted); white-space: nowrap; }
@media (max-width: 420px) { .seg button { padding: 0 12px; font-size: 12.5px; } }
.seg button.on { background: var(--acc); color: var(--acc-ink); }
.skeleton { height: 60px; margin-bottom: 10px; border-radius: 14px; background: linear-gradient(90deg, var(--panel), var(--panel-2), var(--panel)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.boot { min-height: 80vh; display: grid; place-items: center; align-content: center; gap: 18px; }
.boot .logo { font-size: 44px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--panel-3); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- red cards (games, banner) ---------- */
.rcard { position: relative; display: flex; flex-direction: column; justify-content: flex-end; width: 100%; min-height: 136px; padding: 16px 20px; text-align: left; overflow: hidden; color: var(--ink);
  border-radius: var(--r-lg); background: var(--panel); transition: transform .2s var(--ease-out); }
.rcard:active { transform: scale(.985); }
.rcard .pill { position: absolute; top: 14px; left: 16px; z-index: 2; }
.rcard h3 { position: relative; z-index: 2; font-size: 30px; line-height: .98; text-transform: lowercase; }
.rcard p { position: relative; z-index: 2; margin: 6px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); max-width: 420px; }

/* home: games as a tile grid */
.games-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
@media (min-width: 680px) { .games-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .games-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 140px; padding: 15px; text-align: left;
  border-radius: var(--r-lg); background: var(--panel); transition: transform .15s var(--ease-out), background .15s; }
.tile:hover { background: var(--panel-2); }
.tile:active { transform: scale(.97); }
.tile h3 { position: relative; z-index: 1; max-width: 100%; font-size: 19px; line-height: .98; text-transform: lowercase; overflow-wrap: anywhere; }
.tile .st { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; padding-right: 58px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tile .st i { width: 6px; height: 6px; border-radius: 50%; background: #3a3a3a; flex: none; }
.tile .st i.live { background: var(--acc); }
/* mascot: the whole cat (body + item), contained bottom-right, never clipped; image is inlined in mascots.css */
.tile .mascot { position: absolute; right: 8px; bottom: 8px; z-index: 0; width: 58%; height: 70%;
  background-repeat: no-repeat; background-position: bottom right; background-size: contain; pointer-events: none; }
/* white cat on the dark theme, black cat on the light theme */
.tile .m-light { display: none; }
[data-theme="light"] body:not(.in-game) .tile .m-dark { display: none; }
[data-theme="light"] body:not(.in-game) .tile .m-light { display: block; }
@media (min-width: 680px) { .tile { min-height: 150px; } }

/* friends promo — the one accent-filled card */
.banner-card { min-height: 128px; background: var(--acc); color: var(--acc-ink); }

/* home: «играть снова» — the last table again in one tap */
.quick { display: grid; gap: 10px; width: 100%; padding: 16px 18px; margin-bottom: 10px; border-radius: 24px; text-align: left;
  background: var(--acc); color: var(--acc-ink); transition: transform .15s var(--ease-out); }
.quick:active { transform: scale(.98); }
.quick small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; opacity: .65; }
.quick .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.quick b { font-family: var(--f-display); font-weight: 900; font-size: 30px; line-height: .92; letter-spacing: -.05em; text-transform: lowercase; min-width: 0; }
.quick .go { width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--acc-ink); color: var(--acc); display: grid; place-items: center; }
.quick .go .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.quick .meta { font-size: 12px; font-weight: 600; opacity: .7; }
@media (min-width: 960px) { .quick b { font-size: 36px; } }

/* «столы»: every open table, filter by game, one-tap seat */
.tables-live { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tables-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); animation: tabLive 1.6s ease-in-out infinite; }
.tables-filter { margin-bottom: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tables-filter::-webkit-scrollbar { display: none; }
.tables-filter .chip { flex: none; text-transform: lowercase; }
.otables { display: grid; gap: 8px; }
@media (min-width: 900px) { .otables { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.otable { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-radius: var(--r-lg); background: var(--panel); min-width: 0; }
.otable.mine { box-shadow: inset 0 0 0 1.5px var(--acc); }
.ot-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ot-main b { font-family: var(--f-display); font-weight: 900; font-size: 20px; line-height: 1; letter-spacing: -.04em; text-transform: lowercase; }
.ot-main small { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ot-seats { display: flex; gap: 4px; margin-top: 2px; }
.ot-seats .av { width: 24px !important; height: 24px !important; font-size: 10px !important; }
.ot-seats i { width: 24px; height: 24px; border-radius: 50%; border: 1.5px dashed var(--dim); }
.ot-side { display: grid; justify-items: end; gap: 8px; flex: none; }
.ot-stake { font-family: var(--f-display); font-weight: 900; font-size: 18px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.banner-card h3 { font-size: 26px; }
.banner-card p { color: rgba(10, 10, 10, .72); font-weight: 600; }
@media (min-width: 960px) { .banner-card { min-height: 140px; } .banner-card h3 { font-size: 30px; } }

.active-banner { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 16px; margin-bottom: 10px; border-radius: var(--r-lg); background: var(--panel); box-shadow: inset 0 0 0 2px var(--red); }
.active-banner b { display: block; }
.active-banner small { color: var(--muted); }

/* ---------- game lobby ---------- */
.ghead { min-height: 170px; cursor: default; }
.ghead:hover { transform: none; }
.ghead .back { position: absolute; top: 14px; left: 14px; z-index: 3; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(0, 0, 0, .35); }
.ghead h3 { font-size: 30px; }
.lobby-cols { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 980px) { .lobby-cols { grid-template-columns: 380px 1fr; align-items: start; } }
.field-label { margin: 16px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field-label:first-of-type { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 40px; min-width: 48px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px;
  background: var(--panel-3); font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--acc); color: var(--acc-ink); }
.chip[disabled] { opacity: .3; pointer-events: none; }
.prize { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.prize .amount { color: var(--acc); font-family: var(--f-display); font-weight: 900; letter-spacing: -.03em; font-size: 24px; }
.stake-custom { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 0 12px; height: 44px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid transparent; transition: border-color .15s; position: relative; }
.stake-custom > span { font-weight: 800; color: var(--muted); }
.stake-custom input { flex: 1; width: 0; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; font-size: 15px; }
.stake-custom input::placeholder { color: var(--dim); font-weight: 500; font-size: 13px; }
.stake-custom.on { border-color: rgba(var(--red-rgb), .7); }
.stake-custom.on > span { color: var(--ink); }
.stake-custom.bad { border-color: #ff5c7a; }
.stake-hint { font-size: 11.5px; font-weight: 600; color: var(--lose); white-space: nowrap; }
/* lobby: players stepper + full-width segmented options (the bottom-sheet look) */
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 10px; margin-bottom: 2px; }
.st-btn { height: 56px; border-radius: 50%; background: var(--panel-3); color: var(--ink); font-family: var(--f-display); font-weight: 400; font-size: 26px; line-height: 1; display: grid; place-items: center; transition: filter .15s; }
.st-btn:hover { filter: brightness(1.15); }
.st-btn:active { transform: scale(.94); }
.st-btn[disabled] { opacity: .35; pointer-events: none; }
.stepper b { text-align: center; font-family: var(--f-display); font-weight: 900; font-size: 42px; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.lobby-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.lobby-seg button { height: 44px; }

/* create-table lobby as an iOS-style bottom sheet that slides up */
body.on-sheet .tabbar { display: none; }
body.on-sheet .view { overflow: hidden; }
.sheet-under { pointer-events: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 104; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-backdrop.anim { animation: fade .2s; }
.create-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 105; display: flex; flex-direction: column;
  max-height: calc(100% - 48px); background: var(--panel); border-radius: 28px 28px 0 0; box-shadow: 0 -24px 60px -24px #000; }
.create-sheet.anim { animation: sheetUp .38s var(--ease-out); }
@media (min-width: 640px) { .create-sheet { left: 50%; margin-left: calc(min(460px, 100%) / -2); width: min(460px, 100%); } }
.cs-grab { width: 42px; height: 5px; flex: none; border-radius: 3px; background: var(--panel-3); margin: 10px auto 0; }
.cs-scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 10px 20px calc(22px + var(--inset-bottom, env(safe-area-inset-bottom, 0px))); }
.cs-title { font-size: 46px; text-transform: lowercase; }
.cs-desc { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.cs-tables { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
@keyframes sheetUp { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .create-sheet { animation: none; } }
.prize-places { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: -6px 0 14px; padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.prize-places .amount { font-size: 12px; color: var(--ink); }
.trow { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--panel-2); margin-bottom: 8px; }
.trow .who { flex: 1; min-width: 0; }
.trow .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .who small { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.trow .stake { text-align: right; font-size: 12px; color: var(--muted); }
.trow .stake .amount { display: flex; justify-content: flex-end; font-size: 15px; color: var(--ink); }
.trow.mine { box-shadow: inset 0 0 0 2px var(--red); }
.waiting { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-top: 10px; border-radius: var(--r-lg); background: var(--panel); box-shadow: inset 0 0 0 2px var(--red); }
.radar { width: 42px; height: 42px; flex: none; border-radius: 50%; position: relative; background: radial-gradient(circle, var(--red) 0 4px, transparent 5px); }
.radar::before, .radar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--red); animation: radar 2s infinite; }
.radar::after { animation-delay: 1s; }
@keyframes radar { from { transform: scale(.25); opacity: 1; } to { transform: scale(1.2); opacity: 0; } }

/* ---------- table ---------- */
.table-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 12px; }
.table-head .back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); flex: none; }
.table-head .title { flex: 1; min-width: 0; }
.table-head .title b { display: block; font-size: 20px; font-weight: 800; }
.table-head .title small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.table-head .title small .amount { vertical-align: -2px; color: var(--green); }
.arena { position: relative; padding: 14px; border-radius: var(--r-lg); background: var(--panel); }
.table-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.wait-screen { text-align: center; padding: 26px 16px; }
.wait-screen h2 { font-size: 22px; margin-top: 4px; }
.wait-screen p { color: var(--muted); max-width: 380px; margin: 8px auto 0; font-size: 13.5px; }
.seats-row { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.seats-row .seat { width: 42px; height: 42px; border-radius: 50%; border: 2px dashed var(--panel-3); display: grid; place-items: center; color: var(--dim); font-weight: 700; font-size: 13px; }

/* opponent-search screen (waiting for a table to fill) */
body.on-search .tabbar, body.on-search .topbar { display: none !important; }
.search-top { position: fixed; top: calc(12px + var(--inset-top, env(safe-area-inset-top, 0px))); left: 16px; right: 16px; z-index: 25; display: flex; align-items: center; justify-content: space-between; }
.search-back { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; }
.search-back .ic { width: 20px; height: 20px; }
.search { min-height: 72vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; padding: 20px 0; }
.search .radar { position: relative; width: 172px; height: 172px; display: grid; place-items: center; flex: none; background: none; }
.search .radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--acc); opacity: 0; }
.clockbig { position: relative; font-family: var(--f-display); font-weight: 900; font-size: 58px; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.s-title { font-size: 44px; text-transform: lowercase; line-height: .95; }
.s-title em { font-style: normal; color: var(--acc); }
.seats { display: flex; align-items: center; justify-content: center; gap: 12px; }
.seat-av { flex: none; box-sizing: border-box; width: 56px; height: 56px; min-width: 56px; min-height: 56px; border-radius: 50%; position: relative; display: grid; place-items: center; line-height: 1; font-family: var(--f-display); font-weight: 800; font-size: 15px; overflow: hidden; }
.seat-av .av { width: 56px !important; height: 56px !important; font-size: 20px !important; }
.seat-av.free { border: 1.5px dashed #444; color: #555; overflow: visible; }
.seat-av.filled::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--acc); opacity: 0; }
.search p { color: var(--muted); font-size: 13.5px; max-width: 30ch; margin: 0; }
.search .ghostbtn { height: 54px; padding: 0 40px; border-radius: 999px; border: 1px solid var(--line); background: none; font-family: var(--f-display); font-weight: 800; font-size: 15px; letter-spacing: -.02em; text-transform: lowercase; color: var(--ink); }
.search .ghostbtn:active { transform: scale(.97); }
@media (prefers-reduced-motion: no-preference) {
  .search .radar .ring { animation: searchPulse 2s ease-out infinite; }
  .search .radar .ring:nth-child(2) { animation-delay: 1s; }
  .seat-av.filled::after { animation: searchTick 1.1s ease-out infinite; }
  .seat-av.filled:nth-child(2)::after { animation-delay: .15s; }
}
@keyframes searchPulse { 0% { transform: scale(.5); opacity: .85; } 100% { transform: scale(1); opacity: 0; } }
@keyframes searchTick { 0%, 70% { transform: scale(1); opacity: 0; } 12% { opacity: .75; } 45% { transform: scale(1.16); opacity: 0; } }

/* ---------- result ---------- */
.result { position: fixed; inset: 0; z-index: 120; display: grid; place-items: end center; background: rgba(0, 0, 0, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s; }
@media (min-width: 640px) { .result { place-items: center; } }
.result-in { width: min(420px, 100%); padding: 28px 22px calc(22px + var(--safe-b)); text-align: center; border-radius: 26px 26px 0 0; background: var(--panel); animation: up .3s var(--ease-out); }
@media (min-width: 640px) { .result-in { border-radius: 26px; padding-bottom: 22px; } }
.result-badge { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center; font-size: 42px; background: var(--panel-3); }
.result.win .result-badge { background: rgba(61, 220, 132, .14); }
.result.lose .result-badge { background: rgba(var(--red-rgb), .14); }
.result h2 { font-size: 28px; }
.result-reason { color: var(--muted); margin-top: 6px; }
.result-amount { margin-top: 14px; font-size: 32px; font-weight: 800; display: flex; justify-content: center; align-items: center; gap: 8px; }
.result-amount .coin { width: 26px; height: 26px; }
.result .acts { display: grid; gap: 10px; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: end center; animation: fade .2s; }
@media (min-width: 640px) { .modal-bg { place-items: center; } }
.modal { position: relative; width: min(420px, 100%); padding: 26px 20px calc(20px + var(--safe-b)); background: var(--panel); border-radius: 26px 26px 0 0; animation: up .3s var(--ease-out); }
@media (min-width: 640px) { .modal { border-radius: 26px; padding-bottom: 22px; } }
.modal h2 { font-size: 22px; text-align: center; }
.modal p { color: var(--muted); text-align: center; margin: 8px 0 0; }
.modal .x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); }
.modal .acts { display: grid; gap: 10px; margin-top: 20px; }
#toast-root { position: fixed; left: 0; right: 0; top: calc(12px + var(--inset-top, 0px)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 420px; padding: 12px 16px; border-radius: 14px; background: var(--panel-3); font-weight: 600; font-size: 14px; box-shadow: 0 16px 40px -16px #000; animation: up .25s; }
.toast.err { box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), .6), 0 16px 40px -16px #000; }
.toast.ok { box-shadow: inset 0 0 0 1px rgba(61, 220, 132, .5), 0 16px 40px -16px #000; }

/* ---------- top ---------- */
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; }
.lrow + .lrow { border-top: 1px solid var(--line-soft); }
.lrow .pos { width: 26px; text-align: center; font-weight: 800; color: var(--dim); }
.lrow .pos.p1 { color: var(--gold); } .lrow .pos.p2 { color: #cfd2da; } .lrow .pos.p3 { color: #e0965f; }
.lrow .nm { flex: 1; min-width: 0; }
.lrow .nm b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .nm small { color: var(--muted); font-size: 12px; }
.lrow.me { background: rgba(var(--red-rgb), .1); box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), .4); }

.bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--red-grad); transition: width .5s var(--ease-out); }

/* ---------- profile ---------- */
/* minmax(0, …) everywhere: a column never grows past the screen because of its content */
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 1100px) { .profile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.profile-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.pcard { display: flex; gap: 14px; align-items: center; }
.pcard > div { min-width: 0; }
.pcard h2 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.pcard .meta b { color: var(--ink); }
.pcard .meta b.green { color: var(--green); }
.bal-card { box-shadow: inset 0 0 0 1px var(--line); }
.bal-card .big { font-family: var(--f-display); font-size: 48px; font-weight: 900; color: var(--ink); letter-spacing: -.05em; line-height: 1.05; display: flex; align-items: center; gap: 8px; }
.bal-card .big .coin { width: 30px; height: 30px; }
.bal-card .row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; margin: 6px 0 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ratings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rate { padding: 12px; border-radius: 14px; background: var(--panel-2); }
.rate .rt { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.rate .gi { width: 28px; height: 28px; border-radius: 8px; background: var(--red-grad); flex: none; }
.rate .num { margin-top: 8px; font-size: 26px; font-weight: 900; letter-spacing: -.02em; line-height: 1; }
.rate .num small { font-size: 12px; font-weight: 600; color: var(--dim); margin-left: 6px; letter-spacing: 0; }
.rate .wdl { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.invite-card { box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .35); }
.invite-card p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.ref-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--panel-2); }
.ref-box input { flex: 1; width: 0; min-width: 0; border: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--ink); outline: none; }
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.ref-stats small { color: var(--muted); font-size: 12px; font-weight: 600; }
.ref-stats b { display: block; font-size: 20px; margin-top: 2px; }
.top-games { margin: -6px 0 14px; }
.lrow .amount .wdl { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-align: right; }

/* ---------- wallet ---------- */
/* phone: one column in reading order; wide: balance across, deposit next to withdrawal, promo next to history */
.wallet-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 900px) {
  .wallet-grid { max-width: 560px; margin: 0 auto; }
}
.bal-card .big .bal-cents { color: var(--muted); font-size: .5em; font-weight: 900; letter-spacing: -.02em; }
/* wallet history (games + payments) */
.hist { display: grid; }
.hr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.hr:last-child { border-bottom: 0; padding-bottom: 0; }
.hr .ht { font-size: 13.5px; font-weight: 600; min-width: 0; }
.hr .ht small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; margin-top: 2px; }
.hr b { font-family: var(--f-display); font-weight: 800; font-size: 16px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-card h3 { justify-content: flex-start; }
.pay-card h3 .ic { color: var(--muted); }
.pay-card label, .cs-scroll label { display: block; margin: 16px 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cs-scroll > label:first-of-type { margin-top: 8px; }
.cs-scroll .pay-amount, .cs-scroll .pay-methods, .cs-scroll .pay-quick, .cs-scroll .pay-details, .cs-scroll .promo-box { margin-top: 0; }
.cs-scroll .btn.block { margin-top: 18px; }
.pay-card .btn.block { margin-top: 16px; }
.pay-hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 4px 0 0; }
.pay-amount, .promo-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--panel-2); }
.pay-amount span { font-size: 18px; font-weight: 800; color: var(--muted); }
.pay-amount input, .promo-box input { flex: 1; width: 0; min-width: 0; height: 38px; border: 0; background: transparent; font-size: 18px; font-weight: 700; color: var(--ink); outline: none; }
.promo-box input { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.promo-box input::placeholder { text-transform: none; letter-spacing: 0; }
.pay-details { width: 100%; height: 50px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--panel-2); font-size: 14px; font-weight: 600; color: var(--ink); outline: none; }
.pay-amount:focus-within, .promo-box:focus-within, .pay-details:focus { box-shadow: inset 0 0 0 1.5px var(--dim); }
.pay-quick { margin-top: 8px; }
.pay-methods .chip { height: 36px; }
.pay-list { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.pay-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; }
.pay-row + .pay-row { border-top: 1px solid var(--line-soft); }
.pay-row .pb { flex: 1; min-width: 0; }
.pay-row b { display: block; font-size: 14px; }
.pay-row b .muted { font-weight: 600; }
.pay-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.pay-row .pay-note { color: #ffb4c0; }
[data-theme="light"] body:not(.in-game) .pay-row .pay-note { color: var(--lose); }
.pay-row .pr { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.pay-st { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.pay-st.gold { background: rgba(var(--gold-rgb), .14); color: var(--gold); }
.pay-st.green { background: rgba(61, 220, 132, .14); color: var(--green); }
.pay-st.red { background: rgba(255, 92, 122, .14); color: #ff5c7a; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }

/* ---------- in-game: the table fills exactly one screen, nothing scrolls ---------- */
body.in-game .topbar, body.in-game .tabbar { display: none !important; }
body.in-game .view { display: flex; flex-direction: column; overflow: hidden; padding: 8px 10px calc(8px + var(--inset-bottom, env(safe-area-inset-bottom, 0px))); }
@media (min-width: 960px) { body.in-game .view { padding: 8px 28px 16px; } }
body.in-game .table-head { flex: none; margin: 0 0 8px; gap: 8px; }
body.in-game .table-head .back { width: 36px; height: 36px; }
body.in-game .table-head .title b { font-size: 17px; }
body.in-game .table-head .title small { font-size: 11.5px; margin-top: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body.in-game .table-head .btn.sm { height: 34px; padding: 0 12px; }
body.in-game .view > .banner { flex: none; margin: 0 0 8px; padding: 6px 10px; }
body.in-game .arena { flex: 1; min-height: 0; padding: 10px; display: flex; flex-direction: column; overflow: hidden; }
body.in-game .arena > * { flex: none; }
body.in-game .arena > :only-child { flex: 1 1 auto; min-height: 0; }
/* durak draws its own edge-to-edge felt: let it fill the arena instead of its fixed height */
body.in-game .arena > .g-durak:not(.dk-fx) { width: calc(100% + 20px); max-width: none; height: calc(100% + 20px); margin: -10px; }
body.in-game .arena .prow { padding: 7px 10px; }
body.in-game .arena .prow .av { width: 32px !important; height: 32px !important; font-size: 13px !important; }
body.in-game .arena .g-actions { margin-top: 8px; }
body.in-game .arena .status-line { margin-top: 6px; }

/* ---------- settings ---------- */
.ph-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
[data-theme="light"] body:not(.in-game) .page-head .back { background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.settings { display: grid; gap: 12px; max-width: 640px; }
.settings .panel h3 { margin-bottom: 10px; }
.set-seg { display: flex; width: 100%; }
.set-seg button { flex: 1; }
.set-note { margin: 10px 2px 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.set-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 0; text-align: left; }
.set-row + .set-row { border-top: 1px solid var(--line-soft); }
.set-text { flex: 1; min-width: 0; }
.set-text b { display: block; font-size: 15px; }
.set-text small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--panel-3); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .2s var(--ease-out); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }
.support-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), .35); }
.support-card .sc-icon { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--red-grad); color: #fff; }
.support-card > .ic:last-child { color: var(--muted); }
.set-btn .ic { width: 19px; height: 19px; }
.nw { white-space: nowrap; }
.approx { margin-top: 2px; font-size: 14px; font-weight: 700; color: var(--muted); }

/* «Лёгкий режим» (Settings): no blur, pulses or confetti — cheaper for weak phones */
.lite .topbar, .lite .tabbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
.lite .modal-bg, .lite .result { backdrop-filter: none; -webkit-backdrop-filter: none; }
.lite .radar::before, .lite .radar::after, .lite .skeleton { animation: none; }
.lite .burst { display: none; }
