:root {
  --bg: #14412A;
  --bg-deep: #071b11;
  --accent: #3ABA7A;
  --accent-soft: rgba(58, 186, 122, 0.22);
  --text: #FFFFFF;
  --muted: rgba(255, 255, 255, 0.68);
  --glass: rgba(255, 255, 255, 0.1);
  --glass-strong: rgba(255, 255, 255, 0.17);
  --line: rgba(255, 255, 255, 0.18);
  --danger: #ff746a;
  --tile: linear-gradient(180deg, rgba(87, 235, 154, 0.9), rgba(25, 139, 84, 0.95));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at 30% 10%, rgba(58, 186, 122, 0.18), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(58, 186, 122, 0.16), transparent 32%),
    linear-gradient(140deg, var(--bg), var(--bg-deep));
  color: var(--text);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, #000, transparent 78%);
}

.floating-cubes span {
  position: fixed;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,0.28), rgba(58,186,122,0.04));
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 22px rgba(255,255,255,0.12), 0 16px 36px rgba(0,0,0,0.18);
  transform: rotate(14deg);
  animation: cubeFloat 8s ease-in-out infinite;
  pointer-events: none;
}

.floating-cubes span:nth-child(1) { left: 8%; top: 12%; animation-delay: 0s; }
.floating-cubes span:nth-child(2) { right: 11%; top: 15%; width: 42px; height: 42px; animation-delay: -2s; }
.floating-cubes span:nth-child(3) { left: 4%; bottom: 12%; width: 46px; height: 46px; animation-delay: -4s; }
.floating-cubes span:nth-child(4) { right: 8%; bottom: 10%; animation-delay: -6s; }
.floating-cubes span:nth-child(5) { left: 46%; bottom: 18%; width: 32px; height: 32px; animation-delay: -1.5s; }

@keyframes cubeFloat {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(14deg); opacity: 0.55; }
  50% { transform: translate3d(0, -18px, 0) rotate(24deg); opacity: 0.95; }
}

.app-shell {
  position: relative;
  width: min(1200px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  z-index: 1;
}

.screen {
  min-height: calc(100vh - 44px);
  min-height: calc(100dvh - 44px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: screenIn 0.45s ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); filter: blur(10px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  object-fit: contain;
  background: linear-gradient(145deg, rgba(58,186,122,0.3), rgba(255,255,255,0.08));
  padding: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}

.brand-title {
  display: grid;
  line-height: 1.03;
  letter-spacing: 0.04em;
  font-weight: 900;
  font-size: 18px;
}

.brand-title span:last-child {
  color: var(--accent);
}

.user-pill, .glass-card, .panel, .modal, .piece-card, .button, .input, .select, .stat-card, .mode-card, .board-wrap {
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.055));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 22px 54px rgba(0,0,0,0.24);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 999px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), rgba(255,255,255,0.22));
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  font-weight: 900;
}

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

.small-text {
  color: var(--muted);
  font-size: 13px;
}

.hero {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.hero-card {
  width: min(560px, 100%);
  padding: 34px 20px;
  border-radius: 34px;
}

.hero-logo {
  width: 128px;
  height: 128px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 20px 38px rgba(58,186,122,0.18));
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 8vw, 72px);
  line-height: 0.95;
  letter-spacing: 0.04em;
}

h2 {
  font-size: clamp(24px, 4vw, 36px);
}

h3 {
  font-size: 18px;
}

.title-accent {
  color: var(--accent);
}

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

.grid-2, .grid-3 {
  display: grid;
  gap: 14px;
}

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

.panel, .glass-card {
  border-radius: 28px;
  padding: 18px;
}

.button {
  min-height: 48px;
  border-radius: 16px;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  user-select: none;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 26px 58px rgba(0,0,0,0.26), 0 0 32px rgba(58,186,122,0.16);
}

.button:active {
  transform: translateY(0) scale(0.98);
}

.button.primary {
  background: linear-gradient(180deg, rgba(74, 232, 148, 0.9), rgba(36, 157, 93, 0.9));
  border-color: rgba(115, 255, 182, 0.55);
  box-shadow: 0 14px 42px rgba(58,186,122,0.26);
  font-weight: 800;
}

.button.danger {
  background: linear-gradient(180deg, rgba(255, 116, 106, 0.4), rgba(120, 35, 30, 0.3));
  border-color: rgba(255, 116, 106, 0.45);
}

.button.ghost {
  background: rgba(255,255,255,0.08);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.input, .select {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.input::placeholder {
  color: rgba(255,255,255,0.45);
}

.menu-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}

.mode-card, .stat-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 138px;
  display: grid;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mode-card:hover, .stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(58,186,122,0.45);
}

.mode-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
}

.tabs, .segmented {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
}

.tab, .segment {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  transition: background 0.2s ease, transform 0.2s ease;
}

.tab.active, .segment.active {
  background: linear-gradient(180deg, rgba(58,186,122,0.72), rgba(58,186,122,0.34));
  box-shadow: 0 10px 22px rgba(58,186,122,0.16);
}

.lobby-code {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.code-cell {
  width: 56px;
  height: 62px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
}

.player-list {
  display: grid;
  gap: 10px;
}

.player-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.game-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 16px;
  align-items: start;
}

.hud-panel {
  position: sticky;
  top: 16px;
}

.board-stage {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 16px;
}

.board-wrap {
  border-radius: 26px;
  padding: 14px;
  width: fit-content;
  max-width: 100%;
  position: relative;
}

.boards-duo {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px;
  position: relative;
}

.boards-duo::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 50%;
  width: 0;
  border-left: 2px dashed rgba(255,255,255,0.5);
  filter: drop-shadow(0 0 10px rgba(58,186,122,0.8));
  z-index: 5;
}

.board-group {
  display: grid;
  gap: 8px;
}

.board-caption {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  gap: 3px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(0,0,0,0.21);
  border: 1px solid rgba(255,255,255,0.13);
  --cell: clamp(26px, 5.7vw, 54px);
}

.boards-duo .board {
  border-radius: 0;
}

.boards-duo .board-group:first-child .board {
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
  border-right: 0;
}

.boards-duo .board-group:last-child .board {
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  border-left: 0;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  border-radius: 8px;
  background: rgba(255,255,255,0.065);
  border: 1px solid rgba(255,255,255,0.07);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.cell.filled {
  background: var(--tile);
  border-color: rgba(168,255,204,0.65);
  box-shadow: inset 0 2px 14px rgba(255,255,255,0.22), 0 0 16px rgba(58,186,122,0.18);
  animation: popIn 0.22s ease both;
}

.cell.filled::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/assets/tile.svg') center / cover no-repeat;
  opacity: 0.32;
}

.cell.preview {
  background: rgba(58,186,122,0.42);
  border-color: rgba(126,255,186,0.8);
  box-shadow: 0 0 18px rgba(58,186,122,0.38);
  transform: scale(1.04);
}

.cell.bad-preview {
  background: rgba(255, 116, 106, 0.26);
  border-color: rgba(255, 116, 106, 0.56);
}

@keyframes popIn {
  from { transform: scale(0.72); filter: blur(6px); }
  to { transform: scale(1); filter: blur(0); }
}

.tray {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.piece-card {
  min-width: 96px;
  min-height: 96px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  touch-action: none;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.piece-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(58,186,122,0.45);
}

.piece-card.dragging {
  opacity: 0.4;
}

.piece-grid {
  display: grid;
  gap: 4px;
}

.piece-cell {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: transparent;
}

.piece-cell.on {
  background: var(--tile);
  border: 1px solid rgba(255,255,255,0.32);
  box-shadow: 0 0 10px rgba(58,186,122,0.25);
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.92;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 22px 40px rgba(0,0,0,0.35));
}

.modal-layer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.2s ease both;
  padding: 16px;
}

.modal {
  width: min(460px, 100%);
  border-radius: 30px;
  padding: 18px;
  animation: modalIn 0.25s ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.results-table, .leader-table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 36px 1fr 90px 70px 70px 70px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 15px;
  background: rgba(255,255,255,0.07);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(7, 27, 17, 0.9);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 22px 50px rgba(0,0,0,0.28);
  backdrop-filter: blur(16px);
  z-index: 1001;
  animation: toastIn 0.25s ease both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.loading-steps {
  width: min(420px, 100%);
  margin: 18px auto 0;
  text-align: left;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.rule-mini {
  display: grid;
  grid-template-columns: repeat(8, 10px);
  gap: 2px;
}

.rule-mini span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
}

.rule-mini span.on {
  background: var(--accent);
}

@media (max-width: 960px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .hud-panel {
    position: static;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .menu-actions {
    grid-template-columns: 1fr;
  }

  .board {
    --cell: min(9.6vw, 42px);
    gap: 2px;
    padding: 4px;
  }

  .boards-duo {
    transform: scale(0.86);
    transform-origin: center top;
    margin-bottom: -48px;
  }

  .table-row {
    grid-template-columns: 30px 1fr 70px;
  }

  .table-row .hide-mobile {
    display: none;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .panel, .glass-card {
    padding: 14px;
    border-radius: 22px;
  }

  .brand-title {
    font-size: 15px;
  }

  .user-pill .small-text {
    display: none;
  }

  .code-cell {
    width: 48px;
    height: 54px;
  }

  .piece-card {
    min-width: 86px;
    min-height: 86px;
  }

  .boards-duo {
    transform: scale(0.76);
    margin-bottom: -78px;
  }
}

.link-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.auth-card {
  contain: content;
}

.auth-state {
  margin-top: 24px;
  display: grid;
  gap: 16px;
  justify-items: center;
}

.telegram-mark {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(58, 186, 122, 0.88), rgba(58, 186, 122, 0.32));
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 18px 40px rgba(58,186,122,0.24), inset 0 1px 0 rgba(255,255,255,0.25);
  font-size: 36px;
  font-weight: 900;
}

.telegram-mark.warning {
  background: linear-gradient(180deg, rgba(255, 116, 106, 0.75), rgba(120, 35, 30, 0.35));
}

.telegram-mark.pulse {
  animation: softPulse 1.6s ease-in-out infinite;
}

@keyframes softPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 18px 40px rgba(58,186,122,0.22); }
  50% { transform: scale(1.035); box-shadow: 0 22px 54px rgba(58,186,122,0.34); }
}

@media (max-width: 720px) {
  .floating-cubes span:nth-child(n+4) { display: none; }
  .user-pill, .glass-card, .panel, .modal, .piece-card, .button, .input, .select, .stat-card, .mode-card, .board-wrap {
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Mobile auth and launch fixes */
.auth-subtitle {
  margin-top: 14px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.auth-buttons {
  width: min(360px, 100%);
  display: grid;
  gap: 10px;
}

.auth-hint {
  max-width: 430px;
}

@media (max-width: 520px) {
  .hero {
    place-items: start center;
    padding-top: 8px;
  }

  .hero-card {
    padding: 22px 14px;
    border-radius: 26px;
  }

  .hero-logo {
    width: 86px;
    height: 86px;
    margin-bottom: 10px;
  }

  h1 {
    font-size: clamp(34px, 12vw, 48px);
  }

  .auth-state {
    margin-top: 18px;
    gap: 12px;
  }

  .telegram-mark {
    width: 58px;
    height: 58px;
    border-radius: 19px;
    font-size: 28px;
  }

  .auth-subtitle,
  .auth-hint,
  .small-text {
    font-size: 12.5px;
  }

  .button {
    min-height: 46px;
  }
}

@media (max-width: 420px) {
  .board {
    --cell: min(9.1vw, 38px);
  }

  .boards-duo {
    transform: scale(0.72);
    margin-bottom: -92px;
  }
}

.telegram-widget-slot {
  min-height: 54px;
  display: grid;
  place-items: center;
  width: min(360px, 100%);
  padding: 4px;
}

.telegram-widget-slot iframe,
.telegram-widget-slot > * {
  max-width: 100%;
}

.auth-state-external .button.primary {
  background: linear-gradient(180deg, rgba(74, 232, 148, 0.9), rgba(36, 157, 93, 0.9));
}

@media (max-width: 520px) {
  .telegram-widget-slot {
    min-height: 48px;
  }
}

/* Gameplay fix: smoother placement preview and clean drag visualization */
.piece-card.dragging {
  opacity: 0.28;
  transform: scale(0.94);
  border-color: rgba(58,186,122,0.55);
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.98;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.19), rgba(255,255,255,0.07));
  border: 1px solid rgba(255,255,255,0.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 24px 60px rgba(0,0,0,0.42), 0 0 28px rgba(58,186,122,0.26);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  will-change: transform;
}

.drag-ghost .piece-grid {
  transform: scale(1.15);
  transform-origin: center;
}

.drag-ghost .piece-cell.on {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  box-shadow: inset 0 1px 10px rgba(255,255,255,0.32), 0 0 18px rgba(58,186,122,0.42);
}

.cell.preview {
  background: var(--tile);
  border-color: rgba(190,255,221,0.95);
  box-shadow: inset 0 2px 14px rgba(255,255,255,0.28), 0 0 22px rgba(58,186,122,0.52);
  transform: scale(1.035);
}

.cell.preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/assets/tile.svg') center / cover no-repeat;
  opacity: 0.28;
}

.cell.bad-preview {
  background: linear-gradient(180deg, rgba(255,116,106,0.36), rgba(130,34,34,0.38));
  border-color: rgba(255,116,106,0.78);
  box-shadow: 0 0 18px rgba(255,116,106,0.35);
  transform: scale(1.02);
}

.boards-duo {
  gap: 0 !important;
}

.boards-duo .board-group {
  gap: 6px;
}

/* Gameplay sync fixes */
.status-pill {
  min-width: 86px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.14);
}

.status-pill.ready {
  background: rgba(58,186,122,0.22);
  color: #caffdf;
  box-shadow: 0 0 18px rgba(58,186,122,0.18);
}

.status-pill.not-ready {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.62);
}

.player-row {
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.player-row.is-ready {
  border-color: rgba(58,186,122,0.28);
  background: rgba(58,186,122,0.08);
}

.player-row.is-not-ready {
  border-color: rgba(255,255,255,0.09);
}

.player-row.is-you {
  border-color: rgba(58,186,122,0.38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 26px rgba(58,186,122,0.08);
}

.board.can-drop {
  border-color: rgba(126,255,186,0.55);
  box-shadow: 0 0 28px rgba(58,186,122,0.18), inset 0 1px 0 rgba(255,255,255,0.14);
}

.board.cannot-drop {
  border-color: rgba(255,116,106,0.55);
  box-shadow: 0 0 28px rgba(255,116,106,0.12), inset 0 1px 0 rgba(255,255,255,0.12);
}

.cell.just-filled {
  animation: tileAppearSmooth 0.28s cubic-bezier(.2,.8,.2,1) both;
}

.cell.clearing {
  animation: tileClearSmooth 0.14s ease both;
}

@keyframes tileAppearSmooth {
  from { transform: scale(0.58); opacity: 0.3; filter: blur(5px); }
  to { transform: scale(1); opacity: 1; filter: blur(0); }
}

@keyframes tileClearSmooth {
  from { transform: scale(1); opacity: 1; filter: blur(0); }
  to { transform: scale(0.45); opacity: 0; filter: blur(4px); }
}

.drag-ghost.on-board {
  opacity: 0.68;
  filter: drop-shadow(0 24px 42px rgba(0,0,0,0.36)) drop-shadow(0 0 18px rgba(58,186,122,0.22));
}

.drag-ghost.on-board .piece-grid {
  gap: var(--ghost-gap, 3px) !important;
}

.drag-ghost.on-board .piece-cell {
  width: var(--ghost-cell, 32px);
  height: var(--ghost-cell, 32px);
  border-radius: 8px;
}

.drag-ghost.on-board .piece-cell:not(.on) {
  opacity: 0;
}

.drag-ghost.on-board .piece-cell.on {
  background: linear-gradient(180deg, rgba(126,255,186,0.72), rgba(58,186,122,0.46));
  border-color: rgba(202,255,223,0.7);
  box-shadow: inset 0 2px 14px rgba(255,255,255,0.18), 0 0 22px rgba(58,186,122,0.28);
}

.boards-duo .board-group {
  gap: 8px;
}

.boards-duo .board-group + .board-group {
  margin-left: 0;
}

/* 2026-05 gameplay hotfixes */
.game-layout.game-layout-clean {
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  align-items: start;
}

.game-layout-clean .board-stage {
  width: 100%;
  overflow: visible;
  isolation: isolate;
}

.game-layout-clean .boards-duo {
  max-width: 100%;
  overflow: visible;
}

.game-layout-clean .board {
  --cell: clamp(24px, 3.15vw, 45px);
}

.players-strip {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.players-strip .player-row {
  min-height: 56px;
  margin: 0;
  background: rgba(255,255,255,0.055);
}

.game-tip {
  text-align: center;
  max-width: 900px;
}

.board-stage > [data-board-area] {
  width: 100%;
  display: grid;
  place-items: center;
}

.hud-panel {
  z-index: 2;
}

.board-stage {
  z-index: 1;
}

.board-caption {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(var(--cell) * 8 + 36px);
}

.boards-duo::before {
  pointer-events: none;
}

.button.primary[data-ready] {
  background: linear-gradient(180deg, rgba(92, 229, 145, 0.98), rgba(47, 165, 96, 0.9));
  color: #ffffff;
  box-shadow: 0 0 28px rgba(58,186,122,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
}

.button.ghost[data-ready] {
  background: rgba(255,255,255,0.11);
  color: rgba(255,255,255,0.82);
  border-color: rgba(255,255,255,0.14);
  box-shadow: none;
}

@media (max-width: 1080px) {
  .game-layout.game-layout-clean {
    grid-template-columns: 1fr;
  }

  .game-layout-clean .board {
    --cell: min(5.05vw, 36px);
  }

  .game-layout-clean .boards-duo {
    transform: none;
    margin-bottom: 0;
  }

  .hud-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .game-layout-clean .board {
    --cell: min(4.75vw, 28px);
    gap: 2px;
    padding: 4px;
  }

  .boards-duo {
    padding: 8px;
  }

  .boards-duo::before {
    top: 8px;
    bottom: 8px;
  }

  .players-strip {
    grid-template-columns: 1fr;
  }
}
