/* Ludo — styles (layout and controls from Mar o Pelle) */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Lalezar';
  src: url('../fonts/lalezar-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
  font-display: swap;
}
@font-face {
  font-family: 'Lalezar';
  src: url('../fonts/lalezar-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-200B, U+2010-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}
@font-face {
  font-family: 'Lalezar';
  src: url('../fonts/lalezar-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  font-display: swap;
}

/* ---------- theme tokens ---------- */
:root {
  --font: 'Vazirmatn', Tahoma, system-ui, sans-serif;
  --title: 'Lalezar', 'Vazirmatn', Tahoma, sans-serif;
  --emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  --r: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
:root[data-theme="classic"] {
  --bg1: #0b3346; --bg2: #1a6f8f; --bg3: #f2b84b;
  --panel: rgba(255, 252, 245, .96); --panel-2: #f3eee3; --ink: #1f2a30; --muted: #5f6b70; --line: rgba(20, 40, 50, .13);
  --accent: #ff7a1a; --accent-hi: #ffad5c; --accent-dark: #c2520a; --accent-ink: #fff;
  --accent2: #1a8fb0; --accent2-dark: #0f6580; --chip: #e5eef0; --title-shadow: #082634;
  --topbar-ink: #fff;
}
:root[data-theme="carpet"] {
  --bg1: #2a0b0c; --bg2: #6e1b1f; --bg3: #d9a018;
  --panel: rgba(250, 240, 220, .96); --panel-2: #f1e3c6; --ink: #2d160f; --muted: #7a5a45; --line: rgba(80, 20, 10, .15);
  --accent: #b8261f; --accent-hi: #dc5a3c; --accent-dark: #7a1410; --accent-ink: #fff;
  --accent2: #203f88; --accent2-dark: #102658; --chip: #ecdcbc; --title-shadow: #1a0405;
  --topbar-ink: #fff;
}
:root[data-theme="tiles"] {
  --bg1: #06223a; --bg2: #0f5574; --bg3: #e2ad4a;
  --panel: rgba(255, 250, 238, .96); --panel-2: #f6ecd6; --ink: #1c2530; --muted: #6b6150; --line: rgba(80, 50, 10, .15);
  --accent: #1b8ea3; --accent-hi: #45b6c9; --accent-dark: #0f5f6e; --accent-ink: #fff;
  --accent2: #c99a1a; --accent2-dark: #8f6a07; --chip: #efe2c4; --title-shadow: #062033;
  --topbar-ink: #fff;
}
:root[data-theme="night"] {
  --bg1: #03040f; --bg2: #141a4a; --bg3: #6d3bd6;
  --panel: rgba(18, 23, 60, .94); --panel-2: #1b2259; --ink: #eef1ff; --muted: #a7b0dc; --line: rgba(255, 255, 255, .13);
  --accent: #ff4d9a; --accent-hi: #ff8cc0; --accent-dark: #b51e66; --accent-ink: #fff;
  --accent2: #2ee5c0; --accent2-dark: #139a80; --chip: #262f72; --title-shadow: #000;
  --topbar-ink: #fff;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg1); }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: transparent;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }
[hidden] { display: none !important; }
.grow { flex: 1; }
.muted { color: var(--muted); }

#decor {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
  background:
    radial-gradient(1100px 650px at 85% -10%, color-mix(in srgb, var(--bg3) 55%, transparent) 0%, transparent 60%),
    radial-gradient(900px 700px at -15% 115%, var(--bg2) 0%, transparent 62%),
    linear-gradient(160deg, var(--bg2), var(--bg1));
}
#decor span {
  position: absolute; bottom: -12vh; font-family: var(--emoji); font-size: var(--s); opacity: .16;
  animation: drift var(--d) linear infinite; animation-delay: var(--dl);
}
@keyframes drift {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-125vh) rotate(var(--rot)); }
}
#app { position: relative; z-index: 1; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 14px 8px;
  color: var(--topbar-ink);
}
.bar-title { margin: 0 4px; font-family: var(--title); font-weight: 400; font-size: 26px; text-shadow: 0 2px 0 var(--title-shadow); white-space: nowrap; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 20px; font-family: var(--emoji); line-height: 1;
  color: #fff; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  cursor: pointer; transition: transform .1s, background .2s;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.icon-btn:hover { background: rgba(255, 255, 255, .26); }
.icon-btn:active { transform: scale(.93); }
.icon-btn.off { opacity: .5; text-decoration: line-through; }
.icon-btn.on { background: rgba(255, 255, 255, .42); }
[dir="rtl"] .flip { display: inline-block; transform: scaleX(-1); }
.badge { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }
body.view-2d .view3d-only { display: none; }

.lang-switch {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(0, 0, 0, .2); border: 1px solid rgba(255, 255, 255, .26);
}
.lang-switch button {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  font-weight: 800; font-size: 14px; padding: 6px 11px; border-radius: 999px; min-width: 40px;
}
.lang-switch button[aria-pressed="true"] { background: #fff; color: #1d1d1d; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 16px; padding: 12px 18px;
  font-weight: 800; font-size: 17px; line-height: 1.3;
  background: var(--panel); color: var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .18), 0 8px 18px rgba(0, 0, 0, .12);
  cursor: pointer; transition: transform .08s, box-shadow .08s, filter .15s;
  -webkit-user-select: none; user-select: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18), 0 4px 10px rgba(0, 0, 0, .1); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.3); }
.btn .ico { font-family: var(--emoji); font-size: 1.1em; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 5px 0 var(--accent-dark), 0 10px 22px rgba(0, 0, 0, .2);
}
.btn-primary:active { box-shadow: 0 2px 0 var(--accent-dark), 0 5px 12px rgba(0, 0, 0, .2); }
.btn-accent2 {
  background: linear-gradient(180deg, var(--accent2), var(--accent2-dark));
  color: #fff; box-shadow: 0 5px 0 var(--accent2-dark), 0 10px 22px rgba(0, 0, 0, .2);
}
.btn-xl { font-size: 21px; padding: 16px 24px; border-radius: 20px; }
.btn-small { font-size: 14px; padding: 8px 12px; border-radius: 12px; }

/* ---------- menu ---------- */
.menu-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 16px 28px; gap: 18px; }
.menu-hero { text-align: center; color: #fff; }
.logo { width: min(330px, 76vw); height: auto; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .32)); overflow: visible; }
.logo-pawn { animation: pawnHop 2.4s ease-in-out infinite; }
.logo-pawn.p2 { animation-delay: -.8s; }
.logo-pawn.p3 { animation-delay: -1.6s; }
@keyframes pawnHop { 0%, 60%, 100% { translate: 0 0; } 70% { translate: 0 -14px; } 80% { translate: 0 0; } 86% { translate: 0 -4px; } }
.logo-die { animation: dieRoll 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes dieRoll { 0%, 100% { rotate: 0deg; translate: 0 0; } 40% { rotate: 0deg; translate: 0 0; } 55% { rotate: 200deg; translate: -6px -16px; } 70% { rotate: 360deg; translate: 0 0; } }
.title {
  margin: 4px 0 0; font-family: var(--title); font-weight: 400;
  font-size: clamp(52px, 13vw, 104px); line-height: 1.05;
  color: #fff; text-shadow: 0 5px 0 var(--title-shadow), 0 12px 28px rgba(0, 0, 0, .35);
}
.tagline { margin: 6px 0 0; font-size: clamp(15px, 3.6vw, 19px); font-weight: 600; opacity: .92; }
.menu-buttons { width: min(430px, 100%); display: flex; flex-direction: column; gap: 12px; }
.menu-buttons .row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.menu-buttons .row2 .btn { padding-inline: 10px; font-size: 16px; gap: 8px; }
.about { margin: 4px 0 0; color: rgba(255, 255, 255, .75); font-size: 13px; text-align: center; }

/* ---------- setup ---------- */
.setup-grid {
  width: 100%; max-width: 1220px; margin: 0 auto; padding: 4px 14px 120px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start;
}
.card { background: var(--panel); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 19px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.card h3 .ico { font-family: var(--emoji); }
.presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: #fff; }
.presets .lbl { font-weight: 800; margin-inline-end: 4px; text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.chip {
  border: 2px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .15); color: #fff;
  border-radius: 99px; padding: 7px 14px; font-weight: 800; cursor: pointer;
}
.chip.on { background: #fff; color: var(--ink); border-color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); }
.chip .ico { font-family: var(--emoji); }

.board-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.board-pick button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 18px; cursor: pointer;
  border: 3px solid transparent; background: var(--panel-2); color: var(--ink); font-weight: 900; font-size: 17px;
}
.board-pick button[aria-pressed="true"] { border-color: var(--accent2); background: var(--chip); }
.board-pick button:disabled { opacity: .45; cursor: not-allowed; }
.board-pick small { font-weight: 700; font-size: 13px; color: var(--muted); }
.board-pick canvas { width: min(150px, 100%); height: auto; border-radius: 12px; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }

.plist { display: flex; flex-direction: column; gap: 10px; }
.prow {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center;
  padding: 10px; border-radius: 18px; background: var(--panel-2);
  border-inline-start: 7px solid var(--pc);
}
.prow-opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.prow-opts .ptype { flex: none; }
.avatar-btn {
  width: 54px; height: 54px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  font-family: var(--emoji); font-size: 30px; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc) 75%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .2); display: grid; place-items: center;
}
.prow input {
  width: 100%; min-width: 0; font: inherit; font-weight: 700; font-size: 16px;
  padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--panel); color: var(--ink);
}
.prow input:focus { border-color: var(--accent2); outline: none; }
.colors { display: flex; gap: 7px; flex-wrap: wrap; padding-inline-start: 2px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; padding: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .55), transparent 55%), var(--sw);
  box-shadow: 0 0 0 1px var(--line), 0 2px 5px rgba(0, 0, 0, .15);
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.12); }
.swatch:disabled { opacity: .3; cursor: not-allowed; }
.icon-mini {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; font-weight: 900;
  background: rgba(220, 50, 50, .12); color: #c0392b;
}
.add-player { margin-top: 10px; width: 100%; border: 2px dashed var(--line); background: transparent; box-shadow: none; color: var(--muted); }

.field { margin: 12px 0 0; }
.field:first-of-type { margin-top: 0; }
.field .lbl { display: block; font-weight: 800; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; border-radius: 15px; background: var(--chip); }
.seg button {
  flex: 1 1 auto; min-width: 58px; border: 0; background: transparent; cursor: pointer;
  font-weight: 800; font-size: 15px; padding: 8px 10px; border-radius: 11px; color: var(--ink);
}
.seg button[aria-pressed="true"] { background: var(--accent2); color: #fff; box-shadow: 0 3px 0 var(--accent2-dark); }
.seg button:disabled { opacity: .38; cursor: not-allowed; }
.seg.small button { min-width: 0; padding: 6px 9px; font-size: 14px; }
.seg .ico { font-family: var(--emoji); }
.note { font-size: 13px; color: var(--muted); margin: 6px 2px 0; }

.toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 4px; border: 0; border-bottom: 1px dashed var(--line); background: none; cursor: pointer;
  font-weight: 700; font-size: 15.5px; text-align: start; color: var(--ink);
}
.toggle:last-child { border-bottom: 0; }
.toggle:disabled { opacity: .4; cursor: not-allowed; }
.switch { position: relative; flex: none; width: 50px; height: 29px; border-radius: 99px; background: var(--line); transition: background .2s; }
.switch::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 23px; height: 23px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: inset-inline-start .2s;
}
.toggle[aria-checked="true"] .switch { background: var(--accent2); }
.toggle[aria-checked="true"] .switch::after { inset-inline-start: 24px; }

.setup-grid.single { max-width: 760px; grid-template-columns: 1fr; }
.stepper { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px; }
.stepper button {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .14); color: #fff;
  font-weight: 800; font-size: 15px; padding: 7px 14px 7px 10px; border-radius: 99px;
}
.stepper button.on { background: #fff; color: var(--ink); border-color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); }
.stepper .num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 14px;
}
.stepper .line { flex: 0 1 50px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .45); }
.code-note { font-size: 13px; color: var(--muted); margin: 6px 2px 0; }
.code-note.err { color: #d62839; font-weight: 800; }

.mode-opts { display: grid; gap: 12px; }
.mode-opt {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center; text-align: start;
  padding: 16px; border-radius: 22px; border: 3px solid transparent; cursor: pointer;
  background: var(--panel-2); color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, .12);
  transition: transform .08s, border-color .2s;
}
.mode-opt:hover { border-color: var(--accent2); }
.mode-opt:active { transform: translateY(3px); }
.mode-opt .big {
  grid-row: span 2; width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center;
  font-family: var(--emoji); font-size: 38px; background: var(--chip);
}
.mode-opt b { font-size: 20px; font-weight: 900; }
.mode-opt .sub { font-size: 14px; color: var(--muted); line-height: 1.55; }
.mode-opt.primary { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); box-shadow: 0 5px 0 var(--accent-dark); }
.mode-opt.primary .sub { color: inherit; opacity: .92; }
.mode-opt.primary .big { background: rgba(255, 255, 255, .28); }

.count-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.count-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; cursor: pointer;
  border-radius: 20px; border: 3px solid transparent; background: var(--panel-2); color: var(--ink);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .12); transition: transform .08s, border-color .2s;
}
.count-grid button:hover { border-color: var(--accent2); }
.count-grid button:active { transform: translateY(3px); }
.count-grid .n { font-family: var(--title); font-size: 40px; line-height: 1; }
.count-grid .ppl { font-family: var(--emoji); font-size: 15px; line-height: 1.2; word-break: break-all; max-width: 64px; text-align: center; }
.count-grid .solo {
  grid-column: span 5; flex-direction: row; justify-content: center; gap: 14px; padding: 15px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: var(--accent-ink);
  box-shadow: 0 5px 0 var(--accent-dark); font-weight: 900; font-size: 18px;
}
.count-grid .solo .ppl { font-size: 24px; white-space: nowrap; max-width: none; }

.setup-footer {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; justify-content: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, .35));
  pointer-events: none;
}
.setup-footer .btn { width: min(430px, 100%); pointer-events: auto; }

/* ---------- game ---------- */
#scr-game { height: 100dvh; min-height: 0; }
.game-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 350px); gap: 14px;
  padding: 2px 14px max(14px, env(safe-area-inset-bottom));
}
#board-box {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; border-radius: 26px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .12);
}
.board-canvas { position: absolute; inset: 0; display: block; touch-action: none; -webkit-user-select: none; user-select: none; }
#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.float {
  position: absolute; left: 0; top: 0; translate: -50% -50%; white-space: nowrap;
  font-family: var(--title); font-size: clamp(20px, 3.4vw, 34px); color: #fff; line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45), 0 0 12px rgba(0, 0, 0, .35);
  animation: floatUp 1.5s ease-out forwards;
}
.float.small { font-size: clamp(15px, 2.4vw, 22px); font-family: var(--font); font-weight: 900; }
.float.emo { font-family: var(--emoji); font-size: clamp(26px, 4.4vw, 40px); }
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(8px) scale(.6); }
  15% { opacity: 1; transform: translateY(0) scale(1.08); }
  25% { transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-70px) scale(1); }
}
.die-tag {
  position: absolute; left: 0; top: 0; translate: -50% -100%;
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 5px; border-radius: 99px;
  background: rgba(255, 255, 255, .94); color: #1d1d24; font-weight: 900; font-size: 14px; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3); border: 3px solid var(--pc, #999);
  transition: opacity .25s;
}
.die-tag .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--emoji); font-size: 16px; background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc) 80%); }
.die-tag.tap { animation: tagPulse 1.2s ease-in-out infinite; }
@keyframes tagPulse { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }
.banner {
  position: absolute; left: 50%; top: 14%; translate: -50% 0; padding: 10px 22px; border-radius: 99px;
  background: rgba(10, 14, 30, .78); color: #fff; font-family: var(--title); font-size: clamp(22px, 4vw, 36px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); border: 3px solid var(--pc, #fff); white-space: nowrap;
  animation: bannerIn 1.6s ease-out forwards;
}
@keyframes bannerIn { 0% { opacity: 0; transform: scale(.6); } 12% { opacity: 1; transform: scale(1.06); } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

#side { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
#panel { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px 2px 6px; scrollbar-width: thin; }

.turn-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 22px;
  background: var(--panel); box-shadow: var(--shadow); border: 3px solid var(--pc, transparent);
  transition: border-color .3s;
}
.turn-avatar {
  width: 60px; height: 60px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--emoji); font-size: 34px; border: 3px solid #fff;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc, #ccc) 75%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}
.turn-avatar.bounce { animation: bounceIn .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes bounceIn { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
.turn-text { min-width: 0; flex: 1; }
.turn-name { font-size: 21px; font-weight: 900; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.turn-hint { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.turn-timer {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 15px;
  background: conic-gradient(var(--pc, #999) var(--p, 100%), var(--line) 0); position: relative;
}
.turn-timer::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--panel); }
.turn-timer span { position: relative; }
.turn-timer.low { animation: pulse .8s ease-in-out infinite; }

.dice-dock {
  flex: none; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 24px;
  background: linear-gradient(var(--panel), var(--panel)), var(--bg1); border: 3px solid var(--pc, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28); transition: border-color .3s;
}
.btn-roll { flex: 1; font-size: 26px; padding: 18px 12px; font-family: var(--title); font-weight: 400; letter-spacing: .5px; }
.btn-roll .ico { font-size: 28px; }
.btn-roll.pulse:not([disabled]) { animation: pulse 1.6s ease-in-out infinite; }
.btn-roll[disabled] { opacity: 1; filter: none; background: var(--chip); color: var(--muted); box-shadow: 0 4px 0 rgba(0, 0, 0, .14); }
.btn-roll.pick { opacity: 1; filter: none; background: linear-gradient(180deg, #fff4c2, #ffd84d); color: #4a3500; box-shadow: 0 5px 0 #c99a1a; font-size: 17px; font-family: var(--font); font-weight: 900; cursor: default; }
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.04; } }

.msg {
  min-height: 54px; padding: 12px 16px; border-radius: 18px; background: var(--panel); box-shadow: var(--shadow);
  font-weight: 800; font-size: 16.5px; line-height: 1.5; display: flex; align-items: center;
}
.msg.bump { animation: bump .35s ease-out; }
@keyframes bump { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }

.players { display: grid; gap: 8px; }
.pcard {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 18px; background: var(--panel); box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
  border: 2px solid transparent; transition: border-color .25s, transform .25s;
}
.pcard.active { border-color: var(--pc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 30%, transparent), 0 6px 16px rgba(0, 0, 0, .15); }
.pcard.done { opacity: .85; }
.pav {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--emoji); font-size: 24px; border: 2px solid #fff;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc) 75%);
}
.pname { font-weight: 900; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psub { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.pdots { display: flex; gap: 4px; margin-top: 5px; }
.pdots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--pc); background: transparent; transition: background .3s; }
.pdots i.track { background: color-mix(in srgb, var(--pc) 45%, transparent); }
.pdots i.lane { background: color-mix(in srgb, var(--pc) 75%, transparent); }
.pdots i.home { background: var(--pc); box-shadow: 0 0 6px var(--pc); }
.pbar { height: 5px; border-radius: 99px; background: var(--line); margin-top: 5px; overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 99px; background: var(--pc); transition: width .3s; }
.pbadges { font-family: var(--emoji); font-size: 18px; }

.log-box { background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 14px; }
.log-box summary { cursor: pointer; font-weight: 900; }
.log-box ol { list-style: none; margin: 8px 0 0; padding: 0; max-height: 220px; overflow: auto; }
.log-box li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; display: flex; gap: 8px; align-items: baseline; }
.log-box li::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--pc, #999); flex: none; transform: translateY(-1px); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 12, 24, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  animation: fadeIn .2s ease-out;
}
.modal.see-through { background: rgba(8, 12, 24, .25); -webkit-backdrop-filter: none; backdrop-filter: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: min(580px, 100%); max-height: min(90dvh, 960px); overflow: auto;
  background: var(--panel); color: var(--ink); border-radius: 28px; padding: 22px 20px 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: popIn .3s cubic-bezier(.2, 1.2, .35, 1);
}
@keyframes popIn { from { transform: scale(.85) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-x {
  position: absolute; top: 12px; inset-inline-end: 12px; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--chip); cursor: pointer; font-size: 16px; font-weight: 900;
}
.modal-card h2 { margin: 0 0 14px; font-family: var(--title); font-weight: 400; font-size: 34px; line-height: 1.2; padding-inline-end: 40px; }
.modal-card h3 { margin: 18px 0 8px; font-size: 17px; font-weight: 900; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1 1 150px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.help-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.help-item:last-child { border-bottom: 0; }
.help-item b { display: block; font-size: 16px; margin-bottom: 3px; }
.help-item p { margin: 0; line-height: 1.7; color: var(--ink); }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; }
.avatar-grid button {
  aspect-ratio: 1; border-radius: 18px; border: 3px solid transparent; background: var(--panel-2);
  font-family: var(--emoji); font-size: 34px; cursor: pointer;
}
.avatar-grid button[aria-pressed="true"] { border-color: var(--accent2); background: var(--chip); }
.avatar-grid button.taken { opacity: .45; }

.lang-big { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lang-big button { padding: 12px 6px; border-radius: 14px; border: 3px solid transparent; background: var(--panel-2); font-weight: 900; font-size: 17px; cursor: pointer; }
.lang-big button[aria-pressed="true"] { border-color: var(--accent2); background: var(--chip); }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-grid button {
  border: 3px solid transparent; border-radius: 16px; padding: 10px; cursor: pointer; background: var(--panel-2);
  font-weight: 800; display: flex; flex-direction: column; gap: 8px; align-items: stretch; color: var(--ink);
}
.theme-grid button[aria-pressed="true"] { border-color: var(--accent2); }
.theme-swatch { height: 40px; border-radius: 10px; display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 5px solid var(--fr); background: var(--pl); gap: 3px; padding: 3px; }
.theme-swatch i { display: block; border-radius: 4px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent2); height: 28px; }
.slider-row .val { width: 46px; text-align: center; font-weight: 800; color: var(--muted); }

/* win */
.win { text-align: center; }
.win h2 { padding: 0; margin-top: 4px; }
.win-avatar {
  width: 110px; height: 110px; margin: 4px auto 6px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--emoji); font-size: 64px; border: 5px solid #fff;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc) 75%);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--pc) 30%, transparent), 0 14px 30px rgba(0, 0, 0, .3);
  animation: winBounce 1.2s ease-in-out infinite;
}
@keyframes winBounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 18px 0 6px; direction: ltr; }
.podium .step { width: 31%; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium .pa {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-family: var(--emoji); font-size: 30px;
  border: 3px solid #fff; background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc) 75%); box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}
.podium .nm { font-weight: 900; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .block { width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center; color: #fff; font-family: var(--title); font-size: 34px; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.podium .r1 .block { height: 112px; background: linear-gradient(#ffe066, #e9a300); }
.podium .r2 .block { height: 82px; background: linear-gradient(#e9eef5, #9aa6b8); }
.podium .r3 .block { height: 62px; background: linear-gradient(#f0b27a, #b86b2c); }
.table-wrap { overflow-x: auto; }
table.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stats th { font-size: 12.5px; color: var(--muted); font-weight: 800; padding: 6px 4px; white-space: nowrap; }
table.stats td { padding: 8px 4px; border-top: 1px dashed var(--line); font-weight: 700; white-space: nowrap; }
table.stats td:first-child { text-align: start; }
table.stats .em { font-family: var(--emoji); }

/* ---------- online room ---------- */
#lobby-body { padding-bottom: 16px; }
.lobby-chat-wrap { padding-top: 0; }
.room-top { display: flex; gap: 16px; align-items: center; }
.room-qr { flex: none; width: 150px; padding: 6px; background: #fff; border-radius: 16px; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.room-qr svg { display: block; width: 100%; height: auto; }
.room-info { min-width: 0; }
.room-label { font-weight: 800; color: var(--muted); font-size: 14px; }
.room-code { font-family: var(--title); font-size: 64px; line-height: 1; letter-spacing: 4px; color: var(--accent); text-shadow: 0 3px 0 var(--accent-dark); margin: 4px 0 6px; }
.room-info p { margin: 0; line-height: 1.6; font-size: 14px; }
.room-link {
  margin-top: 12px; padding: 8px 12px; border-radius: 12px; background: var(--chip); color: var(--muted);
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; text-align: left;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.seg.vis button { display: flex; flex-direction: column; gap: 2px; align-items: center; padding: 10px 8px; }
.seg.vis small { font-weight: 600; font-size: 12px; opacity: .85; }
.lseats { display: flex; flex-direction: column; gap: 8px; }
.lseat {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 16px; background: var(--panel-2); border-inline-start: 6px solid var(--pc);
}
.lseat.me { box-shadow: 0 0 0 2px var(--pc) inset; }
.lname { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.lname b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.tag.host { background: #ffe9a8; color: #6b4b00; }
.pres { width: 12px; height: 12px; border-radius: 50%; background: #b9b9b9; box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.pres.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
.icon-mini.edit { background: var(--chip); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip-l { border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); border-radius: 99px; padding: 7px 13px; font-weight: 800; cursor: pointer; }
.chip-l.on { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.chip-l .ico { font-family: var(--emoji); }
/* guests see the room's settings read-only: chosen options stay clear, the rest fades */
.room-cfg .seg button:disabled, .room-cfg .board-pick button:disabled { opacity: 1; cursor: default; }
.room-cfg .seg button:disabled:not([aria-pressed="true"]), .room-cfg .board-pick button:disabled:not([aria-pressed="true"]) { opacity: .4; }
.room-cfg .toggle:disabled { opacity: 1; cursor: default; }
.room-cfg .toggle:disabled[aria-checked="false"] { opacity: .55; }
.wait-pill {
  pointer-events: auto; padding: 14px 22px; border-radius: 99px; background: var(--panel); color: var(--ink);
  font-weight: 800; box-shadow: var(--shadow); text-align: center;
}
.public-list { display: flex; flex-direction: column; gap: 8px; }
.pub-room {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 4px 12px; align-items: center; text-align: start;
  padding: 10px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
}
.pub-room:hover { border-color: var(--accent2); }
.pub-room b { font-family: var(--title); font-size: 26px; font-weight: 400; color: var(--accent); }
.pub-room span:nth-child(4) { grid-column: 2 / 4; font-size: 13px; color: var(--muted); }
.pub-room .go { grid-row: 1 / 3; grid-column: 4; font-weight: 900; color: var(--accent2); }
.pub-room .pav { grid-row: 1 / 3; }
.join-row { display: flex; gap: 8px; }
.join-row input, .text-in {
  flex: 1; min-width: 0; font: inherit; font-weight: 900; font-size: 20px; padding: 10px 12px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--panel); color: var(--ink);
}
.join-row input { letter-spacing: 4px; text-transform: uppercase; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.text-in { width: 100%; font-weight: 700; font-size: 17px; }

/* chat */
.chat-card { padding: 14px; }
.chat-card h3 { margin-bottom: 8px; }
.chat-list { max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 6px; }
.chat-item { display: flex; gap: 8px; align-items: flex-end; }
.chat-item.mine { flex-direction: row-reverse; }
.cav {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--emoji); font-size: 17px;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pc) 80%);
}
.cbubble {
  max-width: 78%; padding: 7px 11px; border-radius: 16px; background: var(--panel-2); border: 2px solid color-mix(in srgb, var(--pc) 35%, transparent);
  display: flex; flex-direction: column; gap: 2px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere;
}
.chat-item.mine .cbubble { background: color-mix(in srgb, var(--pc) 16%, var(--panel)); }
.cbubble b { font-size: 12px; color: var(--muted); }
.cbubble .q { font-size: 18px; font-weight: 800; }
.voice-btn { border: 0; border-radius: 99px; padding: 6px 12px; background: var(--accent2); color: #fff; font-weight: 800; cursor: pointer; }
.quick-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.qbtn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); border-radius: 99px;
  padding: 5px 10px; font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.qbtn:active { transform: scale(.94); }
.chat-form { display: flex; gap: 6px; }
.chat-input { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); }
.mic { touch-action: none; -webkit-user-select: none; user-select: none; }
.mic.rec { background: #e53950; color: #fff; animation: pulse 0.9s ease-in-out infinite; }

/* settings: songs */
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.track-grid button {
  display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 14px; border: 3px solid transparent;
  background: var(--panel-2); color: var(--ink); font-weight: 800; font-size: 14px; cursor: pointer; text-align: start;
}
.track-grid button[aria-pressed="true"] { border-color: var(--accent2); background: var(--chip); }
.track-grid .ico { font-family: var(--emoji); font-size: 20px; }

.net-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 8px 16px; border-radius: 99px; background: #e53950; color: #fff; font-weight: 800; box-shadow: var(--shadow);
}
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 70; max-width: min(520px, 92vw);
  padding: 10px 18px; border-radius: 16px; background: rgba(20, 24, 40, .92); color: #fff; font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); text-align: center; overflow-wrap: anywhere;
}
.toast.show { animation: popIn .25s ease-out; }

/* ---------- responsive ---------- */
/* phones held sideways: board and panel side by side, compact panel */
@media (max-height: 540px) and (min-aspect-ratio: 1/1) {
  .topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 4px; gap: 6px; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  .bar-title { font-size: 20px; }
  .lang-switch button { padding: 4px 8px; min-width: 32px; font-size: 13px; }
  .game-main { grid-template-columns: minmax(0, 1fr) minmax(230px, 300px); gap: 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  #side, #panel { gap: 8px; }
  .turn-card { padding: 7px 10px; border-width: 2px; }
  .turn-avatar { width: 40px; height: 40px; font-size: 22px; }
  .turn-name { font-size: 16px; }
  .turn-hint { display: none; }
  .dice-dock { padding: 8px 10px; gap: 10px; border-width: 2px; }
  .btn-roll { font-size: 20px; padding: 11px 8px; }
  .msg { min-height: 40px; font-size: 14px; padding: 8px 12px; }
  .pcard { padding: 5px 10px; }
  .pav { width: 32px; height: 32px; font-size: 18px; }
  .pdots { margin-top: 3px; }
  #board-box { border-radius: 18px; }
}
@media (max-width: 880px) and (max-aspect-ratio: 1/1), (max-aspect-ratio: 5/6) {
  #scr-game { height: auto; min-height: 100dvh; }
  .game-main { grid-template-columns: 1fr; gap: 10px; padding-inline: 10px; padding-bottom: 0; }
  #board-box { height: min(calc(100vw - 20px), 64dvh); border-radius: 22px; }
  #panel { overflow: visible; }
  .players { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
  /* upright phones and tablets: the dock becomes a bar fixed to the bottom of the screen */
  .dice-dock {
    position: sticky; bottom: 0; z-index: 4; margin-inline: -10px;
    border-radius: 24px 24px 0 0; border-width: 3px 0 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .28);
  }
}
@media (max-width: 520px) {
  .topbar { gap: 6px; padding-inline: 10px; }
  .icon-btn { width: 40px; height: 40px; font-size: 18px; }
  .bar-title { font-size: 21px; }
  .game-title { display: none; }
  .hide-narrow { display: none; }
  .lang-switch button { padding: 5px 8px; min-width: 34px; font-size: 13px; }
  .btn-roll { font-size: 23px; padding: 15px 10px; }
  .setup-grid { grid-template-columns: 1fr; padding-inline: 10px; }
  .swatch { width: 28px; height: 28px; }
  .room-top { flex-direction: column; }
  .room-qr { width: 190px; }
  .room-info { text-align: center; }
  .modal-card { padding: 18px 14px 16px; border-radius: 22px; }
  .modal-card h2 { font-size: 28px; }
  .count-grid { grid-template-columns: repeat(3, 1fr); }
  .count-grid .solo { grid-column: span 3; font-size: 16px; }
  /* narrow cards: the name gets the room, the trophy sits in the corner, the dots show the progress */
  .pcard { position: relative; padding: 7px 9px; gap: 8px; grid-template-columns: auto minmax(0, 1fr); }
  .pcard .pbadges { position: absolute; top: 4px; inset-inline-end: 8px; font-size: 14px; }
  .pcard .pbadges small { display: none; }
  .pav { width: 34px; height: 34px; font-size: 19px; }
  .turn-card { padding: 8px 10px; }
  .turn-avatar { width: 46px; height: 46px; font-size: 26px; }
  .turn-name { font-size: 18px; }
  .msg { min-height: 44px; font-size: 15px; padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #decor span, .logo-pawn, .logo-die, .btn-roll.pulse, .win-avatar, .die-tag.tap { animation: none !important; }
}

/* what the magic squares do (setup, room, help) */
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 8px; margin-top: 10px; }
.legend div { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel-2); border-radius: 12px; font-weight: 700; font-size: 14px; line-height: 1.4; }
.legend .ico { font-family: var(--emoji); font-size: 22px; flex: none; }
