:root {
  /* Палитра как в мобильном Flet-клиенте */
  --bg0: #1f2a24;
  --bg1: #2a3830;
  --bg2: #33453b;
  --ink: #d7e0d8;
  --muted: #8fa195;
  --accent: #7cb342;
  --accent-dark: #558b2f;
  --accent-ink: #ffffff;
  --warn: #e8a54b;
  --danger: #d96b5c;
  --cell: #f3e7d3;
  --cell-filled: #e8d4b0;
  --cell-ink: #1a1410;
  --cell-empty: rgba(243, 231, 211, 0.08);
  --cell-pick: #c4e0a8;
  --cell-new: #f0c674;
  --cell-target: #a8c5e0;
  --cell-hint: #9bc4a0;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Spectral", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #2d5a46 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #3d4f2f 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #10221b);
}

body {
  min-height: 100dvh;
}

.app-shell {
  width: min(480px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  box-sizing: border-box;
}

.panel,
.game-layout,
.invite-panel,
.review-panel,
.form-card,
.words-panel {
  max-width: 100%;
  min-width: 0;
}

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

.brand {
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand.small { font-size: 1.35rem; }

.user-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}

.panel, .form-card, .words-panel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px 18px;
}

.form-card {
  padding: 16px;
  position: relative;
  z-index: 1;
}

.lead {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}

.stack {
  display: grid;
  gap: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
  position: relative;
  z-index: 2;
}

.tab, .btn, .back {
  font: inherit;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tab {
  min-height: 48px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(226, 180, 90, 0.55);
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.consent-check {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  color: var(--cell) !important;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
}

.consent-check input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--accent-dark);
}

.btn {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-weight: 700;
}

.btn.primary {
  background: var(--accent-dark);
  color: var(--accent-ink);
}

.btn.menu {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  min-height: 52px;
}

.btn.menu.ghost {
  border: 1.5px solid var(--accent);
  color: var(--cell);
}

.version-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.screen-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cell);
}

.back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.menu-stack {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.menu-brand {
  margin: 0;
  font-family: var(--display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--cell);
  line-height: 1;
  text-align: center;
}

.letter-pad {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.letter-pad button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cell);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.letter-pad button.active {
  background: var(--accent-dark);
  color: #fff;
}

.letter-pad button:disabled {
  opacity: 0.4;
}

.cell.target {
  background: var(--cell-target) !important;
  color: var(--cell-ink);
}

.cell.hint {
  box-shadow: inset 0 0 0 2px var(--cell-hint);
}

.timer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.timer-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--warn);
  min-width: 3ch;
}

.open-room {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.open-room strong {
  color: var(--cell);
}

.game-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.divider {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  position: relative;
  margin: 4px 0;
}

.divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.divider span {
  position: relative;
  padding: 0 10px;
  background: #1a3a2f;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.join-row input {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.status {
  min-height: 1.3em;
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 0.95rem;
}

.status.error { color: var(--danger); }

.hidden { display: none !important; }

.game-top {
  align-items: flex-start;
}

.back {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  text-decoration: none;
  font-size: 1.2rem;
}

.code-line {
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.invite-panel {
  padding: 18px 16px;
  border-radius: var(--radius);
  background: rgba(226, 180, 90, 0.12);
  border: 1px solid rgba(226, 180, 90, 0.45);
  text-align: center;
  display: grid;
  gap: 12px;
}

.invite-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.invite-code {
  font-family: var(--display);
  font-size: clamp(1.25rem, 6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.invite-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.turn-badge {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(226, 180, 90, 0.18);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.game-layout {
  display: grid;
  gap: 14px;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.score-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(226, 180, 90, 0.35);
}

.score-name {
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-card strong {
  font-size: 1.35rem;
}

.board-wrap {
  display: grid;
  place-items: center;
}

.board {
  width: min(100%, 360px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(var(--board-size, 5), 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.22);
}

.board.size-6 { gap: 5px; }
.board.size-7 { gap: 4px; }
.board.size-6 .cell { font-size: clamp(0.95rem, 4.2vw, 1.3rem); }
.board.size-7 .cell { font-size: clamp(0.8rem, 3.6vw, 1.1rem); border-radius: 10px; }

.size-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.size-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.size-option {
  cursor: pointer;
}

.size-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.size-option span {
  display: grid;
  place-items: center;
  min-height: 72px;
  padding: 10px 6px;
  border-radius: 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 800;
  line-height: 1.25;
}

.size-option small {
  font-weight: 600;
  color: var(--muted);
}

.size-option input:checked + span {
  border-color: var(--accent);
  background: rgba(226, 180, 90, 0.16);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(226, 180, 90, 0.35);
}

.review-panel {
  padding: 18px 16px;
  border-radius: var(--radius);
  background: rgba(224, 122, 104, 0.12);
  border: 1px solid rgba(224, 122, 104, 0.45);
  text-align: center;
  display: grid;
  gap: 12px;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cell {
  border: 0;
  border-radius: 12px;
  background: var(--cell-empty);
  color: var(--cell-ink);
  font-family: var(--display);
  font-size: clamp(1.1rem, 5vw, 1.55rem);
  font-weight: 700;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  text-transform: uppercase;
  transition: transform 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.cell.filled {
  background: var(--cell-filled);
  color: var(--cell-ink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.cell.path {
  background: var(--cell-pick);
  transform: scale(0.96);
}

.cell.placed {
  background: var(--cell-new);
}

.cell:disabled {
  opacity: 1;
}

.controls {
  padding: 4px 0 0;
}

.letter-row {
  display: grid;
  grid-template-columns: 84px 1fr 1fr;
  gap: 8px;
}

#letterInput {
  text-align: center;
  text-transform: uppercase;
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 700;
}

.path-preview {
  margin: 0;
  color: var(--muted);
  min-height: 1.4em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.profile-card {
  padding: 14px 16px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.stat {
  text-align: center;
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.stat strong {
  display: block;
  font-size: 1.15rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.72rem;
}

.achievements-list,
.leaderboard-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.achievements-list li,
.leaderboard-list li {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.achievements-list li.locked {
  opacity: 0.45;
}

.achievements-list li strong,
.leaderboard-list li strong {
  overflow-wrap: anywhere;
}

.achievements-list li span,
.leaderboard-list li span {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.leaderboard-list li {
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
}

.rank-num {
  color: var(--accent);
  font-weight: 800;
}

.section-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}

.words-panel {
  padding: 14px 16px 8px;
}

.words-panel h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}

.moves-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
}

.moves-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
}

.moves-list .meta {
  color: var(--muted);
  font-size: 0.82rem;
}

/* —— Промо-лендинг —— */
.landing-top {
  margin-bottom: 8px;
}

.landing-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-nav-link {
  color: #f4efe6;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.landing-promo {
  margin-bottom: 20px;
}

.landing-hero {
  min-height: calc(100dvh - 88px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 8px 0 28px;
  animation: landing-fade 0.7s ease both;
}

.landing-brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 12vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 0.95;
  color: var(--cell);
  animation: landing-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-headline {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 5.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  max-width: 18ch;
  animation: landing-rise 0.75s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-lead {
  margin: 0;
  color: #d7e0d6;
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 34ch;
  animation: landing-rise 0.75s 0.14s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  animation: landing-rise 0.75s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-cta .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.hero-board {
  margin-top: 10px;
  margin-inline: -16px;
  width: calc(100% + 32px);
  padding: 22px 16px 8px;
  background:
    linear-gradient(180deg, rgba(15, 34, 27, 0.15), rgba(15, 34, 27, 0.55)),
    radial-gradient(80% 70% at 50% 30%, #2f5a45 0%, transparent 70%);
  animation: landing-rise 0.85s 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-board-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 320px;
  margin: 0 auto;
}

.hero-board-grid span {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--cell-empty);
  border: 1px solid rgba(247, 241, 228, 0.12);
}

.hero-board-grid span.filled {
  display: grid;
  place-items: center;
  background: var(--cell);
  color: var(--cell-ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  animation: cell-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-board-grid span.filled:nth-child(11) { animation-delay: 0.35s; }
.hero-board-grid span.filled:nth-child(12) { animation-delay: 0.42s; }
.hero-board-grid span.filled:nth-child(13) { animation-delay: 0.49s; }
.hero-board-grid span.filled:nth-child(14) { animation-delay: 0.56s; }
.hero-board-grid span.filled:nth-child(15) { animation-delay: 0.63s; }

.hero-board-grid span.center {
  background: var(--accent);
  color: var(--accent-ink);
}

.landing-stores {
  padding: 22px 4px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.landing-stores-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.landing-stores-text {
  margin: 0 0 14px;
  color: #d7e0d6;
  line-height: 1.5;
  font-size: 0.98rem;
}

.landing-stores-text strong {
  color: var(--cell);
}

.store-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.store-badge {
  display: grid;
  gap: 2px;
  padding: 14px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(247, 241, 228, 0.16);
  color: var(--ink);
}

.store-badge-name {
  font-weight: 800;
  font-size: 1rem;
}

.store-badge-meta {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.consent-note {
  color: #e8efe6 !important;
}

.consent-note a {
  color: #f0d089;
  font-weight: 700;
}

.landing-footer {
  margin-top: 18px;
  padding: 8px 4px 4px;
  text-align: center;
}

.landing-footer a {
  color: #f4efe6;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes landing-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes landing-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cell-pop {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-hero,
  .landing-brand,
  .landing-headline,
  .landing-lead,
  .landing-cta,
  .hero-board,
  .hero-board-grid span.filled {
    animation: none !important;
  }
}
