:root {
  --primary: #024acc;
  --primary-dark: #0040c2;
  --text: #121826;
  --muted: #667085;
  --bg: #fbf4ef;
  --bg-alt: #fff8f3;
  --line: #e7e0db;
  --on-primary: #fbf4ef;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--sans); overflow-x: clip; }
a { color: inherit; }
.muted { color: var(--muted); }

.top, main, .bottom { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.top { display: flex; align-items: center; justify-content: space-between; height: 88px; position: relative; z-index: 2; }
.logo { font: 600 40px/1 var(--serif); color: var(--primary); text-decoration: none; letter-spacing: 0.01em; }
.top-link { border: 1px solid var(--primary); color: var(--primary); border-radius: 10px; padding: 10px 22px; text-decoration: none; font-size: 15px; }
.top-link:hover { background: var(--primary); color: var(--on-primary); }
.top-nav { display: flex; gap: 10px; }
.top-link.ghost { border-color: transparent; }
.top-link.ghost:hover { background: transparent; color: var(--primary); border-color: var(--primary); }

/* Главный экран */
.hero { position: relative; padding: 48px 0 56px; }
.blob {
  position: absolute; right: -140px; top: -120px; width: 520px; height: 520px; border-radius: 44% 56% 62% 38% / 46% 38% 62% 54%;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.7), transparent 34%),
    radial-gradient(circle at 74% 72%, #ff5f9e, transparent 52%),
    radial-gradient(circle at 78% 30%, #ff9a62, transparent 48%),
    radial-gradient(circle at 26% 72%, #1f4dff, transparent 58%),
    radial-gradient(circle at 50% 50%, #6c86ff, #3a5cf0 70%);
  filter: blur(18px) saturate(1.1); opacity: 0.9; z-index: 0;
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: rotate(18deg) translate(-24px, 18px); border-radius: 58% 42% 40% 60% / 52% 60% 40% 48%; } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }
.eyebrow { position: relative; z-index: 1; color: var(--primary); font-size: 14px; margin: 0 0 8px; }
h1 { position: relative; z-index: 1; font: 500 clamp(64px, 11vw, 132px)/0.95 var(--serif); color: var(--primary); margin: 0 0 28px; letter-spacing: -0.01em; }
.hero-sub { position: relative; z-index: 1; display: grid; grid-template-columns: 56px minmax(0, 460px); gap: 20px; align-items: start; }
.stroke { display: block; width: 2px; height: 96px; background: var(--primary); transform: rotate(24deg); transform-origin: top left; margin: 6px 0 0 36px; }
.hero-sub p { font: 400 21px/1.45 var(--serif); margin: 0; }

/* Игра */
.game { position: relative; z-index: 1; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: 0 0 4px rgba(90, 90, 90, 0.18); }
.game-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.round { font: 500 40px/1 var(--serif); color: var(--primary); margin: 0; }
.round .muted { font-size: 28px; }
.score { margin: 0; font-size: 15px; color: var(--muted); }
.score strong { color: var(--text); font-weight: 600; font-size: 18px; }

.board { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.sample { margin: 0; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 46% 54% 50% 50% / 52% 46% 54% 48%; background: #888; box-shadow: inset 0 0 0 1px rgba(18, 24, 38, 0.06); transition: background 0.4s ease; }
.sample figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }
.field-wrap { position: relative; }
.field { display: block; width: 100%; height: 320px; border-radius: 12px; cursor: crosshair; touch-action: none; outline: none; }
.field:focus-visible { box-shadow: 0 0 0 3px var(--bg-alt), 0 0 0 5px var(--primary); }
.aim, .mark { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; pointer-events: none; }
.aim { border: 2px solid rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 1px rgba(18, 24, 38, 0.35); opacity: 0; transition: opacity 0.15s; }
.field-wrap:hover .aim, .field:focus-visible ~ .aim { opacity: 1; }
.mark.guess { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--text); }
.mark.real { width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--primary), 0 4px 14px rgba(2, 74, 204, 0.35); }
.link { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.link line { stroke: #fff; stroke-width: 2; stroke-dasharray: 4 4; filter: drop-shadow(0 0 1px rgba(18, 24, 38, 0.6)); }

.result { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; min-height: 52px; flex-wrap: wrap; }
.verdict { margin: 0; font: 400 20px/1.4 var(--serif); }
.verdict b { font-family: var(--sans); font-weight: 600; font-size: 17px; color: var(--primary); }
.btn { display: inline-flex; align-items: center; gap: 14px; background: linear-gradient(to right, var(--primary-dark), var(--primary)); color: var(--on-primary); border: 0; border-radius: 10px; padding: 14px 18px 14px 22px; font: 500 15px var(--sans); cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.final { text-align: center; padding: 24px 0 8px; }
.final-score { font: 500 88px/1 var(--serif); color: var(--primary); margin: 0; }
.final-score .muted { font-size: 40px; }
.final-title { font: 500 italic 30px/1.2 var(--serif); margin: 12px 0 8px; }
.final .btn { margin-top: 16px; }

/* Правила */
.how { padding: 72px 0 24px; }
h2 { font: 500 48px/1.05 var(--serif); color: var(--primary); margin: 0 0 32px; }
.steps { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.steps li { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.num { font: 500 32px/1 var(--serif); color: var(--primary); }
.steps p { margin: 12px 0 0; }

.bottom { padding: 48px 24px; color: var(--muted); font-size: 14px; }

/* Главная: список игр */
.games { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; gap: 18px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 20px; padding: 20px; text-decoration: none; box-shadow: 0 0 4px rgba(90, 90, 90, 0.12); transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 10px 28px rgba(2, 74, 204, 0.12); }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.card-body p { margin: 0; }
.card-num { font: 500 20px/1 var(--serif); color: var(--muted); }
.card-title { font: 500 44px/1 var(--serif); color: var(--primary); margin: 6px 0 10px; }
.card-meta { display: flex; justify-content: space-between; margin: auto 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.card-meta b { color: var(--text); font-weight: 600; }
.art { position: relative; height: 140px; border-radius: 14px; overflow: hidden; }
.art-hue {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.55), transparent 45%, rgba(18, 24, 38, 0.35)),
    linear-gradient(to right, #e8737f, #e0a35a, #b8c057, #5fc79a, #4fb9d9, #7d8fe8, #c67ad8, #e8737f);
}
.art-contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: transparent; }
.art-contrast span { display: grid; place-items: center; border-radius: 14px; font: 500 56px/1 var(--serif); }
.art-contrast .a { background: #1f4dff; color: #fbf4ef; }
.art-contrast .b { background: #ffe1d0; color: #ff9a62; }
.art-ruler { background: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 8px) bottom / 100% 18px no-repeat, repeating-linear-gradient(to right, var(--muted) 0 1px, transparent 1px 40px) bottom / 100% 30px no-repeat, var(--bg); }
.art-ruler .bar { position: absolute; left: 22%; right: 30%; top: 46px; height: 2px; background: var(--primary); }
.art-ruler .bar::before, .art-ruler .bar::after { content: ""; position: absolute; top: -9px; width: 2px; height: 20px; background: var(--primary); }
.art-ruler .bar::before { left: 0; }
.art-ruler .bar::after { right: 0; }
.art-center { display: grid; place-items: center; background: radial-gradient(var(--line) 1px, transparent 1px) 0 0 / 14px 14px, var(--bg); }
.art-center .frame { position: relative; width: 62%; height: 70%; box-shadow: inset 0 0 0 2px var(--primary); border-radius: 6px; }
.art-center .frame::before, .art-center .frame::after { content: ""; position: absolute; background: rgba(2, 74, 204, 0.35); }
.art-center .frame::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.art-center .frame::after { top: 50%; left: 0; right: 0; height: 1px; }
.art-center .dot { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: linear-gradient(135deg, #ff5f9e, #ff9a62); z-index: 1; }

/* Общие части игр */
.question { font: 400 24px/1.3 var(--serif); margin: 0 0 16px; }
.stage { position: relative; height: 300px; border-radius: 14px; border: 1px solid var(--line); background: radial-gradient(var(--line) 1px, transparent 1px) 0 0 / 16px 16px, var(--bg); overflow: hidden; display: grid; place-items: center; }
.stage-tall { height: 360px; display: block; }

/* Контраст */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.duo-card { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 230px; padding: 26px 24px 22px; border: 0; border-radius: 16px; text-align: left; font: inherit; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(18, 24, 38, 0.06); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.duo-card:hover:not([aria-disabled]) { transform: translateY(-2px); }
.duo-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.duo-card[aria-disabled] { cursor: default; }
.duo-card .big { font: 500 88px/0.9 var(--serif); }
.duo-card .small { font-size: 16px; line-height: 1.5; max-width: 30ch; }
.duo-card .badge { position: absolute; top: 14px; right: 14px; padding: 6px 12px; border-radius: 999px; background: rgba(18, 24, 38, 0.85); color: #fff; font: 600 13px/1.2 var(--sans); }
.duo-card.win .badge { background: var(--primary); }
.duo-card.win .badge::before { content: "✓ "; }
.duo-card.picked { box-shadow: 0 0 0 3px var(--bg-alt), 0 0 0 6px var(--text); }

/* Линейка */
.lr-row { display: flex; }
.lr-blk { width: 88px; height: 88px; border-radius: 12px; background: var(--primary); }
.lr-blk.lr-alt { background: linear-gradient(135deg, #ff5f9e, #ff9a62); }
.lr-btn { display: inline-flex; align-items: center; justify-content: center; height: 52px; border-radius: 10px; background: linear-gradient(to right, var(--primary-dark), var(--primary)); color: var(--on-primary); font: 500 15px var(--sans); overflow: hidden; white-space: nowrap; }
.lr-word { font-family: var(--sans); font-weight: 500; line-height: 1; color: var(--text); }
.lr-box { width: 180px; height: 180px; background: linear-gradient(135deg, #6c86ff, #1f4dff); }
.lr-dim { position: absolute; height: 2px; background: #e5484d; }
.lr-dim::before, .lr-dim::after { content: ""; position: absolute; top: -7px; width: 2px; height: 16px; background: #e5484d; }
.lr-dim::before { left: 0; }
.lr-dim::after { right: 0; }
.lr-dim span, .lr-tag { position: absolute; padding: 3px 9px; border-radius: 999px; background: #e5484d; color: #fff; font: 600 13px/1.3 var(--sans); white-space: nowrap; }
.lr-dim span { top: 10px; left: 50%; transform: translateX(-50%); }
.lr-tag { top: 14px; right: 14px; }
.answer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 72px auto; align-items: center; gap: 12px; margin-top: 18px; }
.answer input[type="range"] { width: 100%; accent-color: var(--primary); }
.step { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--primary); background: transparent; color: var(--primary); font: 500 20px/1 var(--sans); cursor: pointer; }
.step:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); }
.step:disabled, .answer .btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.out { font: 600 18px/1 var(--sans); text-align: right; font-variant-numeric: tabular-nums; }

/* Центр */
.ct-frame { position: absolute; box-shadow: inset 0 0 0 2px var(--primary); border-radius: 4px; }
.ct-frame.corners {
  box-shadow: none;
  background:
    linear-gradient(var(--primary), var(--primary)) left top / 22px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) left top / 2px 22px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right top / 22px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right top / 2px 22px no-repeat,
    linear-gradient(var(--primary), var(--primary)) left bottom / 22px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) left bottom / 2px 22px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right bottom / 22px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right bottom / 2px 22px no-repeat;
}
.ct-piece, .ct-ghost { position: absolute; }
.ct-piece { cursor: grab; touch-action: none; user-select: none; outline: none; background: linear-gradient(135deg, #ff5f9e, #ff9a62); box-shadow: 0 6px 16px rgba(255, 95, 158, 0.3); }
.ct-piece.dragging { cursor: grabbing; }
.ct-piece:focus-visible { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--primary); }
.ct-piece.done { opacity: 0.9; cursor: default; }
.ct-piece.circle, .ct-ghost.circle { border-radius: 50%; }
.ct-piece.square, .ct-ghost.square { border-radius: 8px; }
.ct-piece.pill, .ct-ghost.pill { border-radius: 999px; }
.ct-piece.pill { display: grid; place-items: center; color: #fff; font: 600 14px var(--sans); }
.ct-piece.bar, .ct-ghost.bar { border-radius: 6px; }
.ct-ghost { border: 2px dashed var(--primary); background: rgba(2, 74, 204, 0.06); pointer-events: none; }
.ct-cross { position: absolute; background: rgba(2, 74, 204, 0.5); pointer-events: none; }
.ct-cross.x { left: 50%; top: 0; bottom: 0; width: 1px; }
.ct-cross.y { top: 50%; left: 0; right: 0; height: 1px; }

@media (max-width: 800px) {
  .top { height: 72px; }
  .logo { font-size: 32px; }
  .blob { width: 360px; height: 360px; right: -160px; top: -60px; opacity: 0.7; }
  .hero { padding: 24px 0 36px; }
  .hero-sub { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .stroke { height: 72px; margin-left: 24px; }
  .hero-sub p { font-size: 19px; }
  .game { padding: 18px; border-radius: 16px; }
  .board { grid-template-columns: 1fr; gap: 16px; }
  .sample { display: flex; align-items: center; gap: 16px; }
  .swatch { width: 96px; flex: none; }
  .sample figcaption { margin: 0; text-align: left; }
  .field { height: 260px; }
  .steps { grid-template-columns: 1fr; }
  h2 { font-size: 40px; }
  .top-nav .ghost { display: none; }
  .games { grid-template-columns: 1fr; }
  .card-title { font-size: 38px; }
  .art { height: 120px; }
  .question { font-size: 21px; }
  .stage { height: 240px; }
  .stage-tall { height: 340px; }
  .duo { gap: 10px; }
  .duo-card { min-height: 190px; padding: 20px 14px 16px; }
  .duo-card .big { font-size: 64px; }
  .duo-card .small { font-size: 14px; }
  .duo-card .badge { top: 8px; right: 8px; left: 8px; text-align: center; padding: 5px 6px; font-size: 12px; }
  .lr-blk { width: 64px; height: 64px; }
  .lr-box { width: 140px; height: 140px; }
  .answer { grid-template-columns: auto minmax(0, 1fr) auto 64px; }
  .answer .btn { grid-column: 1 / -1; justify-content: center; }
}
