:root {
  --font-main: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Dropdle Atmospheric Slate & Dew Palette */
  --bg-deep: #07101c;
  --surface-glass: rgba(11, 22, 36, 0.80);
  --surface-glass-strong: rgba(13, 25, 42, 0.92);
  --surface-well: rgba(5, 11, 20, 0.62);
  --edge-top: rgba(210, 238, 255, 0.26);
  --edge-side: rgba(155, 208, 245, 0.14);
  --edge-bottom: rgba(3, 8, 16, 0.85);

  /* Semantic Accents — Cohesive Dew, Forest Emerald, Sunlit Gold & Terracotta */
  --gold: #f7c948;
  --gold-deep: #b8740e;
  --amber: #f59e0b;
  --emerald: #2ec98a;
  --emerald-deep: #0e6f4c;
  --ocean: #4da8e8;
  --ocean-deep: #175c94;
  --combo-coral: #f08a38;
  --combo-deep: #a34710;
  --crimson: #e5484d;
  --crimson-mid: #b3262d;
  --crimson-deep: #5e1116;

  --tx: #f4f9ff;
  --tx-soft: #c2d7ea;
  --tx-muted: #8ea9c2;

  /* 3D Tile Depth Tokens */
  --tile-depth: 5px;
  --tile-radius: 11px;
  --panel-radius: 20px;
}

#app *,
#app *::before,
#app *::after,
#go *,
#go *::before,
#go *::after,
#rules *,
#rules *::before,
#rules *::after,
#dd-confirm *,
#dd-confirm *::before,
#dd-confirm *::after,
#toast {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body.dropdle-body ::selection {
  background: rgba(86, 195, 255, 0.35);
  color: #fff;
}

/* Custom themed scrollbars */
body.dropdle-body ::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

body.dropdle-body ::-webkit-scrollbar-track {
  background: rgba(6, 14, 24, 0.4);
  border-radius: 99px;
}

body.dropdle-body ::-webkit-scrollbar-thumb {
  background: rgba(126, 184, 226, 0.28);
  border-radius: 99px;
}

body.dropdle-body ::-webkit-scrollbar-thumb:hover {
  background: rgba(126, 184, 226, 0.45);
}

html,
body.dropdle-body {
  width: 100%;
  min-height: 100vh;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body.dropdle-body {
  background-color: #162b42;
  background-image:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(165, 220, 255, 0.28), transparent 65%),
    linear-gradient(180deg, rgba(16, 36, 58, 0.14) 0%, rgba(10, 24, 42, 0.28) 100%),
    url('../img/bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--tx);
  font-family: var(--font-main);
  padding: 16px 14px 44px;
  margin: 0;
  overflow-y: auto;
  font-variant-numeric: tabular-nums;
}

/* Permettre la sélection de texte dans les modals Bootstrap et la sidenav */
body.dropdle-body .modal,
body.dropdle-body #popup-not-logged,
body.dropdle-body #game-nav {
  -webkit-user-select: text;
  user-select: text;
}

#app :focus-visible,
#go :focus-visible,
#rules :focus-visible {
  outline: 2px solid var(--ocean);
  outline-offset: 2px;
}

canvas#rain-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}

canvas#fireworks {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1015;
}

#app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 auto;
}

#game-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  align-items: center;
}

.game-core {
  width: 100%;
  max-width: 452px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* LOGO */
.logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px 0 4px;
}

.main-logo {
  display: block;
  max-width: 240px;
  width: 78%;
  height: auto;
  filter: drop-shadow(0 10px 22px rgba(4, 14, 28, 0.72));
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.main-logo:hover {
  transform: translateY(-2px);
}

/* 3D BEVELED GLASS PANEL */
.dd-glass-panel {
  background: linear-gradient(168deg, rgba(20, 38, 60, 0.76) 0%, rgba(10, 20, 34, 0.86) 100%);
  border: 1px solid var(--edge-side);
  border-top-color: var(--edge-top);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
  border-radius: var(--panel-radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35),
    0 5px 0 rgba(5, 12, 22, 0.82),
    0 18px 38px rgba(2, 8, 18, 0.65);
}

/* STOCK BAR */
#stock-container {
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#stock-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

#stock-label {
  font-size: 0.78rem;
  color: var(--tx-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

#stock-count {
  font-family: var(--font-display);
  font-size: 1.18rem;
  color: var(--tx);
  font-weight: 800;
  letter-spacing: -0.01em;
}

#stock-bar-bg {
  background: var(--surface-well);
  border-radius: 99px;
  height: 11px;
  width: 100%;
  padding: 2px;
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

#stock-bar-fill {
  background: linear-gradient(90deg, #1ea97c 0%, #44e3a7 100%);
  height: 100%;
  width: 100%;
  border-radius: 99px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

#stock-bar-fill.stock-orange {
  background: linear-gradient(90deg, #d97706 0%, #fbbf24 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

#stock-bar-fill.stock-red {
  background: linear-gradient(90deg, #b91c1c 0%, #f87171 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45);
  animation: pulse-bar 1.05s ease-in-out infinite;
}

@keyframes pulse-bar {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.62;
  }
}

/* STATS ROW */
#sc-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.sb {
  padding: 10px 8px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 4px 0 rgba(5, 12, 22, 0.8),
    0 10px 22px rgba(2, 8, 18, 0.45);
}

.sb-l {
  font-size: 0.75rem;
  color: var(--tx-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 3px;
  font-weight: 700;
}

.sb-v {
  font-family: var(--font-display);
  font-size: 1.44rem;
  color: var(--tx);
  line-height: 1.05;
  font-weight: 800;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sb-v#vSc {
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(2, 8, 18, 0.65);
}

.sb-v.pop {
  transform: scale(1.18);
}

/* MAIN BOARD PANEL */
.board-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 14px;
  margin: 0;
  border-bottom: 1px solid rgba(160, 212, 255, 0.12);
}

#hdr-r {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* QUEUE 3D TILES */
#queue {
  display: flex;
  align-items: center;
  min-height: 52px;
  min-width: 0;
}

#q-tiles {
  display: flex;
  gap: 4px;
  align-items: center;
}

.qt {
  position: relative;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.qt.q0 {
  width: 46px;
  height: 50px;
  font-size: 1.5rem;
  background: linear-gradient(165deg, #ffe580 0%, #f5be36 58%, #df931c 100%);
  color: #1c1204;
  border: 1px solid rgba(255, 245, 198, 0.65);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.65),
    0 5px 0 #9c610b,
    0 10px 18px rgba(2, 8, 18, 0.55);
  text-shadow: 0 1px 0 rgba(255, 248, 215, 0.6);
}

.qt.q1 {
  width: 33px;
  height: 37px;
  font-size: 1.05rem;
  background: linear-gradient(165deg, rgba(247, 201, 72, 0.25), rgba(180, 128, 24, 0.18));
  color: #ffe28a;
  border: 1px solid rgba(247, 201, 72, 0.38);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.22), 0 3px 0 rgba(6, 14, 26, 0.72);
}

.qt.q2 {
  width: 29px;
  height: 33px;
  font-size: 0.92rem;
  background: linear-gradient(165deg, rgba(160, 210, 255, 0.16), rgba(80, 125, 175, 0.12));
  color: var(--tx);
  border: 1px solid rgba(160, 212, 255, 0.22);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.16), 0 3px 0 rgba(6, 14, 26, 0.68);
}

.qt.q3,
.qt.q4 {
  width: 24px;
  height: 28px;
  font-size: 0.78rem;
  background: rgba(140, 190, 235, 0.08);
  color: var(--tx-soft);
  border: 1px solid rgba(155, 205, 245, 0.16);
  box-shadow: 0 2px 0 rgba(6, 14, 26, 0.55);
}

.q-sep {
  color: rgba(165, 210, 245, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0;
}

/* ACTION BUTTONS (HAMMER, SOUND, NEW GAME, RULES) */
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(168, 216, 255, 0.15) 0%, rgba(28, 52, 82, 0.42) 100%);
  border: 1px solid rgba(165, 215, 255, 0.2);
  border-top-color: rgba(220, 242, 255, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 0 rgba(5, 12, 22, 0.8),
    0 7px 14px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tx);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.icon-btn:hover {
  background: linear-gradient(165deg, rgba(180, 224, 255, 0.24) 0%, rgba(36, 66, 102, 0.52) 100%);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(5, 12, 22, 0.8);
}

#sound-btn.muted {
  color: #ff9c9c;
  background: linear-gradient(165deg, rgba(229, 72, 77, 0.22) 0%, rgba(68, 22, 30, 0.5) 100%);
  border-color: rgba(255, 107, 107, 0.45);
}

/* HAMMER BUTTON + 4-PIP CHARGE METER */
#delete-btn {
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}

#delete-btn .hammer-svg {
  width: 18px;
  height: 18px;
  opacity: 0.45;
  color: var(--tx-soft);
}

.hammer-pips {
  display: flex;
  gap: 2.5px;
}

.hammer-pip {
  width: 5px;
  height: 3.5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.hammer-pip.filled {
  background: var(--gold);
}

#delete-btn.off {
  cursor: default;
}

#delete-btn.rdy {
  background: linear-gradient(165deg, rgba(251, 191, 36, 0.34) 0%, rgba(180, 96, 12, 0.46) 100%);
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 200, 0.5),
    0 4px 0 #6e3d06,
    0 8px 16px rgba(2, 8, 18, 0.55);
}

#delete-btn.rdy .hammer-svg {
  opacity: 1;
  color: #ffe89e;
}

#delete-btn.active {
  background: linear-gradient(165deg, rgba(239, 68, 68, 0.52) 0%, rgba(153, 27, 27, 0.66) 100%);
  border-color: #ff6b6b;
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.35),
    0 1px 0 #5c0d0d,
    0 4px 12px rgba(2, 8, 18, 0.55);
}

#delete-btn.active .hammer-svg {
  opacity: 1;
  color: #fff;
  transform: rotate(-24deg) scale(1.08);
}

#delete-btn.active .hammer-pip.filled {
  background: #ff9c9c;
}

.hammer-ready-anim {
  animation: hammer-pop 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes hammer-pop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.16) rotate(-8deg);
  }

  70% {
    transform: scale(0.96) rotate(4deg);
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

/* GRID WRAPPER & COLUMN BUTTONS */
.grid-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#col-btns {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  padding: 0 8px;
}

.cb {
  position: relative;
  background: linear-gradient(168deg, rgba(160, 212, 255, 0.16) 0%, rgba(22, 44, 70, 0.52) 100%);
  border: 1px solid rgba(158, 210, 255, 0.18);
  border-top-color: rgba(215, 240, 255, 0.35);
  color: var(--tx-soft);
  border-radius: 11px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 0 rgba(5, 13, 24, 0.82),
    0 6px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.12s ease, border-color 0.15s ease;
  touch-action: manipulation;
}

.cb svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}

.cb.hovered {
  background: linear-gradient(168deg, rgba(86, 195, 255, 0.32) 0%, rgba(28, 76, 120, 0.62) 100%);
  border-color: rgba(126, 212, 255, 0.55);
  color: #fff;
  transform: translateY(-1px);
}

.cb.hovered svg {
  transform: translateY(2px);
}

.cb.pressed,
.cb:active:not(:disabled) {
  background: linear-gradient(165deg, #ffe27a 0%, #f5b72b 100%) !important;
  color: #1c1204 !important;
  border-color: rgba(255, 248, 210, 0.8) !important;
  transform: translateY(3px) !important;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.6),
    0 1px 0 #8a5609 !important;
}

.cb:disabled {
  opacity: 0.22;
  pointer-events: none;
  box-shadow: 0 2px 0 rgba(5, 13, 24, 0.6);
}

/* 3D RECESSED GRID TRAY */
#grid-area {
  position: relative;
  padding: 9px 8px 13px;
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(4, 11, 20, 0.78) 0%, rgba(9, 20, 34, 0.64) 100%);
  border: 1px solid rgba(155, 210, 255, 0.12);
  border-bottom-color: rgba(205, 236, 255, 0.22);
  box-shadow:
    inset 0 5px 14px rgba(0, 0, 0, 0.68),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

#grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  width: 100%;
  touch-action: none;
}

/* 3D TACTILE BEVELED CELLS */
.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--tile-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4.9vw, 1.85rem);
  font-weight: 800;
  color: transparent;
  background: linear-gradient(180deg, rgba(4, 10, 18, 0.62) 0%, rgba(12, 24, 40, 0.42) 100%);
  border: 1px solid rgba(135, 188, 235, 0.08);
  box-shadow:
    inset 0 3px 7px rgba(0, 0, 0, 0.56),
    inset 0 -1px 0 rgba(205, 235, 255, 0.08);
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s ease, background 0.18s ease, border-color 0.18s ease, filter 0.16s ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* Subtle active column rail highlight on empty cells */
.cell.col-rail {
  background: linear-gradient(180deg, rgba(35, 84, 130, 0.28) 0%, rgba(20, 52, 84, 0.22) 100%);
  border-color: rgba(110, 200, 255, 0.18);
}

/* Letter point subscript */
.cell .pts-sub {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.65;
  font-family: var(--font-main);
  letter-spacing: -0.02em;
  pointer-events: none;
}

/* Multiplier badge (x2, x3) */
.cell[data-mult]::after {
  content: "×" attr(data-mult);
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 0.68rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.28);
  border: 1px solid rgba(251, 191, 36, 0.65);
  color: #ffe89e;
  font-family: var(--font-display);
  font-weight: 800;
  z-index: 5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.cell[data-mult="3"]::after {
  background: rgba(240, 138, 56, 0.35);
  border-color: rgba(255, 196, 130, 0.78);
  color: #fff0db;
}

.cell.mult-spawn {
  animation: mult-pop 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mult-pop {
  0% {
    transform: scale(0.86);
  }

  60% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
  }
}

/* PLACED 3D LETTER TILE */
.cell.on {
  color: #f5faff;
  background: linear-gradient(166deg, rgba(168, 212, 248, 0.32) 0%, rgba(58, 96, 138, 0.42) 55%, rgba(34, 62, 94, 0.62) 100%);
  border: 1px solid rgba(190, 226, 255, 0.32);
  border-top-color: rgba(235, 248, 255, 0.55);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.34),
    inset 0 -2px 4px rgba(8, 20, 36, 0.4),
    0 var(--tile-depth) 0 #162a42,
    0 8px 14px rgba(2, 8, 18, 0.52);
  text-shadow: 0 2px 3px rgba(4, 14, 28, 0.72);
  transform: translateY(-2px);
}

/* HIGHLIGHTED VALID WORDS — UNMISTAKABLE 3D ELEVATED BLOCKS */
.cell.wh,
.cell.wv,
.cell.wb {
  color: #ffffff;
  font-weight: 900;
  transform: translateY(-3px);
  animation: word-glow 1.85s ease-in-out infinite;
}

/* Horizontal Word — Forest Emerald 3D */
.cell.wh {
  background: linear-gradient(165deg, #4ce6a6 0%, #1db579 56%, #108557 100%);
  border: 1px solid rgba(200, 255, 232, 0.72);
  border-top-color: rgba(240, 255, 248, 0.92);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.55),
    0 var(--tile-depth) 0 #095738,
    0 10px 18px rgba(2, 10, 20, 0.62);
  text-shadow: 0 2px 3px rgba(5, 42, 26, 0.75);
}

/* Vertical Word — Dropdle Ocean Blue 3D */
.cell.wv {
  background: linear-gradient(165deg, #74cbf7 0%, #2b8fd9 56%, #1668ab 100%);
  border: 1px solid rgba(204, 240, 255, 0.74);
  border-top-color: rgba(242, 251, 255, 0.92);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.55),
    0 var(--tile-depth) 0 #0d4575,
    0 10px 18px rgba(2, 10, 20, 0.62);
  text-shadow: 0 2px 3px rgba(7, 34, 62, 0.75);
}

/* Cross / Combo Word — Sunlit Amber-Coral 3D */
.cell.wb {
  background: linear-gradient(165deg, #ffd17a 0%, #f08a38 56%, #c85818 100%);
  border: 1px solid rgba(255, 232, 188, 0.78);
  border-top-color: rgba(255, 248, 228, 0.95);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.62),
    0 var(--tile-depth) 0 #7a2f08,
    0 10px 20px rgba(2, 10, 20, 0.65);
  text-shadow: 0 2px 3px rgba(68, 24, 4, 0.76);
}

@keyframes word-glow {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.13);
  }
}

/* JOKER TILE (3D Sunlit Gold-Pearl — haute spécificité) */
.joker-tile,
.cell.on.joker-tile,
.qt.q0.joker-tile,
.qt.q1.joker-tile,
.qt.q2.joker-tile,
.qt.q3.joker-tile,
.qt.q4.joker-tile,
.ghost.joker-tile {
  color: #1f1404;
  background: linear-gradient(148deg, #fff5c4 0%, #f7cb4f 52%, #d48917 100%);
  border: 1px solid rgba(255, 248, 212, 0.85);
  border-top-color: #ffffff;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.8),
    0 var(--tile-depth) 0 #804d06,
    0 10px 18px rgba(2, 8, 18, 0.58);
  text-shadow: 0 1px 0 rgba(255, 250, 224, 0.7);
}

.qt.q0.joker-tile,
.qt.q1.joker-tile,
.qt.q2.joker-tile,
.qt.q3.joker-tile,
.qt.q4.joker-tile {
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.75), 0 4px 0 #804d06, 0 6px 12px rgba(2, 8, 18, 0.5);
}

.cell.on.joker-tile.wh {
  box-shadow:
    inset 0 0 0 3px #2ec98a,
    inset 0 2px 2px rgba(255, 255, 255, 0.75),
    0 var(--tile-depth) 0 #095738,
    0 10px 18px rgba(2, 10, 20, 0.65);
}

.cell.on.joker-tile.wv {
  box-shadow:
    inset 0 0 0 3px #4da8e8,
    inset 0 2px 2px rgba(255, 255, 255, 0.75),
    0 var(--tile-depth) 0 #0d4575,
    0 10px 18px rgba(2, 10, 20, 0.65);
}

.cell.on.joker-tile.wb {
  box-shadow:
    inset 0 0 0 3px #f08a38,
    inset 0 2px 2px rgba(255, 255, 255, 0.75),
    0 var(--tile-depth) 0 #7a2f08,
    0 10px 20px rgba(2, 10, 20, 0.68);
}

/* RED BRICK TILE — SCULPTED 3D CRIMSON MASONRY BLOCK */
.brick-tile,
.cell.on.brick-tile,
.qt.q0.brick-tile,
.qt.q1.brick-tile,
.qt.q2.brick-tile,
.qt.q3.brick-tile,
.qt.q4.brick-tile,
.ghost.brick-tile {
  color: transparent !important;
  background:
    linear-gradient(168deg, rgba(255, 200, 195, 0.34) 0%, rgba(255, 255, 255, 0) 40%, rgba(36, 4, 8, 0.36) 100%) 0 0 / 100% 100% no-repeat,
    linear-gradient(90deg, transparent 46%, rgba(66, 8, 13, 0.65) 46%, rgba(66, 8, 13, 0.65) 54%, transparent 54%) 0 0 / 100% 50% no-repeat,
    linear-gradient(90deg, transparent 22%, rgba(66, 8, 13, 0.55) 22%, rgba(66, 8, 13, 0.55) 28%, transparent 28%, transparent 72%, rgba(66, 8, 13, 0.55) 72%, rgba(66, 8, 13, 0.55) 78%, transparent 78%) 0 100% / 100% 50% no-repeat,
    linear-gradient(0deg, transparent 45%, rgba(66, 8, 13, 0.72) 45%, rgba(66, 8, 13, 0.72) 55%, transparent 55%) 0 0 / 100% 100% no-repeat,
    linear-gradient(165deg, #ee4b50 0%, #c4232c 55%, #8f141c 100%);
  border: 1px solid #f47276;
  border-top-color: #ffadaf;
  box-shadow:
    inset 0 2px 1px rgba(255, 222, 222, 0.48),
    inset 0 -2px 4px rgba(52, 6, 10, 0.58),
    0 var(--tile-depth) 0 var(--crimson-deep),
    0 8px 15px rgba(2, 8, 18, 0.62);
  text-shadow: none !important;
}

.qt.q0.brick-tile,
.qt.q1.brick-tile,
.qt.q2.brick-tile,
.qt.q3.brick-tile,
.qt.q4.brick-tile {
  box-shadow:
    inset 0 2px 1px rgba(255, 220, 220, 0.45),
    0 4px 0 var(--crimson-deep),
    0 6px 12px rgba(2, 8, 18, 0.55);
}

.cell.brick-tile[data-mult]::after {
  display: none;
}

.cell.on.brick-tile.brick-targeted {
  transform: translateY(-4px) scale(1.04);
  border-color: #ffd166;
  box-shadow:
    inset 0 0 0 2.5px #ffd166,
    0 var(--tile-depth) 0 #7a171c,
    0 12px 20px rgba(2, 8, 18, 0.72);
  animation: brick-tremble 0.28s linear infinite;
  z-index: 8;
}

@keyframes brick-tremble {

  0%,
  100% {
    transform: translateY(-4px) scale(1.04) rotate(0deg);
  }

  25% {
    transform: translateY(-4px) scale(1.04) rotate(-2.2deg);
  }

  75% {
    transform: translateY(-4px) scale(1.04) rotate(2.2deg);
  }
}

/* INVALID CROSS-WORD WARNING */
.cell.invalid-warn {
  border-color: rgba(251, 191, 36, 0.95) !important;
  box-shadow:
    inset 0 0 0 2.5px rgba(245, 158, 11, 0.92),
    inset 0 2px 2px rgba(255, 255, 255, 0.4),
    0 var(--tile-depth) 0 #78350f,
    0 10px 18px rgba(2, 8, 18, 0.65) !important;
}

/* HOVERED WORD GROUP LIFT */
.cell.group-hovered {
  filter: brightness(1.16) saturate(1.1);
  transform: translateY(-5px) scale(1.05);
  z-index: 10;
}

.cell.group-hovered:not(.invalid-warn) {
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.75),
    0 7px 0 rgba(7, 22, 38, 0.8),
    0 14px 24px rgba(2, 8, 18, 0.72);
}

/* LANDING PREVIEW GHOST CELL */
.cell.pv {
  background: linear-gradient(165deg, rgba(247, 201, 72, 0.24), rgba(247, 201, 72, 0.1));
  border: 1.5px dashed rgba(247, 201, 72, 0.68);
  color: rgba(255, 232, 150, 0.95);
  transform: translateY(0);
}

.cell.pv.brick-tile {
  background: linear-gradient(165deg, rgba(238, 75, 80, 0.52), rgba(143, 20, 28, 0.46));
  border: 1.5px dashed #ff9c9e;
  box-shadow: inset 0 2px 2px rgba(255, 210, 210, 0.25);
  color: transparent !important;
}

.cell.pv.joker-tile {
  background: linear-gradient(148deg, rgba(255, 245, 196, 0.52), rgba(212, 137, 23, 0.45));
  border: 1.5px dashed #ffe89e;
  box-shadow: inset 0 2px 2px rgba(255, 248, 212, 0.25);
  color: #fff8dc;
}

/* DELETE MODE (HAMMER ACTIVE) */
body.delete-mode .cell.filled {
  border-color: #ff6b6b !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 92, 92, 0.65),
    0 var(--tile-depth) 0 #661116,
    0 8px 16px rgba(2, 8, 18, 0.6) !important;
  animation: none !important;
}

body.delete-mode .cell.filled.hammer-hover {
  transform: translateY(-5px) scale(1.06);
  filter: brightness(1.2);
  z-index: 12;
  box-shadow:
    inset 0 0 0 2.5px #ffd166,
    0 7px 0 #590c11,
    0 14px 24px rgba(2, 8, 18, 0.75) !important;
}

/* HINT / PREVIEW BAR */
#hint {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--tx-soft);
  background: var(--surface-well);
  border: 1px solid rgba(155, 210, 255, 0.1);
  border-radius: 12px;
  padding: 9px 12px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  font-weight: 700;
  line-height: 1.38;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

#hint.active-preview {
  background: linear-gradient(165deg, rgba(245, 166, 35, 0.16), rgba(20, 34, 54, 0.86));
  border-color: rgba(247, 201, 72, 0.52);
  color: var(--tx);
  box-shadow: inset 0 1px 0 rgba(255, 240, 185, 0.22), 0 6px 14px rgba(2, 8, 18, 0.45);
}

#hint.delete-hint {
  background: linear-gradient(165deg, rgba(229, 72, 77, 0.22), rgba(32, 14, 22, 0.82));
  border-color: rgba(255, 107, 107, 0.55);
  color: #ffe3e3;
}

#hint.grid-full-hint {
  background: linear-gradient(165deg, rgba(245, 158, 11, 0.28), rgba(45, 24, 12, 0.88));
  border-color: rgba(251, 191, 36, 0.78);
  color: #fff3cc;
  box-shadow: inset 0 1px 0 rgba(255, 240, 185, 0.25), 0 0 16px rgba(245, 158, 11, 0.25);
}

#hint .h-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#hint b {
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 800;
}

#hint .h-total {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 10px;
}

/* FALLING GHOST & TILE ANIMATIONS */
.ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  border-radius: var(--tile-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  background: linear-gradient(165deg, #ffe580 0%, #f5be36 58%, #df931c 100%);
  color: #1c1204;
  border: 1px solid rgba(255, 245, 198, 0.7);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.65),
    0 5px 0 #9c610b,
    0 12px 24px rgba(0, 0, 0, 0.45);
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.32, 0, 0.67, 0.2);
  animation-name: ghostFall;
}

@keyframes ghostFall {
  from {
    transform: translateY(var(--ghost-from, 0px)) scale(1.04);
  }

  to {
    transform: translateY(-2px) scale(1);
  }
}

.cell.land {
  animation: land 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes land {
  0% {
    transform: translateY(-2px) scale(1);
  }

  38% {
    transform: translateY(1px) scaleX(1.1) scaleY(0.88);
  }

  100% {
    transform: translateY(-2px) scale(1);
  }
}

.cell.cfalling {
  animation: cfall 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cfall {
  from {
    transform: translateY(calc(var(--fall-dist, 1) * -108%));
  }

  to {
    transform: translateY(-2px);
  }
}

.cell.blast {
  animation: blast 0.26s cubic-bezier(0.32, 0, 0.67, 0) forwards !important;
  pointer-events: none;
}

@keyframes blast {
  0% {
    transform: translateY(-3px) scale(1);
    opacity: 1;
  }

  30% {
    transform: translateY(-5px) scale(1.18);
    filter: brightness(1.55);
    opacity: 1;
  }

  100% {
    transform: translateY(-3px) scale(0.15);
    opacity: 0;
  }
}

.shake {
  animation: shk 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97) !important;
}

@keyframes shk {

  0%,
  100% {
    transform: translateX(0);
  }

  18% {
    transform: translateX(-6px);
  }

  36% {
    transform: translateX(6px);
  }

  54% {
    transform: translateX(-4px);
  }

  72% {
    transform: translateX(4px);
  }

  88% {
    transform: translateX(-2px);
  }
}

/* WORD LOG SIDEBAR */
#wlog {
  width: 100%;
  max-width: 452px;
  padding: 16px;
}

#wlog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 2px;
}

#wlog-lbl {
  font-size: 0.78rem;
  color: var(--tx-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

#wlog-max-combo {
  font-size: 0.74rem;
  color: #ffe08a;
  font-family: var(--font-display);
  font-weight: 800;
  cursor: default;
  padding: 4px 9px;
  background: rgba(245, 158, 11, 0.18);
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.42);
  transition: transform 0.18s ease, background 0.18s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#wlog-max-combo:hover {
  background: rgba(245, 158, 11, 0.3);
  transform: scale(1.04);
}

#wlog-empty {
  font-size: 0.86rem;
  color: var(--tx-muted);
  text-align: center;
  padding: 14px 8px;
  line-height: 1.5;
}

body.combo-hover .wc {
  opacity: 0.32;
  filter: grayscale(0.75);
}

body.combo-hover .wc.combo-active {
  opacity: 1;
  filter: grayscale(0);
  transform: translateY(-2px) scale(1.04);
  border-color: var(--gold);
  box-shadow: 0 4px 0 #784208, 0 8px 16px rgba(2, 8, 18, 0.6);
  background: rgba(245, 158, 11, 0.24);
}

#wlog-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  width: 100%;
}

.wc {
  font-family: var(--font-display);
  font-size: 0.84rem;
  padding: 6px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  background: linear-gradient(165deg, rgba(165, 212, 250, 0.15), rgba(22, 42, 68, 0.48));
  border: 1px solid rgba(165, 212, 250, 0.18);
  border-top-color: rgba(220, 242, 255, 0.32);
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(5, 12, 22, 0.72), 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.14s ease, background 0.18s ease, opacity 0.2s ease, filter 0.2s ease, box-shadow 0.18s ease;
}

.wc:hover:not(.combo-active) {
  background: linear-gradient(165deg, rgba(165, 212, 250, 0.26), rgba(34, 64, 102, 0.58));
  transform: translateY(-2px);
  opacity: 1 !important;
  filter: grayscale(0) !important;
}

.wc span:first-child {
  color: var(--tx);
}

.wc .p {
  color: var(--gold);
  font-weight: 800;
}

.wc-word-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.w-mult {
  font-size: 0.62rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.25);
  color: #ffe08a;
  font-family: var(--font-display);
  font-weight: 800;
}

.w-mult:not([data-mult="2"]) {
  background: rgba(240, 138, 56, 0.34);
  color: #fff0db;
}

/* PARTICLES & FLOATING TEXT */
.fp {
  position: fixed;
  pointer-events: none;
  z-index: 70;
  width: 7px;
  height: 7px;
  border-radius: 3px;
  animation: pf var(--d) cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.fp.brick-shard {
  width: 9px;
  height: 6px;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

@keyframes pf {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0.35) rotate(var(--rot, 160deg));
  }
}

.fs {
  position: fixed;
  pointer-events: none;
  z-index: 75;
  font-family: var(--font-display);
  font-weight: 900;
  transform: translateX(-50%);
  text-shadow: 0 3px 0 rgba(4, 12, 24, 0.9), 0 6px 16px rgba(0, 0, 0, 0.85);
  animation: fu 0.88s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fu {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.78);
  }

  22% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1.1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -62px) scale(0.92);
  }
}

.epic-text {
  position: fixed;
  pointer-events: none;
  z-index: 80;
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: #ffffff;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-shadow: 0 4px 0 #142238, 0 8px 20px rgba(0, 0, 0, 0.88);
  animation: epic-pop 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes epic-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.35);
  }

  22% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.12);
  }

  78% {
    opacity: 1;
    transform: translate(-50%, -74%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -98%) scale(0.86);
  }
}

/* LOADING */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 170px;
  gap: 12px;
  color: var(--tx-soft);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.spin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(155, 210, 255, 0.18);
  border-top-color: var(--ocean);
  animation: spin 0.85s linear infinite;
}

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

/* MODALS (GAME OVER, RULES & CONFIRM) */
#go,
#rules,
#dd-confirm {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1010;
  background: rgba(4, 10, 18, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#go.on,
#rules.on,
#dd-confirm.on {
  display: flex;
  animation: fi 0.22s ease;
}

#dd-confirm-card {
  max-width: 390px;
  width: 100%;
  border-radius: 22px;
  padding: 28px 24px 24px;
  text-align: center;
  animation: ddConfirmPop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ddConfirmPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dd-warn-wrap {
  width: 74px;
  height: 74px;
  margin: 0 auto 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, rgba(247, 201, 72, 0.22), rgba(184, 116, 14, 0.28));
  border: 1px solid rgba(255, 224, 130, 0.42);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.3),
    0 5px 0 rgba(8, 16, 28, 0.78),
    0 12px 24px rgba(2, 8, 18, 0.55);
}

.dd-warn-svg {
  width: 48px;
  height: 48px;
  overflow: visible;
}

.dd-warn-tri {
  fill: rgba(247, 201, 72, 0);
  stroke: var(--gold);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 170;
  stroke-dashoffset: 170;
}

.dd-warn-stem {
  fill: none;
  stroke: #fff4cc;
  stroke-width: 3.8;
  stroke-linecap: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
}

.dd-warn-dot {
  fill: #fff4cc;
  opacity: 0;
  transform-origin: 32px 46.5px;
  transform: scale(0);
}

#dd-confirm.on .dd-warn-svg {
  animation: ddWarnSettle 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.68s 1;
}

#dd-confirm.on .dd-warn-tri {
  animation:
    ddDrawTri 0.52s cubic-bezier(0.22, 1, 0.36, 1) 0.08s forwards,
    ddFillTri 0.32s ease 0.46s forwards;
}

#dd-confirm.on .dd-warn-stem {
  animation: ddDrawStem 0.26s cubic-bezier(0.22, 1, 0.36, 1) 0.38s forwards;
}

#dd-confirm.on .dd-warn-dot {
  animation: ddPopDot 0.3s cubic-bezier(0.18, 1.35, 0.45, 1) 0.56s forwards;
}

@keyframes ddDrawTri {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes ddFillTri {
  to {
    fill: rgba(247, 201, 72, 0.16);
  }
}

@keyframes ddDrawStem {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes ddPopDot {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  65% {
    opacity: 1;
    transform: scale(1.3);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ddWarnSettle {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  28% {
    transform: rotate(-6deg) scale(1.06);
  }
  60% {
    transform: rotate(5deg) scale(1.04);
  }
}

.dd-confirm-t {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--tx);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.dd-confirm-m {
  font-size: 0.92rem;
  color: var(--tx-soft);
  line-height: 1.5;
  margin: 0 0 22px;
}

.dd-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dd-btn-cancel,
.dd-btn-ok {
  border-radius: 12px;
  padding: 12px 10px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease, background 0.18s ease;
}

.dd-btn-cancel {
  background: linear-gradient(165deg, rgba(165, 212, 250, 0.14), rgba(24, 44, 70, 0.56));
  color: var(--tx-soft);
  border: 1px solid rgba(165, 212, 250, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 4px 0 rgba(5, 12, 22, 0.8);
}

.dd-btn-cancel:hover {
  background: linear-gradient(165deg, rgba(165, 212, 250, 0.24), rgba(34, 62, 98, 0.66));
  color: #fff;
  transform: translateY(-1px);
}

.dd-btn-cancel:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(5, 12, 22, 0.8);
}

.dd-btn-ok {
  background: linear-gradient(165deg, #ffe580 0%, #f5be36 56%, #de9319 100%);
  color: #1c1204;
  border: 1px solid rgba(255, 248, 215, 0.78);
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.65), 0 4px 0 #945c0a, 0 10px 18px rgba(2, 8, 18, 0.5);
}

.dd-btn-ok:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.dd-btn-ok:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4), 0 1px 0 #945c0a;
}

@keyframes fi {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

#go-card,
.m {
  max-width: 420px;
  width: 100%;
  border-radius: 22px;
  padding: 28px 22px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#go-card {
  text-align: center;
}

.m {
  text-align: left;
}

.go-badge {
  width: 60px;
  height: 60px;
  margin: 0 auto 10px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, rgba(247, 201, 72, 0.28), rgba(168, 92, 16, 0.35));
  border: 1px solid rgba(255, 232, 148, 0.45);
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.35), 0 4px 0 rgba(8, 16, 28, 0.75);
  font-size: 1.9rem;
}

.go-t {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--gold);
  letter-spacing: 0.02em;
  font-weight: 900;
  text-transform: uppercase;
}

.go-m {
  font-size: 0.9rem;
  color: var(--tx-soft);
  margin-top: 6px;
  font-weight: 500;
  display: none;
  line-height: 1.45;
  padding: 0 8px;
}

.go-s {
  font-family: var(--font-display);
  font-size: 3.4rem;
  color: var(--tx);
  line-height: 1;
  margin: 14px 0 12px;
  font-weight: 900;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.go-s span {
  font-size: 1.15rem;
  color: var(--tx-muted);
  font-family: var(--font-main);
  font-weight: 600;
}

.go-best-badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffe89e;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.45);
}

.go-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(155, 210, 255, 0.14);
  border-bottom: 1px solid rgba(155, 210, 255, 0.14);
  padding: 13px 4px;
  margin-bottom: 18px;
  gap: 8px;
}

.go-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

.go-stat-lbl {
  font-size: 0.74rem;
  color: var(--tx-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  white-space: nowrap;
}

.go-stat-val {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--tx);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.leaderboard-card {
  padding: 6px 2px 4px;
  margin-top: 6px;
  text-align: left;
}

.leaderboard-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--tx);
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 11px;
  border-bottom: 1px solid rgba(155, 210, 255, 0.1);
}

.lb-row:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
}

.lb-row.lb-me {
  background: rgba(77, 168, 232, 0.18);
  border: 1px solid rgba(77, 168, 232, 0.4);
}

.lb-rank {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.rank-1 {
  color: #ffd700;
}

.rank-2 {
  color: #d1d9e6;
}

.rank-3 {
  color: #e29558;
}

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(165, 215, 255, 0.28);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--tx);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-stats {
  font-size: 0.78rem;
  color: var(--tx-muted);
  margin: 2px 0 0;
}

.lb-empty {
  text-align: center;
  font-size: 0.84rem;
  color: var(--tx-muted);
  padding: 10px 4px 14px;
}

.lb-sep {
  text-align: center;
  font-size: 0.75rem;
  color: var(--tx-muted);
  letter-spacing: 3px;
  margin: 2px 0 6px;
}

.full-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(165deg, rgba(165, 212, 250, 0.16), rgba(26, 48, 76, 0.55));
  color: var(--tx);
  border: 1px solid rgba(165, 212, 250, 0.25);
  border-radius: 10px;
  padding: 10px 0;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 3px 0 rgba(5, 12, 22, 0.75);
  transition: transform 0.12s ease, background 0.18s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.full-btn:hover {
  background: linear-gradient(165deg, rgba(165, 212, 250, 0.25), rgba(36, 66, 102, 0.65));
  color: #fff;
}

.full-btn:active {
  transform: translateY(2px);
}

.btn-a,
.mok {
  background: linear-gradient(165deg, #ffe580 0%, #f5be36 56%, #de9319 100%);
  color: #1c1204;
  border: 1px solid rgba(255, 248, 215, 0.75);
  font-weight: 800;
  border-radius: 13px;
  padding: 13px 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  width: 100%;
  margin-top: 14px;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.65),
    0 5px 0 #945c0a,
    0 12px 22px rgba(2, 8, 18, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
  text-transform: uppercase;
}

.btn-a:hover,
.mok:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-a:active,
.mok:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4), 0 1px 0 #945c0a;
}

.m h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--tx);
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  text-align: center;
  font-weight: 800;
}

.rb {
  display: flex;
  gap: 12px;
  margin-bottom: 13px;
  align-items: flex-start;
}

.ri {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(86, 195, 255, 0.14);
  border: 1px solid rgba(126, 212, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.rt {
  font-size: 0.88rem;
  color: var(--tx-soft);
  line-height: 1.55;
}

.rt strong {
  color: var(--tx);
  font-weight: 700;
}

/* TOAST */
#toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  padding: 11px 20px;
  border-radius: 13px;
  max-width: calc(100vw - 32px);
  text-align: center;
  color: var(--tx);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  font-weight: 600;
  background: var(--surface-glass-strong);
  border: 1px solid rgba(165, 215, 255, 0.28);
  border-top-color: rgba(220, 244, 255, 0.45);
  box-shadow: 0 5px 0 rgba(4, 10, 20, 0.85), 0 14px 30px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 1020;
}

#toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* DESKTOP SPLIT-SCREEN */
@media (min-width: 920px) {
  #app {
    max-width: 1060px;
  }

  #game-layout {
    display: grid;
    grid-template-columns: 1fr 452px 1fr;
    gap: 22px;
    align-items: flex-start;
    width: 100%;
  }

  .game-core {
    grid-column: 2;
    margin: 0 auto;
    width: 100%;
  }

  #wlog {
    grid-column: 3;
    width: 268px;
    max-width: 268px;
    background: linear-gradient(168deg, rgba(16, 32, 52, 0.62) 0%, rgba(9, 18, 32, 0.72) 100%);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
}

@media (max-width: 992px) {
  body.dropdle-body {
    padding: 14px 12px 36px !important;
  }
}

@media (max-width: 500px),
(max-height: 760px) {
  body.dropdle-body {
    padding: 10px 10px 32px !important;
  }

  #app {
    gap: 10px;
  }

  .main-logo {
    max-width: 200px;
  }

  .board-panel {
    padding: 13px;
    gap: 12px;
  }

  #grid-area {
    padding: 7px 6px 11px;
  }

  #grid,
  #col-btns {
    gap: 5px;
  }

  #col-btns {
    padding: 0 6px;
  }

  .cb {
    height: 36px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .icon-btn svg {
    width: 17px;
    height: 17px;
  }

  #delete-btn .hammer-svg {
    width: 16px;
    height: 16px;
  }

  #hdr-r {
    gap: 5px;
  }

  .qt.q0 {
    width: 40px;
    height: 44px;
    font-size: 1.35rem;
  }

  .qt.q1 {
    width: 29px;
    height: 33px;
    font-size: 0.95rem;
  }

  .qt.q2 {
    width: 25px;
    height: 29px;
    font-size: 0.85rem;
  }

  .qt.q3,
  .qt.q4 {
    width: 21px;
    height: 25px;
    font-size: 0.72rem;
  }

  :root {
    --tile-depth: 4px;
    --tile-radius: 9px;
  }

  #go-card,
  .m {
    padding: 22px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {

  #app *,
  #app *::before,
  #app *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}