/* ============================================================
   Шарики — мультяшный интерфейс
   Небо с облаками, толстые обводки, «пухлые» кнопки с тенью
   ============================================================ */
:root {
  --ink: #24164a;
  --ink-soft: #4a3d78;
  --muted: #7a6fa3;
  --paper: #ffffff;
  --cream: #fff7e8;
  --lav: #f3eeff;
  --sky-top: #5cc8ff;
  --sky-bot: #c6f0ff;
  --grass: #5fd36b;
  --grass-dark: #3fae4c;

  --green: #3fd46c;
  --blue: #3ba7ff;
  --yellow: #ffc93c;
  --orange: #ff9f1c;
  --pink: #ff6fb5;
  --red: #ff5a5f;
  --purple: #9b5cff;

  --display: 'Rubik', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --bw: 4px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 70%, #e9fbff 100%) fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 4px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 8px var(--ink); }
img { max-width: 100%; }

/* ---------- фон: облака и холмы ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud {
  position: absolute; width: 220px; height: 70px; background: #fff; border-radius: 60px; opacity: .92;
  filter: drop-shadow(0 6px 0 rgba(36, 22, 74, .08));
  animation: drift linear infinite;
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 100px; height: 100px; left: 30px; top: -50px; }
.cloud::after { width: 80px; height: 80px; left: 110px; top: -34px; }
.cloud.c1 { top: 9%; left: -240px; animation-duration: 70s; }
.cloud.c2 { top: 26%; left: -240px; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; }
.cloud.c3 { top: 4%; left: -240px; transform: scale(.55); animation-duration: 120s; animation-delay: -80s; }
.cloud.c4 { top: 40%; left: -240px; transform: scale(.85); animation-duration: 85s; animation-delay: -20s; opacity: .7; }
@keyframes drift { from { translate: 0 0; } to { translate: calc(100vw + 480px) 0; } }
.hills { position: absolute; left: 0; right: 0; bottom: 0; height: 26vh; min-height: 140px; }
.hills svg { width: 100%; height: 100%; display: block; }

/* ---------- общий каркас ---------- */
.app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
.screen {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
  padding-block: 14px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 10px; min-width: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--paper); border: var(--bw) solid var(--ink);
  border-radius: 999px; padding: 5px 14px 5px 6px; box-shadow: 0 4px 0 var(--ink); font-family: var(--display); font-weight: 800;
  min-width: 0;
}
.chip.btn-like { cursor: pointer; transition: transform .1s; }
.chip.btn-like:hover { transform: translateY(-2px); }
.chip .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--ink); background: var(--yellow); flex: none;
  display: grid; place-items: center; font-family: var(--display); font-weight: 900; overflow: hidden; color: var(--ink);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.coin {
  width: 30px; height: 30px; border-radius: 50%; flex: none; border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff3a8 0 18%, #ffd23f 19% 62%, #f0a400 63%);
  display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 13px; color: #8a5200;
}
.coin::after { content: 'Ш'; }
.coin.sm { width: 22px; height: 22px; border-width: 2.5px; font-size: 10px; }
.coins-val { font-variant-numeric: tabular-nums; font-size: 19px; }
.coins-chip.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.18) rotate(-3deg); } }

.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: var(--bw) solid var(--ink); background: var(--paper);
  box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; transition: transform .1s; flex: none; padding: 0;
}
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- логотип ---------- */
.logo { display: inline-flex; gap: 2px; font-family: var(--display); font-weight: 900; font-size: clamp(44px, 7vw, 86px); line-height: 1; letter-spacing: 1px; user-select: none; }
.logo span {
  display: inline-block; color: #fff;
  text-shadow:
    -4px -4px 0 var(--ink), 4px -4px 0 var(--ink), -4px 4px 0 var(--ink), 4px 4px 0 var(--ink),
    0 -5px 0 var(--ink), 0 5px 0 var(--ink), -5px 0 0 var(--ink), 5px 0 0 var(--ink),
    0 11px 0 var(--ink);
  animation: wob 3.2s ease-in-out infinite;
}
.logo span:nth-child(1) { color: var(--red); animation-delay: 0s; }
.logo span:nth-child(2) { color: var(--orange); animation-delay: .15s; }
.logo span:nth-child(3) { color: var(--yellow); animation-delay: .3s; }
.logo span:nth-child(4) { color: var(--green); animation-delay: .45s; }
.logo span:nth-child(5) { color: var(--blue); animation-delay: .6s; }
.logo span:nth-child(6) { color: var(--purple); animation-delay: .75s; }
.logo span:nth-child(7) { color: var(--pink); animation-delay: .9s; }
@keyframes wob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.logo.sm { font-size: 34px; }
.logo.sm span { text-shadow: -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 3px 3px 0 var(--ink), 0 7px 0 var(--ink); }
.tagline { font-family: var(--display); font-weight: 800; font-size: 18px; color: #fff; text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); margin: 0; }

/* ---------- пухлые кнопки ---------- */
.btn {
  --c: var(--green);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-md); padding: 14px 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 72%, #fff) 0%, var(--c) 55%);
  box-shadow: 0 6px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, .14), inset 0 4px 0 rgba(255, 255, 255, .45);
  color: #fff; font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: .3px;
  text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, filter .1s; user-select: none;
}
.btn:hover { transform: translateY(-2px) rotate(-.6deg); filter: brightness(1.05); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink), inset 0 -3px 0 rgba(0, 0, 0, .14), inset 0 3px 0 rgba(255, 255, 255, .45); }
.btn:disabled { filter: grayscale(.7) brightness(.95); opacity: .7; cursor: not-allowed; transform: none; }
.btn.blue { --c: var(--blue); }
.btn.yellow { --c: var(--yellow); }
.btn.orange { --c: var(--orange); }
.btn.pink { --c: var(--pink); }
.btn.red { --c: var(--red); }
.btn.purple { --c: var(--purple); }
.btn.white { --c: #ffffff; color: var(--ink); text-shadow: none; background: linear-gradient(180deg, #fff, #f1ecff); }
.btn.sm { font-size: 16px; padding: 9px 14px; border-radius: var(--r-sm); box-shadow: 0 4px 0 var(--ink), inset 0 -4px 0 rgba(0, 0, 0, .12), inset 0 3px 0 rgba(255, 255, 255, .45); gap: 8px; }
.btn.sm:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.big { font-size: 26px; padding: 18px 26px; border-radius: 24px; }
.btn .ic {
  width: 46px; height: 46px; flex: none; border-radius: 50%; background: #fff; border: 3px solid var(--ink);
  display: grid; place-items: center; box-shadow: inset 0 -4px 0 rgba(36, 22, 74, .12);
}
.btn .ic svg { width: 26px; height: 26px; }
.btn.sm svg { width: 20px; height: 20px; }
.btn .lbl { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.btn .lbl small { font-family: var(--body); font-weight: 800; font-size: 13px; text-shadow: none; color: rgba(255, 255, 255, .95); opacity: .95; }
.btn.white .lbl small { color: var(--muted); }

/* ---------- карточки ---------- */
.card {
  background: var(--paper); border: var(--bw) solid var(--ink); border-radius: var(--r-lg);
  box-shadow: 0 8px 0 var(--ink); padding: 20px; min-width: 0;
}
.card.cream { background: var(--cream); }
.card h2, .h2 { font-family: var(--display); font-weight: 900; font-size: 26px; margin: 0; line-height: 1.1; }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 900; }
.muted { color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.4; }

.screen-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.screen-title {
  font-family: var(--display); font-weight: 900; font-size: clamp(30px, 5vw, 44px); color: #fff; margin: 0; line-height: 1;
  text-shadow: -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 3px 3px 0 var(--ink), 0 7px 0 var(--ink);
}
.screen-head .spacer { flex: 1; }

/* ---------- главный экран ---------- */
.home {
  flex: 1; display: grid; grid-template-columns: minmax(300px, 440px) 1fr; gap: 28px; align-items: center;
}
.home .menu { display: flex; flex-direction: column; gap: 16px; }
.home .menu .btn { justify-content: flex-start; padding: 12px 18px 12px 12px; font-size: 24px; }
.home .menu .btn:nth-child(odd):hover { transform: translateY(-2px) rotate(.6deg); }
.home .brand { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }

.stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 460px; }
.stage .glow { position: absolute; width: min(520px, 90%); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.85) 0%, rgba(255,255,255,0) 65%); top: 0; }
.stage .rays { position: absolute; width: min(560px, 95%); aspect-ratio: 1; top: -20px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,255,255,.28) 0 10deg, rgba(255,255,255,0) 10deg 20deg);
  mask: radial-gradient(circle, #000 0 40%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 0 40%, transparent 70%);
  animation: spin 40s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.hero-canvas { position: relative; width: min(380px, 80vw); aspect-ratio: 1; z-index: 2; margin-bottom: -58px; cursor: pointer; }
.podium { position: relative; width: min(340px, 72vw); height: 92px; z-index: 1; }
.podium .top { position: absolute; inset: 0 0 auto 0; height: 70px; border-radius: 50%; border: var(--bw) solid var(--ink); background: radial-gradient(ellipse at 50% 40%, #fff 0 30%, #ffe28a 31% 60%, #ffc93c 61%); z-index: 2; }
.podium .side { position: absolute; left: 0; right: 0; top: 35px; height: 56px; border: var(--bw) solid var(--ink); border-top: none; border-radius: 0 0 50% 50% / 0 0 40px 40px; background: linear-gradient(90deg, #ff8a3d, #ffb24d 45%, #e86f1f); }
.nameplate { margin-top: 14px; z-index: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.nameplate .tag {
  background: var(--ink); color: #fff; font-family: var(--display); font-weight: 900; font-size: 20px; padding: 8px 18px; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
.rarity { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 900; color: #fff; padding: 4px 10px; border-radius: 999px; border: 3px solid var(--ink); }

.stats-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: rgba(255,255,255,.8); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; font-size: 14px; }
.stat b { font-family: var(--display); font-size: 18px; }

/* ---------- вход ---------- */
.login { flex: 1; display: grid; grid-template-columns: 1fr minmax(300px, 440px); gap: 28px; align-items: center; }
.login .card { display: flex; flex-direction: column; gap: 16px; }
.login-btns { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.provider { min-height: 52px; display: flex; justify-content: center; align-items: center; background: var(--lav); border: 3px dashed #cbbff0; border-radius: 16px; padding: 8px; }
.provider.ready { border-style: solid; border-color: transparent; background: transparent; padding: 0; }
.invite { background: #fff1c2; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; font-size: 15px; }

/* ---------- магазин и гардероб ---------- */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab { border: var(--bw) solid var(--ink); background: #fff; border-radius: 999px; padding: 8px 18px; font-family: var(--display); font-weight: 900; box-shadow: 0 4px 0 var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.tab .soon { font-size: 11px; background: var(--pink); color: #fff; padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.char-card {
  position: relative; background: var(--paper); border: var(--bw) solid var(--ink); border-radius: var(--r-lg); box-shadow: 0 8px 0 var(--ink);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .15s; min-width: 0;
}
.char-card:hover { transform: translateY(-4px) rotate(-.4deg); }
.char-card .bg { position: relative; height: 200px; display: grid; place-items: center; border-bottom: var(--bw) solid var(--ink); overflow: hidden; }
.char-card .bg::before { content: ''; position: absolute; inset: -40%; background: repeating-conic-gradient(rgba(255,255,255,.3) 0 12deg, rgba(255,255,255,0) 12deg 24deg); animation: spin 30s linear infinite; }
.char-card canvas { position: relative; width: 190px; height: 190px; }
.char-card .rarity { position: absolute; top: 12px; left: 12px; z-index: 2; }
.char-card .owned-badge { position: absolute; top: 12px; right: 12px; z-index: 2; background: var(--green); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 900; }
.char-card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.char-card .name { font-family: var(--display); font-weight: 900; font-size: 24px; line-height: 1; }
.char-card .desc { font-size: 14px; color: var(--muted); line-height: 1.35; flex: 1; }
.char-card .btn { width: 100%; }
.price { display: inline-flex; align-items: center; gap: 8px; }
.locked-note { font-size: 13px; color: var(--muted); text-align: center; }

.soon-box { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.soon-box .big-emoji { width: 90px; height: 90px; border-radius: 50%; background: var(--yellow); border: var(--bw) solid var(--ink); display: grid; place-items: center; box-shadow: 0 6px 0 var(--ink); }
.soon-box .big-emoji svg { width: 46px; height: 46px; }

.wardrobe { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 24px; align-items: start; }
.wardrobe .stage { min-height: 400px; }
.wardrobe .side { display: flex; flex-direction: column; gap: 18px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.pick {
  position: relative; border: var(--bw) solid var(--ink); border-radius: 20px; background: var(--lav); padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 5px 0 var(--ink); transition: transform .1s; min-width: 0;
}
.pick:hover { transform: translateY(-2px); }
.pick canvas { width: 96px; height: 96px; }
.pick .nm { font-family: var(--display); font-weight: 900; font-size: 15px; }
.pick[aria-pressed="true"] { background: #d9f7e3; }
.pick[aria-pressed="true"]::after { content: ''; position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/18px no-repeat; border: 3px solid var(--ink); }
.pick.locked { background: #ece8f5; }
.pick.locked canvas { filter: grayscale(1) brightness(.75) contrast(.9); opacity: .65; }
.pick .lock { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.sw { width: 48px; height: 48px; border-radius: 50%; border: var(--bw) solid var(--ink); box-shadow: 0 4px 0 var(--ink), inset 0 -6px 0 rgba(0,0,0,.15), inset 0 5px 0 rgba(255,255,255,.4); padding: 0; transition: transform .1s; }
.sw:hover { transform: translateY(-2px) scale(1.05); }
.sw[aria-pressed="true"] { outline: 4px solid var(--ink); outline-offset: 4px; }

/* ---------- комната ---------- */
.room { display: grid; grid-template-columns: 1fr minmax(280px, 340px); gap: 22px; align-items: start; }
.code-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.code-big { font-family: var(--display); font-weight: 900; font-size: clamp(36px, 6vw, 52px); letter-spacing: .14em; line-height: 1; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.slot {
  position: relative; border: var(--bw) solid var(--ink); border-radius: 22px; background: var(--lav); display: flex; flex-direction: column; align-items: center;
  padding: 8px 6px 12px; gap: 4px; min-width: 0; box-shadow: 0 5px 0 var(--ink);
}
.slot canvas { width: 100%; max-width: 120px; aspect-ratio: 1; }
.slot .nm { font-family: var(--display); font-weight: 900; font-size: 16px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .badge { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 900; padding: 3px 9px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; }
.slot .badge.ready { background: var(--green); color: #fff; }
.slot .badge.wait { background: #fff1c2; }
.slot .badge.off { background: #ddd; }
.slot.you { background: #fff1c2; }
.slot.empty { border-style: dashed; background: rgba(255,255,255,.55); box-shadow: none; justify-content: center; min-height: 170px; color: var(--muted); font-size: 14px; text-align: center; gap: 8px; }
.slot .crown { position: absolute; top: -16px; left: 50%; translate: -50% 0; width: 38px; height: 30px; }
.slot .kick { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; display: grid; place-items: center; padding: 0; }
.slot .kick svg { width: 14px; height: 14px; }
.slot .wins { font-size: 12px; color: var(--muted); }
.room-side { display: flex; flex-direction: column; gap: 14px; }
.room-side .btn { width: 100%; }
.status-line { font-size: 15px; line-height: 1.4; }

/* ---------- игра ---------- */
.game { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.game-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hud .round-title { font-family: var(--display); font-weight: 900; font-size: 22px; }
.hud .chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.mchip { font-size: 12px; font-weight: 900; border: 3px solid var(--ink); border-radius: 999px; padding: 3px 10px; background: #fff1c2; }
.mchip.mod { background: #e3f1ff; }
.timer-bubble { width: 64px; height: 64px; border-radius: 50%; border: var(--bw) solid var(--ink); background: #fff; box-shadow: 0 5px 0 var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 26px; font-variant-numeric: tabular-nums; flex: none; }
.timer-bubble.hot { background: var(--red); color: #fff; animation: pulse .6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.arena-wrap { position: relative; width: 100%; aspect-ratio: 5 / 4; max-height: calc(100vh - 230px); margin: 0 auto; }
.arena-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.banner {
  position: absolute; left: 50%; top: 3%; translate: -50% 0; background: var(--ink); color: #fff; font-family: var(--display); font-weight: 900;
  font-size: 18px; padding: 9px 18px; border-radius: 999px; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; pointer-events: none; animation: pop .25s;
}
@keyframes pop { from { scale: .5; } }
.spectate { position: absolute; left: 50%; bottom: 4%; translate: -50% 0; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 8px 16px; font-size: 14px; white-space: nowrap; }
.controls { display: flex; gap: 12px; align-items: center; }
.controls .hint { flex: 1; }
.dash-btn { --cd: 1; min-width: 170px; background: linear-gradient(90deg, var(--blue) calc(var(--cd) * 100%), #a9cdf0 0); }
.board { display: flex; flex-direction: column; gap: 8px; }
.pl { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 6px 10px; min-width: 0; box-shadow: 0 3px 0 var(--ink); }
.pl canvas { width: 40px; height: 40px; flex: none; }
.pl .nm { flex: 1; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pl .ln { font-family: var(--display); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.pl.dead { opacity: .45; }
.pl.dead .nm { text-decoration: line-through; }
.pl.you { background: #fff1c2; }

/* ---------- модалки и тосты ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(36, 22, 74, .55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; animation: pop2 .28s cubic-bezier(.2, 1.4, .4, 1); display: flex; flex-direction: column; gap: 14px; }
@keyframes pop2 { from { transform: scale(.7); opacity: 0; } }
.modal .actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* кнопки результатов всегда видны внизу окна, даже если список длинный */
.modal .actions:not(:empty) { position: sticky; bottom: -20px; z-index: 2; background: var(--paper); margin: 0 -20px -20px; padding: 12px 20px 20px; border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 -10px 16px -10px rgba(36,22,74,.25); }
.modal .actions .btn { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.input {
  border: var(--bw) solid var(--ink); border-radius: 16px; padding: 12px 16px; background: var(--lav); font-family: var(--display); font-weight: 800; font-size: 20px; width: 100%;
}
.input.code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-size: 30px; }
.err { color: var(--red); font-size: 14px; min-height: 1.2em; }
.toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.25); animation: pop .25s; text-align: center; }
.toast.ok { background: var(--green); border: 3px solid var(--ink); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.toast.bad { background: var(--red); border: 3px solid var(--ink); }

.results-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.results-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 14px; border: 3px solid transparent; }
.results-list li.you { background: #fff1c2; border-color: var(--ink); }
.results-list .pos { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 900; flex: none; background: #fff; }
.results-list li:nth-child(1) .pos { background: #ffd23f; }
.results-list li:nth-child(2) .pos { background: #dfe6ef; }
.results-list li:nth-child(3) .pos { background: #f0a868; }
.results-list canvas { width: 40px; height: 40px; flex: none; }
.results-list .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.results-list .nm { font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-list .st { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results-list .cn { display: flex; align-items: center; gap: 4px; font-family: var(--display); font-weight: 900; }
.win-title { font-family: var(--display); font-weight: 900; font-size: 30px; text-align: center; line-height: 1.1; text-wrap: balance; }
.earned { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--display); font-weight: 900; font-size: 28px; }

.loading { flex: 1; display: grid; place-items: center; }
.spinner { width: 70px; height: 70px; border-radius: 50%; border: 8px solid #fff; border-top-color: var(--ink); animation: spin 1s linear infinite; }
.conn-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--red); color: #fff; text-align: center; padding: 6px; font-weight: 900; border-bottom: 3px solid var(--ink); }

.footer { text-align: center; font-size: 13px; color: var(--ink-soft); padding-bottom: 10px; position: relative; z-index: 1; }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .game { grid-template-columns: 1fr; }
  .board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .home, .login { grid-template-columns: 1fr; gap: 10px; }
  .home .stage, .login .stage { order: -1; min-height: 0; }
  .home .brand { align-items: center; text-align: center; }
  .home .menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .home .menu .btn { flex-direction: column; justify-content: center; padding: 12px 8px; font-size: 19px; gap: 6px; text-align: center; }
  .home .menu .btn .lbl { align-items: center; }
  .home .menu .btn .lbl small { display: none; }
  .hero-canvas { width: min(270px, 66vw); margin-bottom: -44px; }
  .podium { width: min(240px, 58vw); height: 70px; }
  .podium .top { height: 54px; }
  .podium .side { top: 27px; height: 42px; }
  .wardrobe { grid-template-columns: 1fr; }
  .login .brand { text-align: center; align-items: center; }
}
@media (max-width: 560px) {
  .slots { grid-template-columns: repeat(2, 1fr); }
  .grid-cards { grid-template-columns: 1fr; }
  .chip .nm { max-width: 90px; }
  .btn.big { font-size: 22px; }
  .controls { flex-wrap: wrap; }
  .controls .hint { flex-basis: 100%; }
  .controls .btn { flex: 1; }
  .board { grid-template-columns: 1fr 1fr; }
  .pl canvas { width: 30px; height: 30px; }
  .pl { padding: 4px 8px; gap: 6px; }
  .pl .nm { font-size: 14px; }
  .arena-wrap { max-height: none; }
  .hud .round-title { font-size: 18px; }
  .timer-bubble { width: 54px; height: 54px; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- режим «Падающий пол» ---------- */
.mode-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-pick .tab { padding: 6px 12px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
.mode-pick .tab:disabled { cursor: default; opacity: .75; }
.mode-pick .tab[aria-selected="true"]:disabled { opacity: 1; }
body.floor-mode { background: #c9b8ff url('/assets/bg_sky.webp') center / cover no-repeat fixed; }
body.floor-mode .sky .hills { display: none; }
body.floor-mode .cloud { opacity: .45; }
body.potato-mode { background: #ffc9a8 url('/assets/potato/bg.webp') center / cover no-repeat fixed; }
body.potato-mode .cloud { opacity: .25; }
body.king-mode { background: #8fe3f0 url('/assets/king/bg.webp') center / cover no-repeat fixed; }
body.king-mode .cloud { opacity: .3; }
body.spin-mode { background: #ffd7b8 url('/assets/spin/bg.webp') center / cover no-repeat fixed; }
body.spin-mode .cloud { opacity: .25; }
body.candy-mode { background: #ffc8e6 url('/assets/candy/bg.webp') center / cover no-repeat fixed; }
body.candy-mode .cloud { opacity: .25; }
body.floor-mode .arena-wrap canvas {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 88%, transparent 100%);
}

/* ---------- выбор мини-игр и матч ---------- */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.mode-card {
  border: var(--bw) solid var(--ink); border-radius: 20px; background: var(--lav); padding: 0; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 5px 0 var(--ink); transition: transform .12s; text-align: center; min-width: 0;
}
.mode-card:hover:not(:disabled) { transform: translateY(-3px) rotate(-.6deg); }
.mode-card .mc-img { aspect-ratio: 1; display: grid; place-items: center; background: radial-gradient(circle at 50% 55%, #fff 0 25%, #bfe3ff 75%); border-bottom: 3px solid var(--ink); }
.mode-card .mc-img img { width: 100%; height: 100%; object-fit: contain; }
.mode-card .dice { width: 64%; aspect-ratio: 1; display: grid; place-items: center; animation: wob 2.6s ease-in-out infinite; }
.mode-card .dice svg { width: 100%; height: 100%; }
.mode-card .mc-name { font-family: var(--display); font-weight: 900; font-size: 16px; padding: 8px 6px 10px; }
.mode-card.on { background: #d9f7e3; outline: 4px solid var(--green); outline-offset: 2px; }
.mode-card:disabled { cursor: default; }
.mode-card:disabled:not(.on) { opacity: .6; }
.mode-short { min-height: 1.4em; }
.rounds-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rounds-row .tab { min-width: 46px; }
.mode-pick .tab:disabled { cursor: default; }
.round-chip { background: var(--ink) !important; color: #fff; }
.results-list .pts { font-family: var(--display); font-weight: 900; white-space: nowrap; }
.results-list .pts small { font-size: 11px; color: var(--muted); }
.results-list.standings li { padding: 4px 10px; }
@media (max-width: 980px) {
  .room .room-main { display: contents !important; }
  .room .room-players { order: 0; }
  .room .room-side { order: 1; }
  .room .room-modes { order: 2; }
}
body.shoot-mode { background: #f6b26b url('/assets/shootout/bg.webp') center / cover no-repeat fixed; }
body.shoot-mode .sky .hills { display: none; }
body.shoot-mode .cloud { opacity: .35; }

/* ---------- игра на весь экран ---------- */
.game-full { position: fixed; inset: 0; z-index: 5; overflow: hidden; }
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.g-top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; gap: 12px; pointer-events: none;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px));
}
.g-top > * { pointer-events: auto; }
.g-title {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,.88); border: 3px solid var(--ink);
  border-radius: 18px; padding: 8px 14px; box-shadow: 0 4px 0 var(--ink); max-width: 620px;
}
.g-title .round-title { font-size: 20px; }
.g-top .timer-bubble { margin-left: auto; }
.g-board {
  position: absolute; right: max(14px, env(safe-area-inset-right, 0px)); top: 96px; display: flex; flex-direction: column; gap: 6px;
  width: 220px; pointer-events: none;
}
.g-board .pl { padding: 3px 8px; gap: 6px; border-width: 2.5px; box-shadow: 0 2px 0 var(--ink); background: rgba(255,255,255,.9); }
.g-board .pl canvas { width: 30px; height: 30px; }
.g-board .pl .nm { font-size: 13px; }
.g-board .pl .ln { font-size: 13px; }
.g-board .pl.you { background: rgba(255,241,194,.95); }
.game-full .banner { top: 92px; position: absolute; z-index: 3; }
.game-full .spectate { position: absolute; left: 50%; bottom: 110px; translate: -50% 0; }
.g-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; pointer-events: none;
  padding: 0 max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
}
.g-hint {
  margin: 0; max-width: 520px; font-size: 14px; line-height: 1.35; background: rgba(36,22,74,.78); color: #fff; padding: 8px 14px; border-radius: 14px;
}
.g-hint:empty { display: none; }
.g-btns { display: flex; gap: 10px; pointer-events: auto; }
.g-btns .btn.big { font-size: 22px; padding: 16px 24px; }
@media (max-width: 700px) {
  .g-title { padding: 6px 10px; }
  .g-title .round-title { font-size: 16px; }
  .g-title .chips .mchip:not(.round-chip) { display: none; }
  .g-board { width: auto; top: 80px; }
  .g-board .pl .nm { display: none; }
  .g-board .pl .dot { display: none; }
  .g-board .pl { padding: 2px 6px 2px 2px; }
  .g-board .pl canvas { width: 26px; height: 26px; }
  .g-board .pl .ln { font-size: 11px; }
  .game-full .banner { top: 74px; font-size: 14px; }
  .g-bottom { flex-direction: column; align-items: stretch; }
  .g-hint { font-size: 12px; padding: 6px 10px; align-self: flex-start; }
  .g-btns { justify-content: flex-end; }
  .g-btns .btn.big { font-size: 18px; padding: 12px 18px; }
}
body.floor-mode .arena-wrap canvas, body.floor-mode .game-canvas { -webkit-mask-image: none; mask-image: none; }

/* ---------- Предметы и аксессуары ---------- */
.slot-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tab.sm { padding: 6px 14px; font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
.shop-note { margin: 0 0 16px; }
.item-card .bg { height: 210px; }
.item-card canvas.wear { width: 190px; height: 190px; }
.item-card canvas.icon { position: absolute; right: 10px; bottom: 10px; width: 64px; height: 64px; z-index: 2; background: rgba(255,255,255,.85); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 3px 0 var(--ink); }
.item-card .slot-tag { align-self: flex-start; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.acc-row { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-top: 2px dashed #e4dcf7; }
.acc-row:first-child { border-top: 0; }
.acc-slot { font-family: var(--display); font-weight: 900; font-size: 15px; }
.acc-list { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-pick { position: relative; width: 58px; height: 58px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; padding: 0; cursor: pointer; transition: transform .1s; }
.acc-pick:hover { transform: translateY(-2px); }
.acc-pick canvas { width: 50px; height: 50px; }
.acc-pick.none svg { width: 22px; height: 22px; opacity: .45; }
.acc-pick[aria-pressed="true"] { background: #d9f7e3; box-shadow: 0 3px 0 var(--ink), 0 0 0 3px var(--green) inset; }
.acc-more { border: 2px dashed var(--muted); background: transparent; border-radius: 14px; padding: 8px 12px; font-weight: 800; color: var(--muted); cursor: pointer; }

/* ---------- Быстрая игра ---------- */
.btn.quick { --c: var(--orange); }
.btn.quick .ic svg { width: 30px; height: 30px; }
.quick-head { display: flex; flex-direction: column; gap: 4px; }
.quick-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: var(--orange); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 4px 12px; font-family: var(--display); font-weight: 900; box-shadow: 0 3px 0 var(--ink); }
.quick-badge svg { width: 18px; height: 18px; }
.auto-timer { display: flex; align-items: center; gap: 12px; background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; padding: 10px 14px; }
.auto-timer .n { width: 56px; height: 56px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 26px; box-shadow: 0 3px 0 var(--ink); }
.auto-timer .t { font-family: var(--display); font-weight: 900; font-size: 18px; }
.auto-timer.hot .n { background: var(--red); color: #fff; animation: pulse .5s ease-in-out infinite alternate; }
@media (max-width: 860px) {
  .home .menu .btn.quick { grid-column: 1 / -1; flex-direction: row; padding: 14px 10px; font-size: 22px; }
}
@media (max-width: 860px) {
  .wardrobe .side .acc-card { order: -1; }
}
@media (max-width: 560px) {
  .grid-cards.items { grid-template-columns: 1fr 1fr; gap: 12px; }
  .item-card .bg { height: 150px; }
  .item-card canvas.wear { width: 140px; height: 140px; }
  .item-card canvas.icon { width: 46px; height: 46px; right: 6px; bottom: 6px; border-radius: 12px; }
  .item-card .rarity { top: 8px; left: 8px; font-size: 10px; }
  .item-card .owned-badge { top: 8px; right: 8px; font-size: 11px; padding: 2px 8px; }
  .item-card .body { padding: 10px 10px 12px; gap: 6px; }
  .item-card .name { font-size: 17px; }
  .item-card .desc { display: none; }
  .item-card .btn { padding: 10px 8px; font-size: 17px; }
}

/* ---------- Вход через бота Telegram ---------- */
.btn.tg-bot-btn { --c: #2AABEE; font-size: 18px; gap: 10px; text-decoration: none; }
.btn.tg-bot-btn .tg-ic, .btn.tg-bot-btn svg { display: inline-grid; flex: none; }
.tg-login { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.tg-login .hint { margin: 0; }
.tg-badge svg { width: 64px; height: 64px; filter: drop-shadow(0 4px 0 var(--ink)); }
.tg-code { font-family: var(--display); font-weight: 900; font-size: 44px; letter-spacing: 10px; padding: 6px 18px 6px 28px; background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); }
.tg-login .btn.tg-bot-btn { width: 100%; }
.tg-status { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 28px; }
.spinner.sm { width: 22px; height: 22px; border-width: 4px; border-color: #e4dcf7; border-top-color: #2AABEE; }
.tg-login .actions { width: 100%; }
