:root {
  --felt-deep: #0f3d2e;
  --felt-mid: #165c43;
  --felt-light: #1f7a58;
  --ink: #f4efe4;
  --ink-dim: rgba(244, 239, 228, 0.72);
  --amber: #e8a54b;
  --amber-deep: #c47d22;
  --danger: #d85a4a;
  --card: #f7f1e6;
  --card-ink: #1c1a17;
  --red-suit: #c0392b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  background: #0a241c;
  overscroll-behavior-y: auto;
}

.felt-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 30%, rgba(232, 165, 75, 0.12), transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(31, 122, 88, 0.55), transparent 40%),
    linear-gradient(160deg, #0c2b20 0%, var(--felt-deep) 40%, #0a1f18 100%);
  z-index: -2;
}

.felt-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.conn-dot {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.conn-dot[hidden] {
  display: none !important;
}

.conn-dot.ok {
  background: #3dcc7a;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 8px rgba(61, 204, 122, 0.55);
}

.conn-dot.warn {
  background: #e8a54b;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 8px rgba(232, 165, 75, 0.45);
}

.conn-dot.err {
  background: #e85a4a;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 8px rgba(232, 90, 74, 0.5);
}

.boot-hint {
  margin: 0 0 18px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-dim);
}

.boot-hint code {
  color: var(--amber);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
}

.screen {
  display: none;
  flex: 1;
  padding: 24px clamp(16px, 4vw, 48px) 32px;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.screen.active.screen-enter {
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.brand {
  font-family: 'Spectral', serif;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--amber);
  line-height: 1.05;
}

.brand.small {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

h1, h2 {
  font-family: 'Spectral', serif;
  font-weight: 600;
  margin: 8px 0 0;
}

h1 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  color: var(--ink);
}

.lede {
  color: var(--ink-dim);
  max-width: 36ch;
  line-height: 1.5;
  margin: 12px 0 28px;
}

.home-panel {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 28px 26px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 92, 67, 0.55), rgba(12, 43, 32, 0.75));
  border: 1px solid rgba(232, 165, 75, 0.22);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--ink-dim);
}

input {
  appearance: none;
  border: 1px solid rgba(244, 239, 228, 0.18);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 165, 75, 0.2);
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-align: center;
  font-weight: 700;
  width: 120px;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.home-actions #btn-create {
  width: 100%;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.join-row .code-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 14px 10px;
  border-radius: 14px;
  border: 1px solid rgba(244, 239, 228, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.join-row .code-input::placeholder {
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  font-weight: 600;
}

.join-row .code-input:focus {
  outline: none;
  border-color: rgba(232, 165, 75, 0.55);
}

.join-row #btn-join {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 14px 10px;
  border-radius: 14px;
  border: 1px solid rgba(244, 239, 228, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  box-shadow: none;
}

.join-row #btn-join:hover {
  border-color: rgba(232, 165, 75, 0.4);
  transform: translateY(-1px);
}

.btn {
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 12px;
  padding: 14px 20px;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, var(--amber), var(--amber-deep));
  color: #1c1408;
}

.btn.ghost {
  background: rgba(244, 239, 228, 0.08);
  color: var(--ink);
  border: 1px solid rgba(244, 239, 228, 0.16);
}

.btn.danger {
  background: linear-gradient(180deg, #e06b5c, var(--danger));
  color: #fff;
}

.btn.sm {
  padding: 10px 14px;
  font-size: 0.9rem;
}

.error {
  color: #ffb4a8;
  margin: 12px 0 0;
  font-size: 0.9rem;
}

.ok-msg {
  color: #b8e0c8;
  margin: 12px 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

#auth-dev-link a {
  color: var(--amber);
  word-break: break-all;
}

#btn-resend {
  margin-top: 12px;
}

.error.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 12, 10, 0.92);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid rgba(216, 90, 74, 0.5);
  z-index: 20;
}

.topbar, .game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.code-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(232, 165, 75, 0.18);
  color: var(--amber);
  letter-spacing: 0.18em;
  font-family: 'Manrope', sans-serif;
  font-size: 0.95rem;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  max-width: 900px;
}

@media (max-width: 720px) {
  .lobby-grid { grid-template-columns: 1fr; }
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(244, 239, 228, 0.08);
}

.player-list .tag {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 239, 228, 0.1);
}

.player-list .tag.ready {
  background: rgba(232, 165, 75, 0.25);
  color: var(--amber);
}

.lobby-side {
  padding: 22px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(244, 239, 228, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hint {
  margin: 0;
  color: var(--ink-dim);
  line-height: 1.45;
  font-size: 0.95rem;
}

.ready-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}

.ready-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--amber);
}

/* GAME */
.game-top {
  justify-content: center;
}

.status-line {
  flex: 0 0 auto;
  text-align: center;
  margin: 0;
  padding: 6px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  min-height: 1.4em;
  line-height: 1.3;
}

.game-turn-status {
  margin: 2px 0 0;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(244, 239, 228, 0.1);
  color: var(--ink-dim);
}

.opponents {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 88px;
  margin-bottom: 12px;
}

.opponent {
  min-width: 132px;
  padding: 12px 14px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(244, 239, 228, 0.1);
  text-align: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.opponent.attacker {
  border-color: rgba(232, 165, 75, 0.55);
  box-shadow: 0 0 0 1px rgba(232, 165, 75, 0.2);
}

.opponent.defender {
  border-color: rgba(120, 180, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(120, 180, 255, 0.2);
}

.opponent .name {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.opponent .opp-text {
  min-width: 0;
}

.opponent .opp-count {
  display: none;
}

.opp-cards {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 52px;
  margin: 0 auto 2px;
  min-width: 72px;
}

.opp-card-back {
  --i: 0;
  width: 28px;
  height: 40px;
  margin-left: -14px;
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(244, 239, 228, 0.1), transparent 45%),
    repeating-linear-gradient(
      45deg,
      #1a4d38 0 4px,
      #163f2e 4px 8px
    );
  border: 1.5px solid rgba(232, 165, 75, 0.5);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  transform: rotate(calc(var(--i) * 7deg));
  transform-origin: center bottom;
}

.opp-card-back:first-child {
  margin-left: 0;
}

.opp-more {
  align-self: center;
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber);
}

.opp-empty {
  font-size: 0.8rem;
  color: var(--ink-dim);
  align-self: center;
}

.table-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 36px);
  min-height: 220px;
  margin: 8px 0 16px;
  padding: 16px clamp(12px, 3vw, 28px);
  border-radius: 28px;
  background:
    radial-gradient(ellipse at center, rgba(31, 122, 88, 0.35), transparent 65%),
    rgba(0, 0, 0, 0.18);
  border: 2px solid rgba(232, 165, 75, 0.12);
}

.table-deck {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 96px;
}

.deck-pile {
  position: relative;
  width: 118px;
  height: 118px;
}

.deck-pile .card.trump-under {
  position: absolute;
  left: 42px;
  top: 22px;
  transform: rotate(90deg);
  z-index: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

.deck-pile .card-back {
  position: absolute;
  left: 0;
  top: 8px;
  width: 72px;
  height: 104px;
  border-radius: 10px;
  z-index: 2;
  background:
    linear-gradient(145deg, rgba(244, 239, 228, 0.08), transparent 40%),
    repeating-linear-gradient(
      45deg,
      #1a4d38 0 6px,
      #163f2e 6px 12px
    );
  border: 2px solid rgba(232, 165, 75, 0.45);
  box-shadow:
    3px 3px 0 rgba(0, 0, 0, 0.18),
    6px 6px 0 rgba(0, 0, 0, 0.12),
    0 10px 20px rgba(0, 0, 0, 0.28);
}

.deck-pile .card-back.empty {
  opacity: 0.25;
  box-shadow: none;
  border-style: dashed;
}

.deck-pile.only-trump .card.trump-under {
  left: 20px;
  top: 8px;
  transform: none;
}

.deck-count-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(244, 239, 228, 0.12);
  white-space: nowrap;
}

.deck-trump-name {
  font-size: 0.78rem;
  color: var(--ink-dim);
  text-align: center;
  white-space: nowrap;
}

.table-cards {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 22px 28px;
  justify-content: center;
  align-content: center;
  min-height: 140px;
  padding: 8px;
}

.table-cards:empty::after {
  content: 'Стол';
  color: rgba(244, 239, 228, 0.28);
  font-family: 'Spectral', serif;
  font-size: 1.2rem;
}

.pair {
  position: relative;
  width: 110px;
  height: 140px;
}

.pair .card {
  position: absolute;
}

.pair .card.attack {
  left: 0;
  top: 0;
  z-index: 1;
}

.pair .card.defend {
  left: 44px;
  top: 34px;
  transform: rotate(14deg);
  z-index: 2;
}

.pair .card.attack.selectable {
  outline: 2px solid #7eb6ff;
  cursor: pointer;
}

.hand-wrap {
  margin-top: auto;
  padding-top: 8px;
}

.hand {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 120px;
}

.card {
  width: 72px;
  height: 104px;
  border-radius: 10px;
  background: linear-gradient(160deg, #fffdf8, var(--card));
  color: var(--card-ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 9px;
  font-weight: 800;
  user-select: none;
  position: relative;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.2s ease,
    filter 0.2s ease;
}

.card.card-enter,
.pair.pair-enter {
  animation: cardEnter 0.28s ease both;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pair .card.defend.card-enter {
  animation: defendEnter 0.28s ease both;
}

@keyframes defendEnter {
  from {
    opacity: 0;
    transform: rotate(14deg) translateY(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: rotate(14deg);
  }
}

.card.red { color: var(--red-suit); }

.card .rank {
  font-size: 1.15rem;
  line-height: 1;
}

.card .suit {
  font-size: 1.55rem;
  text-align: center;
  line-height: 1;
}

.card .rank.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card.mini {
  width: 42px;
  height: 60px;
  padding: 4px 5px;
  border-radius: 6px;
}

.card.mini .rank { font-size: 0.75rem; }
.card.mini .suit { font-size: 0.95rem; }

.card.playable {
  cursor: pointer;
}

.card.playable:hover {
  transform: translateY(-12px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
}

.card.dim {
  opacity: 0.4;
  filter: grayscale(0.3);
}

.card.transfer-hint {
  box-shadow: 0 0 0 2px var(--amber), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 52px;
}

.choice-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(232, 165, 75, 0.35);
}

.choice-bar[hidden] {
  display: none !important;
}

.choice-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-dim);
  margin-right: 4px;
}

.card.selected {
  transform: translateY(-14px);
  box-shadow: 0 0 0 2px var(--amber), 0 16px 28px rgba(0, 0, 0, 0.35);
}

.role {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
  color: var(--amber);
}

/* Auth / account / social */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tab {
  flex: 1;
  border: 1px solid rgba(244, 239, 228, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink-dim);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  color: #1c1408;
  background: linear-gradient(180deg, var(--amber), var(--amber-deep));
  border-color: transparent;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form[hidden] {
  display: none !important;
}

/* Landing */
.screen.landing {
  padding: 0;
  overflow-x: hidden;
}

.landing-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: clamp(24px, 5vw, 56px);
  isolation: isolate;
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(232, 165, 75, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 50% at 20% 80%, rgba(31, 122, 88, 0.45), transparent 50%),
    linear-gradient(160deg, #0c2b20 0%, #0f3d2e 45%, #071912 100%);
}

.fan-card,
.hero-chess,
.hero-sea,
.hero-dominoes {
  position: absolute;
  will-change: transform;
  opacity: 0;
}

.fan-card {
  width: min(14vw, 96px);
  height: min(20vw, 138px);
  border-radius: 10px;
  background: linear-gradient(160deg, #fffdf8, #f0e6d4);
  color: #1c1a17;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(28, 26, 23, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  font-family: 'Spectral', serif;
  font-weight: 700;
  font-size: 1.05rem;
  animation:
    dealIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    tokenFloat 6.5s ease-in-out infinite;
}

.fan-card i {
  font-style: normal;
  font-size: 1.65rem;
  align-self: center;
  line-height: 1;
}

.fan-card.c5 span {
  font-size: 0.92em;
  letter-spacing: -0.04em;
}

/* Веер из 6 карт — как раздача в дураке */
.fan-card.c1 {
  right: 1%;
  top: 7%;
  color: #1c1a17;
  --deal-rot: -20deg;
  --deal-x: 40px;
  animation-delay: 0.04s, 0.85s;
  z-index: 6;
}
.fan-card.c2 {
  right: 4.5%;
  top: 9%;
  color: #c0392b;
  --deal-rot: -12deg;
  --deal-x: 32px;
  animation-delay: 0.1s, 0.95s;
  z-index: 5;
}
.fan-card.c3 {
  right: 8%;
  top: 11%;
  color: #c0392b;
  --deal-rot: -4deg;
  --deal-x: 24px;
  animation-delay: 0.16s, 1.05s;
  z-index: 4;
}
.fan-card.c4 {
  right: 11.5%;
  top: 13%;
  color: #1c1a17;
  --deal-rot: 4deg;
  --deal-x: 18px;
  animation-delay: 0.22s, 1.15s;
  z-index: 3;
}
.fan-card.c5 {
  right: 15%;
  top: 15%;
  color: #c0392b;
  --deal-rot: 12deg;
  --deal-x: 14px;
  animation-delay: 0.28s, 1.25s;
  z-index: 2;
}
.fan-card.c6 {
  right: 18.5%;
  top: 17%;
  color: #1c1a17;
  --deal-rot: 20deg;
  --deal-x: 10px;
  animation-delay: 0.34s, 1.35s;
  z-index: 1;
}

/* Chessboard */
.hero-chess {
  right: 34%;
  top: 6%;
  width: min(24vw, 210px);
  aspect-ratio: 1;
  --deal-rot: -6deg;
  --deal-x: -28px;
  animation:
    dealIn 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    boardDrift 8s ease-in-out 1s infinite;
  animation-delay: 0.4s, 1.35s;
  z-index: 2;
}

.chess-board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(244, 239, 228, 0.28);
  background:
    repeating-conic-gradient(#edd9b0 0% 25%, #5a3d24 0% 50%)
    0 0 / 25% 25%;
  position: relative;
}

.chess-board .cp {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  left: calc((var(--c) - 1) * 12.5%);
  top: calc((var(--r) - 1) * 12.5%);
  display: grid;
  place-items: center;
  font-size: clamp(0.95rem, 2.6vw, 1.7rem);
  line-height: 1;
  font-weight: 700;
  animation: none;
  pointer-events: none;
  user-select: none;
}

.chess-board .cp.light {
  color: #fff8ec;
  -webkit-text-stroke: 1px #2a1a0e;
  text-shadow:
    0 0 1px #2a1a0e,
    0 1px 0 #2a1a0e,
    0 2px 3px rgba(0, 0, 0, 0.4);
}

.chess-board .cp.dark {
  color: #140e0a;
  -webkit-text-stroke: 0.6px rgba(255, 244, 220, 0.55);
  text-shadow:
    0 0 1px rgba(255, 244, 220, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Sea battle field — classic 10×10 */
.hero-sea {
  right: 5%;
  top: 52%;
  width: min(30vw, 240px);
  aspect-ratio: 1;
  --deal-rot: 5deg;
  --deal-x: 30px;
  animation:
    dealIn 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    boardDrift 7s ease-in-out 1.2s infinite;
  animation-delay: 0.48s, 1.45s;
  z-index: 2;
}

.sea-board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1.1fr repeat(10, 1fr);
  grid-template-rows: 1.1fr repeat(10, 1fr);
  border-radius: 12px;
  overflow: hidden;
  background: #0a3345;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(140, 210, 230, 0.28);
  font-family: 'Manrope', sans-serif;
}

.sea-corner {
  grid-column: 1;
  grid-row: 1;
  background: #082a38;
}

.sea-cols {
  grid-column: 2 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  background: #082a38;
  color: rgba(210, 235, 245, 0.9);
  font-size: clamp(0.45rem, 1.1vw, 0.68rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sea-cols span,
.sea-rows span {
  display: grid;
  place-items: center;
}

.sea-rows {
  grid-column: 1;
  grid-row: 2 / -1;
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  background: #082a38;
  color: rgba(210, 235, 245, 0.9);
  font-size: clamp(0.42rem, 1vw, 0.64rem);
  font-weight: 700;
}

.sea-field {
  grid-column: 2 / -1;
  grid-row: 2 / -1;
  position: relative;
  background:
    linear-gradient(180deg, rgba(70, 160, 195, 0.2), transparent 45%),
    #0c4258;
}

.sea-field::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(180, 230, 245, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 230, 245, 0.2) 1px, transparent 1px);
  background-size: 10% 10%;
  pointer-events: none;
  animation: seaShimmer 5s ease-in-out infinite;
}

.sea-ship {
  position: absolute;
  left: calc((var(--c) - 1) * 10% + 4%);
  top: calc((var(--r) - 1) * 10% + 12%);
  color: #d7e8f0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  z-index: 1;
}

.sea-ship svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sea-ship.h4 {
  width: calc(40% - 8%);
  height: calc(10% - 24%);
}
.sea-ship.h3 {
  width: calc(30% - 8%);
  height: calc(10% - 24%);
}
.sea-ship.h2 {
  width: calc(20% - 8%);
  height: calc(10% - 24%);
}
.sea-ship.v3 {
  width: calc(10% - 24%);
  height: calc(30% - 8%);
  left: calc((var(--c) - 1) * 10% + 12%);
  top: calc((var(--r) - 1) * 10% + 4%);
}
.sea-ship.boat {
  width: calc(10% - 24%);
  height: calc(10% - 24%);
  left: calc((var(--c) - 1) * 10% + 12%);
  top: calc((var(--r) - 1) * 10% + 12%);
}

.sea-field .shot {
  position: absolute;
  width: 10%;
  height: 10%;
  left: calc((var(--c) - 1) * 10%);
  top: calc((var(--r) - 1) * 10%);
  display: grid;
  place-items: center;
  font-weight: 800;
  z-index: 2;
}

.sea-field .shot.hit::after {
  content: '×';
  color: #ff6b5a;
  font-size: clamp(0.7rem, 1.8vw, 1.1rem);
  animation: hitFlash 2.4s ease-in-out infinite;
}

.sea-field .shot.miss::after {
  content: '';
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(220, 240, 250, 0.8);
  box-shadow: 0 0 0 1.5px rgba(220, 240, 250, 0.25);
}

/* Dominoes — логичная цепочка-змейка */
.hero-dominoes {
  right: 32%;
  top: 54%;
  width: min(28vw, 220px);
  height: min(22vw, 170px);
  --deal-rot: -4deg;
  --deal-x: -20px;
  animation:
    dealIn 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    boardDrift 7.5s ease-in-out 1.1s infinite;
  animation-delay: 0.55s, 1.5s;
  z-index: 3;
}

.domino {
  position: absolute;
  border-radius: 7px;
  background: linear-gradient(160deg, #fffdf8, #ebe2d2);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(28, 26, 23, 0.12);
  display: flex;
  color: #1c1a17;
}

.domino.vt {
  flex-direction: column;
  width: 18%;
  height: 42%;
}

.domino.hz {
  flex-direction: row;
  width: 34%;
  height: 22%;
}

.domino.vt::after {
  content: '';
  position: absolute;
  left: 16%;
  right: 16%;
  top: 50%;
  height: 1px;
  background: rgba(28, 26, 23, 0.28);
  transform: translateY(-50%);
}

.domino.hz::after {
  content: '';
  position: absolute;
  top: 16%;
  bottom: 16%;
  left: 50%;
  width: 1px;
  background: rgba(28, 26, 23, 0.28);
  transform: translateX(-50%);
}

.domino .half {
  flex: 1;
  position: relative;
  background-repeat: no-repeat;
}

.domino .half[data-n="1"] {
  background-image: radial-gradient(circle, currentColor 45%, transparent 46%);
  background-size: 22% 22%;
  background-position: center;
}
.domino .half[data-n="2"] {
  background-image:
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%);
  background-size: 18% 18%, 18% 18%;
  background-position: 24% 24%, 76% 76%;
}
.domino .half[data-n="3"] {
  background-image:
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%);
  background-size: 17% 17%;
  background-position: 22% 20%, 50% 50%, 78% 80%;
}
.domino .half[data-n="4"] {
  background-image:
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%);
  background-size: 17% 17%;
  background-position: 24% 22%, 76% 22%, 24% 78%, 76% 78%;
}
.domino .half[data-n="5"] {
  background-image:
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%);
  background-size: 16% 16%;
  background-position: 22% 18%, 78% 18%, 50% 50%, 22% 82%, 78% 82%;
}
.domino .half[data-n="6"] {
  background-image:
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%),
    radial-gradient(circle, currentColor 45%, transparent 46%);
  background-size: 15% 15%;
  background-position: 28% 16%, 72% 16%, 28% 50%, 72% 50%, 28% 84%, 72% 84%;
}

/* Змейка: [6|6]—[6|3]—[3|1]
                      |
                   [1|4]
                      |
        [5|2]—[2|4]——┘  (стык по 2 и по 4) */
.domino.d1 { left: 2%; top: 4%; }
.domino.d2 { left: 20%; top: 14%; }
.domino.d3 { left: 52%; top: 14%; }
.domino.d4 { left: 80%; top: 14%; }
.domino.d5 { left: 50%; top: 56%; }
.domino.d6 { left: 18%; top: 56%; }

@keyframes dealIn {
  from {
    opacity: 0;
    transform: translate(var(--deal-x, 30px), 28px) rotate(calc(var(--deal-rot, 0deg) - 8deg)) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) rotate(var(--deal-rot, 0deg)) scale(1);
  }
}

@keyframes boardDrift {
  0%, 100% { transform: translate(0, 0) rotate(var(--deal-rot, 0deg)); }
  50% { transform: translate(0, -6px) rotate(var(--deal-rot, 0deg)); }
}

@keyframes tokenFloat {
  0%, 100% { transform: translate(0, 0) rotate(var(--deal-rot, 0deg)); }
  50% { transform: translate(0, -8px) rotate(var(--deal-rot, 0deg)); }
}

@keyframes piecePulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes seaShimmer {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@keyframes hitFlash {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

.hero-copy {
  max-width: min(46rem, 92vw);
  animation: fadeIn 0.7s ease both;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.08em 0.12em;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
  font-family: 'Spectral', serif;
  margin: 0;
}

.brand-mark .brand-stol {
  font-weight: 700;
  color: var(--ink);
}

.brand-mark .brand-ok {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  padding: 0.12em 0.28em 0.14em 0.32em;
  border-radius: 0.28em;
  background:
    linear-gradient(160deg, rgba(232, 165, 75, 0.95), rgba(196, 125, 34, 0.92));
  color: #1c1510;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: rotate(-3deg);
}

.brand-mark .brand-ok-text {
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-mark .brand-ok-face {
  position: relative;
  width: 0.52em;
  height: 0.52em;
  border-radius: 50%;
  background: rgba(28, 21, 16, 0.12);
  border: 2px solid rgba(28, 21, 16, 0.55);
  flex-shrink: 0;
  align-self: center;
}

.brand-mark .brand-ok-face .eye {
  position: absolute;
  top: 32%;
  width: 0.09em;
  height: 0.09em;
  border-radius: 50%;
  background: #1c1510;
}

.brand-mark .brand-ok-face .eye.left { left: 26%; }

.brand-mark .brand-ok-face .eye.right {
  right: 24%;
}

.brand-mark .brand-ok-face .eye.wink {
  width: 0.14em;
  height: 0.03em;
  border-radius: 2px;
  top: 36%;
  background: #1c1510;
  animation: brandWink 2.8s ease-in-out 1.2s infinite;
}

.brand-mark .brand-ok-face .mouth {
  position: absolute;
  left: 50%;
  bottom: 22%;
  width: 0.22em;
  height: 0.12em;
  border: 2px solid #1c1510;
  border-top: none;
  border-radius: 0 0 0.2em 0.2em;
  transform: translateX(-50%);
}

.hero-brand {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  font-size: clamp(3.2rem, 10vw, 5.5rem);
  margin-bottom: 10px;
}

.hero-brand .brand-stol {
  animation: brandIn 0.75s ease both;
}

.hero-brand .brand-ok {
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  animation: brandOkIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.brand-mark-tab {
  font-size: 1.2rem;
  pointer-events: none;
}

.brand-mark-tab .brand-ok {
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-mark-tab .brand-ok-face {
  border-width: 1.5px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes brandIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes brandOkIn {
  from {
    opacity: 0;
    transform: rotate(-8deg) scale(0.7) translateY(12px);
  }
  to {
    opacity: 1;
    transform: rotate(-3deg) scale(1) translateY(0);
  }
}

@keyframes brandWink {
  0%, 40%, 60%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.15); }
}

.hero-title {
  font-size: clamp(1.7rem, 4.2vw, 2.55rem);
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  max-width: 22ch;
}

.hero-lede {
  margin: 14px 0 28px;
  color: var(--ink-dim);
  font-size: 1.08rem;
  line-height: 1.55;
  max-width: 46ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Auth modal */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 16, 12, 0.72);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.25s ease;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(92vh, 720px);
  overflow: auto;
  padding: 28px 24px 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 92, 67, 0.92), rgba(10, 36, 28, 0.96));
  border: 1px solid rgba(232, 165, 75, 0.28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: modalIn 0.28s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-panel h2 {
  margin: 0;
  font-size: 1.45rem;
}

.modal-lede {
  margin: 8px 0 18px;
  color: var(--ink-dim);
  font-size: 0.92rem;
  line-height: 1.4;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-panel .tabs {
  margin-bottom: 14px;
}

.modal-panel .btn.primary {
  width: 100%;
}

/* Keep hero icons spaced on wide screens */
@media (min-width: 1100px) {
  .hero-copy {
    max-width: min(42rem, 46vw);
    position: relative;
    z-index: 5;
  }
  .fan-card {
    width: 92px;
    height: 132px;
  }
  .fan-card.c1 { right: 1%; top: 5%; }
  .fan-card.c2 { right: 4%; top: 7%; }
  .fan-card.c3 { right: 7%; top: 9%; }
  .fan-card.c4 { right: 10%; top: 11%; }
  .fan-card.c5 { right: 13%; top: 13%; }
  .fan-card.c6 { right: 16%; top: 15%; }
  .hero-chess {
    right: 26%;
    top: 5%;
    width: min(18vw, 236px);
  }
  .chess-board .cp {
    font-size: clamp(1.15rem, 1.45vw, 1.7rem);
  }
  .hero-sea {
    right: 3%;
    top: 48%;
    width: min(19vw, 240px);
  }
  .hero-dominoes {
    right: 24%;
    top: 52%;
    width: 210px;
    height: 160px;
  }
}

@media (min-width: 1400px) {
  .hero-chess {
    right: 28%;
    width: 252px;
  }
  .hero-sea {
    right: 4%;
    width: 255px;
  }
  .hero-dominoes {
    right: 26%;
    width: 230px;
    height: 175px;
  }
  .fan-card.c1 { right: 2%; }
  .fan-card.c2 { right: 5%; }
  .fan-card.c3 { right: 8%; }
  .fan-card.c4 { right: 11%; }
  .fan-card.c5 { right: 14%; }
  .fan-card.c6 { right: 17%; }
  .chess-board .cp {
    font-size: 1.75rem;
  }
}

@media (max-width: 720px) {
  body.is-landing {
    min-height: 100dvh;
  }
  body.is-landing #app {
    min-height: 100dvh;
  }

  .screen.landing {
    min-height: 100dvh;
    padding: 0;
  }

  .landing-hero {
    min-height: 100dvh;
    align-items: center;
    padding: 112px 18px 128px;
    box-sizing: border-box;
  }

  .hero-visual {
    overflow: hidden;
  }

  .fan-card {
    width: 58px;
    height: 84px;
    font-size: 0.78rem;
    padding: 6px 7px;
  }
  .fan-card i { font-size: 1.15rem; }
  .fan-card.c1 { right: 2%; top: 20px; }
  .fan-card.c2 { right: 8%; top: 24px; }
  .fan-card.c3 { right: 14%; top: 28px; }
  .fan-card.c4 { right: 20%; top: 32px; opacity: 0.92; }
  .fan-card.c5 { right: 26%; top: 36px; opacity: 0.82; }
  .fan-card.c6 { right: 32%; top: 40px; opacity: 0.72; }

  .hero-chess {
    left: 12px;
    right: auto;
    top: 22px;
    width: 108px;
    --deal-rot: -5deg;
    --deal-x: -12px;
    z-index: 1;
  }
  .chess-board .cp {
    font-size: 0.72rem;
    -webkit-text-stroke-width: 0.45px;
  }

  .hero-sea {
    left: 14px;
    right: auto;
    top: auto;
    bottom: 24px;
    width: 146px;
    --deal-rot: 4deg;
    z-index: 1;
  }
  .hero-dominoes {
    right: 12px;
    left: auto;
    top: auto;
    bottom: 26px;
    width: 140px;
    height: 108px;
    --deal-rot: -6deg;
    z-index: 1;
  }

  .hero-copy {
    position: relative;
    z-index: 2;
    max-width: 100%;
  }
  .hero-brand {
    font-size: clamp(2.6rem, 13vw, 3.4rem);
    margin-bottom: 6px;
  }
  .hero-title {
    max-width: none;
    font-size: clamp(1.25rem, 5.8vw, 1.55rem);
  }
  .hero-lede {
    max-width: none;
    margin: 10px 0 16px;
    font-size: 0.92rem;
    line-height: 1.4;
  }
  .hero-cta {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }
  .hero-cta .btn {
    width: 100%;
    padding: 13px 16px;
  }

  @keyframes boardDrift {
    0%, 100% { transform: translate(0, 0) rotate(var(--deal-rot, 0deg)); }
    50% { transform: translate(0, -2px) rotate(var(--deal-rot, 0deg)); }
  }
  @keyframes tokenFloat {
    0%, 100% { transform: translate(0, 0) rotate(var(--deal-rot, 0deg)); }
    50% { transform: translate(0, -3px) rotate(var(--deal-rot, 0deg)); }
  }
}

@media (max-width: 400px) {
  .landing-hero {
    padding: 100px 14px 118px;
  }

  .fan-card {
    width: 52px;
    height: 76px;
    font-size: 0.72rem;
  }
  .fan-card i { font-size: 1.05rem; }
  .fan-card.c1 { right: 2%; top: 18px; }
  .fan-card.c2 { right: 8%; top: 22px; }
  .fan-card.c3 { right: 14%; top: 26px; }
  .fan-card.c4 { right: 20%; top: 30px; }
  .fan-card.c5 { right: 26%; top: 34px; }
  .fan-card.c6 { right: 32%; top: 38px; }

  .hero-chess {
    left: 10px;
    top: 20px;
    width: 96px;
  }
  .chess-board .cp {
    font-size: 0.64rem;
  }

  .hero-sea {
    left: 10px;
    bottom: 22px;
    width: 128px;
  }
  .hero-dominoes {
    right: 8px;
    bottom: 24px;
    width: 122px;
    height: 94px;
  }

  .hero-brand { font-size: 2.55rem; }
  .hero-title { font-size: 1.22rem; }
  .hero-lede {
    font-size: 0.88rem;
    margin: 8px 0 14px;
  }

  .sea-cols,
  .sea-rows {
    font-size: 0.4rem;
  }
}

.game-icons {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.game-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 112px;
  padding: 12px 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(244, 239, 228, 0.1);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  box-sizing: border-box;
}

.game-icon.is-active {
  border-color: rgba(232, 165, 75, 0.55);
  background: rgba(232, 165, 75, 0.12);
  box-shadow: 0 0 0 1px rgba(232, 165, 75, 0.15);
}

.game-icon.is-soon {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.game-glyph {
  width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  line-height: 1;
  color: inherit;
}

.game-glyph .icon-ship {
  width: 34px;
  height: 28px;
  display: block;
}

.game-name {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-status {
  margin-top: auto;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.game-icon.is-active .game-status {
  color: var(--amber);
}

.account-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.account-me {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-name {
  font-weight: 800;
  font-size: 1.05rem;
}

.account-stats {
  color: var(--ink-dim);
  font-size: 0.88rem;
}

.account-actions {
  display: flex;
  gap: 8px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #124533;
  border: 2px solid rgba(232, 165, 75, 0.45);
  flex-shrink: 0;
}

.avatar.lg {
  width: 88px;
  height: 88px;
}

.avatar.sm {
  width: 32px;
  height: 32px;
}

.avatar.xs {
  width: 22px;
  height: 22px;
}

.home-tabs {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 14px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(244, 239, 228, 0.1);
}

.home-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.home-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.home-tab.is-active {
  color: var(--ink);
  background: rgba(232, 165, 75, 0.18);
  box-shadow: inset 0 0 0 1px rgba(232, 165, 75, 0.35);
}

.home-layout {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.home-tab-panel[hidden] {
  display: none !important;
}

.home-tab-panel.home-panel,
.home-tab-panel.side-block {
  width: 100%;
}

.side-block {
  padding: 22px 20px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 92, 67, 0.42), rgba(12, 43, 32, 0.7));
  border: 1px solid rgba(232, 165, 75, 0.18);
  box-shadow: var(--shadow);
  flex: 1;
}

.side-block h3 {
  margin: 0 0 12px;
  font-family: 'Spectral', serif;
  font-size: 1.25rem;
}

.game-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 22px;
}

.game-pick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(244, 239, 228, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.game-pick-item:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(232, 165, 75, 0.4);
}

.game-pick-item.is-active {
  border-color: rgba(232, 165, 75, 0.65);
  background: rgba(232, 165, 75, 0.14);
  box-shadow: 0 0 0 1px rgba(232, 165, 75, 0.12);
}

.game-pick-item.is-soon,
.game-pick-item:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.game-pick-glyph {
  font-size: 1.55rem;
  line-height: 1;
}

.game-pick-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.game-pick-status {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.game-pick-item.is-active .game-pick-status {
  color: var(--amber);
}

.home-panel .lede {
  margin-bottom: 18px;
}

.subhead {
  margin: 14px 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.friend-add {
  display: flex;
  gap: 8px;
}

.friend-add input {
  flex: 1;
  padding: 10px 12px;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-list .meta {
  flex: 1;
  min-width: 0;
}

.mini-list .meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-list .meta span {
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.mini-list .row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.rating-table {
  margin-top: 4px;
}

.board-head,
.board-list .board-row {
  display: grid;
  grid-template-columns: 1.35rem 22px minmax(0, 1fr) 1.55rem 1.55rem 1.55rem;
  align-items: center;
  column-gap: 7px;
  padding: 6px 8px;
}

.board-head {
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(244, 239, 228, 0.12);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.board-head .board-col.board-h-w,
.board-w {
  color: #b8e0c8;
}

.board-list {
  gap: 3px;
}

.board-list .board-row {
  display: grid;
  border-radius: 10px;
  padding: 5px 8px;
}

.board-list .board-empty {
  display: block;
  padding: 10px 8px;
}

.board-rank {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.board-av {
  width: 22px;
  height: 22px;
}

.board-who {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  overflow: hidden;
  white-space: nowrap;
}

.board-name {
  font-size: 0.86rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-nick {
  font-size: 0.7rem;
  color: var(--ink-dim);
  font-weight: 500;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-col,
.board-w,
.board-l,
.board-d {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
}

.board-w { color: #b8e0c8; }
.board-l { color: #ffb4a8; }
.board-d { color: #f0d090; }

.board-legend {
  margin: 10px 2px 0;
  font-size: 0.72rem;
  color: var(--ink-dim);
  line-height: 1.35;
}

#screen-profile.screen.active {
  justify-content: flex-start;
  align-items: stretch;
  padding-top: 16px;
}

.profile-panel {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  height: auto;
  flex: 0 0 auto;
  gap: 14px;
  padding: 18px 18px 22px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0 2px;
}

.profile-hero-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.profile-display {
  margin: 0;
  font-family: 'Spectral', serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

.profile-hero-text .hint {
  margin: 0;
  font-size: 0.82rem;
}

.profile-rank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(232, 165, 75, 0.22), rgba(232, 165, 75, 0.06)),
    rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(232, 165, 75, 0.4);
}

.profile-rank-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}

.profile-rank-value {
  font-family: 'Spectral', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.profile-rank-of {
  margin-left: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-dim);
  font-family: 'Manrope', sans-serif;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 6px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(244, 239, 228, 0.1);
  text-align: center;
  min-width: 0;
}

.profile-stat-n {
  font-family: 'Spectral', serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.profile-stat-l {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.profile-stat.is-win {
  border-color: rgba(61, 204, 122, 0.35);
  background: linear-gradient(180deg, rgba(61, 204, 122, 0.14), rgba(0, 0, 0, 0.22));
}
.profile-stat.is-win .profile-stat-n { color: #b8e0c8; }

.profile-stat.is-loss {
  border-color: rgba(216, 90, 74, 0.35);
  background: linear-gradient(180deg, rgba(216, 90, 74, 0.14), rgba(0, 0, 0, 0.22));
}
.profile-stat.is-loss .profile-stat-n { color: #ffb4a8; }

.profile-stat.is-draw {
  border-color: rgba(232, 165, 75, 0.3);
  background: linear-gradient(180deg, rgba(232, 165, 75, 0.12), rgba(0, 0, 0, 0.22));
}
.profile-stat.is-draw .profile-stat-n { color: #f0d090; }

.profile-stat.is-rate {
  border-color: rgba(120, 180, 255, 0.3);
  background: linear-gradient(180deg, rgba(120, 180, 255, 0.12), rgba(0, 0, 0, 0.22));
}
.profile-stat.is-rate .profile-stat-n { color: #b7d4ff; }

#screen-profile .field {
  margin: 2px 0 0;
}

#screen-profile #btn-profile-save {
  width: 100%;
  margin-top: 2px;
}

@media (max-width: 420px) {
  .profile-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-stat-n {
    font-size: 1.25rem;
  }

  .profile-hero {
    gap: 12px;
  }
}

.file-btn {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

/* не использовать attribute hidden — на iOS/Safari label не открывает file picker */
.file-btn input[type='file'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.player-list li .who {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opponent .name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.opponent .name {
  margin-bottom: 0;
}

.opponent .opp-text .role {
  margin-top: 2px;
}

@media (max-width: 900px) {
  .home-tabs {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .card {
    width: 58px;
    height: 84px;
    padding: 6px 7px;
  }
  .card .suit { font-size: 1.25rem; }
  .pair {
    width: 96px;
    height: 118px;
  }
  .pair .card.defend {
    left: 34px;
    top: 28px;
  }
  .deck-pile {
    width: 96px;
    height: 98px;
  }
  .deck-pile .card.trump-under {
    left: 34px;
    top: 18px;
  }
  .deck-pile .card-back {
    width: 58px;
    height: 84px;
    left: 0;
    top: 6px;
  }
  .table-area {
    flex-direction: column;
    min-height: 200px;
  }
  .status-line { font-size: 0.92rem; }
}

/* Дурак / домино: компактное поле под телефон (~400–480px) */
@media (max-width: 480px) {
  body.is-game #app {
    min-height: 100dvh;
  }

  #screen-game.screen,
  #screen-domino.screen {
    padding: 6px 8px 8px;
    gap: 4px;
    min-height: 100dvh;
  }

  #screen-game .status-line,
  #screen-game .game-turn-status,
  #screen-domino .status-line,
  #screen-domino .game-turn-status {
    font-size: 0.76rem;
    line-height: 1.25;
    min-height: 0;
    padding: 5px 8px;
    margin: 0;
    border-radius: 8px;
  }

  #screen-game .actions,
  #screen-domino .actions {
    min-height: 0;
  }

  #screen-game .opponents,
  #screen-domino .opponents {
    gap: 4px;
    min-height: 0;
    margin-bottom: 2px;
    padding: 0;
    flex-shrink: 0;
    flex-wrap: nowrap;
    justify-content: center;
    overflow: visible;
  }

  #screen-game .opponent,
  #screen-domino .opponent {
    min-width: 0;
    max-width: 118px;
    flex: 0 1 auto;
    padding: 5px 6px;
    border-radius: 10px;
    text-align: left;
  }

  /* При нескольких соперниках делим ширину поровну, чтобы влезли */
  #screen-game .opponents[data-count="4"] .opponent,
  #screen-game .opponents[data-count="5"] .opponent,
  #screen-domino .opponents[data-count="2"] .opponent,
  #screen-domino .opponents[data-count="3"] .opponent {
    flex: 1 1 0;
    max-width: none;
  }

  #screen-game .opponent .name-row,
  #screen-domino .opponent .name-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 0;
    justify-content: flex-start;
  }

  #screen-game .opponent .avatar.sm,
  #screen-domino .opponent .avatar.sm {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  #screen-game .opponent .opp-text,
  #screen-domino .opponent .opp-text {
    flex: 1 1 auto;
    min-width: 0;
  }

  #screen-game .opponent .name,
  #screen-domino .opponent .name {
    font-size: 0.68rem;
    max-width: none;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.15;
  }

  #screen-game .opponent .role,
  #screen-domino .opponent .role {
    display: block;
    font-size: 0.55rem;
    margin-top: 1px;
    letter-spacing: 0.03em;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #screen-game .opponent .opp-count,
  #screen-domino .opponent .opp-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 24px;
    min-width: 18px;
    padding: 0;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 800;
    color: #f4efe4;
    line-height: 1;
    background:
      linear-gradient(145deg, rgba(244, 239, 228, 0.14), transparent 45%),
      repeating-linear-gradient(
        45deg,
        #1a4d38 0 3px,
        #163f2e 3px 6px
      );
    border: 1.5px solid rgba(232, 165, 75, 0.55);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  }

  #screen-game .opponents[data-count="4"] .opponent .name,
  #screen-game .opponents[data-count="5"] .opponent .name,
  #screen-domino .opponent .name {
    font-size: 0.62rem;
  }

  #screen-game .opponents[data-count="5"] .opponent,
  #screen-domino .opponent {
    padding: 4px 4px;
  }

  #screen-game .opponents[data-count="5"] .opponent .avatar.sm,
  #screen-domino .opponent .avatar.sm {
    width: 20px;
    height: 20px;
  }

  #screen-game .table-area {
    flex: 1 1 auto;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    min-height: 0;
    margin: 2px 0;
    padding: 8px 6px;
    border-radius: 14px;
    overflow: hidden;
  }

  #screen-game .table-deck {
    min-width: 0;
    gap: 4px;
    align-self: center;
    flex: 0 0 auto;
  }

  #screen-game .deck-pile {
    width: 86px;
    height: 74px;
  }

  #screen-game .deck-pile .card.trump-under {
    left: 30px;
    top: 4px;
    width: 44px;
    height: 62px;
    padding: 4px 5px;
    transform: rotate(90deg);
    transform-origin: center center;
  }

  #screen-game .deck-pile .card.trump-under .rank {
    font-size: 0.78rem;
  }

  #screen-game .deck-pile .card.trump-under .suit {
    font-size: 0.95rem;
  }

  #screen-game .deck-pile .card-back {
    width: 44px;
    height: 62px;
    left: 0;
    top: 4px;
    border-radius: 7px;
    box-shadow:
      2px 2px 0 rgba(0, 0, 0, 0.16),
      4px 4px 0 rgba(0, 0, 0, 0.1),
      0 6px 12px rgba(0, 0, 0, 0.24);
  }

  #screen-game .deck-pile.only-trump .card.trump-under {
    left: 12px;
    top: 4px;
  }

  #screen-game .deck-count-label {
    font-size: 0.68rem;
    padding: 2px 7px;
  }

  #screen-game .deck-trump-name {
    font-size: 0.65rem;
    max-width: none;
    white-space: nowrap;
  }

  #screen-game .table-cards {
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px 10px;
    padding: 2px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    align-content: center;
  }

  #screen-game .table-cards:empty::after {
    font-size: 0.95rem;
  }

  #screen-game .pair {
    width: 72px;
    height: 90px;
  }

  #screen-game .pair .card,
  #screen-game .table-cards > .card {
    width: 48px;
    height: 68px;
    padding: 5px 6px;
    border-radius: 8px;
  }

  #screen-game .pair .card .rank,
  #screen-game .table-cards > .card .rank {
    font-size: 0.88rem;
  }

  #screen-game .pair .card .suit,
  #screen-game .table-cards > .card .suit {
    font-size: 1.05rem;
  }

  #screen-game .pair .card.defend {
    left: 22px;
    top: 18px;
  }

  #screen-game .actions {
    min-height: 36px;
    gap: 6px;
    flex-shrink: 0;
    padding: 0 2px;
  }

  #screen-game .actions .btn {
    padding: 8px 12px;
    font-size: 0.82rem;
    border-radius: 10px;
  }

  #screen-game .actions .btn.sm {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  #screen-game .choice-bar {
    gap: 6px;
    padding: 7px 8px;
    border-radius: 12px;
    width: 100%;
  }

  #screen-game .choice-label {
    font-size: 0.75rem;
    width: 100%;
    text-align: center;
    margin: 0;
  }

  #screen-game .hand-wrap {
    flex-shrink: 0;
    padding-top: 2px;
    margin-top: 0;
  }

  #screen-game .hand {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px;
    min-height: 0;
    padding: 6px 4px 10px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  #screen-game .hand.is-fanned {
    gap: 0;
  }

  #screen-game .hand .card {
    width: 54px;
    height: 78px;
    padding: 5px 6px;
    border-radius: 8px;
    flex: 0 0 auto;
    margin-left: 0;
  }

  #screen-game .hand .card .rank {
    font-size: 0.95rem;
  }

  #screen-game .hand .card .suit {
    font-size: 1.15rem;
  }

  #screen-game .hand .card.playable:hover {
    transform: translateY(-8px);
  }

  #screen-game .hand .card.selected {
    transform: translateY(-10px);
  }

  .conn-dot {
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
  }
}

@media (max-width: 400px) {
  #screen-game.screen,
  #screen-domino.screen {
    padding: 4px 6px 6px;
    gap: 3px;
  }

  #screen-game .status-line,
  #screen-domino .status-line {
    font-size: 0.72rem;
    padding: 3px 6px;
  }

  #screen-game .opponent,
  #screen-domino .opponent {
    padding: 4px 4px;
  }

  #screen-game .opponent .name,
  #screen-domino .opponent .name {
    font-size: 0.6rem;
  }

  #screen-game .opponent .opp-count,
  #screen-domino .opponent .opp-count {
    width: 16px;
    height: 22px;
    min-width: 16px;
    font-size: 0.58rem;
  }

  #screen-game .table-area {
    gap: 6px;
    padding: 6px 4px;
    border-radius: 12px;
  }

  #screen-game .deck-pile {
    width: 78px;
    height: 66px;
  }

  #screen-game .deck-pile .card.trump-under {
    left: 26px;
    top: 4px;
    width: 40px;
    height: 56px;
    transform: rotate(90deg);
    transform-origin: center center;
  }

  #screen-game .deck-pile .card-back {
    width: 40px;
    height: 56px;
  }

  #screen-game .pair {
    width: 66px;
    height: 82px;
  }

  #screen-game .pair .card,
  #screen-game .table-cards > .card {
    width: 44px;
    height: 62px;
    padding: 4px 5px;
  }

  #screen-game .pair .card.defend {
    left: 20px;
    top: 16px;
  }

  #screen-game .hand .card {
    width: 52px;
    height: 74px;
  }

  #screen-game .actions .btn {
    padding: 7px 10px;
    font-size: 0.78rem;
  }
}

/* --- Морской бой --- */
#screen-seabattle {
  gap: 10px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

#screen-seabattle .status-line {
  text-align: center;
  margin: 0;
  font-size: 0.95rem;
}

.sb-boards {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: 'own turn enemy';
  gap: 14px 16px;
  align-items: center;
}

.sb-own-wrap { grid-area: own; }
.sb-enemy-wrap { grid-area: enemy; }
.sb-turn { grid-area: turn; }

.sb-board-wrap {
  min-width: 0;
}

.sb-turn {
  margin: 0;
  padding: 10px 12px;
  text-align: center;
  font-family: 'Spectral', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(244, 239, 228, 0.12);
  min-width: 7.5rem;
  max-width: 11rem;
  justify-self: center;
}

.sb-turn.is-mine {
  color: #f4efe4;
  border-color: rgba(232, 165, 75, 0.55);
  background: rgba(232, 165, 75, 0.18);
}

.sb-turn.is-foe {
  color: var(--ink-dim);
  border-color: rgba(120, 180, 200, 0.28);
}

.sb-board-title {
  margin: 0 0 8px;
  font-family: 'Spectral', serif;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.sb-grid {
  display: grid;
  grid-template-columns: 18px repeat(10, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.sb-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 3px;
  padding: 0;
  background: rgba(10, 40, 55, 0.55);
  box-shadow: inset 0 0 0 1px rgba(120, 180, 200, 0.2);
  color: var(--ink);
  font: inherit;
  cursor: default;
}

.sb-cell.sb-label {
  background: transparent;
  box-shadow: none;
  aspect-ratio: auto;
  min-height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-dim);
}

.sb-cell.is-empty,
.sb-cell.is-fog {
  background: rgba(12, 48, 64, 0.65);
}

.sb-cell.is-ship {
  background: linear-gradient(160deg, #6f8fa3, #3d5a6e);
  box-shadow: inset 0 0 0 1px rgba(232, 165, 75, 0.35);
}

.sb-cell.is-hit {
  background: #c0392b;
  box-shadow: inset 0 0 0 1px rgba(255, 200, 180, 0.4);
}

.sb-cell.is-sunk {
  background: #5a1f1a;
  box-shadow: inset 0 0 0 1px rgba(255, 120, 100, 0.35);
}

.sb-cell.is-miss {
  background: rgba(20, 60, 80, 0.9);
  background-image: radial-gradient(circle at center, rgba(244, 239, 228, 0.55) 0 22%, transparent 24%);
}

.sb-cell.ghost-ok {
  outline: 2px solid rgba(120, 200, 150, 0.85);
  outline-offset: -1px;
  background: rgba(61, 204, 122, 0.35);
}

.sb-cell.ghost-bad {
  outline: 2px solid rgba(216, 90, 74, 0.85);
  outline-offset: -1px;
  background: rgba(216, 90, 74, 0.35);
}

.sb-cell.shootable {
  cursor: pointer;
}

.sb-cell.shootable:hover {
  background: rgba(232, 165, 75, 0.28);
}

.sb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 4px;
}

.sb-hint {
  font-size: 0.82rem;
  color: var(--ink-dim);
  font-weight: 600;
  margin-right: 4px;
}

@media (max-width: 720px) {
  .sb-boards {
    grid-template-columns: 1fr;
    grid-template-areas:
      'own'
      'turn'
      'enemy';
    gap: 12px;
  }

  .sb-turn {
    max-width: none;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.95rem;
  }

  .sb-grid {
    max-width: 100%;
    grid-template-columns: 16px repeat(10, minmax(0, 1fr));
  }

  .sb-toolbar {
    gap: 6px;
  }

  .sb-toolbar .btn {
    flex: 1 1 calc(50% - 6px);
  }
}


/* Домино: компактные чипы соперников и на широком экране */
#screen-domino .opponents {
  min-height: 0;
  margin-bottom: 6px;
  gap: 6px;
}

#screen-domino .opponent {
  min-width: 0;
  max-width: 140px;
  padding: 6px 8px;
  text-align: left;
}

#screen-domino .opponent .name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  justify-content: flex-start;
}

#screen-domino .opponent .name {
  margin: 0;
  font-size: 0.82rem;
}

#screen-domino .opponent .opp-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 28px;
  min-width: 20px;
  padding: 0;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #f4efe4;
  line-height: 1;
  background:
    linear-gradient(145deg, rgba(244, 239, 228, 0.14), transparent 45%),
    repeating-linear-gradient(
      45deg,
      #1a4d38 0 3px,
      #163f2e 3px 6px
    );
  border: 1.5px solid rgba(232, 165, 75, 0.55);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#screen-domino .opponent .opp-cards {
  display: none;
}

/* --- Домино (в духе экрана дурака) --- */
#screen-domino {
  gap: 8px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

#screen-domino .dm-table-area {
  align-items: center;
  min-height: 200px;
}

.dm-chain-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 18px 4px;
}

.dm-chain {
  /* u = толщина кости; обычная = 2u×u, дубль вертикально = u×2u */
  --dm-u: 36px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  min-height: calc(var(--dm-u) * 2 + 8px);
}

.dm-chain-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.dm-chain-empty {
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 16px;
  opacity: 0.85;
}

.dm-end-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(232, 165, 75, 0.45);
  background: rgba(232, 165, 75, 0.18);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

.dm-end-btn:hover {
  background: rgba(232, 165, 75, 0.32);
}

.dm-tile {
  --dm-w: calc(var(--dm-u, 36px) * 2);
  --dm-h: var(--dm-u, 36px);
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  width: var(--dm-w);
  height: var(--dm-h);
  padding: 0;
  border: 1px solid rgba(40, 30, 20, 0.35);
  border-radius: 5px;
  background: linear-gradient(165deg, #fbf6ec 0%, #ebe2d2 55%, #e2d8c6 100%);
  color: #1a1a1a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 0 rgba(0, 0, 0, 0.14),
    0 5px 12px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  font: inherit;
  cursor: default;
  position: relative;
  overflow: hidden;
}

/* Разделитель половин */
.dm-tile::after {
  content: '';
  position: absolute;
  z-index: 2;
  background: rgba(30, 24, 18, 0.35);
  pointer-events: none;
}

.dm-tile.is-h::after {
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 1.5px;
  transform: translateX(-50%);
}

/* Дубль — вертикально поперёк линии хода */
.dm-tile.is-v {
  flex-direction: column;
  width: var(--dm-h);
  height: var(--dm-w);
}

.dm-tile.is-v::after {
  left: 10%;
  right: 10%;
  top: 50%;
  bottom: auto;
  width: auto;
  height: 1.5px;
  transform: translateY(-50%);
}

/* На столе кости стыкуются вплотную — цифра к цифре */
.dm-tile.on-table {
  border-radius: 4px;
}

.dm-chain-item + .dm-chain-item .dm-tile.on-table {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.dm-chain-item:not(:last-child) .dm-tile.on-table.is-h {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.dm-chain-item.is-double .dm-tile.on-table {
  border-radius: 4px;
  z-index: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 0 rgba(0, 0, 0, 0.16),
    0 6px 14px rgba(0, 0, 0, 0.28);
}

.dm-tile.playable {
  cursor: pointer;
  outline: 2px solid rgba(232, 165, 75, 0.55);
  outline-offset: 2px;
}

.dm-tile.playable:hover {
  transform: translateY(-3px);
}

.dm-tile.selected {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  transform: translateY(-4px);
}

.dm-tile.dim {
  opacity: 0.45;
  filter: grayscale(0.15);
}

.dm-half {
  flex: 1 1 50%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  padding: 3px;
  min-width: 0;
  min-height: 0;
}

.dm-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
}

.dm-pip.on {
  background: #1a1510;
  box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.25);
}

.dm-hand {
  --dm-u: 38px;
  align-items: flex-end;
  gap: 8px;
}

.dm-hand .dm-tile.is-v {
  /* дубли в руке тоже стоят вертикально */
  align-self: center;
}

.dm-opp-back {
  width: 18px !important;
  height: 28px !important;
  border-radius: 4px;
}

#dm-actions {
  justify-content: center;
}

@media (max-width: 720px) {
  #screen-domino .dm-table-area {
    flex-direction: column;
    min-height: 0;
    gap: 10px;
    padding: 10px;
  }

  .dm-chain {
    --dm-u: 30px;
  }

  .dm-chain-wrap {
    width: 100%;
    order: 1;
    padding: 14px 2px;
  }

  #dm-bazar {
    order: 0;
  }

  .dm-hand {
    --dm-u: 30px;
    gap: 6px;
  }

  .dm-pip {
    width: 4px;
    height: 4px;
  }
}

/* --- Шахматы --- */
#screen-chess {
  gap: 8px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  align-items: center;
}

#screen-chess .opponents {
  width: 100%;
  min-height: 0;
  margin-bottom: 4px;
  gap: 6px;
}

#screen-chess .opponent {
  min-width: 0;
  max-width: 160px;
  padding: 6px 8px;
  text-align: left;
}

#screen-chess .opponent .name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

#screen-chess .opponent .name {
  margin: 0;
  font-size: 0.82rem;
}

#screen-chess .opponent .opp-count {
  display: inline-flex;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border-radius: 50%;
  padding: 0;
  border: 1px solid rgba(244, 239, 228, 0.35);
  background: #1a1a1a;
  box-shadow: none;
}

#screen-chess .opponent .opp-count.is-w {
  background: #f4efe4;
}

#screen-chess .opponent .opp-count.is-b {
  background: #1c1814;
}

#screen-chess .status-line {
  width: 100%;
  text-align: center;
  margin: 0;
}

.ch-board-wrap {
  width: min(100%, 520px);
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at center, rgba(31, 122, 88, 0.28), transparent 70%),
    rgba(0, 0, 0, 0.22);
  border: 2px solid rgba(232, 165, 75, 0.18);
  box-sizing: border-box;
}

.ch-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.ch-sq {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  aspect-ratio: 1;
}

.ch-sq.is-light {
  background: #e8d5b5;
}

.ch-sq.is-dark {
  background: #3d6b52;
}

.ch-sq.is-selected {
  box-shadow: inset 0 0 0 3px rgba(232, 165, 75, 0.95);
}

.ch-sq.is-last {
  box-shadow: inset 0 0 0 2px rgba(232, 165, 75, 0.45);
}

.ch-sq.is-target::after {
  content: '';
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.28);
}

.ch-sq.is-capture::after {
  content: '';
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 3px solid rgba(192, 57, 43, 0.55);
  background: transparent;
  width: auto;
  height: auto;
}

.ch-board.is-check .ch-sq.is-selected,
.ch-piece {
  line-height: 1;
}

.ch-piece {
  font-size: clamp(1.35rem, 6.2vw, 2.55rem);
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  user-select: none;
}

.ch-piece.is-w {
  color: #fffdf6;
  -webkit-text-stroke: 1.25px rgba(20, 16, 12, 0.75);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}

.ch-piece.is-b {
  color: #120e0c;
  -webkit-text-stroke: 0.6px rgba(255, 255, 255, 0.12);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.ch-promo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(232, 165, 75, 0.35);
}

.ch-promo-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.ch-promo-btn {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(244, 239, 228, 0.2);
  background: rgba(244, 239, 228, 0.12);
  color: var(--ink);
  font-size: 1.6rem;
  cursor: pointer;
}

.ch-promo-btn:hover {
  border-color: rgba(232, 165, 75, 0.55);
  background: rgba(232, 165, 75, 0.18);
}

#ch-actions {
  justify-content: center;
  width: 100%;
}

@media (max-width: 480px) {
  #screen-chess.screen {
    padding: 6px 8px 8px;
    gap: 4px;
  }

  #screen-chess .opponents {
    margin-bottom: 2px;
  }

  #screen-chess .opponent {
    max-width: 118px;
    padding: 4px 6px;
  }

  #screen-chess .opponent .name {
    font-size: 0.62rem;
  }

  .ch-board-wrap {
    padding: 6px;
    border-radius: 14px;
    width: min(100%, 100vw - 16px);
  }

  .ch-piece {
    font-size: clamp(1.2rem, 9vw, 2rem);
  }
}
