:root {
  --brand-forest: #102e23;
  --brand-forest-2: #173c2e;
  --brand-paper: #f5ecd8;
  --brand-ink: #17251f;
  --brand-gold: #d5ae5e;
  --brand-gold-light: #f1d892;
  --brand-copper: #b66f46;
  --brand-radius: 22px;
  --control-radius: 12px;
  --control-height: 44px;
  --brand-shadow: 0 24px 70px rgba(3, 20, 13, .24);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --layer-header: 1000;
  --layer-nav: 1010;
  --layer-overlay: 2000;
  --layer-toast: 3000;   /* toast увек изнад модала (иначе се крије иза .overlay) */
}

html { scroll-behavior: smooth; }
body { background: var(--brand-forest); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }
.overlay { z-index: var(--layer-overlay); }
#toast { z-index: var(--layer-toast); }  /* изнад .overlay да порука не нестане иза модала */
button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(241,216,146,.72); outline-offset: 3px;
}

/* position:sticky је НЕОПХОДАН — без позиције z-index не важи, па backdrop-filter
   ствара stacking context на auto нивоу и мобилни мени (дете хедера) остаје
   испод .menu-open backdrop-а (z:999) и позиционираног садржаја. */
.app-header { position: sticky; top: 0; z-index: var(--layer-header); min-height: 66px; background: rgba(12, 39, 29, .96); backdrop-filter: blur(18px); }
.header-shell { max-width: 1440px; }
.brand-name { letter-spacing: -.02em; }
.header-right { gap: 3px; }
body[data-view="hub"] #btn-profile,
body[data-view="content"] #btn-profile { min-height: var(--control-height); border-radius: var(--control-radius); }
.site-nav-link, .hero-link, .content-back, .section-action {
  appearance: none; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.site-nav-link { min-height: var(--control-height); padding: 10px 12px; border-radius: var(--control-radius); color: rgba(255,255,255,.72); text-decoration: none; }
.site-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.site-nav-link[aria-current="page"] { background: rgba(241,216,146,.12); color: var(--brand-gold-light); }
#btn-profile[aria-current="page"] { background: rgba(241,216,146,.12); border-color: rgba(241,216,146,.28); color: var(--brand-gold-light); }
.header-new { min-height: var(--control-height); border-radius: var(--control-radius); box-shadow: 0 8px 22px rgba(213,174,94,.2); }
.mobile-menu-toggle { display: none; }
.setup-mobile-nav, .setup-review { display: none; }

.home-hub .hub-hero {
  min-height: min(820px, calc(100svh - 66px)); box-sizing: border-box;
  grid-template-columns: minmax(0, 1.05fr) minmax(500px, .95fr);
  align-items: center;
  gap: clamp(36px, 6vw, 96px);
  padding-block: clamp(56px, 6vh, 76px);
  background: radial-gradient(circle at 78% 42%, rgba(213,174,94,.12), transparent 34%), linear-gradient(145deg, #123528, #0b241b 75%);
}
.home-hub .hero-copy { max-width: 650px; }
.home-hub .hero-copy h1 { font-size: clamp(3.4rem, 6vw, 6.4rem); line-height: .94; letter-spacing: -.055em; max-width: 11ch; }
.home-hub .hero-copy > p { max-width: 560px; font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.7; }
.home-hub .hero-actions { display: flex; align-items: center; gap: 14px; }
.home-hub .hero-play { border-radius: var(--control-radius); }
.hero-link, .section-action {
  min-height: var(--control-height); display: inline-flex; align-items: center; gap: 10px;
  color: var(--brand-paper); padding: 10px 2px; border-bottom: 1px solid rgba(245,236,216,.34);
}
.hero-link:hover { color: var(--brand-gold-light); border-color: currentColor; }
.section-action i { font-style: normal; transition: transform .2s ease; }
.section-action:hover i { transform: translateX(4px); }
.hero-facts { opacity: .72; }

.trust-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid rgba(255,255,255,.12); }
.trust-strip div { padding: 26px clamp(22px, 4vw, 58px); display: grid; gap: 4px; border-right: 1px solid rgba(255,255,255,.12); }
.trust-strip div:last-child { border: 0; }
.trust-strip strong { color: var(--brand-gold-light); font-size: 1.05rem; }
.trust-strip span { color: rgba(255,255,255,.62); font-size: .88rem; }

.bot-showcase { padding: clamp(76px, 7vw, 104px) 0; background: #07170e; }
.bot-showcase .section-heading { align-items: end; }
.bot-showcase .section-heading h2 { color: #fff3d3; }
.bot-showcase .section-kicker { color: #d5ae5e; }
.bot-showcase .section-action { flex: 0 0 auto; color: var(--brand-gold-light); }
.bot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 30px; }
.bot-card { overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: var(--brand-radius); background: rgba(255,255,255,.055); transition: transform .25s ease, border-color .25s ease, background .25s ease; }
.bot-card:hover { transform: translateY(-6px); border-color: rgba(213,174,94,.55); background: rgba(255,255,255,.085); }
.bot-card > div { padding: 20px; }
.bot-card h3 { margin: 5px 0 8px; font-size: 1.45rem; color: #fff; }
.bot-card p, .bot-card small { color: rgba(255,255,255,.66); line-height: 1.5; }
.bot-card small { display: block; min-height: 3em; }
.bot-card strong { display: block; color: var(--brand-gold-light); margin-top: 15px; font-size: .86rem; }
.bot-card button {
  width: 100%; min-height: var(--control-height); margin-top: 14px; padding: 10px 0 0;
  display: flex; align-items: center; border: 0; border-top: 1px solid rgba(255,255,255,.1);
  background: transparent; color: #fff; font: inherit; font-weight: 750; cursor: pointer;
}
.bot-card button:hover { color: var(--brand-gold-light); }
.bot-level { color: var(--brand-gold-light); text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; }
.bot-portrait { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: radial-gradient(circle, #31594a, #10271f); }
.bot-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bot-fallback { display: grid; place-items: center; position: absolute; inset: 0; font-size: 4rem; }
.bot-portrait img + .bot-fallback { display: none; }
.bot-portrait.asset-missing img { display: none; }
.bot-portrait.asset-missing .bot-fallback { display: grid; }
.ai-difficulty-choice .bot-avatar { width: 58px; height: 58px; padding: 0; overflow: hidden; border-radius: 16px; }
.ai-difficulty-choice .bot-portrait { width: 100%; height: 100%; }
.ai-difficulty-choice .bot-fallback { font-size: 1.7rem; }

#dlg-new .setup-form { padding-bottom: 28px; }
#dlg-new .setup-form .preset-choice label,
#dlg-new .setup-form .time-control-choice label,
#dlg-new .setup-form .ai-difficulty-choice label {
  position: relative;
  padding-right: 42px;
}
#dlg-new .setup-form .ai-difficulty-choice { gap: 10px; }
#dlg-new .setup-form .preset-choice input[type="radio"],
#dlg-new .setup-form .time-control-choice input[type="radio"],
#dlg-new .setup-form .ai-difficulty-choice input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
#dlg-new .setup-form .preset-choice label:has(input:checked)::after,
#dlg-new .setup-form .time-control-choice label:has(input:checked)::after,
#dlg-new .setup-form .ai-difficulty-choice label:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #315d3e;
  font-size: .74rem;
  font-weight: 950;
  box-shadow: 0 4px 10px rgba(49,93,62,.18);
}
#dlg-new .setup-form .preset-choice label:has(input:focus-visible),
#dlg-new .setup-form .time-control-choice label:has(input:focus-visible),
#dlg-new .setup-form .ai-difficulty-choice label:has(input:focus-visible) {
  outline: 3px solid rgba(220,185,103,.3);
  outline-offset: 2px;
}
#dlg-new .setup-form .ai-difficulty-choice label {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr);
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 10px 42px 10px 12px;
}
#dlg-new .setup-form .ai-difficulty-choice .bot-avatar {
  align-self: center;
  width: 58px;
  height: 58px;
  border-radius: 15px;
  box-shadow: 0 5px 14px rgba(27,41,31,.12);
}
#dlg-new .setup-form .ai-difficulty-choice label > span:last-child {
  min-width: 0;
  display: grid;
  gap: 4px;
  line-height: 1.25;
}
#dlg-new .setup-form .ai-difficulty-choice label b { font-size: .9rem; }
#dlg-new .setup-form .ai-difficulty-choice label small {
  max-width: 29ch;
  color: #6a6256;
  font-size: .73rem;
}
#dlg-new .new-game-actions {
  position: static;
  margin-top: 12px;
  padding-top: 0;
  background: none;
}

.content-screen { min-height: calc(100vh - 70px); color: var(--brand-paper); background: radial-gradient(circle at 82% 7%, rgba(213,174,94,.13), transparent 28%), radial-gradient(circle at 8% 55%, rgba(68,126,101,.12), transparent 30%), linear-gradient(145deg, #123528, #091f17 78%); }
.content-shell { width: min(1180px, calc(100% - 48px)); margin: auto; padding: 30px 0 100px; }
.content-back { display: inline-flex; align-items: center; min-height: 42px; color: rgba(255,255,255,.66); padding: 8px 0; text-decoration: none; }
.content-back:hover { color: var(--brand-gold-light); }
.product-page { --page-line: rgba(255,255,255,.12); }
.content-screen .page-masthead {
  position: relative; display: block; width: auto; max-width: none; min-height: 370px;
  box-sizing: border-box; padding: clamp(50px, 6vw, 78px) min(32vw, 360px) clamp(44px, 5vw, 64px) 0;
  color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--page-line);
  box-shadow: none;
}
.content-screen .page-masthead::after { position: absolute; right: clamp(40px, 8vw, 120px); top: 50%; display: grid; place-items: center; width: clamp(126px, 14vw, 178px); aspect-ratio: 1; border: 1px solid rgba(255,255,255,.48); border-radius: 28px; color: #193126; background: linear-gradient(145deg, #fff2cf, #d5ae5e); box-shadow: inset 0 -9px rgba(93,57,25,.14), 0 28px 70px rgba(0,0,0,.25); font-family: Georgia, serif; font-size: clamp(4rem, 7vw, 6.2rem); font-weight: 900; line-height: 1; text-shadow: 0 2px rgba(255,255,255,.4); transform: translateY(-50%) rotate(5deg); }
.rules-page .page-masthead::after { content: "★"; }.bots-page .page-masthead::after { content: "AI"; font-family: inherit; font-size: clamp(2.8rem,5vw,4.2rem); transform: translateY(-50%) rotate(-5deg); }.games-page .page-masthead::after { content: "7"; transform: translateY(-50%) rotate(-4deg); }.not-found-page .page-masthead::after { content: "?"; }
.page-eyebrow, .page-section-label, .page-section-heading > span, .page-cta span, .profile-access > div > span {
  display: block; width: max-content; color: var(--brand-gold-light); font-size: .75rem; font-weight: 850; letter-spacing: .16em; line-height: 1.2; text-transform: uppercase; writing-mode: horizontal-tb;
}
.page-masthead h1 { max-width: 13ch; margin: 16px 0 22px; color: #fff8e8; font: 700 clamp(3rem, 5.8vw, 5.7rem)/.94 Georgia, "Times New Roman", serif; letter-spacing: -.052em; text-wrap: balance; }
.page-masthead > p { max-width: 680px; margin: 0; color: rgba(255,255,255,.7); font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.7; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.page-meta span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: rgba(255,255,255,.72); background: rgba(255,255,255,.045); font-size: .8rem; }
.page-section-heading { display: grid; gap: 11px; margin-bottom: 28px; }
.page-section-heading h2 { max-width: 18ch; margin: 0; color: #fff; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -.035em; }
.rules-section, .move-guide { padding: 54px 0; border-top: 1px solid var(--page-line); }
.rules-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.rules-steps article, .move-grid article, .profile-feature-grid article { min-width: 0; padding: 28px; border: 1px solid var(--page-line); border-radius: var(--brand-radius); background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.025)); box-shadow: 0 18px 50px rgba(0,0,0,.08); transition: transform .22s ease, border-color .22s ease, background .22s ease; }
.rules-steps article:hover, .move-grid article:hover, .profile-feature-grid article:hover { transform: translateY(-4px); border-color: rgba(213,174,94,.4); background-color: rgba(255,255,255,.07); }
.rules-steps article { display: flex; gap: 20px; }
.rules-steps b { flex: 0 0 auto; color: var(--brand-gold); font-size: .78rem; letter-spacing: .12em; }
.rules-steps h3, .move-grid h3 { margin: 0 0 10px; color: #fff; font-size: 1.3rem; }
.rules-steps p, .move-grid p, .profile-feature-grid p { margin: 0; color: rgba(255,255,255,.66); line-height: 1.65; }
.score-guide { display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: clamp(42px, 8vw, 100px); margin: 42px 0; padding: clamp(38px, 6vw, 70px); border-radius: 30px; color: var(--brand-ink); background: var(--brand-paper); box-shadow: var(--brand-shadow); }
.score-copy h2 { margin: 12px 0 16px; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -.04em; }
.score-copy p { line-height: 1.7; color: #425047; }
.score-copy strong { display: block; margin-top: 24px; color: #8c4e30; }
.score-copy .page-section-label { color: #8c4e30; }
.score-tiles { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 12px; }
.score-tile { aspect-ratio: 1; display: grid; place-content: center; gap: 5px; border-radius: 18px; color: #16251e; font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 900; text-align: center; box-shadow: inset 0 -5px rgba(0,0,0,.08); }
.score-tile small { font-size: .63rem; letter-spacing: .08em; text-transform: uppercase; }
.letter-two { background: #a9dce1; }.letter-three { background: #6bb4ca; }.word-two { background: #e9b5a7; }.word-three { background: #d87d68; }.start-star { background: #e3c36f; }
.move-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.move-grid i { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 30px; border-radius: 13px; background: rgba(213,174,94,.13); color: var(--brand-gold-light); font-size: 1.4rem; font-style: normal; }
.rules-details { padding: 58px 0; border-top: 1px solid var(--page-line); }
.rules-accordion { display: grid; gap: 10px; }
.rules-accordion details { border: 1px solid var(--page-line); border-radius: var(--radius-md); background: rgba(255,255,255,.045); }
.rules-accordion summary { position: relative; padding: 19px 54px 19px 20px; color: #fff; font-weight: 800; cursor: pointer; list-style: none; }
.rules-accordion summary::-webkit-details-marker { display: none; }
.rules-accordion summary::after { content: "+"; position: absolute; right: 20px; top: 50%; color: var(--brand-gold-light); font-size: 1.35rem; transform: translateY(-50%); }
.rules-accordion details[open] summary::after { content: "−"; }
.rules-accordion p { margin: 0; padding: 0 20px 20px; color: rgba(255,255,255,.68); line-height: 1.65; }
.page-cta, .profile-access { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-top: 54px; padding: 34px 38px; border: 1px solid rgba(213,174,94,.32); border-radius: var(--brand-radius); background: linear-gradient(110deg, rgba(213,174,94,.12), rgba(255,255,255,.035)); }
.page-cta h2, .profile-access h2 { margin: 7px 0 0; color: #fff; font-size: clamp(1.5rem, 3vw, 2.35rem); letter-spacing: -.025em; }
.content-primary, .content-secondary { min-height: 48px; border-radius: var(--control-radius); padding: 12px 22px; font: inherit; font-weight: 800; cursor: pointer; white-space: nowrap; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.content-primary { border: 0; background: var(--brand-gold); color: var(--brand-ink); box-shadow: 0 10px 26px rgba(213,174,94,.18); }
.content-primary:hover { background: var(--brand-gold-light); transform: translateY(-1px); }
.content-secondary { border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; }.content-secondary:hover { border-color: rgba(213,174,94,.62); background: rgba(213,174,94,.08); }
.bots-page .bot-grid { margin-top: 22px; }
.bot-principles { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 42px; border-block: 1px solid var(--page-line); }
.bot-principles span { padding: 22px 18px; color: rgba(255,255,255,.6); text-align: center; }
.bot-principles b { color: var(--brand-gold-light); }
.profile-access p { max-width: 650px; margin: 9px 0 0; color: rgba(255,255,255,.64); line-height: 1.6; }
.profile-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.profile-feature-grid span { display: block; color: var(--brand-gold); font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.profile-feature-grid h2 { margin: 32px 0 12px; color: #fff; font-size: 1.7rem; }
.profile-access { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.profile-access-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 20px; background: var(--brand-gold); color: var(--brand-ink); font-size: 2rem; font-weight: 900; box-shadow: inset 0 -5px rgba(0,0,0,.1); }
.profile-actions { display: flex; flex-direction: column; gap: 10px; }
.embedded-profile { overflow: hidden; margin-top: 42px; border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-xl); background: #f8f3e9; color: var(--brand-ink); box-shadow: var(--brand-shadow); }
.embedded-profile-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 28px 30px; border-bottom: 1px solid #ddd3c2; background: #fffaf1; }
.embedded-profile-head label { display: grid; gap: 8px; color: #80662e; font-size: .68rem; font-weight: 900; letter-spacing: .12em; }
.embedded-profile-head input { width: min(360px,70vw); min-height: 46px; padding: 10px 13px; border: 1px solid #d3c8b5; border-radius: var(--radius-md); background: #fff; color: #26352b; font: inherit; font-weight: 700; }
.embedded-profile-tabs { margin: 0; padding: 14px 30px 0; background: #fffaf1; }
.embedded-profile-tabs button { min-height: 44px; }
.embedded-profile-content { min-height: 260px; padding: 26px 30px 34px; }
.embedded-profile-content .profile-empty { min-height: 210px; display: grid; place-content: center; text-align: center; }
.embedded-profile-content .profile-game { background: #fff; }
.not-found-page { min-height: 70vh; }
.content-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  margin-top: 76px; padding: 28px 0 0; border-top: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.62);
}
.content-footer > div { display: flex; align-items: center; gap: 12px; }
.content-footer p { display: grid; gap: 2px; }.content-footer b { color: #fff4d8; font-family: Georgia,serif; }.content-footer small { font-size: .72rem; }
.content-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.content-footer a { color: rgba(255,255,255,.68); font-size: .82rem; text-decoration: none; }.content-footer a:hover, .content-footer a[aria-current="page"] { color: var(--brand-gold-light); }

body[data-view="hub"] #btn-sound, body[data-view="hub"] #btn-fullscreen, body[data-view="hub"] #btn-rules,
body[data-view="content"] #btn-sound, body[data-view="content"] #btn-fullscreen, body[data-view="content"] #btn-rules { display: none; }
body[data-view="game"] .site-nav-link, body[data-view="setup"] .site-nav-link { display: none; }

@media (max-width: 1320px) {
  .home-hub .hub-hero { grid-template-columns: minmax(0,1fr) minmax(380px,.76fr); gap: 36px; }
  .home-hub .hero-copy { max-width: 760px; }
  .hero-orbit-system { width: min(100%,560px); }
  .bot-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
  .mobile-menu-toggle { display: block; min-height: var(--control-height); margin-left: auto; border: 1px solid rgba(255,255,255,.18); border-radius: var(--control-radius); background: transparent; color: #fff; padding: 9px 13px; }
  body.menu-open { overflow: hidden; }
  body.menu-open::before { content: ""; position: fixed; inset: 66px 0 0; z-index: calc(var(--layer-header) - 1); background: rgba(2,13,8,.64); backdrop-filter: blur(5px); }
  .header-right { display: none; position: fixed; z-index: var(--layer-nav); left: 12px; right: 12px; top: 74px; padding: 12px; gap: 4px; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; background: #15382b; box-shadow: var(--brand-shadow); }
  .menu-open .header-right { display: grid; }
  .header-right .site-nav-link { display: block; width: 100%; min-height: 46px; text-align: left; text-decoration: none; }
  .header-right .header-new, .header-right #btn-profile { width: 100%; }
}

@media (max-width: 980px) {
  .home-hub .hub-hero { grid-template-columns: 1fr; }
  .hero-orbit-system { width: min(100%,570px); margin-inline: auto; }
}

@media (max-width: 700px) {
  .app-header { min-height: 66px; padding-block: 8px; }
  .header-shell { min-height: 50px; }
  .brand-tile { width: 36px; height: 36px; }
  .header-context { display: none; }
  .home-hub .hub-hero { min-height: auto; gap: 20px; padding: 44px 16px 48px; }
  .home-hub .hero-copy h1 { font-size: clamp(3rem, 15vw, 4.35rem); }
  .home-hub .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-link { text-align: center; }
  .hero-orbit-system { min-height: 230px; transform: scale(.7); margin: 28px 0 -8px; }
  .trust-strip { grid-template-columns: 1fr; }
  .trust-strip div { padding-block: 18px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.12); }
  .home-hub .mode-section { padding: 56px 12px 44px; }
  .home-hub .mode-card.featured { min-height: 260px; }
  .home-hub .mode-card:not(.featured) {
    min-height: 158px; display: grid; grid-template-columns: 58px minmax(0,1fr);
    grid-template-rows: auto auto; gap: 8px 14px; padding: 18px;
  }
  .home-hub .mode-card:not(.featured) .mode-card-top { grid-area: 1 / 1 / 3; align-self: start; }
  .home-hub .mode-card:not(.featured) .mode-copy { grid-area: 1 / 2; }
  .home-hub .mode-card:not(.featured) .mode-meta { display: none; }
  .home-hub .mode-card:not(.featured) .mode-cta { grid-area: 2 / 2; padding-top: 8px; }
  .home-hub .play-path { padding-block: 20px; }
  .home-hub .bot-showcase { padding: 62px 12px; }
  #landing-bot-grid .bot-card:nth-child(n+3) { display: none; }
  #landing-bot-grid .bot-card { display: grid; grid-template-columns: 112px minmax(0,1fr); min-height: 170px; }
  #landing-bot-grid .bot-portrait { height: 100%; min-height: 170px; aspect-ratio: auto; }
  #landing-bot-grid .bot-card > div { display: flex; flex-direction: column; justify-content: center; padding: 15px; }
  #landing-bot-grid .bot-card h3 { font-size: 1.2rem; }
  #landing-bot-grid .bot-card button { margin-top: 8px; font-size: .72rem; }
  .home-hub .hub-lower { padding: 58px 12px; }
  .home-hub .hub-lower .hub-secondary { display: none; }
  .bot-grid, .rules-steps, .move-grid, .profile-feature-grid { grid-template-columns: 1fr; }
  .content-shell { width: min(100% - 28px, 1180px); }
  .page-masthead { padding-top: 42px; }
  .content-screen .page-masthead { min-height: 0; padding-right: 0; }
  .content-screen .page-masthead::after { display: none; }
  .page-masthead h1 { max-width: 11ch; font-size: clamp(2.75rem, 13vw, 3.55rem); line-height: .94; }
  .page-masthead > p { font-size: 1rem; line-height: 1.58; }
  .page-section-heading { display: grid; }
  .score-guide { grid-template-columns: 1fr; padding: 28px; }
  .score-tiles { grid-template-columns: repeat(3, 1fr); }
  .page-cta { align-items: stretch; flex-direction: column; padding: 28px; }
  .page-cta .content-primary { width: 100%; white-space: normal; }
  .profile-access { grid-template-columns: auto 1fr; padding: 26px; }
  .profile-actions { grid-column: 1 / -1; margin-top: 8px; }
  .embedded-profile { margin-top: 26px; border-radius: var(--radius-lg); }
  .embedded-profile-head { align-items: stretch; flex-direction: column; padding: 22px 18px; }
  .embedded-profile-head input { width: 100%; }
  .embedded-profile-head .content-primary { width: 100%; }
  .embedded-profile-tabs { padding: 12px 14px 0; }
  .embedded-profile-content { padding: 18px 14px 24px; }
  .bot-principles { grid-template-columns: 1fr; }
  .bot-principles span { border-bottom: 1px solid var(--page-line); }
  .bot-principles span:last-child { border: 0; }
  .content-footer { align-items: flex-start; flex-direction: column; margin-top: 54px; }
  .content-footer nav { gap: 12px 18px; }
}

/* Важан лимит партије стоји уз остале информације о партији. */
.scoreless-status {
  --scoreless-hue: 132;
  --scoreless-accent: hsl(var(--scoreless-hue) 52% 34%);
  width: 100%; margin: 0; padding: 10px 12px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 7px 14px; color: var(--scoreless-accent);
  border: 1px solid hsl(var(--scoreless-hue) 36% 68%); border-radius: 13px;
  background: linear-gradient(135deg,
    hsl(var(--scoreless-hue) 48% 97%),
    hsl(var(--scoreless-hue) 45% 89%));
  box-shadow: 0 3px 10px rgba(35,63,43,.07);
  transition: background .22s ease, border-color .22s ease, color .22s ease, box-shadow .22s ease;
}
.scoreless-status-copy { min-width: 0; }
.scoreless-status-copy > div { min-width: 0; }
.scoreless-status-kicker {
  display: block; font-size: .65rem; line-height: 1; font-weight: 900;
  letter-spacing: .11em; color: var(--scoreless-accent);
}
.scoreless-status p { margin-top: 4px; font-size: .76rem; line-height: 1.25; color: var(--scoreless-accent); }
.scoreless-status > strong {
  min-width: 58px; display: flex; align-items: baseline; justify-content: flex-end;
  color: var(--scoreless-accent); font: 900 1.65rem/1 Georgia, serif;
}
.scoreless-status > strong small { margin-left: 2px; font: 800 .82rem/1 system-ui, sans-serif; opacity: .62; }
.scoreless-meter { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.scoreless-meter span {
  height: 5px; border-radius: 999px;
  background: hsl(var(--scoreless-hue) 24% 75% / .45);
}
.scoreless-meter span.filled { background: var(--scoreless-accent); }
.scoreless-status.is-danger {
  box-shadow: 0 4px 14px hsl(var(--scoreless-hue) 54% 30% / .18);
}

/* Responsive application surfaces: setup, profile and gameplay share the same shell. */
@media (min-width: 901px) {
  body[data-view="game"] main {
    min-height: calc(100dvh - 66px); max-width: 1400px;
    padding: clamp(18px, 2.4vh, 32px) clamp(18px, 2.2vw, 34px);
    grid-template-columns: minmax(0, 1fr) minmax(320px, 350px);
    grid-template-rows: auto auto;
    column-gap: clamp(18px, 2vw, 30px); row-gap: 12px;
    align-content: center; align-items: start; overflow: visible;
  }
  body[data-view="game"] #board-wrap {
    min-height: 0; align-self: end; display: grid; justify-items: center;
    overflow: visible;
  }
  body[data-view="game"] #board {
    width: min(100%, clamp(420px, calc(100dvh - 340px), 880px));
    max-width: 100%; contain: layout paint;
  }
  body[data-view="game"] #side {
    min-height: 0; align-self: stretch; max-height: calc(100dvh - 110px);
    overflow-y: auto; scrollbar-gutter: stable;
  }
  body[data-view="game"] #rack-area {
    align-self: start; padding-block: 0 4px; position: relative; z-index: 3;
  }
}

@media (min-width: 1081px) {
  body[data-view="game"] #rack-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "rack" "controls";
    justify-items: center;
    row-gap: 8px;
  }
  body[data-view="game"] #rack { grid-area: rack; justify-self: center; }
  body[data-view="game"] #controls {
    grid-area: controls;
    justify-self: center;
    flex-wrap: nowrap;
  }
  body[data-view="game"] #exchange-bar { grid-column: 1 / -1; }
}

/* Gameplay stays comfortable on tablets and narrow laptop windows. */
@media (min-width: 901px) and (max-width: 1080px) {
  body[data-view="game"] main {
    grid-template-columns: 1fr;
    grid-template-rows: max-content max-content max-content;
    grid-template-areas: "board" "rack" "side";
    max-width: 820px; align-content: start;
    overflow: visible;
  }
  body[data-view="game"] #board-wrap,
  body[data-view="game"] #rack-area { width: min(100%, 720px); justify-self: center; }
  body[data-view="game"] #side {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 720px); max-height: none; justify-self: center; overflow: visible;
  }
  body[data-view="game"] #players,
  body[data-view="game"] #scoreless-status,
  body[data-view="game"] .history-panel { grid-column: 1 / -1; }
  body[data-view="game"] #players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (max-width: 1080px) {
  body[data-view="game"] .history-panel { display: block; min-height: 0; overflow: visible; }
  body[data-view="game"] #history {
    max-height: none; overflow: visible; padding-right: 0; margin-right: 0;
  }
}

@media (max-width: 900px) {
  #dlg-new.overlay { align-items: stretch; padding: 0; }
  #dlg-new .new-game-card {
    width: 100%; height: 100dvh; max-height: 100dvh; min-height: 0;
    grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr);
    overflow: hidden; border: 0; border-radius: 0;
  }
  #dlg-new .setup-identity {
    min-height: 0; padding: 14px 18px; gap: 12px;
    grid-template-columns: auto minmax(0,1fr) auto; align-items: center;
  }
  #dlg-new .setup-back { grid-column: 1 / -1; padding: 0; }
  #dlg-new .setup-mode-symbol { width: 44px; height: 44px; border-radius: var(--radius-md); }
  #dlg-new .setup-identity h2 { margin: 3px 0 0; font-size: 1.35rem; }
  #dlg-new .setup-subtitle, #dlg-new .setup-benefits { display: none; }
  #dlg-new .setup-form { min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 18px 16px 20px; }
  #dlg-new[data-setup-step="1"] [data-setup-panel]:not([data-setup-panel="1"]),
  #dlg-new[data-setup-step="2"] [data-setup-panel]:not([data-setup-panel="2"]),
  #dlg-new[data-setup-step="3"] [data-setup-panel]:not([data-setup-panel="3"]) { display: none !important; }
  #dlg-new .setup-mobile-nav {
    position: sticky; bottom: -20px; z-index: 4; display: flex; justify-content: space-between; gap: 12px;
    order: 20; margin: 22px -16px -20px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    background: rgba(250,247,239,.98); border-top: 1px solid #ded4c3; box-shadow: 0 -12px 30px rgba(30,42,33,.1);
  }
  #dlg-new .setup-mobile-nav button { min-height: 46px; flex: 1; }
  #dlg-new .setup-review { display: grid; gap: 8px; padding: 24px; border: 1px solid #d8cdb9; border-radius: var(--radius-lg); background: #fffdf8; }
  #dlg-new .setup-review > span { color: #9b7732; font-size: .68rem; font-weight: 900; letter-spacing: .13em; }
  #dlg-new .setup-review strong { color: #263d2d; font: 700 1.65rem/1.1 Georgia,serif; }
  #dlg-new .setup-review p { color: #746b5d; line-height: 1.55; }
  #dlg-new .new-game-actions { position: static; margin-top: 14px; padding: 0; background: none; box-shadow: none; }
  #dlg-new[data-setup-step="3"] .setup-mobile-nav { margin-top: 16px; }
  #dlg-profile.overlay { align-items: stretch; padding: 0; }
  #dlg-profile .profile-card { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; overflow-y: auto; }
  #dlg-profile .profile-hero { position: sticky; top: 0; z-index: 2; padding: 20px; }
  body[data-view="game"] main { grid-template-columns: minmax(0,1fr); padding-top: 8px; }
  body[data-view="game"] #rack-area { position: sticky; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 12; box-shadow: 0 18px 45px rgba(18,35,23,.28); }
  body[data-view="game"] #side { order: 3; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-view="game"] #players,
  body[data-view="game"] .history-panel { grid-column: 1 / -1; }
  body[data-view="game"] #players { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
}

@media (max-width: 560px) {
  #dlg-new .setup-form .ai-difficulty-choice { grid-template-columns: 1fr; }
  #dlg-new .setup-form-head strong { font-size: 1.05rem; }
  #dlg-new .setup-progress { margin-bottom: 8px; }
  #dlg-new .setup-note { margin-bottom: 0; }
  body[data-view="game"] #controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
  body[data-view="game"] .action-group { min-width: 0; }
  body[data-view="game"] .info-btn { display: none; }
  body[data-view="game"] .action-group { grid-template-columns: 1fr; }
  body[data-view="game"] #rack { width: 100%; justify-content: center; gap: clamp(3px,1.2vw,6px); padding-inline: clamp(6px,2vw,10px); }
  body[data-view="game"] #rack .tile,
  body[data-view="game"] #rack .rack-slot {
    width: min(44px, calc((100vw - 58px) / 7));
    height: min(48px, calc((100vw - 58px) / 7 + 4px));
    flex-basis: min(44px, calc((100vw - 58px) / 7));
  }
  body[data-view="game"] .action-main { min-height: 48px; }
  body[data-view="game"] .preview {
    width: 100%; border-radius: 14px; justify-content: flex-start; align-items: flex-start;
  }
  body[data-view="game"] .preview-copy { align-items: flex-start; flex-direction: column; gap: 3px; }
  body[data-view="game"] #side { grid-template-columns: 1fr; }
  body[data-view="game"] #players,
  body[data-view="game"] .history-panel { grid-column: auto; }
  body[data-view="game"] #players { grid-template-columns: 1fr; }
  body[data-view="game"] .scoreless-status { padding: 8px 9px; gap: 6px 9px; }
  body[data-view="game"] .scoreless-status p { font-size: .7rem; }
  body[data-view="game"] .scoreless-status > strong { min-width: 48px; font-size: 1.45rem; }
}

/* -------------------------------------------------------------------------
   Private analytics workspace
   ------------------------------------------------------------------------- */
.analytics-page { padding-top: 24px; }
header.analytics-masthead {
  display: flex; align-items: end; justify-content: space-between; gap: 30px;
  padding: 42px 0 30px; color: inherit; background: transparent;
  border: 0; border-bottom: 1px solid rgba(255,255,255,.14); box-shadow: none;
}
.analytics-masthead h1 {
  margin: 9px 0 0; color: #fff8e8;
  font: 700 clamp(2.5rem, 5vw, 4.8rem)/.96 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
}
.analytics-masthead > p { margin: 0 0 6px; color: rgba(255,255,255,.58); font-size: .84rem; }
.analytics-auth {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr);
  gap: clamp(42px, 8vw, 110px); align-items: end; min-height: 430px;
  padding: 72px 0 90px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.analytics-auth h2 { max-width: 15ch; margin: 12px 0 14px; color: #fff; font-size: clamp(1.8rem, 3.5vw, 3rem); line-height: 1.02; }
.analytics-auth > div p { max-width: 520px; color: rgba(255,255,255,.6); line-height: 1.65; }
.analytics-auth form { display: grid; gap: 10px; }
.analytics-auth label { color: rgba(255,255,255,.7); font-size: .78rem; font-weight: 800; }
.analytics-key-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
.analytics-key-row input {
  min-width: 0; min-height: 52px; padding: 11px 14px; border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--control-radius); outline: 0; color: #fff; background: rgba(255,255,255,.06); font: inherit;
}
.analytics-key-row input:focus { border-color: var(--brand-gold); box-shadow: 0 0 0 3px rgba(213,174,94,.15); }
.analytics-key-row button, .analytics-range button {
  min-height: 44px; border: 1px solid rgba(255,255,255,.16); border-radius: var(--control-radius);
  color: #fff; background: rgba(255,255,255,.055); font: inherit; font-weight: 800; cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.analytics-key-row button { min-height: 52px; padding: 11px 18px; border-color: var(--brand-gold); color: var(--brand-ink); background: var(--brand-gold); }
.analytics-key-row button:hover, .analytics-range button:hover { transform: translateY(-1px); }
.analytics-status { min-height: 22px; color: #efc285; font-size: .83rem; }
.analytics-dashboard { padding: 54px 0 92px; animation: analytics-reveal .24s ease-out both; }
@keyframes analytics-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.analytics-dashboard[aria-busy="true"] { opacity: .58; pointer-events: none; }
.analytics-toolbar, .analytics-section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.analytics-toolbar h2 { margin: 9px 0 6px; color: #fff; font-size: clamp(1.7rem, 3vw, 2.55rem); letter-spacing: -.03em; }
.analytics-toolbar p, .analytics-section-head > p { color: rgba(255,255,255,.52); font-size: .78rem; }
.analytics-range { display: inline-flex; gap: 6px; }
.analytics-range button { padding: 9px 13px; }
.analytics-range button[aria-pressed="true"] { border-color: var(--brand-gold); color: #251d10; background: var(--brand-gold); }
.analytics-self-filter {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-top: 30px; padding: 18px 0; border-block: 1px solid rgba(118,189,161,.28);
}
.analytics-self-filter > div { display: flex; align-items: center; gap: 13px; min-width: 0; }
.analytics-filter-state {
  display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center;
  border: 1px solid rgba(118,189,161,.52); border-radius: 50%; color: #b9ead7;
  background: rgba(118,189,161,.12); font-weight: 900;
}
.analytics-self-filter h3 { margin: 0 0 4px; color: #e8fff6; font-size: .92rem; }
.analytics-self-filter p { margin: 0; color: rgba(255,255,255,.56); font-size: .76rem; line-height: 1.45; }
.analytics-self-filter button {
  flex: 0 0 auto; min-height: 40px; padding: 8px 12px; border: 1px solid rgba(118,189,161,.4);
  border-radius: var(--control-radius); color: #cef2e4; background: rgba(118,189,161,.08);
  font: inherit; font-size: .75rem; font-weight: 800; cursor: pointer;
}
.analytics-self-filter[data-network-excluded="true"] button { border-color: rgba(255,255,255,.2); color: rgba(255,255,255,.72); background: transparent; }
.analytics-self-filter button:hover { border-color: #91d2b9; }
.analytics-self-filter button:disabled { opacity: .55; cursor: wait; }
.analytics-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 34px;
  border-block: 1px solid rgba(255,255,255,.15);
}
.analytics-kpis > div { display: grid; gap: 7px; padding: 26px clamp(16px, 3vw, 32px); border-right: 1px solid rgba(255,255,255,.11); }
.analytics-kpis > div:first-child { padding-left: 0; }.analytics-kpis > div:last-child { border-right: 0; }
.analytics-kpis span { color: rgba(255,255,255,.58); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.analytics-kpis strong { color: #fff8e8; font: 700 clamp(2.05rem, 4vw, 3.35rem)/1 Georgia,serif; letter-spacing: -.04em; }
.analytics-kpis small { color: var(--brand-gold-light); font-size: .72rem; }
.analytics-trend-section { padding: 54px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.analytics-section-head h3, .analytics-breakdowns h3, .analytics-table-section h3 { margin: 8px 0 0; color: #fff; font-size: 1.45rem; }
.analytics-legend { display: flex; gap: 18px; color: rgba(255,255,255,.65); font-size: .74rem; }
.analytics-legend span { display: flex; align-items: center; gap: 7px; }
.analytics-legend i { width: 20px; height: 3px; border-radius: 999px; }.analytics-legend .views { background: var(--brand-gold); }.analytics-legend .visitors { background: #76bda1; }
.analytics-chart { margin-top: 30px; }
.analytics-chart svg { display: block; width: 100%; height: 250px; overflow: visible; }
.chart-grid line { stroke: rgba(255,255,255,.09); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-views { stroke: var(--brand-gold); }.chart-visitors { stroke: #76bda1; }
.analytics-axis { display: flex; justify-content: space-between; margin-top: 9px; color: rgba(255,255,255,.43); font-size: .7rem; }
.analytics-breakdowns { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(44px, 8vw, 110px); padding: 54px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.analytics-breakdowns h4 { margin: 26px 0 12px; color: rgba(255,255,255,.52); font-size: .69rem; letter-spacing: .11em; text-transform: uppercase; }
.analytics-bars { display: grid; gap: 14px; margin-top: 24px; }
.analytics-bar-row { display: grid; gap: 7px; }
.analytics-bar-row > div { display: flex; justify-content: space-between; gap: 14px; color: rgba(255,255,255,.72); font-size: .8rem; }
.analytics-bar-row strong { color: #fff; }
.analytics-bar-row > i { height: 3px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.analytics-bar-row > i b { display: block; height: 100%; border-radius: inherit; background: var(--brand-gold); transition: width .3s ease-out; }
.analytics-audience { padding: 54px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.analytics-audience h3 { margin: 8px 0 0; color: #fff; font-size: 1.45rem; }
.analytics-audience-grid { display: grid; grid-template-columns: minmax(220px,.72fr) minmax(0,1.7fr); gap: clamp(40px,6vw,84px); margin-top: 34px; }
.analytics-audience-grid h4 { margin: 0; color: rgba(255,255,255,.52); font-size: .69rem; letter-spacing: .11em; text-transform: uppercase; }
.analytics-location-list { display: grid; gap: 17px; margin-top: 22px; }
.analytics-location-row { display: grid; gap: 8px; }
.analytics-location-row > div { display: grid; gap: 3px; }
.analytics-location-row strong { color: #fff; font-size: .83rem; font-weight: 720; }
.analytics-location-row span { color: rgba(255,255,255,.46); font-size: .7rem; }
.analytics-location-row > i { height: 2px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.09); }
.analytics-location-row > i b { display: block; height: 100%; border-radius: inherit; background: #76bda1; }
.analytics-visitors-scroll { margin-top: 14px; overflow-x: auto; }
.analytics-visitors-scroll table { width: 100%; min-width: 670px; border-collapse: collapse; font-size: .76rem; }
.analytics-visitors-scroll th, .analytics-visitors-scroll td { padding: 13px 12px; border-bottom: 1px solid rgba(255,255,255,.085); text-align: right; }
.analytics-visitors-scroll thead th { color: rgba(255,255,255,.44); font-size: .64rem; letter-spacing: .07em; text-transform: uppercase; }
.analytics-visitors-scroll th:first-child, .analytics-visitors-scroll td:nth-child(2) { text-align: left; }
.analytics-visitors-scroll th:first-child { padding-left: 0; }
.analytics-visitors-scroll th:last-child, .analytics-visitors-scroll td:last-child { padding-right: 0; }
.analytics-visitors-scroll tbody th { color: var(--brand-gold-light); font-weight: 800; }
.analytics-visitors-scroll tbody td { color: rgba(255,255,255,.78); font-variant-numeric: tabular-nums; }
.analytics-visitors-scroll tbody th strong, .analytics-visitors-scroll tbody th small,
.analytics-visitors-scroll tbody td span, .analytics-visitors-scroll tbody td small { display: block; }
.analytics-visitors-scroll small { margin-top: 3px; color: rgba(255,255,255,.4); font-size: .65rem; font-weight: 500; }
.analytics-table-section { padding-top: 54px; }
.analytics-table-scroll { margin-top: 24px; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.14); }
.analytics-table-section table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: .82rem; }
.analytics-table-section th, .analytics-table-section td { padding: 15px 14px; border-bottom: 1px solid rgba(255,255,255,.085); text-align: right; }
.analytics-table-section thead th { color: rgba(255,255,255,.48); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.analytics-table-section th:first-child { padding-left: 0; text-align: left; }.analytics-table-section td:last-child, .analytics-table-section th:last-child { padding-right: 0; }
.analytics-table-section tbody th { color: rgba(255,255,255,.66); font-weight: 650; }.analytics-table-section tbody td { color: #fff; font-variant-numeric: tabular-nums; }
.analytics-empty { margin-top: 22px; color: rgba(255,255,255,.5); font-size: .82rem; }

@media (max-width: 900px) {
  .analytics-auth { grid-template-columns: 1fr; min-height: 0; gap: 34px; padding-block: 54px 70px; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; }
  .analytics-kpis > div:nth-child(2) { border-right: 0; }.analytics-kpis > div:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.11); }
  .analytics-kpis > div:nth-child(3) { padding-left: 0; }
  .analytics-breakdowns { gap: 44px; }
  .analytics-audience-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  header.analytics-masthead, .analytics-toolbar, .analytics-section-head { align-items: flex-start; flex-direction: column; }
  .analytics-masthead h1 { font-size: 2.75rem; }
  .analytics-masthead > p { font-size: .75rem; }
  .analytics-key-row { grid-template-columns: 1fr; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; }
  .analytics-kpis > div { padding: 20px 13px; }
  .analytics-kpis > div:first-child, .analytics-kpis > div:nth-child(3) { padding-left: 0; }
  .analytics-kpis strong { font-size: 2rem; }
  .analytics-range { width: 100%; }.analytics-range button { flex: 1; }
  .analytics-chart svg { height: 190px; }
  .analytics-breakdowns { grid-template-columns: 1fr; }
  .analytics-breakdowns > section + section { padding-top: 40px; border-top: 1px solid rgba(255,255,255,.1); }
  .analytics-self-filter { align-items: flex-start; flex-direction: column; }
  .analytics-self-filter button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .analytics-dashboard { animation: none; }
  .analytics-bar-row > i b { transition: none; }
}

body[data-view="game"] button,
body[data-view="game"] .cell,
body[data-view="game"] .tile { touch-action: manipulation; }
body[data-view="game"] #board { overscroll-behavior: contain; }
.preview.thinking {
  --preview-tone: #806329; --preview-border: #dcc27d; --preview-bg: #fff9e9;
}
.preview.thinking .preview-icon { animation: thinking-pulse .9s ease-in-out infinite alternate; }
@keyframes thinking-pulse { to { transform: scale(.78); opacity: .55; } }
.tile.ai-reveal {
  animation: ai-tile-arrive 320ms cubic-bezier(.2,.8,.25,1) both;
  animation-delay: min(calc(var(--ai-reveal-order, 0) * 70ms), 280ms);
  transform-origin: center;
}
@keyframes ai-tile-arrive {
  0% { opacity: 0; transform: translateY(-45%) scale(.72) rotate(-3deg); }
  65% { opacity: 1; transform: translateY(4%) scale(1.04) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bot-card { transition: none; transform: none; }
  .hero-orbit-system, .space-orbit, .space-tile, .space-star { animation: none; }
  .preview.thinking .preview-icon { animation: none; }
  .tile.ai-reveal { animation: none; }
  .orbit-a { transform: rotate(18deg); }.orbit-b { transform: rotate(68deg); }
  .orbit-c { transform: rotate(122deg); }.orbit-d { transform: rotate(178deg); }
  .orbit-e { transform: rotate(218deg); }.orbit-f { transform: rotate(262deg); }
  .orbit-g { transform: rotate(304deg); }.orbit-h { transform: rotate(344deg); }
  .orbit-i { transform: rotate(145deg); }.orbit-j { transform: rotate(286deg); }
}

/* Premium action hierarchy: utilities, navigation and the primary play CTA. */
.header-right { align-items: center; gap: 7px; }
.brand-cluster { min-width: 0; display: inline-flex; align-items: center; gap: 7px; }
.beta-status { position: relative; flex: 0 0 auto; }
.beta-status summary {
  list-style: none; padding: 3px 6px 2px; border: 1px solid rgba(241,216,146,.38);
  border-radius: 5px; color: #f1d892; background: rgba(241,216,146,.08);
  font-size: .5rem; font-weight: 900; line-height: 1; letter-spacing: .12em;
  cursor: help; user-select: none;
}
.beta-status summary::-webkit-details-marker { display: none; }
.beta-status summary:hover { border-color: rgba(241,216,146,.62); background: rgba(241,216,146,.14); }
.beta-status summary:focus-visible { outline: 2px solid #f1d892; outline-offset: 3px; }
.beta-note {
  position: absolute; z-index: calc(var(--layer-nav) + 1); left: 0; top: calc(100% + 10px);
  width: min(270px, calc(100vw - 24px)); padding: 10px 12px; border: 1px solid rgba(241,216,146,.22);
  border-radius: 10px; color: rgba(255,255,255,.84); background: #15382b;
  box-shadow: 0 14px 34px rgba(2,13,8,.34); font-size: .72rem; font-weight: 650;
  line-height: 1.45; letter-spacing: 0; opacity: 0; visibility: hidden;
  transform: translateY(-3px); transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.beta-status:hover .beta-note,
.beta-status:focus-within .beta-note,
.beta-status[open] .beta-note { opacity: 1; visibility: visible; transform: translateY(0); }
.header-utilities {
  display: inline-flex; align-items: center; gap: 5px; margin-right: 2px;
  padding-right: 9px; border-right: 1px solid rgba(255,255,255,.12);
}
.header-right .header-action {
  min-height: 42px; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 7px; border: 1px solid transparent; border-radius: 11px;
  background: transparent; color: rgba(255,255,255,.76); box-shadow: none;
  font-size: .78rem; font-weight: 820;
}
.header-right .header-action:hover:not(:disabled) {
  color: #fff; border-color: rgba(241,216,146,.16); background: rgba(255,255,255,.075);
  box-shadow: none;
}
.header-right .header-action:active:not(:disabled) { background: rgba(255,255,255,.11); }
.header-right .icon-toggle::before { content: none; }
.header-action-icon {
  width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center;
  border-radius: 8px; color: var(--brand-gold-light); background: rgba(241,216,146,.1);
}
.header-action-icon svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.header-right .icon-toggle[aria-pressed="false"] { color: rgba(255,255,255,.55); background: transparent; }
.header-right .icon-toggle[aria-pressed="false"] .header-action-icon { color: rgba(255,255,255,.5); background: rgba(255,255,255,.06); }
.header-new {
  min-height: 42px; display: inline-flex; align-items: center; gap: 12px;
  padding: 5px 6px 5px 16px; border-radius: 11px; font-size: .83rem; font-weight: 900;
  letter-spacing: .01em;
}
.header-cta-arrow {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  background: rgba(49,38,13,.12); font-size: 1rem; transition: transform .18s ease, background .18s ease;
}
.header-new:hover:not(:disabled) .header-cta-arrow { transform: translateX(2px); background: rgba(49,38,13,.18); }
body[data-view="hub"] .header-utilities,
body[data-view="content"] .header-utilities { display: none; }

.home-hub .hero-actions { align-items: stretch; gap: 13px; }
.home-hub .hero-actions .hero-play,
.home-hub .hero-actions .hero-link {
  min-height: 58px; display: inline-flex; align-items: center; justify-content: space-between;
  gap: 26px; padding: 10px 11px 10px 20px; border-radius: 14px;
  font-size: .88rem; font-weight: 900; text-decoration: none;
}
.home-hub .hero-actions .hero-play { min-width: 218px; }
.home-hub .hero-actions .hero-link {
  min-width: 224px; border: 1px solid rgba(241,216,146,.24);
  background: rgba(255,255,255,.055); color: rgba(255,255,255,.86);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.home-hub .hero-actions .hero-link:hover:not(:disabled) {
  color: #fff; border-color: rgba(241,216,146,.45); background: rgba(255,255,255,.095);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 12px 26px rgba(0,0,0,.2);
}
.home-hub .hero-actions .hero-link i {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  background: rgba(241,216,146,.11); color: var(--brand-gold-light); font-style: normal;
  transition: transform .18s ease, background .18s ease;
}
.home-hub .hero-actions .hero-link:hover i { transform: translate(2px,-2px); background: rgba(241,216,146,.16); }

/* Move feedback lives in a fixed-height HUD slot, so validation never shifts the board. */
body[data-view="game"] .preview-slot {
  width: min(100%, 620px);
  height: 42px; min-height: 42px; flex: 0 0 42px;
  align-self: center;
}
body[data-view="game"] #board-wrap .preview-slot {
  margin-top: 5px;
}
body[data-view="game"] .preview {
  box-sizing: border-box;
  width: fit-content; max-width: 100%; height: 38px; min-height: 38px;
  justify-content: center; gap: 8px; padding: 6px 10px 6px 7px;
  border: 1px solid var(--preview-border); border-left: 3px solid var(--preview-tone); border-radius: 8px;
  color: #24372a; background: #f5f8f5;
  box-shadow: 0 4px 12px rgba(23,54,36,.09); overflow: hidden;
  animation: game-toast-in .18s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes game-toast-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
}
body[data-view="game"] .preview::after {
  content: "";
  width: 24px;
  flex: 0 0 24px;
}
body[data-view="game"] .preview.ok {
  --preview-tone: #2f6b43; --preview-border: #b9d0bf;
  color: #24442f; background: #edf6ef;
}
body[data-view="game"] .preview.err {
  --preview-tone: #a33e35; --preview-border: #ddb8b3;
  color: #6f302a; background: #fff3f1;
}
body[data-view="game"] .preview.wait,
body[data-view="game"] .preview.thinking {
  --preview-tone: #8b681d; --preview-border: #ddca91;
  color: #654d19; background: #fff8e8;
}
body[data-view="game"] .preview-icon {
  width: 24px; height: 24px; flex-basis: 24px; border-radius: 6px;
  background: var(--preview-tone); color: #fff; font-size: .75rem;
  box-shadow: none;
}
body[data-view="game"] .preview-copy {
  flex: 0 1 auto; justify-content: center; gap: 10px;
  text-align: center;
  color: inherit; font-size: .84rem; line-height: 1.2; overflow: hidden;
}
body[data-view="game"] .preview-copy strong {
  color: var(--preview-tone); font-size: .65rem; letter-spacing: .08em;
}
body[data-view="game"] .preview-copy span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 1100px) {
  .header-utilities { margin: 0; padding: 0; border: 0; }
  .header-right .header-action { width: 100%; justify-content: flex-start; min-height: 48px; }
  .header-right .header-new { width: 100%; justify-content: space-between; min-height: 48px; }
}

@media (max-width: 420px) {
  .brand-cluster { gap: 5px; }
  .beta-status summary { padding-inline: 5px; font-size: .46rem; }
}

@media (max-width: 560px) {
  .beta-note { left: 50%; transform: translate(-50%,-3px); }
  .beta-status:hover .beta-note,
  .beta-status:focus-within .beta-note,
  .beta-status[open] .beta-note { transform: translate(-50%,0); }
  .home-hub .hero-actions .hero-play,
  .home-hub .hero-actions .hero-link { width: 100%; min-width: 0; }
  body[data-view="game"] .preview { width: fit-content; max-width: 100%; padding: 6px 8px; align-items: center; }
  body[data-view="game"] .preview-copy {
    flex-direction: row; align-items: baseline; gap: 7px;
    font-size: .78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .beta-note,
  .header-cta-arrow,
  .home-hub .hero-actions .hero-link i { transition: none; }
  .header-new:hover:not(:disabled) .header-cta-arrow,
  .home-hub .hero-actions .hero-link:hover i { transform: none; }
}

/* -------------------------------------------------------------------------
   Editorial game-table direction

   The first viewport behaves like a composed game surface: one promise,
   one action, and a tactile word construction. The same mode components are
   retained below, while /igraj becomes a focused route instead of an anchor
   jump into the middle of the marketing page.
   ------------------------------------------------------------------------- */
.home-hub .hub-hero {
  min-height: clamp(640px, calc(100svh - 66px), 740px);
  grid-template-columns: minmax(0, .95fr) minmax(440px, 1.05fr);
  gap: clamp(42px, 6vw, 92px);
  padding-block: clamp(46px, 6vh, 68px);
  background:
    radial-gradient(circle at 79% 42%, rgba(213,174,94,.13), transparent 29%),
    linear-gradient(145deg, #113326 0%, #0a251b 62%, #071c14 100%);
}
.home-hub .hero-copy > p { color: rgba(248,242,232,.76); }
.home-hub .hero-facts { opacity: .9; }

/* The old orbit markup becomes a structured word board. */
.hero-orbit-system {
  --word-tile-w: 76px;
  --word-tile-h: 82px;
  width: min(100%, 590px);
  min-height: 500px;
  overflow: hidden;
  border: 1px solid rgba(241,216,146,.16);
  border-radius: 34px;
  background:
    linear-gradient(rgba(241,216,146,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241,216,146,.055) 1px, transparent 1px),
    radial-gradient(circle at 72% 22%, rgba(213,174,94,.12), transparent 24%),
    linear-gradient(145deg, rgba(255,255,255,.035), rgba(0,0,0,.14));
  background-size: 56px 56px, 56px 56px, auto, auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 32px 70px rgba(0,0,0,.24);
  transform: rotate(-1.25deg);
  animation: editorial-board-in .72s cubic-bezier(.2,.8,.2,1) .08s both;
}
.hero-orbit-system::before {
  width: 68%;
  opacity: .3;
  filter: blur(18px);
  background: radial-gradient(circle, rgba(112,180,132,.22), transparent 68%);
}
.hero-orbit-system::after {
  content: "РЕЧ ПО РЕЧ  ·  ПОТЕЗ ПО ПОТЕЗ";
  position: absolute;
  left: 8%;
  bottom: 7%;
  color: rgba(248,242,232,.42);
  font-size: .63rem;
  font-weight: 850;
  letter-spacing: .16em;
}
.hero-orbit-system .orbit-glow,
.hero-orbit-system .space-star { display: none; }
.hero-orbit-system .space-orbit {
  width: var(--word-tile-w);
  height: var(--word-tile-h);
  left: auto;
  top: auto;
  opacity: 1;
  filter: none;
  transform: none;
  animation: editorial-tile-in .55s cubic-bezier(.2,.8,.2,1) both;
  will-change: transform, opacity;
}
.hero-orbit-system .space-tile,
.hero-orbit-system .depth-back .space-tile,
.hero-orbit-system .depth-front .space-tile {
  position: relative;
  inset: auto;
  width: var(--word-tile-w);
  height: var(--word-tile-h);
  border-radius: 14px;
  font-size: 2rem;
  transform: none;
  animation: none;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.8), 0 14px 26px rgba(0,0,0,.28);
}
.hero-orbit-system .orbit-a { left: 19%; top: 28%; animation-delay: .14s; }
.hero-orbit-system .orbit-b { left: 41%; top: 28%; animation-delay: .19s; }
.hero-orbit-system .orbit-c { left: 63%; top: 28%; animation-delay: .24s; }
.hero-orbit-system .orbit-d { left: 19%; top: 51%; animation-delay: .29s; }
.hero-orbit-system .orbit-e { left: 41%; top: 51%; animation-delay: .34s; }
.hero-orbit-system .orbit-f { left: 63%; top: 51%; animation-delay: .39s; }

.home-hub .mode-section { padding-block: clamp(58px, 6vw, 76px); }
.home-hub .mode-card { border-radius: 18px; box-shadow: 0 10px 28px rgba(45,35,19,.07); }
.home-hub .mode-card:hover:not(:disabled) { transform: translateY(-3px); }

/* /igraj is an operational choice screen with a stable header. */
body[data-route="/igraj"] .home-hub .hub-hero,
body[data-route="/igraj"] .home-hub .trust-strip,
body[data-route="/igraj"] .home-hub .hub-continue,
body[data-route="/igraj"] .home-hub .bot-showcase,
body[data-route="/igraj"] .home-hub .hub-lower,
body[data-route="/igraj"] .home-hub .hub-footer { display: none; }
body[data-route="/igraj"] .home-hub .mode-section {
  min-height: calc(100svh - 66px - 92px);
  display: grid;
  align-content: center;
  padding-block: clamp(42px, 6vh, 68px);
}
body[data-route="/igraj"] .home-hub .play-path { margin-top: 0; }

/* Secondary content stays editorial but reaches the decision sooner. */
.content-screen .page-masthead { min-height: 320px; padding-block: clamp(42px, 5vw, 62px); }
.content-screen .page-masthead::after { width: clamp(118px, 12vw, 158px); }

@media (min-width: 901px) {
  #dlg-new .new-game-card {
    width: min(94vw, 1040px);
    height: auto;
    max-height: min(90dvh, 760px);
    grid-template-columns: 300px minmax(0, 1fr);
  }
  #dlg-new .setup-identity { padding: 26px 28px 30px; gap: 22px; }
  #dlg-new .setup-form { padding: 22px 28px 24px; gap: 10px; }
}

@media (max-width: 900px) {
  .home-hub .hub-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 50px max(20px, 6vw) 48px;
  }
  .hero-orbit-system { width: min(100%, 540px); min-height: 390px; margin-inline: auto; }
  body[data-route="/igraj"] .home-hub .mode-section { min-height: auto; align-content: start; }
}

@media (max-width: 560px) {
  .home-hub .hub-hero { gap: 26px; padding: 38px 16px 32px; }
  .home-hub .hero-copy h1 {
    margin-top: 0;
    font-size: clamp(3.2rem, 16.5vw, 4.25rem);
    line-height: .89;
  }
  .home-hub .hero-copy > p { margin-top: 20px; font-size: .92rem; line-height: 1.55; }
  .home-hub .hero-actions { margin-top: 22px; gap: 10px; }
  .home-hub .hero-actions .hero-play,
  .home-hub .hero-actions .hero-link { min-height: 52px; }
  .home-hub .hero-facts { margin-top: 24px; padding-top: 18px; }
  .hero-orbit-system {
    --word-tile-w: 48px;
    --word-tile-h: 52px;
    width: 100%;
    min-height: 230px;
    margin: 0;
    border-radius: 22px;
    background-size: 34px 34px, 34px 34px, auto, auto;
    transform: none;
  }
  .hero-orbit-system::after { left: 7%; bottom: 6%; font-size: .49rem; }
  .hero-orbit-system .space-tile,
  .hero-orbit-system .depth-back .space-tile,
  .hero-orbit-system .depth-front .space-tile { border-radius: 9px; font-size: 1.25rem; }
  .hero-orbit-system .orbit-a { left: 17%; top: 23%; }
  .hero-orbit-system .orbit-b { left: 40%; top: 23%; }
  .hero-orbit-system .orbit-c { left: 63%; top: 23%; }
  .hero-orbit-system .orbit-d { left: 17%; top: 49%; }
  .hero-orbit-system .orbit-e { left: 40%; top: 49%; }
  .hero-orbit-system .orbit-f { left: 63%; top: 49%; }
  .trust-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trust-strip div {
    min-width: 0;
    padding: 14px 8px;
    border-right: 1px solid rgba(255,255,255,.12);
    border-bottom: 0;
    text-align: center;
  }
  .trust-strip strong { font-size: .72rem; }
  .trust-strip span { font-size: .58rem; line-height: 1.25; }
  .home-hub .mode-section { padding: 48px 12px 40px; }
  .home-hub .section-heading { margin-bottom: 22px; }
  .home-hub .section-heading h2 { font-size: 2.15rem; }
  .home-hub .mode-card.featured { min-height: 330px; }
  .home-hub .mode-card:not(.featured) { min-height: 156px; }
  body[data-route="/igraj"] .home-hub .mode-section { padding-top: 34px; }
}

@keyframes editorial-board-in {
  from { opacity: 0; transform: rotate(-1.25deg) translateY(18px) scale(.97); }
  to { opacity: 1; transform: rotate(-1.25deg) translateY(0) scale(1); }
}
@keyframes editorial-tile-in {
  from { opacity: 0; transform: translateY(18px) rotate(3deg) scale(.9); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-orbit-system,
  .hero-orbit-system .space-orbit { animation: none; }
}
