:root {
  --bg: #111111;
  --panel: rgba(30, 35, 45, 0.6);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(30, 35, 45, 0.55);
  --line: rgba(255, 255, 255, 0.15);
  --text: #f4f1ea;
  --muted: #c4bfb6;
  --gold: #f2b90f;
  --gold-2: #ffcc33;
  --ice: #e8eef7;
  --blur: blur(12px);
  --radius: 16px;
  --radius-pill: 24px;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #FFD700 #2c2c2c;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: #0f0f10;
  color: var(--text);
  font-family: "Noto Sans Georgian", "Outfit", sans-serif;
  overflow: hidden;
}
body.lite-motion .checker-ghost,
body.lite-motion .dice-tray,
body.lite-motion .die,
body.lite-motion .die-cube {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #2c2c2c;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: #FFD700;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
}
::-webkit-scrollbar-thumb:hover {
  background: #FFE44D;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
}
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
#screen-lobby,
#screen-tournament {
  background: #2a1c14;
}
#screen-lobby > *:not(.wood-bg),
#screen-tournament > *:not(.wood-bg),
#screen-login > *:not(.wood-bg) { position: relative; z-index: 1; }
.wood-bg {
  position: absolute;
  inset: 0;
  background: url("/assets/board1.png") center / cover no-repeat;
  filter: saturate(1) brightness(1.05);
  pointer-events: none;
  z-index: 0;
}
.wood-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
#screen-login { background: #2a1c14; }
#screen-game { background: #0d1117; }
#screen-lobby {
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(18px, calc(env(safe-area-inset-left, 0px) + 12px));
}

#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0b0b0d;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 20px;
}
@media (orientation: portrait) and (max-width: 900px) {
  #rotate-hint { display: flex; }
}

.screen {
  position: absolute;
  inset: 0;
  padding: 16px 20px 18px;
  display: flex;
  flex-direction: column;
}

.login-card {
  margin: auto;
  width: min(420px, 92vw);
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.eyebrow { color: var(--gold); letter-spacing: .16em; text-transform: uppercase; font-size: 12px; margin: 0 0 8px; }
.login-card h1 { margin: 0 0 8px; font-size: 32px; }
.sub { color: var(--muted); margin: 0 0 18px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
}
.form-error { color: #ff8b8b; font-size: 13px; }

.btn {
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  color: #1a1408;
  transform: translate3d(0, 0, 0);
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:hover { transform: translate3d(0, -1px, 0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: translate3d(0, 0, 0); }
.btn.gold {
  background: linear-gradient(180deg, rgba(255, 212, 70, .95), rgba(242, 185, 15, .9));
  color: #111;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 28px rgba(245, 196, 0, .22);
  font-weight: 800;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.btn.wide { width: 100%; margin-top: 8px; }
.btn.huge {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: clamp(14px, 2.2vw, 26px) clamp(12px, 1.8vw, 18px) clamp(12px, 1.6vw, 18px);
  font-size: clamp(18px, 2.2vw + 8px, 30px);
  letter-spacing: .02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.btn.huge small,
#quick-sub,
#tourney-join-sub,
#tourney-play-sub {
  display: block;
  margin-top: 2px;
  font-size: clamp(11px, 0.7vw + 9px, 14px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
}
.btn.tourney-entry {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 16px);
  padding: clamp(12px, 1.8vw, 18px) clamp(12px, 2vw, 22px);
  border-radius: 24px;
  color: #fff8e8;
  background:
    linear-gradient(180deg, rgba(48, 42, 34, 0.96), rgba(18, 16, 14, 0.98)) padding-box,
    linear-gradient(135deg, #ffe27a 0%, #f2b90f 42%, #9a6f00 100%) border-box;
  border: 1.5px solid transparent;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, .28),
    0 0 0 1px rgba(242, 185, 15, .16),
    inset 0 1px 0 rgba(255, 232, 160, .12);
  font-weight: 800;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.btn.tourney-entry:hover {
  filter: brightness(1.06);
  box-shadow:
    0 14px 34px rgba(245, 196, 0, .28),
    0 0 22px rgba(242, 185, 15, .28),
    inset 0 1px 0 rgba(255, 240, 180, .18);
}
.tourney-entry-icon {
  width: clamp(40px, 5.6vw, 52px);
  height: clamp(40px, 5.6vw, 52px);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(242, 185, 15, 0.14);
  border: 1px solid rgba(255, 211, 77, 0.32);
  box-shadow: 0 0 16px rgba(242, 185, 15, 0.22);
}
.tourney-entry-icon svg {
  width: 34px;
  height: 38px;
  filter: drop-shadow(0 2px 6px rgba(242, 185, 15, .45));
}
.tourney-entry-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.08;
  min-width: 0;
}
.tourney-entry-label {
  font-size: clamp(18px, 2vw + 8px, 28px);
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff8e8;
  white-space: nowrap;
}
.tourney-entry-copy small,
#tourney-entry-sub {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #e4dfd6;
}
.btn.friends-entry {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 24px;
  color: #fff8e8;
  background: linear-gradient(180deg, rgba(52, 44, 32, 0.78), rgba(16, 14, 12, 0.9));
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, .26),
    0 0 14px rgba(212, 175, 55, .12),
    inset 0 1px 0 rgba(255, 232, 160, .1);
  font-weight: 800;
  font-size: clamp(15px, 1.3vw + 10px, 20px);
  letter-spacing: .02em;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition:
    transform .22s ease,
    filter .22s ease,
    border-color .22s ease,
    box-shadow .22s ease,
    background .22s ease;
}
.btn.friends-entry:hover {
  transform: translate3d(0, -2px, 0);
  filter: brightness(1.08);
  border-color: rgba(232, 196, 80, 0.72);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, .3),
    0 0 22px rgba(212, 175, 55, .34),
    inset 0 1px 0 rgba(255, 240, 180, .2);
}
.btn.friends-entry:active {
  transform: translate3d(0, 0, 0);
  filter: brightness(1.02);
}
.friends-entry-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #f2c230;
  background: rgba(242, 185, 15, 0.14);
  border: 1px solid rgba(255, 211, 77, 0.32);
  box-shadow: 0 0 14px rgba(242, 185, 15, 0.2);
}
.friends-entry-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}
.friends-entry-label {
  font-weight: 800;
  color: #fff8e8;
  line-height: 1;
  white-space: nowrap;
}
.tourney-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 8px 10px 20px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.tourney-card {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(30, 35, 45, 0.55);
  color: inherit;
  border-radius: 20px;
  padding: 12px;
  cursor: pointer;
  font: inherit;
  backdrop-filter: var(--blur);
}
.tourney-card img {
  width: 100%;
  height: 92px;
  object-fit: contain;
  background: rgba(0,0,0,.25);
  border-radius: 14px;
  margin-bottom: 8px;
}
.tourney-card strong { display: block; }
.tourney-card small { color: var(--muted); }
.tourney-detail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 12px 16px;
  overflow: hidden;
}
.tourney-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  flex-shrink: 0;
}
.tourney-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.tourney-tab.on {
  background: linear-gradient(180deg, rgba(255, 212, 70, .95), rgba(242, 185, 15, .9));
  color: #111;
  box-shadow: 0 6px 16px rgba(245, 196, 0, .22);
}
.tourney-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.tourney-head {
  min-width: 0;
  flex: 1;
}
.tourney-head strong { font-size: 16px; }
.tourney-head small { display: block; }
#tourney-head-status { color: var(--gold); font-weight: 700; letter-spacing: .04em; }
#tourney-head-timer { color: #c4bfb6; }
#screen-tournament {
  padding:
    max(10px, env(safe-area-inset-top, 0px))
    max(14px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px))
    max(18px, calc(env(safe-area-inset-left, 0px) + 12px));
}
.tourney-overview {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 8px 4px 8px;
}
.tourney-overview-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
}
.tourney-cluster {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}
.tourney-overview .queue-note {
  margin-top: 4px;
}
.tourney-leaders-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tourney-prizes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  flex: 0 0 auto;
  margin: 0;
}
.tourney-prize {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(30, 35, 45, 0.55);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px 18px;
  text-align: left;
}
.tourney-prize img { width: 72px; height: 72px; object-fit: contain; flex-shrink: 0; }
.tourney-prize b { display: block; margin: 0; font-size: 16px; }
.tourney-prize small { color: var(--muted); display: block; margin-top: 4px; }
.tourney-prize .tourney-gift { color: #f0d48a; }
.tourney-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}
.tourney-stat {
  background: rgba(30, 35, 45, 0.55);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 10px;
  text-align: center;
}
.tourney-stat b { display: block; font-size: 28px; color: #f6e2b4; }
.tourney-stat span { color: var(--muted); font-size: 12px; }
.tourney-actions {
  display: grid;
  gap: 10px;
  margin: 0;
  justify-items: stretch;
}
.tourney-play {
  flex-direction: column;
  align-items: center;
  justify-self: center;
  width: 100%;
  max-width: 100%;
  padding: 9px 16px 9px 12px;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.tourney-play-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.tourney-play #tourney-play-sub {
  display: block;
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: #111;
  opacity: 0.72;
}
.tourney-play.searching {
  filter: brightness(0.94);
}
.tourney-rank-wrap {
  background: rgba(30, 35, 45, 0.55);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 8px 10px 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.tourney-rank {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.tourney-rank th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.tourney-rank td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: middle;
}
.tourney-rank tbody tr { cursor: pointer; }
.tourney-rank tbody tr:hover { background: rgba(255,255,255,.04); }
.tourney-rank .who {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tourney-rank .who strong { display: block; }
.tourney-empty { color: var(--muted); text-align: center; padding: 40px 12px; }
@media (max-width: 700px) {
  .tourney-prizes { grid-template-columns: 1fr; }
}
@media (max-width: 900px) and (orientation: landscape) {
  #screen-tournament {
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-right: max(12px, calc(env(safe-area-inset-right, 0px) + 8px));
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    padding-left: max(12px, calc(env(safe-area-inset-left, 0px) + 10px));
  }
  #screen-tournament .lobby-top {
    gap: 10px;
    min-width: 0;
    align-items: center;
  }
  #btn-tourney-back {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    flex: none;
    align-self: center;
    color: #fff;
  }
  #btn-tourney-back svg {
    width: 18px;
    height: 18px;
    display: block;
  }
  #screen-tournament .player-chip {
    min-width: 0;
    max-width: min(220px, 34vw);
    padding: 4px 10px 4px 4px;
  }
  .tourney-detail {
    padding: 2px 4px 4px;
    overflow: hidden;
  }
  .tourney-tabs {
    margin: 0 0 6px;
    padding: 3px;
  }
  .tourney-tab {
    padding: 7px 10px;
    font-size: 13px;
  }
  .tourney-overview {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: clamp(4px, 3.5vh, 16px) 8px 0 0;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: 0;
    overflow: hidden;
  }
  .tourney-overview-main {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0;
    min-height: 0;
  }
  .tourney-cluster {
    width: min(320px, 36vw);
    max-width: calc(46vw - 40px);
    margin-left: clamp(8px, 4vw, 24px);
    gap: 10px;
  }
  .tourney-stats {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .tourney-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    text-align: left;
    border-radius: 14px;
  }
  .tourney-stat b {
    font-size: 20px;
    order: 2;
  }
  .tourney-stat span {
    font-size: 12px;
    font-weight: 700;
    order: 1;
  }
  .tourney-actions {
    flex: none;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    justify-items: stretch;
  }
  #screen-tournament .tourney-actions .btn.huge {
    padding: 10px 16px 9px;
    font-size: clamp(14px, 3.6vh, 18px);
    max-width: none;
  }
  #screen-tournament .tourney-play {
    width: 100%;
    max-width: 100%;
    padding: 8px 14px 8px 10px;
    font-size: clamp(12px, 3.2vh, 14px);
  }
  .tourney-prize {
    padding: 10px 14px;
    gap: 12px;
  }
  .tourney-prize img { width: 52px; height: 52px; }
}
.btn.gold.searching { background: rgba(201, 160, 0, .85); }
.btn.metal {
  flex: 1;
  background: rgba(30, 35, 45, 0.55);
  color: #f3f1ec;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.btn.metal.iconed {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 600;
  white-space: nowrap;
  font-size: clamp(13px, 1.1vw + 8px, 16px);
}
.btn.metal.iconed svg { width: 18px; height: 18px; opacity: .85; }
.btn.ice {
  background: rgba(255, 255, 255, 0.12);
  color: #f6f3ec;
  border: 1px solid var(--line);
  min-width: 220px;
  font-weight: 700;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.lobby-top, .game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#screen-lobby .lobby-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
  align-items: center;
  justify-content: stretch;
}
#screen-lobby .lobby-top .me-chip {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  justify-self: start;
  margin: 0 8px;
}
#screen-lobby .lobby-top .me-chip .chip-text {
  flex: 0 1 auto;
}
#screen-lobby .lobby-top .me-chip .chip-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 16px 8px 8px;
  min-width: 180px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: visible;
}
.player-chip.me-chip {
  padding-right: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f4f1ea;
  box-shadow: 0 8px 22px rgba(0,0,0,.2);
}
.me-chip .chip-text strong { color: #f6f3ec; }
.me-chip .avatar { background: rgba(255,255,255,.12); color: #eee; }
.chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.chip-text strong { font-size: 15px; line-height: 1.15; white-space: nowrap; }
.player-chip.you { box-shadow: 0 0 0 1px rgba(215,177,90,.35); }
.player-chip.active { box-shadow: 0 0 0 2px var(--gold); }
.player-chip.clickable { cursor: pointer; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: #222;
  position: relative;
  overflow: visible;
  flex: none;
}
.avatar-face { line-height: 1; }
.week-medal {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 0;
}
.week-medal svg {
  width: 10px;
  height: 10px;
  display: block;
}
.week-medal.p1 {
  background: linear-gradient(180deg, #ffe7a3, #d4a017);
  color: #5c3f00;
}
.week-medal.p2 {
  background: linear-gradient(180deg, #f4f4f4, #9a9a9a);
  color: #333;
}
.week-medal.p3 {
  background: linear-gradient(180deg, #f0c090, #b56a32);
  color: #4a2808;
}
.week-medal:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}
.chip-points, .player-chip .points {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #e8c56a;
  font-size: 12px;
  line-height: 1.2;
  position: static;
  inset: auto;
}
.chip-points i, .player-chip .points i {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe7a3, #c9a227);
  display: inline-block;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.icon-btn.glass-round.lobby-mute {
  width: 36px;
  height: 36px;
  flex: none;
  color: #eee;
}
.icon-btn.glass-round.lobby-mute svg { width: 18px; height: 18px; }
.icon-btn.glass-round.lobby-shop {
  color: var(--gold);
  box-shadow: 0 0 12px rgba(242, 185, 15, 0.28);
}
#btn-lobby-back {
  display: grid;
  place-items: center;
  color: #fff;
}
#btn-lobby-back svg {
  display: block;
}

.lobby-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-rows: minmax(0, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 22px;
  min-height: 0;
  min-width: 0;
  margin: 8px 0 16px;
  align-items: stretch;
}
.lobby-left {
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  align-items: stretch;
  gap: 12px;
  padding: 0 8px;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
#screen-lobby .lobby-left .btn.huge,
#screen-lobby .lobby-left .btn.tourney-entry,
#screen-lobby .lobby-left .btn.friends-entry {
  min-height: clamp(68px, 11.5vh, 92px);
  box-sizing: border-box;
}
#screen-lobby .lobby-left .btn.tourney-entry {
  padding: clamp(14px, 2.2vw, 26px) clamp(12px, 1.8vw, 18px) clamp(12px, 1.6vw, 18px);
}
#screen-lobby .lobby-left .btn.friends-entry {
  padding: clamp(14px, 2.2vw, 26px) clamp(12px, 1.8vw, 18px) clamp(12px, 1.6vw, 18px);
  font-size: clamp(18px, 2.2vw + 8px, 30px);
}
#screen-lobby .lobby-left .tourney-entry-label {
  font-size: clamp(18px, 2.2vw + 8px, 30px);
}
#screen-lobby .lobby-left .tourney-entry-copy small,
#screen-lobby .lobby-left #tourney-entry-sub {
  margin-top: 2px;
  font-size: clamp(11px, 0.7vw + 9px, 14px);
}
#screen-lobby .lobby-left .friends-entry-icon {
  width: clamp(40px, 5.6vw, 52px);
  height: clamp(40px, 5.6vw, 52px);
}
.lobby-left > * {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.bonus-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px 10px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  overflow: hidden;
  z-index: 1;
}
.bonus-icon {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(242, 185, 15, 0.14);
  border: 1px solid rgba(255, 211, 77, 0.28);
}
.bonus-icon svg { width: 30px; height: 30px; }
.bonus-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bonus-copy strong {
  font-size: clamp(13px, 1.1vw + 8px, 15px);
  line-height: 1.2;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.bonus-copy small {
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 600;
}
.bonus-claim {
  flex: 0 1 auto;
  min-width: 92px;
  max-width: 100%;
  margin-left: auto;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.bonus-claim:disabled {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  color: #d8d2c8;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
  transform: translate3d(0, 0, 0);
}
.bonus-claim:disabled:hover { transform: translate3d(0, 0, 0); }
.bonus-card.is-ready .bonus-claim {
  animation: bonus-glow 1.8s ease-in-out infinite;
}
.bonus-card.is-ready .bonus-icon {
  box-shadow: 0 0 16px rgba(242, 185, 15, 0.35);
}
@keyframes bonus-glow {
  0%, 100% { box-shadow: 0 8px 20px rgba(245, 196, 0, .28); }
  50% { box-shadow: 0 0 22px rgba(255, 220, 90, .7), 0 8px 22px rgba(245, 196, 0, .35); }
}
@media (prefers-reduced-motion: reduce) {
  .bonus-card.is-ready .bonus-claim { animation: none; }
}
.pair {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}
.pair .btn {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
}
.queue-note { text-align: center; color: var(--gold-2); margin: 0; }

@media (max-width: 980px) {
  #screen-lobby {
    padding:
      12px
      14px
      12px
      max(18px, calc(env(safe-area-inset-left, 0px) + 12px));
  }
  .lobby-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
    margin: 6px 0 12px;
  }
  #screen-lobby .lobby-top {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr);
    gap: 12px;
  }
  #screen-lobby .lobby-top .me-chip { margin: 0 4px; }
  .lobby-left { padding: 0 4px; gap: 10px; }
  .bonus-claim {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
    min-width: 0;
  }
  .bonus-copy { flex: 1 1 120px; }
}

@media (max-width: 900px) {
  #screen-lobby {
    padding:
      8px
      10px
      10px
      max(20px, calc(env(safe-area-inset-left, 0px) + 12px));
  }
  .lobby-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 10px;
    margin: 4px 0 8px;
  }
  #screen-lobby .lobby-top {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 10px;
  }
  #screen-lobby .lobby-top .me-chip { margin: 0; }
  .lobby-left { padding: 0; gap: 8px; }
  .online-panel { border-radius: 18px; padding: 6px 4px; }
  .player-search { padding: 2px 4px 4px; }
  .player-search input { padding: 5px 9px; font-size: 12px; }
}

@media (max-width: 700px) {
  #screen-lobby {
    padding:
      6px
      8px
      8px
      max(20px, calc(env(safe-area-inset-left, 0px) + 12px));
  }
  .lobby-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    gap: 8px;
  }
  #screen-lobby .lobby-top {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    gap: 8px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  #screen-lobby {
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    padding-left: max(22px, calc(env(safe-area-inset-left, 0px) + 14px));
    overflow: hidden;
  }
  #screen-lobby .lobby-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    flex: 0 0 auto;
    min-width: 0;
    align-items: center;
  }
  #screen-lobby .player-chip {
    min-width: 0;
    max-width: 100%;
    width: max-content;
    justify-self: start;
    margin: 0 4px 0 0;
    padding: 4px 8px 4px 4px;
  }
  #btn-lobby-back {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }
  #screen-lobby .online-head {
    padding: 5px 10px;
    font-size: 12px;
  }
  #screen-lobby .online-panel-head {
    padding: 0 0 6px;
    gap: 6px;
  }
  #screen-lobby .presence-toggle {
    padding: 4px 6px 4px 10px;
    font-size: 11px;
    gap: 6px;
  }
  #screen-lobby .presence-switch {
    width: 30px;
    height: 18px;
  }
  #screen-lobby .presence-switch i {
    width: 12px;
    height: 12px;
  }
  #screen-lobby .presence-toggle:not(.is-hidden) .presence-switch i {
    transform: translate3d(12px, 0, 0);
  }
  .lobby-grid {
    margin: 4px 0 6px;
    gap: 14px;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .lobby-left {
    justify-content: safe center;
    gap: clamp(10px, 2.8vh, 16px);
    padding: 0 4px 0 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #screen-lobby .online-panel {
    padding: 8px 10px;
  }
  #screen-lobby .player-search {
    padding: 0 2px 4px;
  }
  #screen-lobby .player-search input {
    padding: 4px 9px;
    font-size: 12px;
    border-radius: 10px;
  }
  .bonus-card {
    padding: 6px 10px;
    gap: 8px;
    border-radius: 16px;
  }
  .bonus-icon {
    width: 34px;
    height: 34px;
  }
  .bonus-icon svg {
    width: 22px;
    height: 22px;
  }
  .bonus-copy strong { font-size: 13px; }
  .bonus-copy small { font-size: 11px; }
  .bonus-claim {
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
    padding: 7px 12px;
    font-size: 12px;
  }
  #screen-lobby .lobby-left .btn.huge,
  #screen-lobby .lobby-left .btn.tourney-entry,
  #screen-lobby .lobby-left .btn.friends-entry {
    min-height: clamp(52px, 14vh, 64px);
    padding: 8px 14px 7px;
    border-radius: 18px;
  }
  #screen-lobby .lobby-left .btn.huge {
    font-size: clamp(15px, 4.2vh, 20px);
    gap: 1px;
  }
  #screen-lobby .lobby-left .btn.huge small,
  #screen-lobby .lobby-left #quick-sub {
    font-size: 11px;
    margin-top: 0;
  }
  #screen-lobby .lobby-left .btn.tourney-entry {
    gap: 10px;
  }
  #screen-lobby .lobby-left .tourney-entry-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  #screen-lobby .lobby-left .tourney-entry-icon svg {
    width: 24px;
    height: 28px;
  }
  #screen-lobby .lobby-left .tourney-entry-label {
    font-size: clamp(15px, 4.2vh, 20px);
  }
  #screen-lobby .lobby-left .tourney-entry-copy small,
  #screen-lobby .lobby-left #tourney-entry-sub {
    margin-top: 2px;
    font-size: 11px;
  }
  #screen-lobby .lobby-left .btn.friends-entry {
    font-size: clamp(15px, 4.2vh, 20px);
  }
  #screen-lobby .lobby-left .friends-entry-icon {
    width: 36px;
    height: 36px;
  }
  #screen-lobby .leader-bar {
    padding: 5px 12px 10px 8px;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
    align-items: center;
  }
  #screen-lobby .leader-title .trophy {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  #screen-lobby .leader-title strong { font-size: 12px; }
  #leader-strip {
    gap: 14px;
    padding: 2px 2px 12px 0;
  }
}
.online-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f0ebe3;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3dcf7a; box-shadow: 0 0 8px #3dcf7a; flex: none; }
.dot.is-hidden {
  background: #9b968d;
  box-shadow: none;
}
.online-panel {
  background: rgba(30, 35, 45, 0.55);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
}
.online-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  padding: 2px 6px 8px;
  min-width: 0;
}
.online-panel-head .online-head {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 12px;
}
.presence-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #f6f3ec;
  border-radius: 999px;
  padding: 5px 7px 5px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transform: translate3d(0, 0, 0);
}
.presence-toggle:hover {
  filter: brightness(1.06);
}
.presence-switch {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
  flex: none;
}
.presence-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f4f1ea;
  display: block;
  transform: translate3d(0, 0, 0);
  transition: transform .18s ease, background .18s ease;
}
.presence-toggle:not(.is-hidden) .presence-switch {
  background: linear-gradient(180deg, #4ee08c, #2fbf6a);
  border-color: rgba(130, 237, 87, 0.45);
  box-shadow: 0 0 12px rgba(61, 207, 122, 0.4);
}
.presence-toggle:not(.is-hidden) .presence-switch i {
  transform: translate3d(14px, 0, 0);
  background: #f4fff8;
}
.presence-toggle.is-hidden {
  color: #c4bfb6;
}
.player-search {
  flex: none;
  padding: 2px 6px 6px;
}
.player-search input {
  margin: 0;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  min-height: 0;
}
.player-search-hint {
  flex: none;
  margin: 0 12px 6px;
  color: var(--muted);
  font-size: 13px;
}
#online-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; }
#online-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  border-radius: 16px;
  gap: 8px;
}
#online-list li:hover { background: rgba(255, 255, 255, 0.06); }
#online-list .avatar { background: rgba(255,255,255,.1); }
#online-list .who { min-width: 0; flex: 1 1 auto; }
#online-list .presence { margin-left: 0; flex: none; }
#online-list .invite {
  flex: none;
  margin-left: 4px;
  max-width: 48%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  color: #111;
  background: linear-gradient(180deg, rgba(255, 212, 70, .95), rgba(242, 185, 15, .9));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 18px rgba(245, 196, 0, .22);
}
.who { display: flex; align-items: center; gap: 10px; }
.who strong { font-size: 15px; }
.who small { color: #9b968d; display: block; font-size: 12px; }
.invite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #f2b90f;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}
.invite:disabled { opacity: .35; }
.invite svg { width: 16px; height: 16px; }

.leader-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(30, 35, 45, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 16px 8px 10px;
  color: #f4f1ea;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: visible;
}
.leader-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.leader-title .trophy {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 16px;
}
.leader-title strong { display: block; font-size: 13px; line-height: 1.15; color: #f6f3ec; }
.leader-title small { color: #c4bfb6; font-size: 11px; }
#leader-strip {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 2px 2px 10px 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0;
}
#leader-strip li {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  cursor: pointer;
}
.leader-bar .avatar {
  width: 28px; height: 28px; background: rgba(255,255,255,.12); color: #eee; font-size: 13px;
}
.leader-bar .week-medal {
  width: 13px;
  height: 13px;
  right: -3px;
  bottom: -3px;
}
.leader-bar .week-medal svg {
  width: 8px;
  height: 8px;
}
.lead-who { display: flex; flex-direction: column; line-height: 1.15; }
.lead-who b { font-size: 13px; font-weight: 600; color: #f6f3ec; }
.lead-who span { color: #d0c8b8; font-size: 11px; }
.lead-prize { color: #f0d48a; }
.lead-rank {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.lead-rank.r1 { background: #f0b429; }
.lead-rank.r2 { background: #b8b8b8; color: #333; }
.lead-rank.r3 { background: #d08a4a; }
.leader-all {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #f0d48a;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.leader-all:hover { color: #fff; }
.lead-empty { color: #c4bfb6; font-size: 13px; }

.game-screen {
  padding: 0;
  background: #0d1117;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}
.game-hud.top,
.game-tools,
.play-actions {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  flex: none;
}
.game-hud.top > *,
.game-tools > *,
.play-actions > * {
  pointer-events: auto;
}
.game-hud.top {
  top: 0;
  left: 0;
  right: 0;
  align-items: flex-start;
  gap: 8px;
  padding: max(6px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
}
.hud-player {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
  max-width: min(220px, 32vw);
}
.hud-player.you {
  margin-left: auto;
}
.board-stage {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  justify-items: center;
  align-items: center;
  overflow: hidden;
  container-type: size;
  container-name: boardstage;
}
.board {
  position: relative;
  aspect-ratio: 1748 / 1689;
  width: min(100cqw, calc(100cqh * 1748 / 1689));
  height: min(100cqh, calc(100cqw * 1689 / 1748));
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}
.board-zoom {
  position: absolute;
  inset: 0;
  --off-rail-gap: 0.55%;
  --off-tray-width: 3.5%;
  --home-point-end: 93.65%;
  --board-zoom: 1;
  transform: translate3d(0, 0, 0) scale(var(--board-zoom));
  transform-origin: center center;
}
.board-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; pointer-events: none; user-select: none;
}
.board-points { position: absolute; inset: 0; overflow: visible; pointer-events: auto; }
.point {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 2px 2px;
  box-sizing: border-box;
  cursor: pointer;
  border-radius: 4px;
  overflow: visible;
  pointer-events: auto;
  touch-action: none;
  background: rgba(0, 0, 0, 0.001);
}
.point::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
}
.point.bottom {
  justify-content: flex-end;
  flex-direction: column;
  padding: 2px 2px 8px;
}
.point.legal { outline: 2px solid #f0d48a; outline-offset: -2px; background: rgba(240, 212, 138, .16); }
.point.movable { cursor: grab; }
.point.selected { outline: 2px solid #fff; }
.stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  overflow: visible;
  position: relative;
  z-index: 1;
}
.checker {
  width: 90%;
  max-width: none;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border: 0; background: none; padding: 0; cursor: grab;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stack .checker + .checker {
  margin-top: -12px;
}
.checker img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); pointer-events: none; }
.checker.white img,
.checker[data-color="white"] img {
  transform: translate3d(0, 0, 0) scale(1.30);
  transform-origin: center;
}
.checker.black img,
.checker[data-color="black"] img {
  transform: translate3d(0, 0, 0) scale(1.30);
  transform-origin: center;
}
.point.top .checker img { transform-origin: center top; }
.point.bottom .checker img { transform-origin: center bottom; }
.checker.can-move {
  z-index: 8;
}
.checker.can-move img {
  filter:
    drop-shadow(0 2px 2px rgba(0, 0, 0, .45))
    drop-shadow(0 0 8px rgba(255, 214, 90, .7));
}
.checker.dragging {
  visibility: hidden;
  pointer-events: none;
}
@keyframes checker-play-glow {
  0%, 100% {
    filter:
      drop-shadow(0 2px 2px rgba(0, 0, 0, .45))
      drop-shadow(0 0 5px rgba(255, 214, 90, .45))
      drop-shadow(0 0 12px rgba(242, 185, 15, .35));
  }
  50% {
    filter:
      drop-shadow(0 2px 2px rgba(0, 0, 0, .45))
      drop-shadow(0 0 9px rgba(255, 236, 150, .95))
      drop-shadow(0 0 20px rgba(242, 185, 15, .8));
  }
}
@media (prefers-reduced-motion: reduce) {
  .checker.can-move img {
    animation: none;
    filter:
      drop-shadow(0 2px 2px rgba(0, 0, 0, .45))
      drop-shadow(0 0 8px rgba(255, 214, 90, .75));
  }
}
.checker-ghost {
  position: fixed;
  z-index: 90;
  margin: 0 !important;
  padding: 0;
  pointer-events: none;
  opacity: 1 !important;
  visibility: visible !important;
  left: 0;
  top: 0;
  transform: translate3d(0, 0, 0) translate(-50%, -50%);
  cursor: grabbing;
  filter: none;
  will-change: transform;
}
.checker-ghost img {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale(1.12) !important;
  transform-origin: center center !important;
  filter: none;
}
body.is-opp-animating #board,
body.is-rolling-dice #board {
  pointer-events: none;
}
body.is-opp-animating .checker.can-move img,
body.is-rolling-dice .checker.can-move img,
body.is-dragging-checker .checker.can-move img {
  animation: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45));
}
.point.flight-from {
  outline: 2px solid rgba(255, 255, 255, .5);
  outline-offset: -2px;
}
.point.flight-to,
.bar-zone.flight-to {
  outline: 2px solid #f0d48a;
  outline-offset: -2px;
  background: rgba(240, 212, 138, .2);
}
.off-zone.flight-to {
  outline: none;
  background: transparent;
}
.checker-ghost.checker-flight {
  z-index: 96;
  filter: none;
  transition: none;
}
.more { font-size: 11px; color: #fff; }

.bar-zone, .off-zone {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.bar-zone { left: 46.2%; top: 9%; width: 8.4%; height: 82%; }
.bar-zone .stack {
  width: 77%;
}
.off-zone {
  left: calc(var(--home-point-end) + var(--off-rail-gap));
  width: var(--off-tray-width);
  height: 32.8%;
  z-index: 4;
  pointer-events: auto;
  touch-action: none;
  background: transparent;
  border-radius: 11px;
  overflow: visible;
  color: #f0d48a;
  font-weight: 700;
  font-size: clamp(11px, 1.5vh, 15px);
}
.off-zone.white { top: auto; bottom: 7.8%; }
.off-zone.black { top: 8.8%; bottom: auto; }
body[data-seat="black"] .off-zone.white { top: 8.8%; bottom: auto; }
body[data-seat="black"] .off-zone.black { top: auto; bottom: 7.8%; }
.bar-zone.legal { outline: 2px solid #f0d48a; background: rgba(240, 212, 138, .16); }
.off-tray-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  object-fit: fill;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .45));
}
.off-zone::after {
  content: "";
  position: absolute;
  inset: 9% 18% 9% 20%;
  border-radius: 8px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 231, 168, .42),
    rgba(240, 212, 138, .1),
    rgba(255, 231, 168, .42)
  );
  opacity: 0;
  mix-blend-mode: screen;
  z-index: 2;
}
.off-tray-content {
  position: absolute;
  inset: 9% 16% 9% 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 1;
}
.off-zone.white .off-tray-content { padding-top: 22%; }
.off-zone.black .off-tray-content {
  justify-content: flex-start;
  padding-bottom: 22%;
}
body[data-seat="black"] .off-zone.white .off-tray-content {
  justify-content: flex-start;
  padding-top: 0;
  padding-bottom: 22%;
}
body[data-seat="black"] .off-zone.black .off-tray-content {
  justify-content: flex-end;
  padding-bottom: 0;
  padding-top: 22%;
}
.off-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.off-chip {
  width: 88%;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: block;
  line-height: 0;
}
.off-chip + .off-chip { margin-top: -58%; }
.off-chip img {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5));
}
.off-count {
  position: absolute;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.55em;
  min-height: 1.55em;
  padding: 0.18em 0.32em;
  border-radius: 999px;
  background: rgba(18, 8, 4, .88);
  border: 1px solid rgba(232, 196, 144, .7);
  color: #f6e2b4;
  font-size: clamp(9px, 1.05vh, 12px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  transform: translate3d(-50%, 0, 0);
  overflow: visible;
  pointer-events: none;
}
.off-zone.white .off-count { top: 11.5%; bottom: auto; }
.off-zone.black .off-count { bottom: 11.5%; top: auto; }
body[data-seat="black"] .off-zone.white .off-count { bottom: 11.5%; top: auto; }
body[data-seat="black"] .off-zone.black .off-count { top: 11.5%; bottom: auto; }
.off-zone.can-bear::after {
  opacity: .28;
  animation: off-glow-idle 2.2s ease-in-out infinite;
}
.off-zone.can-bear .off-tray-art {
  filter:
    drop-shadow(0 3px 5px rgba(0, 0, 0, .45))
    drop-shadow(0 0 6px rgba(240, 212, 138, .35));
}
.off-zone.legal {
  cursor: pointer;
  outline: none;
  background: transparent;
}
.off-zone.legal::after,
.off-zone.flight-to::after {
  opacity: .55;
  animation: off-glow-pulse 1.25s ease-in-out infinite;
}
.off-zone.legal .off-tray-art,
.off-zone.flight-to .off-tray-art {
  filter:
    drop-shadow(0 3px 5px rgba(0, 0, 0, .45))
    drop-shadow(0 0 8px rgba(255, 220, 140, .7));
}
@keyframes off-glow-pulse {
  0%, 100% { opacity: .38; }
  50% { opacity: .72; }
}
@keyframes off-glow-idle {
  0%, 100% { opacity: .14; }
  50% { opacity: .36; }
}
body.is-opp-animating .off-zone.can-bear::after,
body.is-opp-animating .off-zone.legal::after,
body.is-opp-animating .off-zone.flight-to::after,
body.is-rolling-dice .off-zone.can-bear::after,
body.is-rolling-dice .off-zone.legal::after,
body.is-rolling-dice .off-zone.flight-to::after {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .off-zone.can-bear::after,
  .off-zone.legal::after,
  .off-zone.flight-to::after,
  .off-zone.legal .off-tray-art,
  .off-zone.flight-to .off-tray-art {
    animation: none;
  }
}

.dice-tray {
  position: absolute;
  left: 74.3%;
  top: 51%;
  width: 11%;
  transform: translate3d(-50%, -50%, 0);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  pointer-events: none;
  z-index: 2;
  background: transparent;
  filter: none;
  perspective: 340px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
}
.die {
  width: 42%;
  aspect-ratio: 1;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
  filter: none;
  position: relative;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  -webkit-transform-style: preserve-3d;
  --die-face: #f1e7d3;
  --die-face-hi: #efe3cf;
  --die-face-lo: #e6d4b8;
  --die-edge: #d7c4a4;
  --die-pip: #1a0c08;
  --die-pip-stroke: #120704;
  --die-trim: 1px;
}
.die[data-skin="classic"] {
  --die-face: #ffffff;
  --die-face-hi: #f8f9fa;
  --die-face-lo: #e9ecef;
  --die-edge: #dee2e6;
  --die-pip: #212529;
  --die-pip-stroke: #212529;
  --die-trim: 1px;
}
.die[data-skin="gold"] {
  --die-face: #141414;
  --die-face-hi: #1c1c1c;
  --die-face-lo: #0d0d0d;
  --die-edge: #f1c40f;
  --die-pip: #f59e0b;
  --die-pip-stroke: #b45309;
  --die-trim: 2px;
}
.die[data-skin="neon"] {
  --die-face: #090d16;
  --die-face-hi: #0f172a;
  --die-face-lo: #020617;
  --die-edge: #38bdf8;
  --die-pip: #38bdf8;
  --die-pip-stroke: #0284c7;
  --die-trim: 2px;
}
.die + .die { margin-top: 0; }
.die:nth-child(1) { transform: translate3d(0, 0, 0) rotateZ(-8deg); }
.die:nth-child(2) { transform: translate3d(0, 0, 0) rotateZ(11deg); }
.die-cube {
  width: 100%;
  height: 100%;
  position: relative;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
  filter: none;
  transform: translate3d(0, 0, 0);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.die-fill,
.die-face {
  position: absolute;
  inset: 0;
  border: 0;
  outline: 0;
  border-radius: 0;
  opacity: 1;
  background-color: var(--die-face, #f1e7d3);
  background-clip: border-box;
  -webkit-background-clip: border-box;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.die-fill {
  box-shadow: none;
  filter: none;
  pointer-events: none;
}
.die-face {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas:
    "tl tc tr"
    "ml mc mr"
    "bl bc br";
  padding: 10%;
  background-image: linear-gradient(160deg, var(--die-face-hi, #efe3cf) 0%, var(--die-face, #f1e7d3) 52%, var(--die-face-lo, #e6d4b8) 100%);
  box-shadow: inset 0 0 0 var(--die-trim, 1px) var(--die-edge, #d7c4a4);
}
.die-fill[data-n="1"] { transform: rotateY(0deg) translateZ(calc(var(--die-half, 18px) - 1.2px)); }
.die-fill[data-n="6"] { transform: rotateY(180deg) translateZ(calc(var(--die-half, 18px) - 1.2px)); }
.die-fill[data-n="3"] { transform: rotateY(90deg) translateZ(calc(var(--die-half, 18px) - 1.2px)); }
.die-fill[data-n="4"] { transform: rotateY(-90deg) translateZ(calc(var(--die-half, 18px) - 1.2px)); }
.die-fill[data-n="2"] { transform: rotateX(90deg) translateZ(calc(var(--die-half, 18px) - 1.2px)); }
.die-fill[data-n="5"] { transform: rotateX(-90deg) translateZ(calc(var(--die-half, 18px) - 1.2px)); }
.die-face[data-n="1"] { transform: rotateY(0deg) translateZ(var(--die-half, 18px)); }
.die-face[data-n="6"] { transform: rotateY(180deg) translateZ(var(--die-half, 18px)); }
.die-face[data-n="3"] { transform: rotateY(90deg) translateZ(var(--die-half, 18px)); }
.die-face[data-n="4"] { transform: rotateY(-90deg) translateZ(var(--die-half, 18px)); }
.die-face[data-n="2"] { transform: rotateX(90deg) translateZ(var(--die-half, 18px)); }
.die-face[data-n="5"] { transform: rotateX(-90deg) translateZ(var(--die-half, 18px)); }
.die .pip {
  display: block;
  width: 78%;
  height: 78%;
  margin: auto;
  place-self: center;
  border-radius: 50%;
  background: none;
  box-shadow: none;
  filter: none;
  opacity: 1;
  mix-blend-mode: normal;
  z-index: 2;
  line-height: 0;
}
.die .pip svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.die .pip svg circle {
  fill: var(--die-pip, #1a0c08);
  stroke: var(--die-pip-stroke, #120704);
  stroke-width: 0.35;
}
.die[data-skin="neon"] .pip svg {
  filter: drop-shadow(0 0 1px #38bdf8);
}
.die .pip-tl { grid-area: tl; }
.die .pip-tc { grid-area: tc; }
.die .pip-tr { grid-area: tr; }
.die .pip-ml { grid-area: ml; }
.die .pip-mc { grid-area: mc; width: 86%; height: 86%; }
.die .pip-mr { grid-area: mr; }
.die .pip-bl { grid-area: bl; }
.die .pip-bc { grid-area: bc; }
.die .pip-br { grid-area: br; }
body.is-rolling-dice .checker.can-move img {
  animation: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45));
}
.dice-tray.is-rolling {
  will-change: transform;
}
.dice-tray.is-rolling .die-cube {
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .die.rolling {
    transition: none;
  }
}

.game-screen .player-chip {
  min-width: 0;
  max-width: min(220px, 32vw);
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.game-screen .player-chip .avatar {
  width: 32px;
  height: 32px;
  font-size: 16px;
}
.game-screen .player-chip strong {
  font-size: 13px;
  line-height: 1.15;
  max-width: 9.5em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-screen .chip-points {
  font-size: 11px;
}
.game-screen .player-chip.active {
  box-shadow: 0 0 0 2px rgba(130, 237, 87, 0.55), 0 0 18px rgba(130, 237, 87, 0.22);
}
.hud-player.turn .player-chip.active {
  box-shadow: 0 0 0 2px rgba(130, 237, 87, 0.7), 0 0 18px rgba(130, 237, 87, 0.28);
}
.timer-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 2px 10px 2px 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.timer-wrap.mine {
  box-shadow: 0 0 0 1px rgba(130, 237, 87, 0.4), 0 0 14px rgba(130, 237, 87, 0.16);
}
.timer-ring { width: 28px; height: 28px; transform: rotate(-90deg); flex: none; }
.timer-ring .track { fill: none; stroke: rgba(255,255,255,0.18); stroke-width: 3; }
.timer-ring .value { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 97.4; stroke-dashoffset: 0; }
.timer-wrap.mine .timer-ring .value { stroke: #82ED57; }
.timer-meta { min-width: 0; }
.timer-meta small { color: var(--muted); display: none; font-size: 10px; }
.timer-meta b { font-size: 14px; line-height: 1.1; font-variant-numeric: tabular-nums; }

.btn.roll {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #ffcc00;
  color: #111;
  border: 0;
  border-radius: 999px;
  min-width: 0;
  max-width: none;
  padding: 8px 16px 8px 11px;
  font-weight: 800;
  font-size: clamp(12px, 2.2vh, 15px);
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-shadow: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.btn.roll .roll-dice-icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  display: block;
}
.btn.roll:hover {
  filter: brightness(1.06);
}
.btn.roll:active:not(:disabled) {
  transform: translate3d(0, 1px, 0);
  filter: brightness(0.97);
}
.btn.roll:disabled {
  opacity: 0.55;
  box-shadow: none;
}
.play-actions {
  right: max(10px, calc(env(safe-area-inset-right, 0px) + 8px));
  top: 52%;
  left: auto;
  transform: translate3d(0, -50%, 0);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: max-content;
  min-width: 132px;
  max-width: min(28vw, 168px);
}
.play-actions .btn.roll {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 7px 10px 7px 8px;
}
.btn.end-turn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #82ED57;
  color: #111;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 800;
  font-size: clamp(12px, 2vh, 14px);
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.btn.end-turn:hover { filter: brightness(1.06); }
.btn.end-turn:active:not(:disabled) {
  transform: translate3d(0, 1px, 0);
  filter: brightness(0.97);
}
.play-extra { display: flex; gap: 8px; }
.btn.play-mini {
  flex: 0 0 auto;
  min-width: 0;
  padding: 6px 12px;
  font-size: clamp(11px, 1.8vh, 13px);
  font-weight: 700;
}
.play-actions .btn.metal {
  flex: none;
}

.game-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
}
.icon-btn.glass-round {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
}
.icon-btn.glass-round svg { width: 20px; height: 20px; display: block; }

@supports not (width: 1cqh) {
  .board {
    width: min(100%, calc(100dvh * 1748 / 1689));
    height: min(100dvh, 100%);
  }
}

@media (min-width: 901px) {
  .play-actions {
    right: max(16px, calc((100vw - min(100vw, 100dvh * 1748 / 1689)) / 2 - 148px));
    left: auto;
    top: 52%;
    transform: translate3d(0, -50%, 0);
    min-width: 118px;
    max-width: 148px;
    gap: 6px;
  }
  .play-actions .btn.roll {
    padding: 7px 10px 7px 8px;
    font-size: 12px;
    gap: 5px;
  }
}

@media (min-height: 900px) and (min-width: 1100px) {
  .board-zoom { --board-zoom: 1; }
}

@media (min-height: 1100px) {
  .board-zoom { --board-zoom: 1; }
}

@media (max-height: 860px) {
  .board-zoom { --board-zoom: 1; }
}

@media (max-height: 740px) {
  .board-zoom { --board-zoom: 1; }
  .timer-ring { width: 24px; height: 24px; }
  .timer-meta b { font-size: 13px; }
  .timer-meta small { display: none; }
  .btn.roll {
    padding: 8px 14px;
    font-size: 13px;
  }
  .icon-btn.glass-round { width: 38px; height: 38px; }
}

@media (max-height: 640px) {
  .board-zoom { --board-zoom: 1; }
  .game-screen .player-chip {
    padding: 3px 8px 3px 3px;
    gap: 5px;
  }
  .game-screen .player-chip .avatar {
    width: 28px;
    height: 28px;
  }
  .btn.roll {
    padding: 7px 12px;
    font-size: 12px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  #screen-game.game-screen {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  #screen-game .board-stage {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
  }
  #screen-game .board {
    --board-h: 95dvh;
    aspect-ratio: 1748 / 1689;
    width: min(100vw, calc(var(--board-h) * 1748 / 1689));
    height: min(var(--board-h), calc(100vw * 1689 / 1748));
    max-width: 100vw;
    max-height: var(--board-h);
  }
  .game-hud.top {
    padding-top: max(2px, env(safe-area-inset-top, 0px));
    padding-right: max(4px, env(safe-area-inset-right, 0px));
    padding-left: max(4px, env(safe-area-inset-left, 0px));
  }
  #screen-game .game-tools {
    right: max(12px, calc(env(safe-area-inset-right, 0px) + 10px));
    bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 10px));
    gap: 8px;
    align-items: center;
  }
  #screen-game .game-tools .icon-btn.glass-round {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
  }
  .play-actions {
    right: max(56px, calc(env(safe-area-inset-right, 0px) + 54px));
    top: 50%;
    left: auto;
    transform: translate3d(0, -50%, 0);
    min-width: 118px;
    max-width: min(26vw, 148px);
    gap: 6px;
  }
  .play-actions .btn.roll {
    padding: 7px 10px 7px 8px;
    font-size: 12px;
    gap: 5px;
  }
  .emoji-menu {
    right: calc(100% + 8px);
    bottom: 0;
  }
  #modal {
    padding: max(6px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    overflow: hidden;
  }
  #modal .modal-card {
    width: min(380px, 92vw);
    padding: 10px 14px 10px;
    max-height: calc(100dvh - 12px);
    overflow: hidden;
    border-radius: 16px;
  }
  #modal #modal-title {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.15;
  }
  #modal #modal-text {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.25;
  }
  #modal .modal-series {
    gap: 6px;
    margin: 0;
    padding: 6px 8px 8px;
  }
  #modal .series-player {
    gap: 4px;
  }
  #modal .series-player .avatar {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  #modal .series-player strong {
    font-size: 12px;
  }
  #modal .series-score {
    font-size: 16px;
    padding: 3px 12px;
  }
  #modal .modal-actions {
    margin-top: 8px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  #modal .modal-actions .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
}

.emoji-wrap { position: relative; }
.emoji-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  z-index: 8;
}
.emoji-menu[hidden] { display: none !important; }
.emoji-menu button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.emoji-menu button:hover { background: rgba(255, 255, 255, 0.12); }
.emoji-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}
.emoji-fly {
  position: absolute;
  left: 50%;
  bottom: 36%;
  font-size: 44px;
  line-height: 1;
  animation: emoji-up 2.7s ease-out forwards;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
  will-change: transform, opacity;
}
@keyframes emoji-up {
  0% { transform: translate3d(-50%, 12px, 0) scale(0.75); opacity: 0; }
  10% { transform: translate3d(-50%, -8px, 0) scale(1.12); opacity: 1; }
  72% { transform: translate3d(-50%, -130px, 0) scale(1.04); opacity: 1; }
  100% { transform: translate3d(-50%, -190px, 0) scale(1); opacity: 0; }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: grid;
  place-items: center;
  align-content: safe center;
  justify-items: center;
  z-index: 40;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}
.modal-card {
  width: min(420px, 100%);
  max-width: 100%;
  max-height: min(92dvh, 100%);
  box-sizing: border-box;
  background: rgba(30, 35, 45, 0.65);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}
#modal-text { white-space: pre-line; margin: 0 0 12px; }
#modal-text.leaders-all {
  white-space: normal;
  max-height: min(52vh, 420px);
  overflow: auto;
  text-align: left;
}
.leaders-all-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.leaders-all-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}
.leaders-all-list li:hover { background: rgba(255, 255, 255, 0.04); }
.leaders-all-list .avatar {
  width: 36px;
  height: 36px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.1);
}
.leaders-all-list .lead-who {
  flex: 1;
  min-width: 0;
}
.leaders-all-list .lead-who b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaders-all-list .lead-points {
  flex: none;
  color: #f0d48a;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.modal-series {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 4px 0 2px;
  padding: 12px 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.modal-series[hidden] { display: none !important; }
.series-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.series-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.series-player .avatar {
  width: 42px;
  height: 42px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.1);
}
.series-player .week-medal {
  width: 18px;
  height: 18px;
}
.series-player strong {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.series-vs-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.series-score {
  min-width: 4.6em;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(240, 212, 138, 0.14);
  border: 1px solid rgba(240, 212, 138, 0.45);
  color: #f6e2b4;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.sheet-close {
  position: sticky;
  top: 0;
  float: right;
  width: 36px;
  height: 36px;
  margin: -6px -6px 0 8px;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 18, 24, 0.72);
  color: #eee;
  font-size: 22px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  z-index: 8;
}
.profile-card,
.friends-card {
  text-align: center;
  width: min(420px, 100%);
  max-width: 100%;
  max-height: min(90dvh, 100%);
  overflow-x: hidden;
}
.profile-card.has-inventory {
  width: min(760px, 100%);
  max-width: 100%;
  max-height: min(90dvh, 820px);
  overflow-x: hidden;
  overflow-y: auto;
  text-align: center;
}
.profile-avatar { width: 56px; height: 56px; margin: 4px auto 10px; font-size: 26px; }
.profile-avatar .week-medal {
  width: 20px;
  height: 20px;
  right: -2px;
  bottom: -2px;
}
.profile-avatar .week-medal svg {
  width: 12px;
  height: 12px;
}
.profile-card h2, .friends-card h2 { margin: 0 0 6px; font-size: 22px; }
.profile-sub { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  margin: 0 0 14px;
  min-width: 0;
  max-width: 100%;
}
.avatar-pick {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.avatar-pick.on {
  outline: 2px solid var(--gold);
  background: rgba(242, 185, 15, 0.16);
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.profile-stats div {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px;
}
.profile-stats b { display: block; font-size: 20px; }
.profile-stats span { color: var(--muted); font-size: 11px; }
.profile-collection-grid,
.inventory-dice {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(168px, 100%), 1fr));
  gap: 10px;
  margin: 8px 0 0;
  min-width: 0;
  align-items: stretch;
}
@media (max-width: 560px) {
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.profile-card .modal-actions {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  margin: 0 auto 14px;
  max-width: 420px;
  width: 100%;
}
.profile-card .modal-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.profile-card .modal-actions:empty,
.profile-card .modal-actions[hidden] {
  display: none;
}
.profile-inventory {
  text-align: left;
  margin: 0 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.profile-inventory h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.profile-inventory h3:not(:first-of-type) {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#friends-list { list-style: none; margin: 14px 0 0; padding: 0; max-height: 52vh; overflow: auto; text-align: left; }
#friends-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
#friends-list .who { cursor: pointer; min-width: 0; }
#friends-list .who strong { display: block; }
.presence { font-size: 12px; font-weight: 600; }
.presence.on { color: #3dcf7a; }
.presence.off { color: #9b968d; }
.friends-empty { color: var(--muted); padding: 18px 8px; text-align: center; }
.shop-card {
  width: min(760px, 100%);
  max-width: 100%;
  max-height: min(88dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
  padding: 22px 22px 18px;
}
.shop-card h2 { margin: 0 0 14px; font-size: 26px; }
.shop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.shop-tab {
  flex: 1 1 88px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: clamp(12px, 2.2vw, 14px);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.shop-tab.on {
  background: linear-gradient(180deg, rgba(255, 212, 70, .95), rgba(242, 185, 15, .9));
  color: #111;
  box-shadow: 0 6px 16px rgba(245, 196, 0, .22);
}
.shop-panels {
  min-width: 0;
  max-width: 100%;
}
.shop-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
  padding-top: 10px;
  min-width: 0;
}
.shop-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font: inherit;
  cursor: pointer;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  transition: transform .18s ease, border-color .18s ease;
  transform: translate3d(0, 0, 0);
}
.shop-item:hover { transform: translate3d(0, -2px, 0); border-color: rgba(255, 255, 255, 0.28); }
.shop-item.featured {
  border-color: rgba(242, 185, 15, 0.5);
  box-shadow: 0 10px 28px rgba(242, 185, 15, 0.16);
}
.shop-item.owned { opacity: 0.88; }
.shop-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}
.shop-badge.sale {
  background: rgba(130, 237, 87, 0.2);
  color: #9af56e;
}
.shop-badge.hot {
  background: linear-gradient(180deg, rgba(255, 212, 70, .95), rgba(242, 185, 15, .9));
  color: #111;
}
.shop-preview {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 72px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  box-sizing: border-box;
  padding: 8px;
}
.shop-preview.coins {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #ffe7a3, #c9a227 55%, #7a5a12);
  color: #1a1408;
}
.shop-preview.coins.best {
  background: radial-gradient(circle at 30% 20%, #fff1c2, #f2b90f 50%, #a36b08);
}
.shop-preview.coins b { font-size: 26px; line-height: 1; }
.shop-preview.coins small { font-size: 11px; font-weight: 700; display: block; }
.shop-preview.board {
  background-repeat: repeat-x, no-repeat;
  background-size: 24px 100%, 100% 100%;
  background-position: center;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.shop-preview.art {
  aspect-ratio: 4 / 3;
  height: auto;
  min-height: 96px;
  background: rgba(0, 0, 0, 0.22);
  padding: 10px 12px;
  overflow: hidden;
}
.shop-preview.art.dice {
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, 0.04);
}
.shop-preview.art img {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}
.shop-preview.board.walnut {
  background-image:
    repeating-linear-gradient(90deg, #6a3b1e 0 12px, #4a2612 12px 24px),
    linear-gradient(#3d2314, #2a160c);
}
.shop-preview.board.onyx {
  background-image:
    repeating-linear-gradient(90deg, #1c1c22 0 12px, #0d0d12 12px 24px),
    linear-gradient(#141418, #07070a);
}
.shop-preview.board.oak {
  background-image:
    repeating-linear-gradient(90deg, #c49a5a 0 12px, #8d6230 12px 24px),
    linear-gradient(#b88846, #6d441c);
}
.shop-preview.die-skin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
}
.shop-preview.die-skin i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.shop-preview.die-skin.bone {
  background: linear-gradient(160deg, #f6efe2, #d9cbb3);
}
.shop-preview.die-skin.bone i { background: #5a2c2b; }
.shop-preview.die-skin.gold {
  background: linear-gradient(160deg, #3a2a12, #1a1208);
  box-shadow: inset 0 0 0 2px #e0b84a;
}
.shop-preview.die-skin.gold i { background: #f2d27a; }
.shop-preview.die-skin.neon {
  background: #0b1220;
  box-shadow: inset 0 0 18px rgba(80, 220, 255, .35);
}
.shop-preview.die-skin.neon i { background: #5cf0ff; box-shadow: 0 0 8px #5cf0ff; }
.shop-item strong,
.inv-die strong,
.pub-skin strong {
  min-width: 0;
  min-height: 2.6em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.shop-item strong { font-size: 15px; }
.shop-sub { color: var(--muted); font-size: 12px; min-height: 1.25em; }
.shop-price {
  color: #e8c56a;
  font-weight: 800;
  font-size: 14px;
}
.shop-price s {
  color: var(--muted);
  font-weight: 600;
  margin-right: 6px;
}
.shop-buy {
  margin-top: 4px;
  width: 100%;
  max-width: 100%;
  text-align: center;
  pointer-events: none;
  box-sizing: border-box;
}
.shop-item.owned .shop-buy {
  background: rgba(255, 255, 255, 0.1);
  color: #f4f1ea;
  box-shadow: none;
}
@media (max-width: 720px) {
  .shop-card,
  .profile-card,
  .profile-card.has-inventory,
  .friends-card {
    padding: 16px 14px 14px;
    border-radius: 18px;
  }
  .shop-card h2 { font-size: 22px; padding-right: 40px; }
}
.shop-empty {
  grid-column: 1 / -1;
  margin: 8px 4px 0;
  color: var(--muted);
  font-size: 14px;
}

.inventory-lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.inv-die,
.pub-skin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-align: left;
  padding: 12px 10px 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
}
.inv-die.is-equipped {
  border-color: #f2b90f;
  box-shadow:
    0 0 0 3px rgba(242, 185, 15, 0.28),
    0 10px 28px rgba(242, 185, 15, 0.18);
}
.inv-die.is-locked {
  opacity: 0.9;
}
.inv-meta {
  min-height: 20px;
  color: #e8c56a;
  font-weight: 800;
  font-size: 14px;
}
.inv-die.is-equipped .inv-meta,
.inv-die.is-owned .inv-meta {
  color: var(--muted);
  font-weight: 700;
}
.inv-equipped-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 212, 70, .95), rgba(242, 185, 15, .9));
  color: #111;
}
.inv-action {
  margin-top: auto;
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}
.inv-action:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: #f4f1ea;
  box-shadow: none;
  cursor: default;
}

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate3d(-50%, 0, 0);
  background: rgba(30, 35, 45, 0.7);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 16px;
  z-index: 50;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.reconnect {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: grid; place-items: center; color: #fff; font-size: 20px; z-index: 5;
}
