﻿:root {
  --bg: #000000;
  --line: #ffffff;
  --text: #ffffff;
  --muted: #9aa0a8;
  --accent: #ff8fb3;
  --red: #ff7a93;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 16px 10px 12px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overflow-x: hidden;
}
.wrap { width: min(560px, 100%); margin: 0 auto; }
h1 {
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: 0.28em;
  font-size: clamp(1.45rem, 6.5vw, 2rem);
  font-weight: 500;
  text-transform: uppercase;
}
.levels { display: flex; gap: 6px; margin: 10px 0 0; }
.levels[hidden] { display: none; }
.lvl {
  appearance: none; flex: 1 1 0; min-width: 0; height: 34px; padding: 0 4px;
  border: 1px solid var(--line); border-radius: 11px;
  background: #000; color: #fff; font: 600 0.78rem "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.03em; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lvl.on { border-color: var(--accent); color: var(--accent); }
.lvl:active { background: var(--accent); border-color: var(--accent); color: #1a0810; }
.hud {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 8px 0; min-height: 30px; color: var(--muted); font-size: 0.78rem;
  font-variant-numeric: tabular-nums; letter-spacing: 0.03em;
}
.hud b { color: #fff; font-weight: 700; }
.hud .finish {
  appearance: none; height: 28px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #1a0810; font: 700 0.78rem "Segoe UI", system-ui, sans-serif; cursor: pointer;
}
.hud .finish[hidden] { display: none; }

.table { position: relative; width: 100%; }
.slot {
  position: absolute; left: 0; top: 0;
  width: var(--cw); height: var(--ch);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: calc(var(--cw) * 0.12);
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.3);
  font: 700 calc(var(--cw) * 0.34) / 1 "Segoe UI", system-ui, sans-serif;
}
.slot.found { border-style: solid; border-color: rgba(255, 143, 179, 0.45); color: rgba(255, 143, 179, 0.5); }
.slot.cell, .slot.reserve { border-style: solid; border-color: rgba(255, 255, 255, 0.28); }
.slot.stock { cursor: pointer; }
.slot.hide { visibility: hidden; }
.slot .badge {
  position: absolute; left: 50%; bottom: calc(var(--cw) * 0.05); transform: translateX(-50%);
  z-index: 900; padding: 1px 6px; border-radius: 8px; background: var(--accent); color: #1a0810;
  font: 800 calc(var(--cw) * 0.17) / 1.3 "Segoe UI", system-ui, sans-serif; white-space: nowrap;
}
.slot .count {
  position: absolute; right: 2px; bottom: 2px; z-index: 900;
  font: 700 calc(var(--cw) * 0.18) / 1 "Segoe UI", system-ui, sans-serif; color: var(--muted);
}

.card {
  position: absolute; left: 0; top: 0;
  width: var(--cw); height: var(--ch);
  border-radius: calc(var(--cw) * 0.12);
  transition: transform 0.2s ease, opacity 0.35s ease 0.25s;
  will-change: transform;
  touch-action: none;
  cursor: pointer;
}
.card.drag { transition: none; }
.card.gone { opacity: 0; pointer-events: none; }
.card.shake { animation: shake 0.28s; }
@keyframes shake { 25% { margin-left: -4px; } 75% { margin-left: 4px; } }
.card .face, .card .back {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
}
.card .face {
  background: #101014; border: 1px solid rgb(225, 225, 230); color: #fff;
}
.card .face.red { color: var(--red); }
.card .back {
  border: 1px solid rgb(225, 225, 230);
  background:
    repeating-linear-gradient(45deg, rgba(255, 143, 179, 0.9) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(255, 143, 179, 0.55) 0 2px, #1a0810 2px 6px);
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.05) #000;
}
.card.down .face, .card:not(.down) .back { display: none; }
.card.hl .face { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.cr {
  position: absolute; top: calc(var(--cw) * 0.05); left: calc(var(--cw) * 0.07);
  font: 800 calc(var(--cw) * 0.33) / 1 "Segoe UI", system-ui, sans-serif; letter-spacing: -0.05em;
}
.cs {
  position: absolute; top: calc(var(--cw) * 0.05); right: calc(var(--cw) * 0.06);
  font: 400 calc(var(--cw) * 0.28) / 1 "Segoe UI Symbol", "Segoe UI", system-ui, sans-serif;
}
.cb {
  position: absolute; left: 0; right: 0; bottom: 9%; text-align: center;
  font: 400 calc(var(--cw) * 0.6) / 1 "Segoe UI Symbol", "Segoe UI", system-ui, sans-serif;
}
.cb.fc { font: 700 calc(var(--cw) * 0.5) / 1 "Segoe UI", system-ui, sans-serif; bottom: 14%; }

/* «Ассоциации» */
.face.item .it, .face.head .ht {
  position: absolute; top: calc(var(--cw) * 0.05); left: calc(var(--cw) * 0.06); right: calc(var(--cw) * 0.06);
  font: 700 calc(var(--cw) * 0.155) / 1.08 "Segoe UI", system-ui, sans-serif;
  text-align: center; overflow: hidden; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.face.item .ic {
  position: absolute; left: 0; right: 0; top: 36%; bottom: 6%;
  display: grid; place-items: center;
  font: 400 calc(var(--cw) * 0.48) / 1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", system-ui, sans-serif;
}
.face.item.pic .ic { top: 4%; bottom: 4%; }
.face.item .ic img.pic { width: calc(var(--cw) * 0.82); height: calc(var(--cw) * 0.82); object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.face.head {
  background: linear-gradient(160deg, #4a1830, #1a0810);
  border-color: var(--accent);
}
.face.head .ht {
  top: 0; bottom: 0; left: calc(var(--cw) * 0.04); right: calc(var(--cw) * 0.04);
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-transform: uppercase; letter-spacing: 0;
  font-size: calc(var(--cw) * 0.122); line-height: 1.15; overflow-wrap: anywhere; word-break: normal;
}

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); z-index: 30;
  padding: 9px 16px; border-radius: 12px; background: #1a1a1f; border: 1px solid rgba(255, 255, 255, 0.6);
  font-size: 0.85rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.overlay {
  display: none; position: fixed; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, 0.78); align-items: center; justify-content: center; padding: 20px; text-align: center;
}
.overlay.show { display: flex; }
.overlay .box { border: 1px solid var(--line); border-radius: 16px; background: #000; padding: 22px 20px; width: min(320px, 100%); }
.overlay h2 { margin: 0 0 8px; font-weight: 600; letter-spacing: 0.06em; }
.overlay p { margin: 0 0 16px; color: var(--muted); line-height: 1.4; }
.overlay button {
  appearance: none; border: 0; border-radius: 12px; padding: 11px 22px;
  font-weight: 700; cursor: pointer; background: var(--accent); color: #1a0810; font-size: 0.95rem;
}

button.sq-btn.sq-btn {
  appearance: none; flex: none; aspect-ratio: 1; width: 100%; height: auto; min-width: 0;
  padding: 0; margin: 0; border: 1px solid #ffffff; border-radius: 14px;
  background: #000; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
button.sq-btn.sq-btn:disabled { opacity: 0.45; cursor: default; }
button.sq-btn.sq-btn:active:not(:disabled) { background: #ff8fb3 !important; border-color: #ff8fb3 !important; color: #1a0810 !important; }
button.sq-btn.sq-btn svg { width: 52%; height: auto; display: block; margin: 0; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
button.sq-btn.sq-btn svg .solid, button.sq-btn.sq-btn svg .door { fill: currentColor; stroke: none; }
.sq-row, .bar.sq-row { display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap; }
.sq-row > button.sq-btn.sq-btn { width: calc((100% - 16px) / 3); height: 58px; aspect-ratio: auto; border-radius: 12px; padding: 0; flex: none; }
.sq-row > button.sq-btn.sq-btn svg { width: auto; height: 34px; }
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none; width: 0; height: 0; }
.tap-flash:not(:disabled) { background: #ff8fb3 !important; border-color: #ff8fb3 !important; color: #1a0810 !important; }

/* ---------- пасьянсы в стиле liquid glass: <body class="lg-game sol"> ---------- */
html:has(> body.sol), html body.lg-game.sol { overflow: hidden; }
html body.lg-game.sol { padding-left: 8px; padding-right: 8px; }
.sol .felt { padding: 8px; margin: 0; border-radius: 22px; }
.sol .felt.inspecting { z-index: 45; }
.sol .table { touch-action: none; }
.sol .slot {
  border: 1px dashed rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.sol .slot.found { border-style: solid; border-color: rgba(255, 143, 179, 0.5); background: rgba(255, 143, 179, 0.06); }
.sol .slot.cell, .sol .slot.reserve { border-style: solid; border-color: rgba(255, 255, 255, 0.22); }
.sol .card .face { background: #121018; border-color: rgba(235, 235, 245, 0.85); }
.sol .card { box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.7); }
.sol .card.drag { box-shadow: 0 14px 26px -8px rgba(0, 0, 0, 0.85); }
.sol #hud .txt b { margin: 0 2px; }
.sol .finish { color: #fff; cursor: pointer; background-color: rgba(255, 95, 158, 0.4); }
.sol .finish[hidden] { display: none !important; }
.sol .toast {
  bottom: calc(var(--lg-dock-space, 120px) + 10px); border: 0; border-radius: 22px; padding: 10px 18px; color: #fff;
  background: rgba(30, 24, 46, 0.72);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 14px 30px -10px rgba(0, 0, 0, 0.8);
}
