@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/manrope-400.ttf") format("truetype");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/manrope-500.ttf") format("truetype");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/manrope-600.ttf") format("truetype");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/manrope-700.ttf") format("truetype");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/manrope-800.ttf") format("truetype");
}

@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/unbounded-600.ttf") format("truetype");
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/unbounded-700.ttf") format("truetype");
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/unbounded-800.ttf") format("truetype");
}

:root {
  color-scheme: dark;
  --font: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --title-font: var(--font);
  --bg: #111719;
  --bg-soft: #172123;
  --panel: #1d2929;
  --panel-2: #243233;
  --tile: #ead2a2;
  --tile-dark: #6c5129;
  --text: #f4efe1;
  --muted: #9fb1aa;
  --line: rgba(244, 239, 225, 0.12);
  --teal: #4fc0ad;
  --amber: #f0ac45;
  --danger: #f07367;
  --ok: #8ddc8a;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  --body-background:
    radial-gradient(circle at 20% 0%, rgba(79, 192, 173, 0.12), transparent 30%),
    linear-gradient(180deg, #111719 0%, #101313 100%);
  --board-background: linear-gradient(180deg, var(--panel) 0%, #192323 100%);
  --input-background: rgba(0, 0, 0, 0.18);
  --tile-face: linear-gradient(180deg, #f2dcaa 0%, #dfbd75 100%);
  --tile-text: #33230e;
  --premium-name-base: var(--amber);
  --premium-name-sheen: #fff0c6;
}

body[data-theme="polar"] {
  color-scheme: dark;
  --font: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
  --title-font: Unbounded, Manrope, ui-sans-serif, system-ui, sans-serif;
  --bg: #060d1f;
  --bg-soft: rgba(20, 38, 72, 0.74);
  --panel: rgba(20, 38, 72, 0.7);
  --panel-2: rgba(30, 55, 100, 0.68);
  --tile: #e0f0ff;
  --tile-dark: #41637e;
  --text: #e8f4ff;
  --muted: #92bad5;
  --line: rgba(160, 210, 255, 0.18);
  --teal: #7dd4fc;
  --amber: #ffb84d;
  --danger: #ff947f;
  --ok: #9ce2cf;
  --shadow: 0 22px 54px rgba(0, 12, 36, 0.45);
  --body-background:
    radial-gradient(ellipse at 30% 8%, rgba(80, 200, 180, 0.28), transparent 38%),
    radial-gradient(ellipse at 70% 0%, rgba(140, 100, 220, 0.22), transparent 42%),
    linear-gradient(180deg, #020810 0%, #060d1f 38%, #0a1a36 78%, #0d2042 100%);
  --board-background: linear-gradient(180deg, rgba(20, 38, 72, 0.82) 0%, rgba(8, 20, 48, 0.86) 100%);
  --input-background: rgba(0, 12, 36, 0.36);
  --tile-face: linear-gradient(180deg, #e0f0ff 0%, #b8d8f0 100%);
  --tile-text: #0a1830;
  --premium-name-base: var(--teal);
  --premium-name-sheen: #e8f8ff;
}

body[data-theme="barbie"] {
  color-scheme: dark;
  --font: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
  --title-font: Unbounded, Manrope, ui-sans-serif, system-ui, sans-serif;
  --bg: #2a0a2a;
  --bg-soft: rgba(80, 18, 58, 0.72);
  --panel: rgba(80, 18, 58, 0.72);
  --panel-2: rgba(120, 28, 82, 0.7);
  --tile: #ffd0e8;
  --tile-dark: #a32c73;
  --text: #ffe8f5;
  --muted: #f3a7ca;
  --line: rgba(255, 130, 200, 0.24);
  --teal: #ff3da8;
  --amber: #ff5dc8;
  --danger: #ff8fca;
  --ok: #ffb1dc;
  --shadow: 0 22px 54px rgba(52, 0, 38, 0.46);
  --body-background:
    radial-gradient(circle at 82% 6%, rgba(255, 93, 200, 0.34), transparent 34%),
    radial-gradient(circle at 0% 88%, rgba(255, 170, 216, 0.26), transparent 38%),
    linear-gradient(180deg, #1a0014 0%, #2a0a2a 34%, #4a1248 68%, #6a1858 100%);
  --board-background: linear-gradient(180deg, rgba(92, 20, 68, 0.84) 0%, rgba(62, 10, 50, 0.88) 100%);
  --input-background: rgba(40, 0, 32, 0.34);
  --tile-face: linear-gradient(180deg, #ffd0e8 0%, #ff8ec8 100%);
  --tile-text: #5a0a3a;
  --premium-name-base: var(--amber);
  --premium-name-sheen: #ffe6f5;
}

body[data-theme="storm"] {
  color-scheme: dark;
  --font: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
  --title-font: Unbounded, Manrope, ui-sans-serif, system-ui, sans-serif;
  --bg: #0a1828;
  --bg-soft: rgba(15, 30, 55, 0.74);
  --panel: rgba(12, 25, 52, 0.80);
  --panel-2: rgba(18, 38, 75, 0.70);
  --tile: rgba(200, 228, 255, 0.10);
  --tile-dark: #3a6080;
  --text: #daeeff;
  --muted: #7aa8cc;
  --line: rgba(140, 200, 255, 0.18);
  --teal: #a8d4ff;
  --amber: #7da0c8;
  --danger: #ff8a80;
  --ok: #7adfc8;
  --shadow: 0 22px 54px rgba(0, 10, 28, 0.52);
  --body-background: linear-gradient(180deg, #060e1c 0%, #0a1828 38%, #0d2038 78%, #0a1828 100%);
  --board-background: linear-gradient(180deg, rgba(10, 22, 46, 0.88) 0%, rgba(6, 14, 32, 0.92) 100%);
  --input-background: rgba(0, 8, 22, 0.42);
  --tile-face: linear-gradient(180deg, #c8e0f8 0%, #9abfe8 100%);
  --tile-text: #060f22;
  --premium-name-base: var(--teal);
  --premium-name-sheen: #e0f0ff;
}
body[data-theme="storm"] .primary {
  background: var(--teal);
  color: #0a1828;
}
body[data-theme="storm"] .quest-streak-dot.premium {
  background: var(--teal);
  color: #0a1828;
}
body[data-theme="storm"] .dictionary-state {
  background: rgba(168, 212, 255, 0.12);
  color: var(--teal);
}
body[data-theme="storm"] .shop-item > strong {
  color: var(--teal);
}
body[data-theme="storm"] .hint-ghost {
  color: #d8ecff;
  opacity: 0.78;
  text-shadow: 0 0 10px rgba(168, 212, 255, 0.42);
}
/* Storm: Найдено — слова-чипы */
body[data-theme="storm"] .word-list li {
  background: rgba(168, 212, 255, 0.12);
  color: var(--teal);
}
/* Storm: Не найдено — строки без фона */
body[data-theme="storm"] .missed-list li {
  background: transparent;
  color: #f0b8b8;
}

body[data-theme="comic"] {
  color-scheme: light;
  --font: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
  --title-font: Unbounded, Manrope, ui-sans-serif, system-ui, sans-serif;
  --bg: #fff5d6;
  --bg-soft: rgba(255, 238, 175, 0.88);
  --panel: rgba(255, 255, 255, 0.97);
  --panel-2: rgba(255, 255, 255, 0.92);
  --tile: rgba(26, 26, 26, 0.08);
  --tile-dark: #1a1a1a;
  --text: #1a1a1a;
  --muted: #555;
  --line: rgba(26, 26, 26, 0.18);
  --teal: #2548c4;
  --amber: #ffd800;
  --danger: #cc2028;
  --ok: #1a7a30;
  --shadow: 0 4px 0 #1a1a1a, 0 6px 20px rgba(0, 0, 0, 0.18);
  --body-background: linear-gradient(180deg, #fff5d6 0%, #ffe8b0 100%);
  --board-background: rgba(255, 255, 255, 0.97);
  --input-background: rgba(255, 255, 255, 0.85);
  --tile-face: linear-gradient(180deg, #ffffff 0%, #f2f2f2 100%);
  --tile-text: #1a1a1a;
  --premium-name-base: #e8323a;
  --premium-name-sheen: #ff9090;
}
body[data-theme="comic"] .quest-streak-dot.premium {
  background: #e8323a;
  color: #fff;
}
body[data-theme="comic"] .dictionary-state {
  background: rgba(37, 72, 196, 0.08);
  color: var(--teal);
}
body[data-theme="comic"] .shop-item > strong {
  color: #e8323a;
}
body[data-theme="comic"] .board {
  border: 2.5px solid #1a1a1a;
}
body[data-theme="comic"] .input-tray {
  background: rgba(210, 210, 210, 0.70);
  border: 1.5px dashed rgba(26, 26, 26, 0.32);
}
body[data-theme="comic"] .panel {
  border: 1.5px solid rgba(26, 26, 26, 0.38);
}
body[data-theme="comic"] .mode-tabs {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #1a1a1a;
}
body[data-theme="comic"] .tab.active {
  color: #ffffff;
}
body[data-theme="comic"] .primary {
  background: #e8323a;
  color: #ffffff;
  border: 2.5px solid #1a1a1a;
  box-shadow: 2px 3px 0 #1a1a1a;
}
body[data-theme="comic"] .secondary {
  background: rgba(255, 255, 255, 0.80);
  border: 1.5px solid #1a1a1a;
  box-shadow: none;
}
body[data-theme="comic"] .panel {
  background: rgba(255, 255, 255, 0.97);
}
body[data-theme="comic"] .icon-action span {
  color: #1a1a1a;
}
body[data-theme="comic"] .quest-claim-btn,
body[data-theme="comic"] .quest-all-done-claim {
  color: #ffffff;
}
body[data-theme="comic"] .tile,
body[data-theme="comic"] .turn-cell,
body[data-theme="comic"] .hand-tile {
  box-shadow: 0 0 0 1.5px rgba(26, 26, 26, 0.40), 3px 4px 0 #1a1a1a;
}
body[data-theme="comic"] .turn-cell.ai-last.filled {
  box-shadow: 0 0 0 1.5px rgba(26, 26, 26, 0.40), 3px 4px 0 #1a1a1a;
}
body[data-theme="comic"] .turn-cell.anchor {
  box-shadow: 0 0 0 1.5px rgba(26, 26, 26, 0.40), 3px 4px 0 #1a1a1a, inset 0 0 0 2.5px #ffd800;
}
body[data-theme="comic"] .quest-streak {
  background: rgba(255, 255, 255, 0.97);
  border: 1.5px solid rgba(26, 26, 26, 0.30);
}
body[data-theme="comic"] .quest-list {
  background: rgba(255, 255, 255, 0.97);
  border: 1.5px solid rgba(26, 26, 26, 0.30);
}
body[data-theme="comic"] .quest-streak-claim {
  color: #ffffff;
}
body[data-theme="comic"] .feedback,
body[data-theme="comic"] .feedback.bad,
body[data-theme="comic"] .feedback.good {
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(26, 26, 26, 0.30);
  color: #1a1a1a;
}
body[data-theme="comic"] .stars-button {
  border: 1.5px solid rgba(26, 26, 26, 0.35);
  box-shadow: none;
}
body[data-theme="comic"] .leaderboard-tabs {
  border: 1.5px solid rgba(26, 26, 26, 0.30);
}
body[data-theme="comic"] .leaderboard-tab.active {
  color: #ffffff;
}
/* Comic: Найдено — слова-чипы */
body[data-theme="comic"] .word-list li {
  background: rgba(26, 26, 26, 0.08);
  color: #1a1a1a;
}
body[data-theme="comic"] #foundWords li.solution-active {
  background: rgba(37, 72, 196, 0.12);
  outline-color: rgba(37, 72, 196, 0.30);
}
/* Comic: Можно было — список слов */
body[data-theme="comic"] .solutions-list li {
  color: #1a1a1a;
}
body[data-theme="comic"] .solutions-list li.solution-active {
  background: rgba(37, 72, 196, 0.10);
}
/* Comic: блок определения */
body[data-theme="comic"] .solution-def-block {
  background: rgba(26, 26, 26, 0.05);
  border-color: rgba(26, 26, 26, 0.14);
}
body[data-theme="comic"] .solution-def-block p,
body[data-theme="comic"] .def-group,
body[data-theme="comic"] .def-group ol {
  color: rgba(26, 26, 26, 0.72);
}
body[data-theme="comic"] .def-group-name {
  color: rgba(26, 26, 26, 0.42);
}
body[data-theme="comic"] .def-flag-btn {
  color: rgba(26, 26, 26, 0.35);
}
body[data-theme="comic"] .def-flag-btn:hover {
  color: rgba(26, 26, 26, 0.65);
}
body[data-theme="comic"] .missing-def-btn {
  color: rgba(26, 26, 26, 0.40);
}
body[data-theme="comic"] .missing-def-btn:hover {
  color: rgba(26, 26, 26, 0.70);
}
body[data-theme="comic"] .missing-def-btn:disabled {
  color: rgba(26, 26, 26, 0.30);
}
/* Comic: Не найдено */
body[data-theme="comic"] .missed-list li {
  background: transparent;
  color: #cc2028;
  border-bottom-color: rgba(204, 32, 40, 0.18);
}

* {
  box-sizing: border-box;
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--body-background);
  background-size: auto, auto, auto;
  background-position: top center, top left, top left;
  background-attachment: fixed, scroll, scroll;
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
}

body::before {
  opacity: 0;
}

body[data-theme="polar"]::before {
  opacity: 0;
  background-image:
    radial-gradient(circle, rgba(232, 244, 255, 0.62) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(184, 224, 255, 0.44) 0 1.4px, transparent 2.5px),
    radial-gradient(ellipse at 50% 100%, rgba(100, 180, 255, 0.14), transparent 58%);
  background-size: 54px 78px, 94px 128px, 100% 100%;
  animation: polar-dust 18s linear infinite;
}

body[data-theme="polar"]::after {
  background:
    radial-gradient(circle at 78% 11%, rgba(244, 248, 255, 0.72) 0 18px, rgba(208, 224, 240, 0.18) 19px 36px, transparent 37px),
    radial-gradient(ellipse at 50% 0%, rgba(56, 130, 240, 0.18) 0%, rgba(30, 80, 180, 0.08) 52%, transparent 76%),
    linear-gradient(180deg, transparent 0%, rgba(100, 160, 255, 0.08) 72%, rgba(80, 130, 220, 0.14) 100%);
  animation: polar-aurora 12s ease-in-out infinite;
}

body[data-theme="barbie"]::before {
  opacity: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 128, 204, 0.72) 0 1.4px, transparent 2.5px);
  background-size: 64px 84px, 92px 118px;
  animation: barbie-glitter 5.2s ease-in-out infinite;
}

body[data-theme="barbie"]::after {
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 61, 168, 0.12), transparent 22%),
    radial-gradient(circle at 80% 36%, rgba(255, 130, 200, 0.1), transparent 28%),
    radial-gradient(circle at 40% 76%, rgba(200, 0, 150, 0.1), transparent 26%),
    radial-gradient(ellipse at 50% 0%, rgba(255, 61, 168, 0.22) 0%, rgba(180, 0, 120, 0.08) 56%, transparent 78%),
    linear-gradient(0deg, rgba(255, 61, 168, 0.08) 0%, transparent 24%);
  animation: barbie-float 8s ease-in-out infinite;
}

@keyframes polar-dust {
  from { background-position: 12px -120px, 24px -180px, center; }
  to { background-position: 42px 720px, -18px 920px, center; }
}

@keyframes polar-aurora {
  0%, 100% { transform: translateX(-18px); opacity: 0.72; }
  50% { transform: translateX(18px); opacity: 1; }
}

@keyframes barbie-glitter {
  0%, 100% { opacity: 0.54; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(1.02); }
}

@keyframes barbie-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

@keyframes iceGlow {
  0%, 100% { opacity: 0.10; }
  50% { opacity: 0.22; }
}

@keyframes moonGlow {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.80; }
}

@keyframes fogFloat {
  0%, 100% { opacity: 0.18; transform: translateX(0) scaleX(1); }
  50% { opacity: 0.28; transform: translateX(-18px) scaleX(1.04); }
}

@keyframes warmGlow {
  0%, 100% { opacity: 0.14; }
  50% { opacity: 0.26; }
}

@keyframes raindrop {
  0%   { transform: translateY(-30px); opacity: 0; }
  8%   { opacity: 0.85; }
  92%  { opacity: 0.6; }
  100% { transform: translateY(110vh); opacity: 0; }
}
@keyframes dropTrail {
  0%   { transform: translateY(0) scaleY(0); opacity: 0; }
  30%  { transform: translateY(150px) scaleY(1); opacity: 0.4; }
  100% { transform: translateY(110vh) scaleY(0.4); opacity: 0; }
}
@keyframes lightningFlash {
  0%, 88%, 100% { opacity: 0; }
  89%, 92%      { opacity: 0.85; }
  90%, 91%      { opacity: 0.2; }
}

@keyframes swatchStormFlash {
  0%, 81%   { opacity: 0; }
  82%       { opacity: 0.95; }
  84%       { opacity: 0; }
  86%       { opacity: 0.50; }
  87.5%     { opacity: 0; }
  100%      { opacity: 0; }
}

@keyframes comicBurstPop {
  0%   { transform: scale(0)    rotate(var(--rot, 0deg)); opacity: 0; }
  15%  { transform: scale(1.2)  rotate(calc(var(--rot, 0deg) + 5deg)); opacity: 1; }
  25%  { transform: scale(0.95) rotate(var(--rot, 0deg)); }
  70%  { transform: scale(1)    rotate(var(--rot, 0deg)); opacity: 1; }
  100% { transform: scale(1.05) rotate(var(--rot, 0deg)); opacity: 0; }
}
@keyframes halftoneShift {
  0%   { background-position: 0 0; }
  100% { background-position: 14px 14px; }
}

.theme-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
}

.theme-snow {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: -18px;
  width: var(--size);
  height: var(--size);
  opacity: var(--opacity);
  filter: drop-shadow(0 0 4px rgba(180, 220, 255, 0.72));
  animation: theme-snowfall var(--dur) linear var(--delay) infinite;
}

.theme-snow::before,
.theme-snow::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 100%;
  height: 1px;
  background: rgba(210, 235, 255, 0.9);
  border-radius: 999px;
  transform-origin: left center;
}

.theme-snow::before {
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(210, 235, 255, 0.1);
}

.theme-snow::after {
  transform: translate(-50%, -50%) rotate(90deg);
  box-shadow:
    0 0 0 1px rgba(210, 235, 255, 0.1),
    0 0 0 999px transparent;
}

.theme-snow {
  background:
    linear-gradient(45deg, transparent calc(50% - 0.5px), rgba(210, 235, 255, 0.82) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(-45deg, transparent calc(50% - 0.5px), rgba(210, 235, 255, 0.82) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

.theme-snow-small {
  filter: drop-shadow(0 0 3px rgba(180, 220, 255, 0.55));
}

@keyframes theme-snowfall {
  0% { transform: translate3d(0, -20px, 0) rotate(0deg); opacity: 0; }
  8% { opacity: var(--opacity); }
  92% { opacity: calc(var(--opacity) * 0.78); }
  100% { transform: translate3d(var(--drift), 840px, 0) rotate(300deg); opacity: 0; }
}

.theme-heart {
  position: absolute;
  left: calc(var(--x) * 1%);
  bottom: -28px;
  font-size: var(--size);
  line-height: 1;
  opacity: var(--opacity);
  filter: blur(0.3px);
  animation: theme-heartrise var(--dur) ease-out var(--delay) infinite;
}

.theme-heart::before {
  content: "♥";
  color: #ff80cc;
  text-shadow: 0 0 12px rgba(255, 93, 200, 0.48);
}

.theme-glitter {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #ffb3e0;
  box-shadow: 0 0 9px rgba(255, 179, 224, 0.72);
  opacity: 0.54;
  animation: theme-glitter var(--dur) ease-in-out var(--delay) infinite;
}

@keyframes theme-heartfall {
  0% { transform: translate3d(0, -24px, 0) rotate(0deg); opacity: 0; }
  8% { opacity: var(--opacity); }
  92% { opacity: calc(var(--opacity) * 0.7); }
  100% { transform: translate3d(42px, 840px, 0) rotate(420deg); opacity: 0; }
}

@keyframes theme-heartrise {
  0% { transform: translate3d(0, 0, 0) rotate(-10deg) scale(0.8); opacity: 0; }
  10% { opacity: var(--opacity); }
  88% { opacity: calc(var(--opacity) * 0.6); }
  100% { transform: translate3d(30px, -880px, 0) rotate(25deg) scale(1.1); opacity: 0; }
}

@keyframes theme-glitter {
  0%, 100% { opacity: 0.14; transform: scale(0.8); }
  50% { opacity: 0.62; transform: scale(1.25); }
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  min-height: 100vh; /* fallback для iOS < 15.4 и старых WebView */
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.topbar,
.score-strip,
.panel,
.board,
.mode-tabs,
.feedback,
.bottom-actions {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.brand {
  margin: 0;
  font-size: 28px;
  font-family: var(--title-font);
  font-weight: 850;
  line-height: 1;
}

.player {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stars-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  justify-content: center;
  padding: 9px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.stars-button.disabled {
  opacity: 0.45;
}

.shop-gear {
  width: 20px;
  height: 20px;
  fill: none;
  color: var(--muted);
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-icon {
  width: 20px;
  height: 20px;
  fill: none;
  color: var(--muted);
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stars-button strong {
  min-width: 1ch;
  color: var(--amber);
  white-space: nowrap;
}

.stars-button strong:empty {
  display: none;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0 14px;
  padding: 4px;
  background: color-mix(in srgb, var(--panel-2) 62%, transparent);
  border-radius: 8px;
}

.tab {
  min-height: 36px;
  min-width: 0;
  padding: 0 5px;
  border-radius: 6px;
  background: transparent;
  color: color-mix(in srgb, var(--text) 60%, var(--muted));
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.tab.active {
  background: var(--teal);
  color: color-mix(in srgb, var(--bg) 16%, #09211c);
}

.tab:not(.active):disabled {
  opacity: 0.48;
}

.score-strip.score-strip-hidden {
  display: none;
  margin-bottom: 0;
}

body[data-mode="solo"] .score-strip,
body[data-mode="turn"] .score-strip,
body[data-mode="quiz"] .score-strip {
  display: none !important;
  margin-bottom: 0;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.score-strip.turn-score-strip {
  grid-template-columns: 0.72fr minmax(0, 1.34fr) minmax(82px, 0.82fr);
}

.score-strip div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.score-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.score-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-strip .wide-score strong {
  font-size: clamp(19px, 5vw, 24px);
  text-align: center;
}

.score-strip .turn-score-own,
.score-strip .turn-score-opponent,
.score-strip .turn-score-separator {
  color: var(--text);
  opacity: 0.4;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.score-strip .turn-score-own.active,
.score-strip .turn-score-opponent.active {
  opacity: 1;
}

.score-strip .turn-score-separator {
  opacity: 0.34;
}

.score-strip .wide-score {
  text-align: center;
}

.board {
  margin-top: 12px;
  padding: 14px;
  background: var(--board-background);
  background-size: auto, auto, 28px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-tray {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 7px 8px 7px 14px;
  border: 1px solid rgba(234, 210, 162, 0.18);
  border-radius: 8px;
  background: var(--input-background);
  background-size: auto, auto, 24px 24px;
  position: relative;
  overflow: hidden;
}

.input-tray::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  border-radius: inherit;
  pointer-events: none;
  transform: scaleX(var(--timer-scale, 0));
  transform-origin: left center;
  transition: transform 0.26s linear;
  will-change: transform;
}

.input-tray > * {
  position: relative;
  z-index: 1;
}

#currentWord {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 24px;
  font-weight: 850;
  color: var(--tile);
}

#currentWord.hint-slots {
  flex: 1;
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.8vw, 9px);
  overflow-x: auto;
  overflow-y: hidden;
  overflow-wrap: normal;
  scrollbar-width: none;
}

#currentWord.hint-slots::-webkit-scrollbar {
  display: none;
}

.hint-slot {
  width: clamp(30px, 9vw, 42px);
  min-width: clamp(30px, 9vw, 42px);
  height: clamp(30px, 9vw, 42px);
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.selected-letter {
  border-radius: 8px;
  background: var(--tile-face);
  box-shadow: 0 3px 0 var(--tile-dark), 0 8px 18px rgba(0, 0, 0, 0.18);
  color: var(--tile-text);
}

.hint-letter {
  border-radius: 8px;
  background: var(--tile-face);
  box-shadow: 0 3px 0 var(--tile-dark), 0 8px 18px rgba(0, 0, 0, 0.18);
  color: var(--tile-text);
  opacity: 0.7;
}

.hint-ghost {
  color: var(--tile);
  font-size: 13px;
  opacity: 0.35;
}

.ghost-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin: 18px 0;
}

.tile,
.turn-cell,
.hand-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border-radius: 8px;
  background: var(--tile-face);
  color: var(--tile-text);
  box-shadow: 0 5px 0 var(--tile-dark), 0 12px 24px rgba(0, 0, 0, 0.25);
  font-size: clamp(19px, 6.4vw, 30px);
  font-weight: 900;
  line-height: 1;
  padding-top: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.selected-letter-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.turn-board {
  display: grid;
  gap: 12px;
  margin-bottom: 4px;
}

.turn-board.preview {
  pointer-events: none;
}

.turn-board.preview .turn-start-panel {
  pointer-events: auto;
}

.turn-grid-wrap {
  overflow: hidden;
  width: min(100%, 420px);
  margin: 0 auto;
}

.turn-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  transition: transform 0.22s ease;
  transform-origin: center center;
  pointer-events: auto;
}

.turn-grid.zoomed { transform: scale(1.32); gap: 3.8px; }
.turn-grid[data-size="11"].zoomed { transform: scale(1.66); gap: 3px; }

.turn-grid[data-size="9"] .turn-cell { font-size: clamp(11px, 3.8vw, 18px); }
.turn-grid[data-size="11"] .turn-cell { font-size: clamp(9px, 3.0vw, 14px); }

.turn-start-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 6px 0 0;
}

.turn-start-btns {
  display: flex;
  gap: 8px;
}

.turn-start-btns button {
  flex: 1;
  min-height: 44px;
}

.turn-size-picker {
  display: flex;
  gap: 7px;
  justify-content: center;
  pointer-events: auto;
}

.turn-size-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(244, 239, 225, 0.18);
  background: color-mix(in srgb, var(--bg-soft) 80%, #172123);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  opacity: 0.7;
}

.turn-size-btn.active {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 18%, var(--bg-soft));
  opacity: 1;
}


.turn-star-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1.5px solid rgba(244, 239, 225, 0.18);
  background: color-mix(in srgb, var(--bg-soft) 80%, #172123);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.55;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.turn-star-toggle.active {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 18%, var(--bg-soft));
  opacity: 1;
}

.hand-tile.wildcard {
  color: var(--tile-text);
  font-size: 30px;
}
.hand-tile.wildcard.selected {
  outline: 3px solid var(--teal);
  transform: translateY(-3px);
}

.turn-cell.wildcard.filled:not(.pending),
.turn-cell.wildcard.pending {
  color: var(--tile-text);
  font-size: 1.5em;
}


.turn-cell.ai-last.filled {
  box-shadow: inset 0 0 0 1.5px rgba(244, 239, 225, 0.35);
}

@keyframes turn-cell-drop-in {
  0%   { transform: translateY(-14px) scale(0.8);  opacity: 0; }
  50%  { transform: translateY(4px)   scale(1.13); opacity: 1; }
  70%  { transform: translateY(-3px)  scale(0.95); }
  88%  { transform: translateY(2px)   scale(1.04); }
  100% { transform: translateY(0)     scale(1);    }
}

.turn-cell.ai-flip {
  animation: turn-cell-drop-in 440ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .turn-cell.ai-flip { animation: none; }
}

.tile-return-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--tile-face);
  color: var(--tile-text);
  font-weight: 900;
  line-height: 1;
  padding-top: 0.08em;
  text-transform: uppercase;
  transform: scale(1.15);
}

@keyframes tile-ghost-fly {
  0%   { transform: scale(1.15);                    opacity: 1; }
  20%  { transform: translateY(-18px) scale(1.2);   opacity: 1; }
  65%  { transform: translateY(-6px)  scale(1.05);  opacity: 1; }
  88%  { transform: translateY(0)     scale(0.95);  opacity: 0.7; }
  100% { transform: translateY(0)     scale(0.8);   opacity: 0; }
}

.tile-return-ghost.flying {
  transition:
    left 420ms cubic-bezier(0.4, 0, 0.6, 1),
    top  420ms cubic-bezier(0.4, 0, 0.6, 1),
    width 420ms,
    height 420ms,
    font-size 420ms;
  animation: tile-ghost-fly 420ms ease-in-out both;
}

.turn-cell {
  border: 1px solid rgba(244, 239, 225, 0.1);
  background: color-mix(in srgb, var(--bg-soft) 88%, #172123);
  box-shadow: inset 0 0 0 1px rgba(79, 192, 173, 0.08);
  font-size: clamp(16px, 5.5vw, 28px);
}

.turn-cell.filled {
  border: 0;
  background: var(--tile-face);
  box-shadow: 0 3px 0 var(--tile-dark), 0 8px 18px rgba(0, 0, 0, 0.2);
}

.turn-cell.pending {
  outline: 2px solid var(--teal);
}

.turn-cell.anchor {
  box-shadow: inset 0 0 0 2.5px rgba(240, 172, 69, 0.85);
}

.turn-cell.anchor.filled {
  box-shadow: 0 3px 0 var(--tile-dark), 0 8px 18px rgba(0, 0, 0, 0.2), inset 0 0 0 2.5px rgba(240, 172, 69, 0.75);
}

.turn-cell.preview-cell,
.hand-tile.preview-cell {
  opacity: 0.5;
  filter: saturate(0.78);
}

.hand-tile.preview-hand-tile {
  opacity: 1;
  filter: none;
}

.turn-cell.preview-cell:not(.filled) {
  background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
}

.turn-hand {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  width: min(100%, 420px);
  margin: 10px auto 8px;
}

.hand-tile {
  font-size: clamp(18px, 6vw, 30px);
  box-shadow: 0 3px 0 var(--tile-dark), 0 8px 18px rgba(0, 0, 0, 0.2);
}

.hand-tile.selected {
  outline: 3px solid var(--teal);
  transform: translateY(-3px);
}

.hand-tile.used {
  opacity: 0.34;
  transform: translateY(4px);
}

.tile.used {
  opacity: 0.36;
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--tile-dark);
}

.shuffle-animate > * {
  animation: tile-shuffle 520ms cubic-bezier(.2,.8,.2,1);
}

.shuffle-animate > *:nth-child(2n) {
  animation-direction: reverse;
}

@keyframes tile-shuffle {
  0% { transform: translateX(0) rotate(0); }
  35% { transform: translateX(16px) translateY(-4px) rotate(7deg); }
  70% { transform: translateX(-13px) translateY(3px) rotate(-5deg); }
  100% { transform: translateX(0) rotate(0); }
}

.tile:disabled {
  cursor: default;
  filter: grayscale(0.2);
  opacity: 0.58;
  transform: none;
  box-shadow: 0 2px 0 var(--tile-dark);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.primary,
.secondary,
.wide {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 820;
}

#hintButton,
.icon-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-action {
  gap: 4px;
}

.icon-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action span {
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  color: var(--amber);
  pointer-events: none;
}

.icon-action span.is-infinite {
  display: none;
}

.primary {
  background: var(--amber);
  color: #211405;
}

.primary.soft-disabled {
  opacity: 0.55;
  filter: grayscale(0.25);
}

/* Cooldown после истечения таймера раунда */
.submit-cooldown {
  position: relative;
  overflow: hidden;
}
.submit-cooldown::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  transform-origin: left center;
  animation: cooldown-drain var(--cooldown-ms, 1500ms) linear forwards;
  border-radius: inherit;
  pointer-events: none;
}
@keyframes cooldown-drain {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.primary.quiet-finish {
  background: rgba(245,241,224,0.08);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(245,241,224,0.14);
}

.primary.quiet-finish:hover {
  background: rgba(245,241,224,0.12);
  color: var(--text);
}

.secondary {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.feedback {
  white-space: pre-line;
  min-height: 42px;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  color: color-mix(in srgb, var(--teal) 28%, var(--text));
  font-size: 14px;
}

.feedback.bad {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: color-mix(in srgb, var(--danger) 46%, var(--text));
}

.feedback.good {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: color-mix(in srgb, var(--ok) 42%, var(--text));
}

.feedback .reward-part {
  vertical-align: -1px;
}

.feedback a {
  color: var(--tile);
  font-weight: 850;
  text-decoration: none;
}

.feedback a:hover {
  text-decoration: underline;
}

.feedback:has(.hurry-ai-btn) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hurry-ai-btn {
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
  color: currentColor;
  font: inherit;
  font-size: 0.78em;
  font-weight: 400;
  opacity: 0.45;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.hurry-ai-btn:active {
  opacity: 0.8;
}

.next-goal {
  color: color-mix(in srgb, var(--teal) 42%, var(--text));
}

.panel-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.share-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--teal) 52%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--teal) 12%, var(--panel));
}

.share-panel-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.share-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.share-hint {
  color: var(--teal);
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
}

.share-panel-btns {
  display: flex;
  gap: 8px;
}

.share-ai-btn {
  flex: 1;
  padding: 9px 11px;
  border-radius: 7px;
  border: 1.5px solid rgba(244, 239, 225, 0.18);
  background: color-mix(in srgb, var(--bg-soft) 80%, #172123);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.share-ai-btn:active { opacity: 0.65; }

.share-panel a {
  flex: 1;
  padding: 9px 11px;
  border-radius: 7px;
  background: var(--teal);
  color: color-mix(in srgb, var(--bg) 16%, #09211c);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.share-panel-disabled {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel-2) 80%, transparent);
}

.share-panel-disabled a,
.share-panel-disabled .share-ai-btn {
  pointer-events: none;
  background: color-mix(in srgb, var(--muted) 30%, transparent);
  color: var(--muted);
  border-color: transparent;
}

.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel h2 {
  margin: 0;
  font-size: 16px;
}

.panel-title span,
.text-button {
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  padding: 0;
  background: transparent;
}

.word-list,
.leaderboard {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 34px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word-list li {
  display: flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(234, 210, 162, 0.12);
  color: var(--tile);
  font-size: 13px;
  font-weight: 760;
}

.word-list button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

.solutions-title {
  margin-top: 14px;
}

#foundPanel.quiz-result .solutions-title {
  margin-top: 0;
}

#foundPanel.quiz-result #foundWords {
  display: none;
}

/* Offline banner — position:fixed чтобы не двигать контент */
.offline-banner {
  background: #c0392b;
  color: #fff;
  text-align: center;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  /* На десктопе центрируем по ширине app-shell */
  max-width: 440px;
  margin: 0 auto;
  border-radius: 0 0 8px 8px;
}

/* Pending (queued) word chips in the found list */
.word-pending {
  opacity: 0.55;
}

.word-pending button {
  cursor: default;
}

.sending-dots {
  display: inline-block;
  width: 1.2em;
  text-align: left;
}

.hidden {
  display: none !important;
}

.solution-def-block {
  margin: 6px 0 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(79, 192, 173, 0.1);
  border: 1px solid rgba(79, 192, 173, 0.18);
}

.solution-def-block p {
  margin: 0;
  color: rgba(200, 238, 231, 0.75);
  font-size: 0.78rem;
  line-height: 1.4;
}

.def-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.def-header p {
  flex: 1;
}
.def-header p:empty {
  display: none;
}
.def-flag-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(200, 238, 231, 0.45);
  cursor: pointer;
  padding: 1px 2px 0;
  line-height: 1;
  transition: color 0.15s;
}
.def-flag-btn:hover {
  color: rgba(200, 238, 231, 0.75);
}
.def-all {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.def-group {
  font-size: 0.75rem;
  color: rgba(200, 238, 231, 0.55);
}

.def-group + .def-group {
  margin-top: 12px;
}

.def-group-name {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(200, 238, 231, 0.35);
  margin-bottom: 2px;
}
.def-group ol {
  margin: 0;
  padding-left: 16px;
  color: rgba(200, 238, 231, 0.65);
  line-height: 1.45;
}
.def-group ol li + li {
  margin-top: 2px;
}
.def-flag-menu {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.def-flag-label {
  font-size: 0.72rem;
  color: rgba(200, 238, 231, 0.45);
  width: 100%;
}
.def-flag-opt {
  background: rgba(200, 238, 231, 0.07);
  border: 1px solid rgba(200, 238, 231, 0.15);
  border-radius: 6px;
  color: rgba(200, 238, 231, 0.7);
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.def-flag-opt:hover {
  background: rgba(200, 238, 231, 0.13);
}
.def-flag-cancel {
  background: none;
  border: none;
  color: rgba(200, 238, 231, 0.3);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 3px 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.def-suggest-form {
  width: 100%;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.def-suggest-text {
  background: rgba(200, 238, 231, 0.07);
  border: 1px solid rgba(200, 238, 231, 0.18);
  border-radius: 6px;
  color: rgba(200, 238, 231, 0.9);
  font-size: 0.72rem;
  padding: 5px 8px;
  resize: none;
  width: 100%;
  box-sizing: border-box;
  min-height: 52px;
  font-family: inherit;
}
.def-suggest-text::placeholder { color: rgba(200, 238, 231, 0.3); }
.def-suggest-submit {
  align-self: flex-end;
  background: rgba(200, 238, 231, 0.12);
  border: 1px solid rgba(200, 238, 231, 0.2);
  border-radius: 6px;
  color: rgba(200, 238, 231, 0.85);
  font-size: 0.72rem;
  padding: 3px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.def-suggest-submit:hover { background: rgba(200, 238, 231, 0.2); }
.def-suggest-submit:disabled { opacity: 0.4; cursor: default; }

.missing-def-btn {
  display: block;
  margin-top: 6px;
  padding: 0;
  background: none;
  border: none;
  color: rgba(200, 238, 231, 0.38);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-style: dotted;
  transition: color 0.15s ease;
}
.def-header .missing-def-btn {
  margin-top: 0;
  margin-right: auto;
  line-height: 1.25;
}
.missing-def-btn:hover {
  color: rgba(200, 238, 231, 0.65);
}
.missing-def-btn:disabled {
  cursor: default;
  text-decoration: none;
  color: rgba(200, 238, 231, 0.5);
}

.solutions-list li {
  background: transparent;
  color: #c8eee7;
  opacity: 0.42;
  transition: opacity 0.18s ease;
  padding: 4px 6px;
}

.solutions-list li.solution-active {
  opacity: 1;
  background: rgba(79, 192, 173, 0.14);
  border-radius: 6px;
}

.solution-word {
  text-align: left;
  width: 100%;
  font-weight: 600;
}

/* В «Найдено» слова — чипы, кнопка не должна растягиваться */
#foundWords .solution-word {
  width: auto;
}

/* Подсветка активного слова в «Найдено» */
#foundWords li.solution-active {
  background: rgba(79, 192, 173, 0.28);
  outline: 1px solid rgba(79, 192, 173, 0.45);
}

/* Variant C: player cards */
.turn-players-container {
  display: grid !important;   /* override .word-list li { display: flex } */
  grid-template-columns: 1fr 1fr;
  align-items: start;
  flex: 0 0 100%;             /* stretch in the .word-list flex container  */
  width: 100%;
  gap: 8px;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.turn-player-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  align-self: start;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.turn-player-col.active {
  border-color: color-mix(in srgb, var(--teal) 55%, transparent);
}

.turn-player-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.turn-player-col.active .turn-player-col-header {
  border-color: color-mix(in srgb, var(--teal) 35%, var(--line));
}

.turn-player-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.turn-player-name {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.turn-player-col.active .turn-player-name {
  color: var(--teal);
}

.turn-player-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.turn-player-score {
  flex: 0 0 auto;
  color: var(--tile);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.turn-player-col.active .turn-player-score {
  color: var(--teal);
}

.turn-word-item {
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--tile);
  padding: 3px 2px;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}
.turn-word-item:hover {
  background: rgba(234, 210, 162, 0.13);
}
.turn-word-item.solution-active {
  background: color-mix(in srgb, var(--teal) 16%, var(--bg-soft));
  color: var(--teal);
}

.turn-word-empty {
  color: var(--muted);
  font-size: 12px;
  background: transparent;
  cursor: default;
  text-align: center;
  padding: 4px 0 2px;
}

.turn-word-skip {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  font-style: italic;
  background: transparent;
  cursor: default;
  padding: 3px 2px;
}

.missed-list li {
  background: transparent;
  color: #f0b8b8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(220, 80, 80, 0.14);
}

/* Виртуализация длинных списков: off-screen элементы пропускают рендер/лейаут.
   contain-intrinsic-size резервирует высоту, чтобы скролл не прыгал. */
.missed-list li,
.analytics-list li {
  content-visibility: auto;
  contain-intrinsic-size: auto 40px;
}

.dictionary-collection-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 96px;
}

.dictionary-result-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.missed-word {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 780;
}

.dispute-btn {
  background: rgba(86, 156, 255, 0.15);
  border: 1px solid rgba(86, 156, 255, 0.34);
  border-radius: 7px;
  color: #9ec5ff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  min-height: 30px;
  max-width: 132px;
  padding: 6px 9px;
  flex-shrink: 0;
  text-transform: lowercase;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.dispute-btn:hover {
  background: rgba(86, 156, 255, 0.23);
  border-color: rgba(86, 156, 255, 0.5);
  color: #c6ddff;
}

.dispute-btn:disabled {
  cursor: default;
}

.dispute-btn.is-sending,
.dispute-btn:disabled {
  background: transparent;
  border-color: transparent;
  color: #dca6ae;
  padding-right: 0;
}

.dispute-status {
  background: transparent !important;
  border: 0 !important;
  flex-shrink: 0;
  color: #dca6ae;
  font-size: 12px;
  font-weight: 850;
  text-align: right;
  text-transform: lowercase;
  white-space: nowrap;
}

.leaderboard {
  display: grid;
}

.leaderboard li {
  display: grid;
  grid-template-columns: 30px 1fr auto auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.leaderboard strong {
  color: var(--text);
}

.leaderboard li.leaderboard-row {
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  column-gap: 6px;
  row-gap: 8px;
}

.leaderboard-row .leaderboard-rank {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

.leaderboard-name {
  align-items: center;
  grid-column: 2;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 0;
  min-width: 0;
  overflow: hidden;
}

.leaderboard-presence {
  justify-self: start;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.leaderboard-presence.is-online {
  background: #37d67a;
  box-shadow: 0 0 0 1px rgba(55, 214, 122, 0.16);
}

body[data-guest="true"] .leaderboard-presence {
  display: none;
}

body[data-guest="true"] .leaderboard-name {
  grid-template-columns: minmax(0, 1fr);
}

.guest-leaderboard-note {
  grid-template-columns: 1fr !important;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.leaderboard-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  grid-column: 4;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  white-space: nowrap;
}

.reward-col {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c9a86a;
  font-size: 10px;
  font-weight: 700;
  min-width: max-content;
  white-space: nowrap;
  text-align: right;
  opacity: 0.85;
}

.reward-part {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}

.reward-part + .reward-part {
  margin-left: 5px;
}

.reward-icon {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  vertical-align: middle;
  margin-bottom: 1px;
  flex-shrink: 0;
}

.reward-hint-svg {
  color: #dcc47d;
}

.reward-shuffle-svg {
  color: #c9a86a;
}

.rank-streak {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
.leaderboard .premium-name,
.premium-name {
  color: var(--premium-name-base);
  background: linear-gradient(90deg, var(--premium-name-base) 0%, var(--premium-name-base) 38%, var(--premium-name-sheen) 50%, var(--premium-name-base) 62%, var(--premium-name-base) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gold-shimmer 2.5s linear infinite;
}
@keyframes gold-shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.leaderboard li.history-row {
  grid-template-columns: 108px minmax(0, 1fr) auto;
}

.leaderboard li.history-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard .leaderboard-section {
  grid-template-columns: 1fr auto;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.leaderboard .leaderboard-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.leaderboard .leaderboard-section span {
  font-size: 12px;
}

.leaderboard-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  background: color-mix(in srgb, var(--panel-2) 62%, transparent);
  border-radius: 8px;
  margin-top: 7px;
  margin-bottom: 4px;
}

.leaderboard-tab {
  min-height: 27px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: color-mix(in srgb, var(--text) 60%, var(--muted));
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
  white-space: nowrap;
}

.leaderboard-tab.active {
  background: var(--teal);
  color: #111719;
}

.leaderboard-period-end {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  opacity: 0.75;
}

.leaderboard-note {
  margin: 9px 0 0;
  color: color-mix(in srgb, var(--teal) 38%, var(--muted));
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
}

.leaderboard .leaderboard-me {
  background: color-mix(in srgb, var(--teal) 20%, transparent);
  border-radius: 0;
  padding-top: 6px;
  padding-bottom: 6px;
  margin-left: -14px;
  margin-right: -14px;
  padding-left: 14px;
  padding-right: 14px;
}

.leaderboard .leaderboard-separator {
  display: block;
  height: 1px;
  background: color-mix(in srgb, var(--muted) 30%, transparent);
  margin: 4px 8px;
  padding: 0;
  pointer-events: none;
}

.leaderboard .tournament-summary {
  grid-template-columns: 1fr;
  gap: 3px;
}

.leaderboard .tournament-summary span {
  line-height: 1.35;
}

.leaderboard-action {
  width: fit-content;
  margin-top: 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.leaderboard-action:hover {
  text-decoration: underline;
}

.leaderboard-action-button {
  width: fit-content;
  border: 1px solid color-mix(in srgb, var(--teal) 38%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  color: var(--teal);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.battle-list-action {
  align-items: center;
}

.battle-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  font-weight: bold;
  font-size: max(16px, 1em); /* iOS не зумит инпут если font-size >= 16px */
  color: inherit;
  font-family: inherit;
  padding: 2px 0;
  min-width: 0;
  width: 100%;
  outline: none;
}

.battle-create-button {
  padding: 7px 13px;
  font-size: 13px;
}

.leaderboard li.battle-list-row {
  grid-template-columns: 78px minmax(0, 1fr) auto auto;
  cursor: pointer;
}

.leaderboard li.battle-list-row small {
  color: var(--muted);
  font-size: 11px;
}

.history-row.win > span:first-child {
  color: var(--ok);
}

.history-row.loss > span:first-child {
  color: var(--danger);
}

.history-row.surrender .history-result-label {
  color: var(--danger);
}

.history-row.draw .history-result-label {
  color: var(--muted);
}

.history-row .history-relation {
  color: var(--text);
  font-weight: 500;
}

.leaderboard li.history-row .history-relation,
.leaderboard li.history-row .history-opponent-name {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text);
  background: none;
}

.history-row strong,
.history-row .history-opponent {
  color: var(--text);
}

.history-row.place > span:first-child {
  color: var(--amber);
}

.battle-chevron {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.55;
}

.battle-expand {
  list-style: none;
  margin: 0 0 4px;
  padding: 6px 0 6px 8px;
  border-left: 2px solid var(--line);
}

.battle-expand li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 0;
}

.battle-expand strong {
  color: var(--text);
}

.bottom-actions:not(.hidden) {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  padding: 14px 16px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(17, 23, 25, 0), var(--bg) 40%);
  z-index: 10;
}

/* Добавляем нижний отступ, чтобы кнопка не перекрывала контент */
/* Fallback для старых WebView (класс проставляется через JS) */
.has-bottom-actions .app-shell {
  padding-bottom: calc(68px + max(20px, env(safe-area-inset-bottom)));
}
/* Современные браузеры с поддержкой :has() */
@supports selector(:has(*)) {
  .has-bottom-actions .app-shell { padding-bottom: 0; }
  .app-shell:has(#bottomActions:not(.hidden)) {
    padding-bottom: calc(68px + max(20px, env(safe-area-inset-bottom)));
  }
}

.wide {
  width: 100%;
}

.shop-dialog {
  width: min(calc(100% - 28px - env(safe-area-inset-left) - env(safe-area-inset-right)), 430px);
  max-height: calc(100dvh - max(18px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)));
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  overscroll-behavior: contain; /* не пропускать скролл в фон на iOS */
  box-shadow: var(--shadow);
  overflow: auto;
}

.analytics-dialog {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  overscroll-behavior: contain;
}

/* Hide shop dialog during theme preview without closing it (preserves scroll position) */
.shop-dialog.preview-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}
.shop-dialog.preview-hidden::backdrop {
  opacity: 0 !important;
}

.shop-dialog[open] {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: calc(50% + (env(safe-area-inset-left) - env(safe-area-inset-right)) / 2);
  transform: translateX(-50%);
}

.analytics-dialog[open] {
  animation: analytics-dialog-in 0.18s ease-out both;
}

.analytics-dialog::-webkit-scrollbar {
  width: 5px;
}

.analytics-dialog::-webkit-scrollbar-track {
  background: transparent;
}

.analytics-dialog::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.shop-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

/* ── Theme preview dialog ── */
.theme-preview-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
  outline: none;
}

.theme-preview-dialog::backdrop {
  background: transparent;
}

.theme-preview-dialog[open] {
  animation: theme-preview-in 0.22s ease-out both;
}

@keyframes theme-preview-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.theme-preview-body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 20px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.32) 55%, transparent 100%);
  z-index: 5;
}

.theme-preview-info {
  margin-bottom: 20px;
}

.theme-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-preview-close {
  color: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}
.theme-preview-close:focus-visible,
.theme-preview-buy:focus-visible {
  outline: none;
}
.shop-dialog:focus {
  outline: none;
}

.theme-preview-name {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.theme-preview-desc {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.82);
  margin: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
  line-height: 1.45;
}

.shop-dialog form {
  padding: 16px;
}

.dictionary-collections:empty {
  display: none;
}

.collections-dialog .dialog-head {
  margin-bottom: 8px;
}

.collections-dialog-list {
  display: grid;
}

.collections-dialog-list .secondary {
  margin-top: 10px;
}

.analytics-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin: 0 0 12px;
  padding: 3px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 72%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.analytics-tab {
  min-width: 0;
  padding: 7px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.analytics-tab.active {
  background: rgba(79, 192, 173, 0.14);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(79, 192, 173, 0.16);
}

.analytics-tab:active {
  transform: scale(0.97);
}

.analytics-tab-panel {
  animation: analytics-panel-in 0.16s ease-out both;
}

.analytics-profile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  margin: 0 0 12px;
  padding: 11px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(79, 192, 173, 0.12), rgba(255, 255, 255, 0.03)),
    var(--panel-2);
  box-shadow: inset 0 0 0 1px rgba(79, 192, 173, 0.18);
}

.analytics-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(79, 192, 173, 0.2);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.analytics-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.analytics-profile-main {
  min-width: 0;
}

.analytics-profile-main strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-player-status {
  display: block;
  margin-top: 3px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

.analytics-player-status-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.analytics-card {
  position: relative;
  min-height: 74px;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
  animation: analytics-card-in 0.22s ease-out both;
  animation-delay: calc(var(--card-index, 0) * 28ms);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.analytics-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.analytics-card:active {
  transform: scale(0.985);
}

.analytics-retry-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  border: none;
  border-radius: 7px;
  background: var(--accent, #4fc0ad);
  color: #05201b;
  font: inherit;
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
}
.analytics-retry-btn:active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .analytics-card:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(79, 192, 173, 0.22), 0 8px 20px rgba(0, 0, 0, 0.16);
  }
}

.analytics-card-primary {
  background:
    linear-gradient(160deg, rgba(79, 192, 173, 0.12), rgba(255, 255, 255, 0.02)),
    var(--panel-2);
  box-shadow: inset 0 0 0 1px rgba(79, 192, 173, 0.22), 0 0 18px rgba(79, 192, 173, 0.06);
}

.analytics-card-primary::before,
.analytics-card-complete::before {
  background: var(--teal);
}

.analytics-card-complete {
  box-shadow: inset 0 0 0 1px rgba(93, 222, 151, 0.24), 0 0 18px rgba(93, 222, 151, 0.08);
}

.analytics-card > span,
.analytics-card-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.analytics-card-icon {
  font-size: 13px;
  line-height: 1;
  filter: saturate(0.9);
}

.analytics-card strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.1;
  animation: analytics-number-in 0.28s ease-out both;
}

.analytics-card-primary strong {
  color: color-mix(in srgb, var(--text) 86%, var(--teal));
  font-size: 21px;
}

.analytics-card-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.analytics-mini-progress {
  height: 5px;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.analytics-mini-progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(79, 192, 173, 0.72), rgba(93, 222, 151, 0.9));
  box-shadow: 0 0 10px rgba(79, 192, 173, 0.24);
  transition: width 0.28s ease;
}

.analytics-section {
  margin-top: 14px;
}

.analytics-list {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.analytics-list li {
  padding: 9px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 68%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quiz-repeat-word {
  display: block;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
}

.quiz-repeat-def {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.quiz-repeat-count {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  color: var(--accent);
  opacity: 0.8;
  font-weight: 500;
}

.quiz-repeat-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 0;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.quiz-repeat-btn:active {
  opacity: 0.7;
}

.analytics-insights {
  margin-top: 10px;
}

.analytics-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* Диаграмма активности */
.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-top: 10px;
  overflow: hidden;
  width: 100%;
}
.daily-bar-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.daily-bar {
  width: 100%;
  height: var(--bar-h, 0px);
  border-radius: 3px 3px 0 0;
  background: var(--teal);
  opacity: 0.55;
  transition: height 0.25s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}
.daily-bar-wrap.daily-today .daily-bar {
  opacity: 1;
  background: color-mix(in srgb, var(--teal) 78%, #ffffff);
  box-shadow: 0 0 12px rgba(79, 192, 173, 0.28);
}
.daily-label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
  text-overflow: clip;
}

.daily-empty {
  width: 100%;
  padding: 14px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 68%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

@keyframes analytics-dialog-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes analytics-card-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes analytics-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes analytics-number-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .analytics-dialog[open],
  .analytics-tab-panel,
  .analytics-card,
  .analytics-card strong {
    animation: none;
  }

  .analytics-card,
  .daily-bar {
    transition: none;
  }

  .premium-name {
    animation: none;
    background: none;
    -webkit-text-fill-color: var(--premium-name-base);
    color: var(--premium-name-base);
  }

  body::before,
  body::after,
  .theme-backdrop *,
  .theme-swatch i,
  .theme-enter .board,
  .theme-enter .panel,
  .theme-enter .score-strip,
  .theme-enter .feedback,
  .theme-enter .tile,
  .theme-enter .hand-tile {
    animation: none !important;
  }
}

/* ── Premium analytics ── */

.premium-sub-grid {
  margin-top: 8px;
}
.premium-sub-grid .analytics-card strong {
  font-size: 15px;
}

.premium-sub-section {
  margin-top: 14px;
}

.premium-sub-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Тренд-индикатор внутри карточки */
.trend-badge {
  font-size: 13px;
  font-weight: 900;
}
.trend-up   { color: #5dde97; }
.trend-down { color: #e0645a; }
.trend-stable { color: var(--muted); }

/* Распределение длин */
.length-dist {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.length-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.length-label {
  width: 22px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}
.length-bar-wrap {
  flex: 1;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.length-bar {
  height: 100%;
  width: var(--bar-w, 0%);
  background: rgba(79, 192, 173, 0.6);
  border-radius: 4px;
  transition: width 0.35s ease;
}
.length-count {
  width: 28px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

/* Топ слов */
.top-words-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.top-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--panel-2);
}
.top-word-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
}
.top-word-pts {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

/* PvP блоки */
.pvp-summary {
  display: grid;
  gap: 10px;
}
.pvp-block {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pvp-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
}
.pvp-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.pvp-total {
  font-size: 11px;
  color: var(--muted);
}
.pvp-counts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.pvp-winrate {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.05;
}

.pvp-stat {
  font-size: 12px;
  font-weight: 800;
}

.pvp-dot {
  color: var(--muted);
  opacity: 0.55;
}

.pvp-win  { color: #5dde97; }
.pvp-loss { color: #e0645a; }
.pvp-draw { color: var(--muted); }
.pvp-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.pvp-bar {
  height: 100%;
  width: var(--win-pct, 0%);
  background: linear-gradient(90deg, rgba(93, 222, 151, 0.72), rgba(79, 192, 173, 0.92));
  border-radius: inherit;
  box-shadow: 0 0 12px rgba(93, 222, 151, 0.22);
  transition: width 0.35s ease;
}

/* Тизер для не-премиум */
.premium-teaser li {
  opacity: 0.55;
}
.premium-teaser li::before {
  content: "🔒 ";
  font-size: 10px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.shop-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
}

.shop-section-title h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.shop-section-title span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: color-mix(in srgb, var(--ok) 42%, var(--text));
}

.setting-row strong {
  font-size: 14px;
  font-weight: 500;
}

.setting-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.logout-row {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
  color: color-mix(in srgb, #ff8a8a 48%, var(--text));
  background: color-mix(in srgb, #ff6b6b 12%, transparent);
}

.logout-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.logout-row > span:last-child {
  color: color-mix(in srgb, #ff8a8a 74%, var(--text));
  font-size: 13px;
  font-weight: 700;
}

.profile-setting {
  background: var(--bg-soft);
  color: var(--text);
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented-control button {
  min-width: 44px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control button.active {
  background: rgba(79, 192, 173, 0.16);
  color: var(--teal);
}

.dictionary-list,
.theme-list {
  display: grid;
  gap: 8px;
}

.dictionary-item,
.theme-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--bg-soft);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
}

.dictionary-item.selected,
.theme-item.selected {
  box-shadow: inset 0 0 0 2px var(--teal);
}

.dictionary-item strong,
.dictionary-item span,
.theme-item strong,
.theme-item span {
  display: block;
}

.dictionary-item strong,
.theme-item strong {
  font-size: 14px;
}

.dictionary-item span span,
.theme-item span span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.dictionary-state {
  min-width: 82px;
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(240, 172, 69, 0.12);
  color: var(--amber);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.dictionary-item.selected .dictionary-state,
.theme-item.selected .dictionary-state {
  background: rgba(79, 192, 173, 0.14);
  color: var(--teal);
}

.dictionary-item-soon {
  opacity: 0.5;
  cursor: default;
}

.dictionary-item.locked,
.shop-item.locked {
  opacity: 0.72;
}

.shop-item.locked > strong,
.dictionary-item.locked .dictionary-state {
  color: var(--muted);
}

.theme-item {
  grid-template-columns: 54px 1fr auto;
  overflow: hidden;
}

.theme-item.locked {
  opacity: 0.88;
}

.theme-item.locked.selected {
  opacity: 1;
}

.theme-swatch {
  position: relative;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.theme-swatch[data-theme-preview="classic"] {
  background:
    linear-gradient(135deg, transparent 0 52%, #ead2a2 52% 100%),
    radial-gradient(circle at 25% 18%, rgba(79, 192, 173, 0.22), transparent 36%),
    #1d2929;
}

.theme-swatch[data-theme-preview="polar"] {
  background:
    radial-gradient(ellipse at 32% 0%, rgba(80, 200, 180, 0.58), transparent 54%),
    radial-gradient(ellipse at 72% 8%, rgba(140, 100, 220, 0.42), transparent 58%),
    linear-gradient(180deg, #020810 0%, #060d1f 48%, #0d2042 100%);
}

.theme-swatch[data-theme-preview="polar"] i {
  position: absolute;
  top: -8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #e8f4ff;
  box-shadow: 0 0 6px #b8e0ff;
  animation: swatch-snow 2.4s linear infinite;
}

.theme-swatch[data-theme-preview="polar"] i:nth-child(1) {
  top: 3px;
  right: 5px;
  left: auto;
  width: 20px;
  height: 20px;
  background: transparent;
  box-shadow:
    inset -6px 3px 0 2px rgba(220, 240, 255, 0.92),
    0 0 10px rgba(160, 210, 255, 0.25);
  animation: moonGlow 4s ease-in-out infinite;
}

.theme-swatch[data-theme-preview="polar"] i:nth-child(2) { left: 8px; animation-delay: -0.8s; }
.theme-swatch[data-theme-preview="polar"] i:nth-child(3) { left: 22px; animation-delay: -1.7s; }

.theme-swatch[data-theme-preview="barbie"] {
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, 0.45), transparent 16%),
    radial-gradient(circle at 18% 74%, rgba(255, 170, 216, 0.4), transparent 30%),
    linear-gradient(180deg, #1a0014 0%, #4a1248 58%, #6a1858 100%);
}

.theme-swatch[data-theme-preview="barbie"] i {
  position: absolute;
  bottom: -10px;
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: #ff80cc;
  filter: drop-shadow(0 0 5px #ff5dc8);
  animation: swatch-heart 3s ease-in infinite;
}

.theme-swatch[data-theme-preview="barbie"] i::before,
.theme-swatch[data-theme-preview="barbie"] i::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: inherit;
}

.theme-swatch[data-theme-preview="barbie"] i::before { left: -5px; top: 0; }
.theme-swatch[data-theme-preview="barbie"] i::after { left: 0; top: -5px; }
.theme-swatch[data-theme-preview="barbie"] i:nth-child(1) { left: 8px; animation-delay: -0.3s; }
.theme-swatch[data-theme-preview="barbie"] i:nth-child(2) { left: 22px; animation-delay: -1.4s; }
.theme-swatch[data-theme-preview="barbie"] i:nth-child(3) { left: 33px; animation-delay: -2.1s; }

.theme-swatch[data-theme-preview="storm"] {
  background:
    linear-gradient(180deg, #0a1422 0%, #15263a 55%, #0e1822 100%);
}
.theme-swatch[data-theme-preview="storm"]::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(200, 228, 255, 0.95);
  mix-blend-mode: screen;
  opacity: 0;
  animation: swatchStormFlash 4.5s linear infinite;
  pointer-events: none;
  z-index: 3;
}
.theme-swatch[data-theme-preview="storm"] i {
  position: absolute;
  background: linear-gradient(180deg, transparent 0%, rgba(180,210,235,0.85) 100%);
  border-radius: 1px;
  animation: raindrop 0.9s linear infinite;
}
.theme-swatch[data-theme-preview="storm"] i:nth-child(1) { left: 20%; top: -8px; width: 1px; height: 12px; animation-delay: -0.1s; }
.theme-swatch[data-theme-preview="storm"] i:nth-child(2) { left: 45%; top: -8px; width: 1px; height: 16px; animation-delay: -0.4s; }
.theme-swatch[data-theme-preview="storm"] i:nth-child(3) { left: 70%; top: -8px; width: 1px; height: 10px; animation-delay: -0.7s; }

.theme-swatch[data-theme-preview="comic"] {
  background: linear-gradient(180deg, #fff5d6 0%, #ffe8b0 100%);
}
.theme-swatch[data-theme-preview="comic"]::before {
  content: 'POW!';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  background: #e8323a;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1.5px solid #1a1a1a;
  transform: rotate(-8deg);
  box-shadow: 1px 1px 0 #1a1a1a;
}
.theme-swatch[data-theme-preview="comic"] i {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,50,58,0.20) 1.4px, transparent 1.6px);
  background-size: 6px 6px;
  animation: halftoneShift 2s linear infinite;
}
.theme-swatch[data-theme-preview="comic"] i:nth-child(1) { inset: 0; border-radius: 0; width: 100%; height: 100%; }
.theme-swatch[data-theme-preview="comic"] i:nth-child(2) { display: none; }
.theme-swatch[data-theme-preview="comic"] i:nth-child(3) { display: none; }

@keyframes swatch-snow {
  from { transform: translateY(0) translateX(0); opacity: 0; }
  20% { opacity: 1; }
  to { transform: translateY(58px) translateX(5px); opacity: 0; }
}

@keyframes swatch-heart {
  from { transform: translateY(0) rotate(45deg) scale(0.75); opacity: 0; }
  18% { opacity: 0.92; }
  to { transform: translateY(-62px) rotate(45deg) scale(1.08); opacity: 0; }
}

.theme-enter .board,
.theme-enter .panel,
.theme-enter .score-strip,
.theme-enter .feedback {
  animation: theme-surface-enter 520ms cubic-bezier(.2,.8,.2,1);
}

.theme-enter .tile,
.theme-enter .hand-tile {
  animation: theme-tile-enter 320ms cubic-bezier(.2,.8,.2,1);
}

@keyframes theme-surface-enter {
  from { opacity: 0.72; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes theme-tile-enter {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.shop-items {
  display: grid;
  gap: 8px;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-soft);
  text-align: left;
}

.shop-item strong {
  color: var(--amber);
  white-space: nowrap;
  flex: 0 0 auto;
}

.shop-item span strong {
  display: block;
  color: var(--text);
}

.shop-item small {
  display: block;
  max-width: 250px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.referral-section {
  margin-top: 4px;
}

#referralShareBtn {
  min-height: 58px;
  padding: 11px 12px;
}

#referralShareBtn > strong {
  min-width: 82px;
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(79, 192, 173, 0.14);
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

@media (min-width: 600px) {
  body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-attachment: fixed;
  }

  .app-shell {
    width: 440px;
    min-height: 100svh;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 32px 80px rgba(0,0,0,0.5);
    position: relative;
  }

  /* Логин-экран на десктопе — карточка тоже ограничена */
  .login-card {
    max-width: 380px;
    width: 100%;
  }
}

/* ── Login screen (browser only) ── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(12, 17, 19, 0.3);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-screen[hidden] { display: none; }

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  background: rgba(29, 41, 41, 0.9);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 24px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.login-icon-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s;
}

.login-icon-btn:active { transform: scale(0.94); }

.login-icon-img {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: block;
}

.login-icon-hint {
  font-size: 11px;
  color: var(--teal);
  font-weight: 600;
  letter-spacing: 0.3px;
  opacity: 0.9;
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.login-widget-wrap {
  margin-top: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tg-login-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 22px;
  height: 48px;
  background: #2AABEE;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.tg-login-btn:hover { background: #1d99db; }
.tg-login-btn:active { transform: scale(0.96); background: #1a8fc9; }

.qr-login-btn {
  background: var(--bg-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.qr-login-btn:hover { background: color-mix(in srgb, var(--teal) 12%, var(--bg-soft)); }

.qr-login-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.guest-login-btn {
  height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(245,241,224,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.guest-login-btn:active {
  transform: scale(0.97);
}

.qr-login-panel {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
}

.qr-login-panel[hidden] {
  display: none;
}

.bot-login-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal) 18%, transparent);
}

.bot-login-panel[hidden] {
  display: none;
}

.bot-login-panel p {
  margin: 0;
  color: color-mix(in srgb, var(--teal) 28%, var(--text));
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.bot-login-link {
  width: fit-content;
  min-width: 0;
  height: 42px;
  padding: 0 18px;
  text-decoration: none;
}

.qr-login-panel img {
  width: 164px;
  height: 164px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.qr-login-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.login-note {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  opacity: 0.6;
}

.login-error {
  font-size: 13px;
  color: var(--danger);
  margin: 0;
  background: rgba(240, 115, 103, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  box-sizing: border-box;
}

.login-warning {
  color: color-mix(in srgb, var(--teal) 35%, var(--text));
  background: color-mix(in srgb, var(--teal) 12%, transparent);
}

.login-error[hidden] { display: none; }

/* Показывается только на десктопе */
.login-desktop-note {
  display: none;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  width: 100%;
}

@media (min-width: 600px) {
  .login-desktop-note { display: block; }
  .login-icon-hint { display: none; }
}

.ios-install-tip {
  background: rgba(79,192,173,0.1);
  border: 1px solid rgba(79,192,173,0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  width: 100%;
  box-sizing: border-box;
}

.ios-install-tip[hidden] { display: none; }

.ios-install-tip p { margin: 0; }

.install-tip-title {
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px !important;
}

.ios-share-icon {
  font-style: normal;
  font-size: 15px;
}

.tg-app-link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.tg-app-link:hover { text-decoration: underline; }

/* ── Quests block ─────────────────────────────────────────────────────────── */

.quests-block {
  padding: 0 0 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Streak bar */
.quest-streak {
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quest-streak-days {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  align-items: center;
}

.quest-streak-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(245,241,224,0.45);
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.quest-streak-dot.done {
  background: var(--teal);
  color: #06211d;
}

.quest-streak-dot.today {
  background: rgba(80,200,170,0.30);
  color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal);
}

.quest-streak-dot.premium {
  background: var(--amber);
  color: #1a1200;
}

body[data-theme="polar"] .primary {
  background: var(--teal);
  color: #060d1f;
}

body[data-theme="polar"] .quest-streak-dot.premium {
  background: var(--teal);
  color: #060d1f;
}

body[data-theme="polar"] .dictionary-state {
  background: rgba(125, 212, 252, 0.12);
  color: var(--teal);
}

body[data-theme="polar"] .shop-item > strong {
  color: var(--teal);
}

.quest-streak-claim {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 7px;
  border: 0;
  background: color-mix(in srgb, var(--teal) 82%, var(--text));
  color: #06211d;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.quest-streak-claim:disabled {
  opacity: 0.4;
  cursor: default;
}

.quest-streak-info {
  display: none;
}

/* Compact quest rows */
.quest-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--teal) 10%, transparent);
}

.quest-summary-row {
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  color: color-mix(in srgb, var(--text) 80%, var(--muted));
  font-size: 13px;
  font-weight: 680;
  text-align: left;
}

.quest-summary-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quest-summary-action {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quest-summary-done {
  color: color-mix(in srgb, var(--ok) 36%, var(--muted));
  cursor: pointer;
}

.quest-card {
  min-height: 26px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 7px;
  padding: 2px 0;
  color: color-mix(in srgb, var(--text) 76%, var(--muted));
  font-size: 13px;
  line-height: 1.25;
}

.quest-card.claimed {
  color: color-mix(in srgb, var(--ok) 34%, var(--muted));
}

.quest-card-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 620;
}

.quest-inline-progress {
  color: var(--muted);
  font-weight: 560;
  white-space: nowrap;
}

.quest-status {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ok);
  font-size: 11px;
  font-weight: 850;
}

.quest-card.ready .quest-status,
.quest-card.claimed .quest-status {
  box-shadow: none;
  background: color-mix(in srgb, var(--ok) 20%, transparent);
}

.quest-row-action {
  justify-self: end;
  white-space: nowrap;
}

.quest-reward {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 650;
  color: color-mix(in srgb, var(--teal) 64%, var(--text));
}

.quest-reward .reward-icon {
  width: 13px;
  height: 13px;
}

.quest-claim-btn {
  padding: 4px 9px;
  border-radius: 7px;
  border: 0;
  background: color-mix(in srgb, var(--teal) 82%, var(--text));
  color: #06211d;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.quest-claim-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.quest-done-label {
  font-size: 11px;
  font-weight: 650;
  color: color-mix(in srgb, var(--ok) 42%, var(--muted));
}

/* All-done bonus banner */
.quest-all-done-banner {
  background: rgba(80,200,170,0.12);
  border: 1px solid rgba(80,200,170,0.30);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quest-all-done-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
}

.quest-all-done-sub {
  font-size: 11px;
  color: rgba(245,241,224,0.55);
  margin-top: 2px;
}

.quest-all-done-claim {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 8px;
  border: 0;
  background: var(--teal);
  color: #06211d;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.quest-all-done-claim:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Quest motivation overlay (post-round) */
.quest-motivation {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  background: #1a2e2a;
  border: 1px solid rgba(80,200,170,0.30);
  border-radius: 14px;
  padding: 14px 16px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideUpFade 0.25s ease;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.quest-motivation-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--teal);
  margin-bottom: 8px;
}

.quest-motivation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: rgba(245,241,224,0.80);
}

.quest-motivation-row .qm-name {
  flex: 1;
}

.quest-motivation-row .qm-progress {
  font-size: 12px;
  color: rgba(245,241,224,0.45);
  white-space: nowrap;
}

.quest-motivation-dismiss {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(245,241,224,0.15);
  background: transparent;
  color: rgba(245,241,224,0.65);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* Quiz mode */
#quizPanel {
  position: relative;
  padding: 16px;
  margin: 12px 0;
}

#quizPanel.quiz-preview {
  padding-bottom: 14px;
}

.quiz-definition {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  padding: 4px 0 8px;
}

.quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.quiz-choice {
  padding: 12px 8px;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 15px;
  border: 1.5px solid var(--line);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
  font-family: inherit;
}

.quiz-choice.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  transform: scale(0.97);
}

.quiz-choice.correct {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 15%, transparent);
}

.quiz-choice.wrong {
  border-color: #e05555;
  background: color-mix(in srgb, #e05555 12%, transparent);
}

.quiz-choice.removed {
  opacity: 0.28;
  pointer-events: none;
}

.quiz-preview-choice:disabled {
  cursor: default;
  opacity: 1;
}

.quiz-preview-controls {
  display: none;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 8px;
  margin: -2px 0 12px;
}

body[data-mode="quiz"] .quiz-preview-controls {
  display: grid;
}

.quiz-preview-pager {
  display: none;
  grid-template-columns: 34px auto 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  justify-self: center;
  margin-top: 18px;
}

body[data-mode="quiz"] .quiz-preview-pager {
  display: grid;
}

.quiz-preview-arrow {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 68%, transparent);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.quiz-preview-arrow:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--teal) 42%, var(--line));
}

.quiz-preview-count {
  min-width: 54px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.quiz-preview-start {
  width: 100%;
  display: block;
}

.quiz-collection-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.quiz-collection-close:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--teal) 42%, var(--line));
}

.collection-result-actions .secondary.selected {
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
  color: var(--teal);
}

.quiz-timer-bar {
  height: 3px;
  background: var(--line);
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}

.quiz-timer-bar.turn-timer-bar {
  margin-bottom: 10px;
}

.quiz-timer-bar::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 100%;
  background: var(--teal);
  transform: scaleX(var(--timer-scale, 1));
  transform-origin: left center;
  transition: transform 0.3s linear;
  will-change: transform;
}

.quiz-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.quiz-hint-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel-2, rgba(255,255,255,0.06));
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.quiz-hint-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.quiz-start-centered {
  min-width: 140px;
}

/* Dictionary collections */
.dictionary-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.dictionary-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
  gap: 8px;
}

.dictionary-search button {
  min-width: 92px;
}

.dictionary-search input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.collection-title-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0 0;
}
.collection-title-input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  background: var(--input-bg, var(--panel));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  outline: none;
  font-family: inherit;
}
.collection-title-input:focus {
  border-color: var(--teal);
}
.collection-title-by-row {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 2px 2px;
}
.collection-title-name {
  font-weight: 700;
  color: var(--text);
}
.collection-title-by {
  color: var(--muted);
  font-weight: 400;
}
.collection-title-notice {
  font-size: 12px;
  color: var(--amber);
  padding: 2px 0 4px;
}
.collection-pending-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--amber, #f59e0b);
  background: color-mix(in srgb, var(--amber, #f59e0b) 12%, transparent);
  border-radius: 20px;
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.collection-adult-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0px 5px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.6;
}
.collection-adult-notice {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}
.collection-author-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 12px;
}
.collection-author-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.5;
}
.collection-author-btn.active {
  border-color: var(--teal);
  color: var(--teal);
}
.collection-title-actions {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  align-self: flex-start;
}

.collection-title-actions button {
  min-height: 36px;
  padding-inline: 16px;
}

.dictionary-results,
.dictionary-draft,
.dictionary-collections,
.quiz-collection-highlights,
.collection-result-panel {
  display: grid;
  gap: 10px;
}

.dictionary-result-card,
.dictionary-collections,
.collection-result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.dictionary-draft {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.dictionary-result-head,
.dictionary-draft-head,
.dictionary-collections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dictionary-title-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0 2px;
}

.dictionary-result-head + .def-group {
  margin-top: 12px;
}

.dictionary-result-card .missing-def-btn {
  color: var(--muted);
}
.dictionary-result-card .missing-def-btn:hover {
  color: var(--text);
}

.dict-batch-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.6;
  margin-top: 10px;
  margin-bottom: 2px;
}
.dict-batch-words {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}
.dict-suggest-btn {
  display: block;
  margin-top: 4px;
  margin-bottom: 10px;
  padding: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-style: dotted;
  transition: color 0.15s ease;
}
.dict-suggest-btn:hover:not(:disabled) {
  color: var(--text);
}
.dict-suggest-btn:disabled {
  cursor: default;
  text-decoration: none;
  opacity: 0.7;
}

.dictionary-draft-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.dictionary-draft-actions button {
  min-height: 34px;
  padding-inline: 9px;
  font-size: 13px;
  white-space: nowrap;
}

.dictionary-draft-title {
  min-width: 0;
  display: grid;
  gap: 0;
}

.dictionary-draft-title strong,
.dictionary-draft-progress-row strong {
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.dictionary-draft-title span,
.dictionary-draft-progress-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.dictionary-draft-progress {
  display: grid;
  gap: 4px;
}

.dictionary-draft-progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.dictionary-draft-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 78%, transparent);
}

.dictionary-draft-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.2s ease;
}

@media (max-width: 380px) {
  .dictionary-draft-head {
    gap: 6px;
  }

  .dictionary-draft-title strong {
    font-size: 14px;
  }

  .dictionary-draft-actions {
    gap: 6px;
  }

  .dictionary-draft-actions button {
    padding-inline: 8px;
    font-size: 13px;
  }
}

.dictionary-result-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Flag button in the bottom-right corner of the dictionary card */
.dict-flag-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  position: relative;
}
.dict-flag-wrap .def-flag-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  margin-top: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 190px;
  z-index: 20;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.35);
}

.dictionary-add-word {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.muted-line {
  color: var(--muted);
}

.dictionary-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}

.dictionary-chip-list button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--soft);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  font-size: 13px;
}

.quiz-highlight-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 4px;
}

.quiz-highlight-card span,
.collection-result-panel span {
  color: var(--muted);
  font-size: 0.9rem;
}

.dictionary-collection-list {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.dictionary-collection-card {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(42px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.dictionary-collection-card:last-child {
  border-bottom: 0;
}

.dictionary-collection-card:hover {
  background: color-mix(in srgb, var(--teal) 10%, transparent);
}

.collection-rank {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.collection-main {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  text-align: left;
  overflow: hidden;
}

.collection-main strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.collection-main .collection-title-by {
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.collection-main small {
  color: var(--muted);
  font-size: 12px;
}

.collection-title-by {
  font-weight: 400;
  color: var(--muted);
}

.quiz-collection-preview .quiz-definition {
  display: grid;
  gap: 10px;
}

.collection-preview-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.collection-number-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--teal) 38%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.collection-preview-title {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  color: var(--text);
}

.collection-preview-title strong {
  font-size: 22px;
  line-height: 1.16;
}

.collection-preview-title .collection-title-by {
  font-size: 14px;
}

.collection-preview-description {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.collection-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.collection-preview-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.collection-result-panel {
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
}

.collection-result-close {
  width: 34px;
  height: 34px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  color: var(--muted);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.collection-result-close:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 28%, var(--line));
}

.collection-result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px;
  gap: 10px;
  align-items: start;
}

.collection-result-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.collection-result-title strong,
.collection-result-score strong {
  font-size: 18px;
  line-height: 1.15;
}

.collection-result-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-result-score {
  display: grid;
  gap: 2px;
  text-align: right;
}

.collection-result-score span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.collection-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.collection-result-actions {
  display: grid;
  grid-template-columns: minmax(88px, auto) 36px 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.collection-result-action-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.collection-result-actions .secondary {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.collection-vote-btn {
  width: 36px;
  padding: 0;
  font-size: 18px;
  font-weight: 900;
}

.collection-share-btn {
  justify-self: stretch;
}

.quiz-collection-highlights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 520px) {
  .quiz-collection-highlights {
    grid-template-columns: 1fr;
  }

  .collection-result-actions {
    grid-template-columns: minmax(88px, auto) 36px 36px minmax(0, 1fr);
  }

  .collection-share-btn {
    min-width: 0;
  }

  .quiz-preview-controls {
    grid-template-columns: 1fr 1fr;
  }
}
