/* Главная: первый экран, мои пазлы, галерея, преимущества, окно старта */

/* ---------- первый экран ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 48px;
  padding-top: 72px;
  padding-bottom: 56px;
}
.pill {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.hero h1 {
  margin: 22px 0 18px;
  font-size: clamp(40px, 6vw, 76px);
  line-height: .98;
  letter-spacing: -0.045em;
  font-weight: 800;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { margin: 0; max-width: 540px; font-size: 18px; line-height: 1.5; color: #b9b9c4; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 34px; color: var(--muted); font-size: 14px; }
.hero-meta b { color: var(--text); font-weight: 700; }

.hero-art {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 28px;
  background:
    radial-gradient(120% 90% at 70% 10%, var(--accent-soft), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
#heroCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- блоки ---------- */


/* ---------- мои пазлы ---------- */

.mine { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.mine-card {
  flex: none;
  width: 240px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  scroll-snap-align: start;
  transition: border-color .15s, transform .15s;
}
.mine-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.mine-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.mystery-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 2;
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 14px, var(--surface-3) 14px 28px);
  color: var(--accent);
  font-size: 48px;
  font-weight: 800;
}
.mine-card .info { padding: 12px 14px 14px; }
.mine-card .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 500; }
.mine-card .row b { color: var(--text); }
.bar { height: 5px; margin-top: 10px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.done-tag { color: var(--accent) !important; }

/* ---------- галерея ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface-2); }
.card .cap { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 11px 14px 13px; }
.card .cap b { font-weight: 600; }
.card .cap span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  padding: 20px;
  text-align: center;
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
}
.upload-card span { font-size: 13px; max-width: 200px; }
.upload-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  margin-bottom: 4px;
}
.upload-icon svg { width: 24px; height: 24px; }
.skeleton { aspect-ratio: 3 / 2.45; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- преимущества ---------- */

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.feature h3 { margin: 16px 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.feature p { margin: 0; color: var(--muted); line-height: 1.5; }
.f-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.f-icon svg { width: 22px; height: 22px; }


/* ---------- окно старта ---------- */

.sheet {
  padding: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
.start { width: min(980px, calc(100vw - 32px)); height: min(720px, calc(100vh - 32px)); }
.start[open] { display: grid; grid-template-columns: 1.2fr 1fr; animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.start-img { position: relative; background: #060608; min-height: 300px; overflow: hidden; }
.start-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#cropCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#cropCanvas.editing { cursor: move; }
.crop-bar { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 6px; }
.crop-bar .btn { background: rgba(20, 20, 24, .85); backdrop-filter: blur(10px); }
.crop-bar .btn.primary { background: var(--accent); }
.start-body { padding: 26px 26px 22px; display: flex; flex-direction: column; overflow-y: auto; }
.start-body h3 { margin: 0; font-size: 26px; letter-spacing: -0.02em; padding-right: 40px; }
.start-body > .muted { margin: 4px 0 0; font-size: 14px; }

.section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.limit { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.limit a, #playersLimit a { color: var(--accent); font-weight: 600; text-decoration: none; }

.pieces-row { display: flex; align-items: center; gap: 12px; }
.pieces-row input[type=range] {
  flex: 1;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--surface-3) var(--fill, 0%));
  outline: none;
}
.pieces-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  cursor: pointer;
}
.pieces-row input[type=range]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  cursor: pointer;
}
.num {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}
.num:focus-within { border-color: var(--accent); }
.num svg { width: 18px; height: 18px; flex: none; }
.num input { width: 58px; border: 0; background: none; outline: none; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.range-ends { display: flex; justify-content: space-between; margin: 6px 102px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.result { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.result b { color: var(--text); }
.result span { display: block; margin-top: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.result .q-отличное { color: #6ee7a0; }
.result .q-хорошее { color: #c6ff3d; }
.result .q-среднее { color: #ffd23d; }
.result .q-низкое { color: var(--danger); }

.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg3 button { height: 38px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; cursor: pointer; }
.seg3 button.on { background: var(--accent); color: var(--accent-ink); }
.hint { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

.eta {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.eta:empty { display: none; }
.eta svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent); }
.eta b { color: var(--text); }

.diff-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.diff-list li { display: flex; align-items: center; gap: 10px; }
.diff-list i { flex: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; }
.diff-list i svg { width: 13px; height: 13px; }
.diff-list li.on i { background: rgba(110, 231, 160, .15); color: #6ee7a0; }
.diff-list li.off { color: var(--muted); }
.diff-list li.off i { background: var(--surface-3); color: var(--muted); }
.diff-list li.harder i { background: var(--accent-soft); color: var(--accent); }
.diff-list li.harder { color: var(--text); font-weight: 600; }

.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.check input:disabled + span { opacity: .55; }
.check b { display: block; font-weight: 600; }
.check small { color: var(--muted); font-size: 13px; }
.start .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.start .field b { font-weight: 600; }
.start .field small { color: var(--muted); font-size: 13px; }
.start .field .input { margin-top: 4px; width: 100%; color: var(--text); }
.pw { position: relative; display: block; }
.pw button {
  position: absolute;
  right: 6px;
  top: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}
.pw button svg { width: 18px; height: 18px; }
#startBtn { margin-top: 22px; flex: none; }
.small-note { margin: 12px 0 0; font-size: 12px; }
.close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  cursor: pointer;
}
.close svg { width: 18px; height: 18px; }

.drop-hint {
  position: fixed;
  inset: 12px;
  z-index: 60;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 24px;
  background: rgba(11, 11, 14, .85);
  font-size: 24px;
  font-weight: 700;
  pointer-events: none;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; gap: 32px; }
  .features { grid-template-columns: 1fr 1fr; }
  .start { height: calc(100vh - 32px); }
  .start[open] { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .start-img { min-height: 0; aspect-ratio: 16 / 10; }
}
@media (max-width: 600px) {
  .topbar nav .ghost { display: none; }
  .features { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card .cap { flex-direction: column; gap: 2px; padding: 9px 11px 11px; }
  .upload-card { min-height: 0; }
  .upload-card span { display: none; }
  .block-head h2 { font-size: 26px; }
  .start-body { padding: 20px; }
}
