/* ============================================================
   Retro-Arcade — Telegram-native dark UI.
   Design source: "Ретро-аркада Mini App.dc.html" (Claude Design).

   Reads as part of Telegram, not as a website inside it: near-black
   blue-grey ground, one Telegram-blue accent, gold for records,
   green for "active/ok", red for destructive. Rounded, roomy, touch-first.

   Rules carried over from the design doc:
     - every touch target >= 44px
     - no hover states, only :active (this lives on phones)
     - bottom safe-area via env(safe-area-inset-bottom)
     - self-contained: no external fonts, images or requests
   ============================================================ */

:root {
  /* ground */
  --bg:      #0B0E14;
  --bg-2:    #0D1018;
  --panel:   #16181F;
  --card:    #1C1F27;
  --card-2:  #22262F;

  /* lines */
  --line:    rgba(255, 255, 255, .06);
  --line-2:  rgba(255, 255, 255, .09);

  /* accents — one job each */
  --tg:      #2AABEE;   /* accent: links, active nav, primary action */
  --tg-2:    #0098EA;   /* accent bottom of gradients */
  --tg-hi:   #43BCF7;   /* accent top of gradients */
  --gold:    #F5C518;   /* records, badges */
  --green:   #3BC85A;   /* active filter, "ok" */
  --red:     #E9557A;   /* favourite, destructive */

  /* text */
  --txt:     #FFFFFF;
  --txt-soft:#C9CED6;
  --txt-2:   #8A8F98;
  --txt-3:   #6E757F;
  --txt-4:   #5A6270;

  --r-card:  18px;
  --r-panel: 16px;
  --r-lg:    22px;
  --r-pill:  999px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;

  --tabbar: calc(62px + env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Half this file sets display on classes that are also toggled with [hidden];
   without this the attribute loses and hidden blocks stay on screen. */
[hidden] { display: none !important; }

html { background: var(--bg); }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--txt);
  background: linear-gradient(180deg, var(--bg), var(--bg-2) 420px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

button, input { font-family: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
img { display: block; }

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(0, 152, 234, .45), 0 0 18px rgba(42, 171, 238, .35); }
  50%      { box-shadow: 0 10px 28px rgba(0, 152, 234, .60), 0 0 34px rgba(42, 171, 238, .60); }
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Splash: covers the first paint, leaves once the catalog is up ---------- */
.splash {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(120% 70% at 50% 22%, #14243A, var(--bg) 62%);
  transition: opacity .3s ease-out;
}
.splash[hidden] { display: none; }
.splash--out { opacity: 0; pointer-events: none; }
.splash__mark {
  position: relative; width: 104px; height: 104px; border-radius: 30px;
  background: linear-gradient(160deg, var(--tg-hi), #0071B8);
  display: grid; place-items: center; font-size: 46px; color: #fff;
  box-shadow: 0 18px 44px rgba(0, 152, 234, .5);
}
.splash__mark::after {
  content: ""; position: absolute; inset: 0; border-radius: 30px;
  background: radial-gradient(110% 70% at 26% 10%, rgba(255, 255, 255, .4), rgba(255, 255, 255, 0) 58%);
}
.splash__name { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.splash__sub  { margin-top: 6px; font-size: 13px; color: var(--txt-2); }
.splash__bar  { width: 180px; height: 5px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .09); overflow: hidden; }
.splash__bar i { display: block; width: 40%; height: 100%; border-radius: var(--r-pill);
                 background: linear-gradient(90deg, var(--tg), var(--green)); animation: splashLoad 1.1s ease-in-out infinite; }
@keyframes splashLoad { 0% { transform: translateX(-100%); } 100% { transform: translateX(280%); } }

/* ---------- Screens ---------- */
.screens { padding: 0 0 calc(var(--tabbar) + 26px); }
.screen { padding: 14px 16px 0; display: flex; flex-direction: column; gap: 18px; animation: fadeUp .22s ease-out; }
.screen[hidden] { display: none; }
.screen__title { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

/* ---------- Who is playing (top of the catalog) ---------- */
.me { display: flex; align-items: center; gap: 10px; }
.me__face {
  position: relative; width: 40px; height: 40px; flex: none; border-radius: var(--r-pill);
  overflow: hidden; background: linear-gradient(150deg, #4E86F7, #7B45D8);
}
.me__text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me__name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__sub  { font-size: 11px; font-weight: 500; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__score {
  display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; flex: none;
  border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line-2);
}
.me__score b { font-size: 13px; font-weight: 700; }
.me__score i { font-style: normal; font-size: 13px; color: var(--gold); }
.me__score span { font-size: 11px; color: var(--txt-2); }

/* ---------- Search + sort ---------- */
.find { display: flex; gap: 10px; }
.find__box {
  flex: 1; display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--panel); border: 1px solid var(--line-2);
}
.find__box:focus-within { border-color: rgba(42, 171, 238, .55); }
.find__ico { font-size: 14px; color: var(--txt-4); }
.find__box input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  font-size: 14px; font-weight: 500; color: var(--txt);
}
.find__box input::placeholder { color: var(--txt-4); }
.find__sort {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-pill);
  background: var(--panel); border: 1px solid var(--line-2);
  display: grid; place-items: center; font-size: 15px; color: var(--txt-2);
}
.find__sort:active { transform: scale(.94); }
.find__sort--on { color: var(--tg); border-color: rgba(42, 171, 238, .45); }

/* ---------- Category chips ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -2px -16px 0; padding: 2px 16px 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: flex; align-items: center; height: 36px; padding: 0 15px;
  border-radius: var(--r-pill); white-space: nowrap; font-size: 13px; font-weight: 600;
  background: var(--card); color: var(--txt-2); border: 1px solid var(--line);
  transition: background .14s, color .14s;
}
.chip:active { transform: scale(.96); }
.chip--on { background: var(--green); color: #06180B; font-weight: 700; border-color: transparent; }

/* ---------- Section heading ---------- */
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.head span { font-size: 12px; font-weight: 500; color: var(--txt-2); }
.head button { font-size: 12px; font-weight: 600; color: var(--tg); }

/* ---------- "Продолжить играть" rail ---------- */
.block { display: flex; flex-direction: column; gap: 10px; }
.rail { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; }
.rail::-webkit-scrollbar { display: none; }
.rail__item { flex: none; width: 118px; display: flex; flex-direction: column; gap: 7px; text-decoration: none; color: inherit; }
.rail__item:active { transform: scale(.97); }
.rail__art {
  position: relative; height: 86px; border-radius: var(--r-panel); overflow: hidden;
  background: #10131A; border: 1px solid var(--line);
}
.rail__art img { width: 100%; height: 100%; object-fit: cover; }
.rail__name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__meta { font-size: 11px; color: var(--txt-2); margin-top: -4px; }

/* ---------- Game of the day ---------- */
.today {
  position: relative; display: flex; align-items: center; gap: 14px; overflow: hidden;
  padding: 18px; border-radius: 20px; text-align: left; width: 100%;
  background: linear-gradient(120deg, var(--tg-2), #38B6F5 55%, #5AA9FF);
  box-shadow: 0 14px 30px rgba(0, 152, 234, .35);
}
.today::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(90% 120% at 88% 10%, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 55%);
}
.today:active { transform: scale(.99); }
.today__text { position: relative; flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.today__kicker { font-size: 10px; font-weight: 800; letter-spacing: .12em; color: rgba(255, 255, 255, .8); }
.today__name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.today__note { font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .85); }
.today__side { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.today__art {
  width: 62px; height: 62px; border-radius: 18px; overflow: hidden; background: rgba(0, 0, 0, .2);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .35));
}
.today__art img { width: 100%; height: 100%; object-fit: cover; }
.today__go {
  height: 34px; padding: 0 18px; border-radius: var(--r-pill); background: #fff; color: #0A5C8C;
  font-size: 13px; font-weight: 700; display: flex; align-items: center;
}

/* ---------- Grid of games ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  position: relative; border-radius: var(--r-card); overflow: hidden; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45);
  color: inherit; width: 100%; display: block;
}
.card:active { transform: scale(.98); }
/* display:block matters — the markup uses <span> so the card stays one button */
.card__art { display: block; position: relative; aspect-ratio: 1 / 1; background: #10131A; }
.card__art img { width: 100%; height: 100%; object-fit: cover; }
.card__badge {
  position: absolute; top: 9px; left: 9px; height: 23px; padding: 0 9px; border-radius: var(--r-pill);
  background: var(--gold); color: #1A1400; font-size: 10px; font-weight: 800; letter-spacing: .07em;
  display: flex; align-items: center;
}
.card__body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 3px; }
.card__name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__meta { font-size: 11px; font-weight: 500; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* heart lives above the cover, never triggers the card underneath */
.heart {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 30px; height: 30px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .38); backdrop-filter: blur(2px);
  display: grid; place-items: center; font-size: 14px; color: #fff;
}
.heart--on { color: var(--red); }
.heart:active { transform: scale(.88); }

/* ---------- Empty / error states ---------- */
.blank { padding: 34px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.blank__ico {
  width: 66px; height: 66px; border-radius: 20px; background: var(--card);
  display: grid; place-items: center; font-size: 28px; color: var(--txt-4);
}
.blank__ico--fav { color: var(--red); background: var(--panel); width: 78px; height: 78px; border-radius: 24px; font-size: 32px; }
.blank__ico--err { color: var(--red); background: rgba(233, 85, 122, .14); border: 1px solid rgba(233, 85, 122, .3); }
.blank b { font-size: 15px; font-weight: 700; }
.blank p { margin: 0; font-size: 13px; color: var(--txt-2); max-width: 240px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
  height: 48px; padding: 0 24px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, var(--tg), var(--tg-2));
  box-shadow: 0 8px 22px rgba(0, 152, 234, .4);
}
.btn:active { transform: scale(.97); }
.btn--ghost {
  background: var(--card); border: 1px solid var(--line-2); color: var(--txt-soft);
  font-weight: 600; box-shadow: none;
}
.btn--danger { background: rgba(233, 85, 122, .14); color: var(--red); box-shadow: none; height: 44px; border-radius: 12px; }
.btn--wide { width: 100%; }

/* ---------- Favourites list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  border-radius: var(--r-card); background: var(--panel); border: 1px solid var(--line);
}
.row__art { position: relative; width: 64px; height: 64px; flex: none; border-radius: 14px; overflow: hidden; background: #10131A; }
.row__art img { width: 100%; height: 100%; object-fit: cover; }
.row__text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row__name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { font-size: 12px; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__note { font-size: 11px; color: var(--green); font-weight: 600; }
.row__play {
  height: 38px; padding: 0 16px; flex: none; border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--tg), var(--tg-2)); color: #fff;
  font-size: 13px; font-weight: 700; display: flex; align-items: center;
}
.row__play:active { transform: scale(.95); }
.row__fav {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-pill); background: var(--card);
  display: grid; place-items: center; font-size: 16px; color: var(--red);
}

/* ---------- Records ---------- */
.stats3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  padding: 12px; border-radius: var(--r-panel); background: var(--panel); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat span { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--txt-2); }
.stat b { font-size: 19px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat--gold b  { color: var(--gold); }
.stat--green b { color: var(--green); }
.stats2 .stat { padding: 14px; }
.stats2 .stat span { font-size: 11px; font-weight: 600; letter-spacing: 0; }
.stats2 .stat b { font-size: 20px; }
.stats2 .stat b.sm { font-size: 16px; font-weight: 700; }

.seg { display: flex; padding: 4px; border-radius: var(--r-pill); background: var(--panel); border: 1px solid var(--line); }
.seg button {
  flex: 1; height: 40px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 700; color: var(--txt-2);
}
.seg button.on { background: var(--tg); color: #fff; }

.lead { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-panel);
        background: var(--panel); border: 1px solid rgba(255, 255, 255, .05); }
.lead--top {
  background: linear-gradient(120deg, rgba(245, 197, 24, .16), rgba(255, 255, 255, .03));
  border-color: rgba(245, 197, 24, .25);
}
.lead__rank { width: 22px; text-align: center; font-size: 13px; font-weight: 800; color: var(--txt-2); flex: none; }
.lead--top .lead__rank { color: var(--gold); }
.lead__art { width: 40px; height: 40px; flex: none; border-radius: 12px; overflow: hidden; background: #10131A; }
.lead__art img { width: 100%; height: 100%; object-fit: cover; }
.lead__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lead__text b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead__text span { font-size: 11px; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead__val { font-size: 14px; font-weight: 700; flex: none; }
.lead--top .lead__val { color: var(--gold); }

.note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--txt-3); }
.note--pad { padding: 0 2px; }

/* ---------- Profile ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0 6px; }
.hero__face {
  width: 88px; height: 88px; border-radius: var(--r-pill); overflow: hidden;
  background: linear-gradient(150deg, #4E86F7, #7B45D8);
  box-shadow: 0 12px 30px rgba(78, 134, 247, .35);
}
.hero__name { font-size: 20px; font-weight: 800; }
.hero__sub  { font-size: 13px; color: var(--txt-2); }
.hero__chip {
  display: flex; align-items: center; height: 32px; padding: 0 14px; border-radius: var(--r-pill);
  background: rgba(42, 171, 238, .14); border: 1px solid rgba(42, 171, 238, .3);
  font-size: 12px; font-weight: 700; color: var(--tg);
}

.panel { display: flex; flex-direction: column; border-radius: var(--r-card); overflow: hidden;
         background: var(--panel); border: 1px solid var(--line); }
.panel__cap { padding: 12px 14px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--txt-4); }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, .05); text-align: left;
}
.opt__ico { font-size: 16px; color: var(--txt-2); width: 18px; text-align: center; flex: none; }
.opt__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.opt__text b { font-size: 14px; font-weight: 600; }
.opt__text span { font-size: 11px; color: var(--txt-2); }
.opt__go { font-size: 14px; color: var(--txt-4); }
.opt__act { font-size: 13px; font-weight: 600; color: var(--tg); flex: none; padding: 8px 0 8px 12px; }
.opt__act.danger { color: var(--red); }

.sw { width: 48px; height: 29px; flex: none; border-radius: var(--r-pill); padding: 3px;
      background: rgba(255, 255, 255, .12); display: flex; justify-content: flex-start; transition: background .16s; }
.sw i { display: block; width: 23px; height: 23px; border-radius: var(--r-pill); background: #fff; transition: transform .16s; }
.sw--on { background: var(--green); }
.sw--on i { transform: translateX(19px); }

.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .05); }
.av {
  aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--card);
  border: 2px solid transparent; display: grid; place-items: center;
}
.av--on { border-color: var(--tg); box-shadow: 0 0 0 3px rgba(42, 171, 238, .18); }
.av:active { transform: scale(.94); }

.face { display: block; width: 100%; height: 100%; object-fit: cover; }
.face--letter { display: grid; place-items: center; width: 100%; height: 100%;
                font-size: 16px; font-weight: 800; color: #fff; background: linear-gradient(150deg, #4E86F7, #7B45D8); }
.face--sprite { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(160deg, #232833, #14171E); }
.face--sprite svg { width: 66%; height: 66%; }
.hero__face .face--letter { font-size: 34px; }
.av .face--letter { font-size: 18px; }

.ver { text-align: center; font-size: 11px; color: var(--txt-4); padding: 4px 0 2px; }

/* ---------- Game sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 200; }
.sheet[hidden] { display: none; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(4, 6, 10, .72); }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  border-radius: 26px 26px 0 0; padding: 10px 16px calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #191C24, #12151B);
  border-top: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 14px;
  animation: fadeUp .22s ease-out;
}
.sheet__grab { width: 38px; height: 4px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .18); margin: 0 auto 2px; }
.sheet__top { display: flex; gap: 14px; align-items: flex-start; }
.sheet__art {
  width: 104px; height: 104px; flex: none; border-radius: 20px; overflow: hidden; background: #10131A;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .5);
}
.sheet__art img { width: 100%; height: 100%; object-fit: cover; }
.sheet__text { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.sheet__name { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  height: 26px; padding: 0 10px; border-radius: var(--r-pill); display: flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .07); font-size: 11px; font-weight: 600; color: var(--txt-soft);
}
.tag--gold  { background: rgba(245, 197, 24, .14); color: var(--gold); font-weight: 700; }
.tag--green { background: rgba(59, 200, 90, .14); color: var(--green); font-weight: 700; }
.sheet__desc { font-size: 12px; line-height: 1.45; color: var(--txt-2); }
.sheet__acts { display: flex; gap: 10px; align-items: center; }
.sheet__acts .btn { flex: 1; height: 52px; font-size: 16px; box-shadow: 0 10px 26px rgba(0, 152, 234, .45); }
.sheet__mp { width: 100%; height: 48px; font-size: 15px; }
.icon-btn {
  width: 52px; height: 52px; flex: none; border-radius: var(--r-pill);
  background: var(--card); border: 1px solid var(--line-2);
  display: grid; place-items: center; font-size: 19px; color: var(--txt-soft);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn--fav { color: var(--red); }
.strip {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px;
  background: rgba(42, 171, 238, .1); border: 1px solid rgba(42, 171, 238, .22);
}
.strip__ico { font-size: 14px; color: var(--tg); }
.strip span { flex: 1; font-size: 12px; color: var(--txt-soft); }
.strip--warn { background: rgba(245, 197, 24, .13); border-color: rgba(245, 197, 24, .3); }
.strip--warn .strip__ico { color: var(--gold); }

/* ---------- Offline banner ---------- */
.offline {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px;
  background: rgba(245, 197, 24, .13); border: 1px solid rgba(245, 197, 24, .3);
}
.offline[hidden] { display: none; }
.offline b { font-size: 13px; font-weight: 700; color: var(--gold); }
.offline span { font-size: 11px; color: var(--txt-2); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  padding: 0 4px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(13, 16, 24, .4), #0F1219 40%);
  border-top: 1px solid var(--line-2);
  backdrop-filter: blur(12px);
}
.tabbar__row { display: flex; align-items: flex-end; height: 62px; padding-bottom: 6px; }
.tab {
  flex: 1; min-height: 44px; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 3px; color: var(--txt-2); transition: color .14s;
}
.tab i { font-style: normal; font-size: 18px; line-height: 1; }
.tab span { font-size: 10px; font-weight: 600; }
.tab--on { color: var(--tg); }
.tab--gap { pointer-events: none; }

.dice {
  position: absolute; left: 50%; top: -20px; transform: translateX(-50%);
  width: 62px; height: 62px; border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--tg-hi), var(--tg-2));
  border: 4px solid #0F1219; display: grid; place-items: center;
  font-size: 24px; color: #fff; animation: glowPulse 2.6s ease-in-out infinite;
}
.dice:active { transform: translateX(-50%) scale(.93); }
.dice__label {
  position: absolute; left: 50%; top: 46px; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; color: var(--txt-2); white-space: nowrap; pointer-events: none;
}

/* ============================================================
   Player page (player.html)
   ============================================================ */
body.player { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: #07090C; }
.pbar {
  flex: none; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px;
  background: rgba(11, 14, 20, .92); border-bottom: 1px solid var(--line-2);
}
.pbar__round {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .07); display: grid; place-items: center; font-size: 16px; color: #fff;
}
.pbar__round:active { transform: scale(.92); }
.pbar__round--fav { font-size: 15px; }
.pbar__text { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pbar__text b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar__text span { font-size: 10px; color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#game-wrap {
  flex: 1 1 auto; min-height: 0; width: 100%; position: relative;
  background: radial-gradient(120% 80% at 50% 0%, #111826, #07090C 70%);
  display: flex; align-items: center; justify-content: center;
}
#game { width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; }
#game canvas { max-width: 100%; max-height: 100%; }
.loading { font-size: 13px; color: var(--txt-2); text-align: center; padding: 40px; }

.pdock {
  flex: none; display: flex; gap: 8px; padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: rgba(11, 14, 20, .9);
}
.pdock button {
  flex: 1; height: 46px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.pdock button:active { transform: scale(.96); }
.pdock i { font-style: normal; font-size: 15px; color: var(--txt-soft); }
.pdock span { font-size: 9px; font-weight: 600; color: var(--txt-2); }
.pdock .on i { color: var(--tg); }

/* ---------- Account: toast, sync state, friends ---------- */
.toast {
  position: fixed; left: 50%; z-index: 300;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  max-width: min(88vw, 440px); padding: 11px 16px; border-radius: var(--r-pill);
  background: rgba(28, 31, 39, .97); border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 600; text-align: center;
  pointer-events: none; box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.toast[hidden] { display: none; }
.toast--on { opacity: 1; transform: translate(-50%, 0); }

.dot { width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--txt-4); flex: none; }
.dot--ok   { background: var(--green); }
.dot--warn { background: var(--gold); }
.dot--busy { background: var(--tg); }

.friend { display: flex; align-items: center; gap: 11px; padding: 10px 14px;
          border-top: 1px solid rgba(255, 255, 255, .05); }
.friend__face { width: 38px; height: 38px; flex: none; border-radius: 12px;
                overflow: hidden; background: var(--card); }
.friend__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.friend__text b { font-size: 14px; font-weight: 600;
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend__text span { font-size: 11px; color: var(--txt-2); }
.friend__x { font-size: 15px; color: var(--txt-4); flex: none; padding: 10px 4px 10px 12px; }
.friend__x:active { color: var(--red); }

/* ---------- Quality floor ---------- */
:focus-visible { outline: 2px solid var(--tg); outline-offset: 2px; }
body.locked { overflow: hidden; }

@media (min-width: 520px) {
  .screen { max-width: 520px; margin: 0 auto; width: 100%; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
