:root {
  --bg: #120b07;
  --ink: #2b1708;
  --cream: #fbefd5;
  --cream-edge: #c9a874;
  --gold: #ffc93c;
  --gold-hi: #ffe07a;
  --gold-edge: #c27f0e;
  --green: #5fd36b;
  --green-edge: #2f8f3c;
  --panel: rgba(32, 18, 10, 0.78);
  --panel-line: rgba(255, 214, 140, 0.28);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--cream);
  font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
svg { fill: currentColor; stroke: currentColor; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(8, 4, 2, 0.65) 100%);
}

/* ---------- загрузка ---------- */
.loading {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 22px; justify-items: center;
  background: radial-gradient(circle at 50% 40%, #3a2111, var(--bg) 70%); z-index: 50; transition: opacity .4s;
}
.loading.done { opacity: 0; pointer-events: none; }
.loader-piece {
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fff6e2 0 40%, #e8d6b2 41% 52%, #f6ead0 53% 100%);
  box-shadow: 0 8px 0 #b89a6a, 0 14px 24px rgba(0, 0, 0, .5);
  animation: hop 0.9s ease-in-out infinite;
}
.loader-bar { width: 160px; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 8%; background: var(--gold); border-radius: 8px; transition: width .2s; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }

/* ---------- кнопки ---------- */
.btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 60px; padding: 0 22px; border-radius: 20px;
  font-size: 21px; font-weight: 900; letter-spacing: .2px; color: var(--ink);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:active { transform: translateY(5px); }
.btn-ico { width: 26px; height: 26px; stroke: none; }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, #f4b21f);
  box-shadow: 0 6px 0 var(--gold-edge), 0 12px 22px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .6);
}
.btn-gold:active { box-shadow: 0 1px 0 var(--gold-edge), 0 4px 10px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .6); }
.btn-cream {
  background: linear-gradient(180deg, #fff8e8, var(--cream));
  box-shadow: 0 6px 0 var(--cream-edge), 0 12px 22px rgba(0, 0, 0, .35), inset 0 2px 0 #fff;
}
.btn-cream:active { box-shadow: 0 1px 0 var(--cream-edge), 0 4px 10px rgba(0, 0, 0, .35), inset 0 2px 0 #fff; }
.btn-green {
  color: #0c2a10;
  background: linear-gradient(180deg, #8ef08f, var(--green));
  box-shadow: 0 6px 0 var(--green-edge), 0 12px 22px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .55);
}
.btn-green:active { box-shadow: 0 1px 0 var(--green-edge), 0 4px 10px rgba(0, 0, 0, .4); }

.round {
  width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, #5a3418, #3d2210);
  box-shadow: 0 4px 0 #1f1007, 0 8px 16px rgba(0, 0, 0, .45), inset 0 1.5px 0 rgba(255, 220, 160, .35);
  color: #ffe6b4; transition: transform .08s, box-shadow .08s, opacity .2s;
}
.round:active { transform: translateY(3px); box-shadow: 0 1px 0 #1f1007, inset 0 1.5px 0 rgba(255, 220, 160, .35); }
.round svg { width: 26px; height: 26px; }
.round b { font-size: 16px; font-weight: 900; letter-spacing: .5px; }
.round:disabled { opacity: .4; pointer-events: none; }
.link { margin-top: 2px; padding: 10px; font-size: 16px; font-weight: 800; color: #ffd98a; text-decoration: underline; text-underline-offset: 4px; }

.disc { display: inline-block; width: 22px; height: 22px; border-radius: 50%; flex: none; }
.disc.w { background: radial-gradient(circle at 50% 40%, #fffaf0 0 38%, #e6d2ad 40% 50%, #f7ecd6 52%); box-shadow: 0 3px 0 #b39a70; }
.disc.b { background: radial-gradient(circle at 50% 40%, #7a2a1e 0 38%, #3b100b 40% 50%, #5e1a12 52%); box-shadow: 0 3px 0 #22070a; }

/* ---------- меню ---------- */
.menu {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(18, 11, 7, .35) 0%, rgba(18, 11, 7, 0) 30%, rgba(18, 11, 7, .25) 55%, rgba(18, 11, 7, .92) 100%);
  animation: fadeIn .4s ease-out;
}
.corner { align-self: stretch; display: flex; justify-content: flex-end; gap: 10px; }
.ico-sound-off { display: none; }
.muted .ico-sound-on { display: none; }
.muted .ico-sound-off { display: block; }

.logo { text-align: center; margin-top: 2vh; }
.logo h1 {
  margin: 0; display: flex; align-items: flex-start; justify-content: center; gap: 8px;
  font-size: clamp(54px, 15vw, 92px); font-weight: 900; line-height: 1; letter-spacing: -1px;
  color: #fff3d6;
  text-shadow: 0 3px 0 #d79b2c, 0 6px 0 #8a4f12, 0 12px 26px rgba(0, 0, 0, .65);
}
.logo h1 em {
  font-style: normal; font-size: .34em; margin-top: .18em; padding: .12em .32em .16em; border-radius: .35em;
  color: var(--ink); text-shadow: none; letter-spacing: 0;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); box-shadow: 0 4px 0 var(--gold-edge);
  transform: rotate(8deg);
}
.logo p { margin: 12px 0 0; font-size: 18px; font-weight: 800; color: #f3cf8f; text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }

.menu-card {
  margin-top: auto; width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; align-items: stretch;
  padding: 18px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(70, 40, 18, .9), rgba(38, 21, 10, .94));
  border: 2px solid var(--panel-line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), inset 0 2px 0 rgba(255, 220, 160, .18);
  animation: rise .45s cubic-bezier(.2, .9, .3, 1.2);
}
.opt { display: flex; flex-direction: column; gap: 8px; }
.opt-label { font-size: 14px; font-weight: 900; color: #e9bf77; text-transform: uppercase; letter-spacing: 1px; padding-left: 4px; }
.chips { display: flex; gap: 8px; }
.chips button {
  flex: 1; min-height: 50px; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 15px; font-weight: 900; color: #f6dcaa;
  background: linear-gradient(180deg, #4b2a13, #34190b);
  box-shadow: 0 4px 0 #1c0d05, inset 0 1.5px 0 rgba(255, 220, 160, .22);
  transition: transform .08s;
}
#sides button { flex-direction: row; gap: 8px; }
.chips button:active { transform: translateY(3px); }
.chips button.on {
  color: var(--ink);
  background: linear-gradient(180deg, #fff6df, #f2dcae);
  box-shadow: 0 4px 0 var(--cream-edge), inset 0 2px 0 #fff;
}
.stars { font-size: 12px; letter-spacing: 1px; color: #ffb52e; }
.chips button.on .stars { color: #d98a00; }

/* ---------- партия ---------- */
.hud {
  position: fixed; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 12px 0;
  pointer-events: none; animation: fadeIn .3s;
}
.hud > * { pointer-events: auto; }
.plates { flex: 1; display: flex; gap: 8px; justify-content: center; min-width: 0; }
.plate {
  flex: 1; max-width: 220px; min-width: 0; display: flex; align-items: center; gap: 9px;
  padding: 7px 12px 7px 9px; border-radius: 16px;
  background: var(--panel); border: 2px solid rgba(255, 214, 140, .14);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4); transition: border-color .25s, box-shadow .25s, transform .25s;
}
.plate .disc { width: 28px; height: 28px; }
.ptext { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.pname { font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcount { font-size: 13px; font-weight: 800; color: #e9bf77; }
.plate.turn {
  border-color: var(--gold); transform: translateY(1px);
  box-shadow: 0 0 0 3px rgba(255, 201, 60, .25), 0 6px 18px rgba(255, 180, 40, .28);
}
.plate.thinking .pcount::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.status {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-bottom)); transform: translateX(-50%); z-index: 5;
  padding: 11px 22px; border-radius: 999px; white-space: nowrap;
  font-size: 17px; font-weight: 900; color: #ffe6b4;
  background: var(--panel); border: 2px solid var(--panel-line); box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
  transition: background .2s, color .2s;
}
.status.alert { background: linear-gradient(180deg, #ff9a4a, #e86a1f); color: #2a0c00; border-color: #ffd3a0; animation: shake .4s; }
.status.good { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--ink); border-color: #fff2c0; }
.view-btn { position: fixed; right: 12px; bottom: calc(12px + var(--safe-bottom)); z-index: 5; width: 46px; height: 46px; }
@keyframes shake { 0%, 100% { transform: translateX(-50%); } 25% { transform: translateX(calc(-50% - 6px)); } 75% { transform: translateX(calc(-50% + 6px)); } }

.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6); z-index: 20; pointer-events: none;
  font-size: clamp(40px, 11vw, 72px); font-weight: 900; color: #fff3d6; white-space: nowrap; opacity: 0;
  text-shadow: 0 3px 0 #d79b2c, 0 6px 0 #8a4f12, 0 12px 26px rgba(0, 0, 0, .7);
}
.toast.show { animation: toast 1.3s cubic-bezier(.2, .9, .3, 1.3) forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  30% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}

/* ---------- окна ---------- */
.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px;
  background: rgba(10, 5, 2, .55); animation: fadeIn .25s;
}
.card {
  width: min(380px, 100%); padding: 26px 20px 20px; border-radius: 28px; text-align: center;
  display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, #5b3418, #2e180b); border: 2px solid var(--panel-line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), inset 0 2px 0 rgba(255, 220, 160, .25);
  animation: pop .45s cubic-bezier(.2, .9, .3, 1.35);
}
.card h2 {
  margin: 0; font-size: 40px; font-weight: 900; color: #fff3d6;
  text-shadow: 0 3px 0 #b8781e, 0 8px 18px rgba(0, 0, 0, .5);
}
.card p { margin: -4px 0 8px; font-size: 17px; font-weight: 700; color: #f0cf96; }
.medal {
  width: 96px; height: 96px; margin: -74px auto 0; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #fff1b0, var(--gold) 55%, #d98a00);
  box-shadow: 0 6px 0 var(--gold-edge), 0 14px 30px rgba(0, 0, 0, .5), inset 0 3px 0 rgba(255, 255, 255, .6);
  font-size: 50px; color: #7a3d00;
}
.medal svg { width: 58px; height: 58px; stroke: none; }
.medal.lose { background: radial-gradient(circle at 50% 35%, #f2e3c8, #b9a07a 60%, #7f684a); box-shadow: 0 6px 0 #5a4a33, 0 14px 30px rgba(0, 0, 0, .5); color: #4a3a26; }
.medal.draw { background: radial-gradient(circle at 50% 35%, #fff, #d9d0c0 60%, #a39784); box-shadow: 0 6px 0 #6d6455, 0 14px 30px rgba(0, 0, 0, .5); color: #4b4236; }
.rules-card { text-align: left; max-height: 86vh; overflow: auto; }
.rules-card h2 { text-align: center; font-size: 32px; }
.rules-card ul { margin: 0; padding: 0 0 0 4px; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rules-card li { position: relative; padding-left: 26px; font-size: 16px; font-weight: 700; line-height: 1.35; color: #f6e2bd; }
.rules-card li::before { content: ""; position: absolute; left: 2px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 2px 0 var(--gold-edge); }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }
@keyframes pop { from { opacity: 0; transform: scale(.7); } }

@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .menu { justify-content: center; }
  .logo { margin-top: auto; }
  .menu-card { margin-top: 28px; margin-bottom: auto; }
  .plate { max-width: 260px; }
}
@media (max-height: 640px) {
  .logo h1 { font-size: 50px; }
  .btn { min-height: 52px; font-size: 19px; }
  .menu-card { gap: 10px; padding: 14px; }
}

/* ================= сеть, профиль, лиги, «Путь», лидеры ================= */
:root {
  --lg-bronze: #d58a4a; --lg-silver: #c9d3de; --lg-gold: #ffc93c; --lg-platinum: #6ee0cf; --lg-diamond: #79b4ff; --lg-master: #c486ff;
  --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
}
.menu {
  padding-top: var(--row-top, calc(10px + var(--safe-top)));
  padding-left: calc(18px + var(--safe-left)); padding-right: calc(18px + var(--safe-right));
}
/* Справа место под капсулу «⋯ | ⌄» Link, если она в этой строке */
.topbar { align-self: stretch; display: flex; align-items: center; gap: 8px; padding-right: var(--cap-right, 0px); min-height: 52px; }
.topbar .profile { flex: 0 1 auto; }
.has-cap #btnSound { display: none; }
.topbar .corner { margin-left: auto; align-self: center; }
.round.sm { width: 42px; height: 42px; border-radius: 14px; }
.round.sm svg { width: 22px; height: 22px; }
.profile {
  display: flex; align-items: center; gap: 9px; min-width: 0; padding: 5px 12px 5px 5px; border-radius: 18px;
  background: var(--panel); border: 2px solid rgba(255, 214, 140, .18); box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(180deg, #ffe08a, #e9a527); color: #5a2c00; font-weight: 900; font-size: 19px;
  box-shadow: 0 0 0 2px #fff3d0, 0 3px 0 2px #b8781e;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pinfo { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 3px; }
.pinfo b { font-size: 15px; font-weight: 900; max-width: 34vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl { display: flex; align-items: center; gap: 6px; }
.lvl em {
  font-style: normal; font-size: 12px; font-weight: 900; color: var(--ink); min-width: 22px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 7px; background: linear-gradient(180deg, #8ef08f, var(--green)); box-shadow: 0 2px 0 var(--green-edge);
}
.xpbar { width: 64px; height: 7px; border-radius: 7px; background: rgba(255, 255, 255, .12); overflow: hidden; display: block; }
.xpbar > i { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, #8ef08f, #d9ff7a); transition: width .6s; }
.league-chip {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 16px; font-size: 16px; font-weight: 900;
  background: var(--panel); border: 2px solid rgba(255, 214, 140, .18); box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
}
.shield {
  width: 26px; height: 30px; display: inline-block; flex: none; background: var(--lg-c, var(--lg-bronze));
  clip-path: path('M13 0 26 5v10c0 8-5.6 13.5-13 15C5.6 28.5 0 23 0 15V5z');
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .2), inset 0 3px 0 rgba(255, 255, 255, .45);
}
.shield.sm { width: 18px; height: 21px; clip-path: path('M9 0 18 3.5v7c0 5.6-3.9 9.4-9 10.5C3.9 19.9 0 16.1 0 10.5v-7z'); }
.lg-bronze { --lg-c: var(--lg-bronze); } .lg-silver { --lg-c: var(--lg-silver); } .lg-gold { --lg-c: var(--lg-gold); }
.lg-platinum { --lg-c: var(--lg-platinum); } .lg-diamond { --lg-c: var(--lg-diamond); } .lg-master { --lg-c: var(--lg-master); }

.logo { margin-top: 1.5vh; }
.btn-big { min-height: 72px; justify-content: flex-start; padding: 0 20px; }
.btn-big .btn-ico { width: 34px; height: 34px; }
.bt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.bt small { font-size: 14px; font-weight: 800; opacity: .72; margin-top: 3px; }
.row2 { display: flex; gap: 10px; }
.row2 .btn { flex: 1; font-size: 18px; padding: 0 10px; }
.row2.links { justify-content: center; gap: 16px; }
.offline { text-align: center; font-size: 14px; font-weight: 800; color: #ffb07a; }
.btn:disabled { filter: grayscale(.7) brightness(.8); pointer-events: none; }

.gate { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; padding: 24px; background: radial-gradient(circle at 50% 40%, #3a2111, var(--bg) 70%); }

/* окна-листы */
.sheet { position: relative; text-align: left; gap: 12px; }
.sheet h2 { text-align: center; font-size: 32px; }
.sheet.tall { width: min(460px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
.close {
  position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border-radius: 12px; font-size: 18px; font-weight: 900;
  background: rgba(0, 0, 0, .25); color: #f6dcaa;
}
.sub { text-align: center; margin: -6px 0 2px !important; font-size: 15px !important; color: #e9bf77 !important; }
.h-sm { font-size: 28px !important; }

.path-grid { overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 2px 2px 6px; margin: 0 -4px; }
.chapter { border-radius: 20px; padding: 10px 10px 12px; background: rgba(0, 0, 0, .2); }
.chapter h3 { margin: 0 0 8px 4px; font-size: 15px; font-weight: 900; color: #ffd98a; text-transform: uppercase; letter-spacing: 1px; display: flex; justify-content: space-between; }
.chapter h3 span { color: #e9bf77; letter-spacing: 0; }
.lv-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lv {
  aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: var(--ink);
  background: radial-gradient(circle at 50% 38%, #fffaf0 0 42%, #e6d2ad 44% 54%, #f7ecd6 56%); box-shadow: 0 5px 0 #a8895a, 0 8px 12px rgba(0, 0, 0, .35);
  transition: transform .08s;
}
.lv:active { transform: translateY(3px); }
.lv .s { font-size: 9px; letter-spacing: -1px; color: #d98a00; height: 10px; line-height: 10px; }
.lv .s .off { color: rgba(90, 60, 20, .25); }
.lv.next { background: radial-gradient(circle at 50% 38%, #fff1b0 0 42%, #ffc93c 44% 54%, #ffd968 56%); box-shadow: 0 5px 0 var(--gold-edge), 0 0 0 4px rgba(255, 201, 60, .35), 0 8px 16px rgba(0, 0, 0, .4); animation: bob 1.4s ease-in-out infinite; }
.lv.locked { background: radial-gradient(circle at 50% 38%, #5b3a22 0 42%, #3e2414 44% 54%, #4a2c18 56%); box-shadow: 0 5px 0 #1c0d05; color: rgba(255, 220, 160, .35); pointer-events: none; }
.lv.locked::after { content: "🔒"; font-size: 12px; opacity: .6; }
.lv.locked .s { display: none; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: rgba(0, 0, 0, .25); }
.tabs button { flex: 1; min-height: 40px; border-radius: 12px; font-size: 16px; font-weight: 900; color: #f6dcaa; }
.tabs button.on { background: linear-gradient(180deg, #fff6df, #f2dcae); color: var(--ink); box-shadow: 0 3px 0 var(--cream-edge); }
.leagues { display: flex; justify-content: space-between; gap: 4px; padding: 0 4px; }
.leagues .lgi { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 800; color: #e9bf77; flex: 1; opacity: .55; }
.leagues .lgi.me { opacity: 1; color: #fff3d6; }
.leagues .lgi.me .shield { transform: scale(1.15); }
.top-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px; background: rgba(0, 0, 0, .18); }
.trow.me { background: rgba(255, 201, 60, .16); box-shadow: inset 0 0 0 2px rgba(255, 201, 60, .5); }
.trow .pl { width: 30px; text-align: center; font-size: 16px; font-weight: 900; color: #e9bf77; flex: none; }
.trow .pl.p1, .trow .pl.p2, .trow .pl.p3 { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.trow .pl.p1 { background: linear-gradient(180deg, #fff1b0, #ffc93c); box-shadow: 0 3px 0 var(--gold-edge); }
.trow .pl.p2 { background: linear-gradient(180deg, #fff, #c9d3de); box-shadow: 0 3px 0 #7d8794; }
.trow .pl.p3 { background: linear-gradient(180deg, #ffd4a8, #d58a4a); box-shadow: 0 3px 0 #8a4f1d; }
.trow .avatar { width: 34px; height: 34px; font-size: 15px; box-shadow: none; }
.trow .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.trow .nm b { font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .nm small { font-size: 12px; font-weight: 800; color: #e9bf77; }
.trow .sc { display: flex; align-items: center; gap: 5px; font-size: 16px; font-weight: 900; }
.top-me:empty { display: none; }
.top-empty { text-align: center; padding: 24px 8px; font-weight: 800; color: #e9bf77; }

.search-ring { width: 110px; height: 110px; margin: 0 auto; position: relative; border-radius: 50%; border: 4px dashed rgba(255, 214, 140, .35); animation: spin 3s linear infinite; }
.search-ring .disc { position: absolute; width: 36px; height: 36px; }
.search-ring .disc.w { top: -18px; left: 33px; }
.search-ring .disc.b { bottom: -18px; left: 33px; }
@keyframes spin { to { transform: rotate(360deg); } }

.or { text-align: center; font-size: 14px; font-weight: 800; color: #e9bf77; margin: 6px 0; }
.code-row { display: flex; gap: 8px; }
.code-row input {
  flex: 1; min-width: 0; height: 60px; border-radius: 18px; border: 2px solid var(--panel-line); background: rgba(0, 0, 0, .3);
  color: #fff3d6; font: 900 26px var(--font); text-align: center; letter-spacing: 6px; text-transform: uppercase; outline: none;
}
.code-row input:focus { border-color: var(--gold); }
.code-row .btn { width: auto; flex: none; }
.room-code { text-align: center; font-size: 46px; font-weight: 900; letter-spacing: 8px; color: #fff3d6; text-shadow: 0 3px 0 #b8781e; user-select: text; -webkit-user-select: text; }
#roomWait p { text-align: center; margin: 0; }

.pav { position: relative; flex: none; }
.pav .avatar { width: 30px; height: 30px; font-size: 13px; box-shadow: 0 0 0 2px #fff3d0; }
.pav .disc { position: absolute; right: -4px; bottom: -3px; width: 15px; height: 15px; box-shadow: 0 0 0 2px #2a170b; }
.pav .disc:only-child { position: static; width: 28px; height: 28px; box-shadow: 0 3px 0 #b39a70; }
.pav .disc.b:only-child { box-shadow: 0 3px 0 #22070a; }
.plate { position: relative; }
.pcount { white-space: nowrap; }
/* Срок хода — значок над углом плашки, имя не сжимает */
.ptimer {
  position: absolute; top: -9px; right: -5px; min-width: 30px; padding: 2px 7px; border-radius: 10px; text-align: center;
  font-size: 13px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff1b0, #ffc93c); box-shadow: 0 2px 0 var(--gold-edge), 0 3px 8px rgba(0, 0, 0, .4);
}
.ptimer:empty { display: none; }
.ptimer.low { color: #fff; background: linear-gradient(180deg, #ff9a6a, #e0512a); box-shadow: 0 2px 0 #8a2a10, 0 3px 8px rgba(0, 0, 0, .4); animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }


.res-stars { display: flex; justify-content: center; gap: 6px; margin: -4px 0 2px; }
.res-stars i { font-style: normal; font-size: 44px; color: rgba(0, 0, 0, .3); text-shadow: none; transform: scale(.4); opacity: 0; animation: starIn .45s cubic-bezier(.2, .9, .3, 1.5) forwards; }
.res-stars i.on { color: #ffc93c; text-shadow: 0 3px 0 #c27f0e, 0 0 18px rgba(255, 201, 60, .6); }
.res-stars i:nth-child(2) { animation-delay: .18s; } .res-stars i:nth-child(3) { animation-delay: .36s; }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
.rewards { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 16px; background: rgba(0, 0, 0, .22); text-align: left; }
.rw { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 900; }
.rw .xpbar { flex: 1; height: 10px; }
.rw .plus { color: #8ef08f; }
.rw .minus { color: #ff8a5a; }
.rw .lvbadge { font-size: 13px; font-weight: 900; color: var(--ink); padding: 3px 7px; border-radius: 8px; background: linear-gradient(180deg, #8ef08f, var(--green)); box-shadow: 0 2px 0 var(--green-edge); }

/* ================= табло, док, настройки (второй вариант панелей) ================= */
.hud { display: block; padding: var(--hud-top, calc(10px + var(--safe-top))) calc(10px + var(--safe-right)) 0 calc(10px + var(--safe-left)); }
.scoreboard {
  position: relative; margin: 0 auto; max-width: 560px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px;
  padding: 9px 10px 10px; border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, .1), rgba(0, 0, 0, 0) 40%),
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .05) 0 3px, rgba(255, 255, 255, .02) 3px 7px),
    linear-gradient(180deg, #6a3c1b, #3b200e);
  border: 2px solid rgba(255, 214, 140, .32);
  box-shadow: 0 5px 0 #1f1007, 0 14px 30px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 228, 175, .28), inset 0 -3px 0 rgba(0, 0, 0, .25);
}
.side {
  position: relative; min-width: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; row-gap: 6px; align-items: center;
  padding: 4px 6px 4px 4px; border-radius: 18px; transition: background .3s;
}
.side.right { grid-template-columns: 1fr auto; padding: 4px 4px 4px 6px; }
.side.right .pav { grid-column: 2; grid-row: 1; }
.side.right .ptext { grid-column: 1; grid-row: 1; text-align: right; align-items: flex-end; }
.side .pips { grid-column: 1 / -1; }
.side.right .pips { justify-content: flex-end; }
.side.turn { background: rgba(255, 201, 60, .13); }
.side .ptext { display: flex; flex-direction: column; min-width: 0; line-height: 1.12; }
.side .pname { font-size: 15px; font-weight: 900; color: #fff3d6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.side .pmeta { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: #e9bf77; white-space: nowrap; }
.side .pmeta .shield.sm { width: 12px; height: 14px; clip-path: path('M6 0 12 2.3v4.7c0 3.7-2.6 6.3-6 7C2.6 13.3 0 10.7 0 7V2.3z'); }

.side .pav { position: relative; width: 46px; height: 46px; display: grid; place-items: center; flex: none; }
.side .pav-in { position: relative; display: grid; place-items: center; }
.side .pav-in .avatar { width: 36px; height: 36px; font-size: 16px; box-shadow: 0 0 0 2px #fff3d0; }
.side .pav-in .disc { width: 34px; height: 34px; box-shadow: 0 3px 0 #b39a70; }
.side .pav-in .disc.b { box-shadow: 0 3px 0 #22070a; }
.side .pav-in .avatar + .disc { position: absolute; right: -6px; bottom: -5px; width: 16px; height: 16px; box-shadow: 0 0 0 2px #2a170b; }
.ring { position: absolute; inset: 0; width: 46px; height: 46px; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 3.5; }
.ring .ring-bg { stroke: rgba(0, 0, 0, .35); }
.ring .ring-fg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 138.2; stroke-dashoffset: calc(138.2 * (1 - var(--p, 1))); opacity: 0; transition: opacity .25s, stroke .3s; filter: drop-shadow(0 0 4px rgba(255, 201, 60, .8)); }
.side.turn .ring-fg { opacity: 1; }
.side.turn.thinking .ring-fg { animation: ringPulse 1s ease-in-out infinite; }
.side.low .ring-fg { stroke: #ff7a45; filter: drop-shadow(0 0 5px rgba(255, 110, 60, .9)); }
@keyframes ringPulse { 50% { opacity: .35; } }
.side .ptimer {
  position: absolute; top: 34px; left: 13px; right: auto; min-width: 26px; padding: 1px 5px; font-size: 11px; border-radius: 8px; z-index: 1;
}
.side.right .ptimer { left: auto; right: 13px; }

.pips { display: flex; flex-wrap: nowrap; gap: 2px; min-width: 0; overflow: hidden; }
.pip { width: 9px; height: 9px; border-radius: 50%; flex: none; transition: opacity .3s, transform .3s; }
.pip.w { background: radial-gradient(circle at 50% 40%, #fffaf0 0 45%, #d9c39a 50%); box-shadow: 0 1.5px 0 #9e8862; }
.pip.b { background: radial-gradient(circle at 50% 40%, #8a3426 0 45%, #45120c 50%); box-shadow: 0 1.5px 0 #1e0606; }
.pip.k { box-shadow: 0 0 0 1.5px var(--gold), 0 1.5px 0 var(--gold-edge); }
.pip.off { opacity: .2; transform: scale(.75); box-shadow: none; }

.vs { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 44px; }
.vs b {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 900; letter-spacing: .5px; color: #6a3500;
  background: radial-gradient(circle at 50% 35%, #fff1b0, var(--gold) 58%, #d98a00);
  box-shadow: 0 3px 0 var(--gold-edge), 0 6px 12px rgba(0, 0, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .6);
}
.vs small { max-width: 76px; text-align: center; font-size: 10px; font-weight: 900; line-height: 1.1; color: #f0cf96; text-transform: uppercase; letter-spacing: .4px; }
.vs small:empty { display: none; }

/* Док снизу: меню, статус, отмена, вид */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  max-width: 580px; margin: 0 auto; padding: 0 calc(10px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(10px + var(--safe-left)); pointer-events: none; animation: fadeIn .3s;
}
.dock > * { pointer-events: auto; }
.dock .round { width: 52px; height: 52px; }
.dock .status {
  position: static; transform: none; left: auto; bottom: auto; flex: 1; min-width: 0; height: 52px;
  display: flex; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border-radius: 18px;
  overflow: hidden; text-overflow: ellipsis;
}
.dock .status #statusText { overflow: hidden; text-overflow: ellipsis; }
.dock .status.alert { animation: shake2 .4s; }
.sdot { width: 16px; height: 16px; border-radius: 50%; flex: none; display: none; }
.sdot.w { display: block; background: radial-gradient(circle at 50% 40%, #fffaf0 0 45%, #d9c39a 50%); box-shadow: 0 2px 0 #9e8862; }
.sdot.b { display: block; background: radial-gradient(circle at 50% 40%, #8a3426 0 45%, #45120c 50%); box-shadow: 0 2px 0 #1e0606; }
.status.good .sdot, .status.alert .sdot { display: none; }
@keyframes shake2 { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Настройки */
.settings { gap: 10px; }
.set-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 9px; border-radius: 18px;
  background: rgba(0, 0, 0, .2); box-shadow: inset 0 1px 0 rgba(255, 220, 160, .08);
}
.set-ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #ffe6b4;
  background: linear-gradient(180deg, #5a3418, #3d2210); box-shadow: 0 3px 0 #1f1007, inset 0 1.5px 0 rgba(255, 220, 160, .3);
}
.set-ico svg { width: 22px; height: 22px; }
.set-name { flex: 1; font-size: 18px; font-weight: 900; color: #fff3d6; }
.switch {
  position: relative; width: 62px; height: 36px; border-radius: 36px; flex: none;
  background: #2a170b; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 220, 160, .15); transition: background .2s;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fffaf0 0 40%, #e6d2ad 44% 54%, #f7ecd6 58%); box-shadow: 0 3px 0 #9e8862, 0 4px 8px rgba(0, 0, 0, .4);
  transition: transform .22s cubic-bezier(.3, 1.4, .5, 1);
}
.switch[aria-checked="true"] { background: linear-gradient(180deg, #8ef08f, var(--green)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), 0 3px 0 var(--green-edge); }
.switch[aria-checked="true"] i { transform: translateX(26px); }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 14px; background: #2a170b; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .5); }
.seg button { min-width: 44px; height: 32px; border-radius: 11px; font-size: 14px; font-weight: 900; color: #e9bf77; }
.seg button.on { color: var(--ink); background: linear-gradient(180deg, #fff6df, #f2dcae); box-shadow: 0 3px 0 var(--cream-edge); }
.set-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.set-actions .row2 .btn { font-size: 18px; }

@media (max-width: 380px) {
  .side .pname { font-size: 14px; }
  .pip { width: 7px; height: 7px; }
  .vs { min-width: 36px; }
  .vs b { width: 32px; height: 32px; font-size: 11px; }
}
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .pip { width: 11px; height: 11px; }
}
/* Таймер хода — в медальоне */
.side .ptimer { display: none; }
.vs b { position: relative; transition: background .3s; }
.vs b.timer { font-size: 17px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.vs b.low { color: #fff; background: radial-gradient(circle at 50% 35%, #ffb08a, #ff6a3a 58%, #c23d12); box-shadow: 0 3px 0 #7a2208, 0 6px 12px rgba(0, 0, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .5); animation: beat 1s ease-in-out infinite; }
.vs b.to-l::before, .vs b.to-r::before {
  content: ""; position: absolute; top: 50%; width: 0; height: 0; margin-top: -5px; border: 5px solid transparent;
}
.vs b.to-l::before { left: -9px; border-right-color: var(--gold); }
.vs b.to-r::before { right: -9px; border-left-color: var(--gold); }
@keyframes beat { 50% { transform: scale(1.1); } }

/* Окна не заходят под капсулу Link и под нижнюю полосу */
.modal { padding: var(--modal-top, 20px) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left)); }
.sheet.tall, .rules-card { max-height: calc(100vh - var(--modal-top, 20px) - 20px - var(--safe-bottom)); max-height: calc(100dvh - var(--modal-top, 20px) - 20px - var(--safe-bottom)); }
.gate { padding-top: var(--modal-top, 24px); }
/* Узкая строка рядом с капсулой Link: имя сжимается внутри плашки профиля */
.topbar .profile { min-width: 0; overflow: hidden; }
.topbar .pinfo { min-width: 0; overflow: hidden; }
.topbar .pinfo b { max-width: 100%; }
.topbar .league-chip { flex: none; }
@media (max-width: 440px) {
  .scoreboard { padding: 8px 7px 9px; gap: 3px; }
  .side { column-gap: 6px; }
  .side .pname { font-size: 14px; }
  .side .pav, .ring { width: 42px; height: 42px; }
  .side .pav-in .avatar { width: 33px; height: 33px; font-size: 15px; }
  .side .pav-in .disc { width: 31px; height: 31px; }
  .vs { min-width: 38px; }
  .vs b { width: 34px; height: 34px; }
  .vs small { max-width: 62px; font-size: 9px; }
  .pip { width: 8px; height: 8px; }
}
/* Капсула Link в строке профиля: лига и рейтинг видны на кнопке «Рейтинговая игра» */
.cap-share .topbar .league-chip { display: none; }

/* Вместо встроенных style="…" (политика безопасности страницы на стенде их запрещает) */
.star-ic { color: #ffc93c; }
.rw .push { margin-left: auto; }
.load-err { max-width: 300px; text-align: center; font-weight: 800; color: #ffd98a; }
