@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(/fonts/fraunces.woff2) format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url(/fonts/fraunces-italic.woff2) format('woff2');
}

:root {
  --bg: #f8f4ec;
  --panel: #ffffff;
  --panel-2: #f2ece1;
  --line: #e4dccd;
  --line-strong: #cfc4b0;
  --text: #1f1b16;
  --muted: #6e665a;
  --accent: #ffb020;
  --accent-text: #1f1400;
  --accent-ink: #a35a00;
  --blue: #2f6fde;
  --ok: #1e9e5a;
  --danger: #cf3f35;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent-ink); }

button, .file-button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}
button:hover, .file-button:hover { border-color: var(--line-strong); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary, .file-button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}
button.danger { color: var(--danger); }
.link-button { background: none; border: none; color: var(--accent-ink); padding: 0.3rem 0; }

input[type=text], input[type=search], input:not([type]) {
  font: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
}
input[type=range] { accent-color: var(--accent); vertical-align: middle; }
input[type=checkbox] { accent-color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(248, 244, 236, 0.9);
  backdrop-filter: blur(6px);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-family: var(--font-display); font-weight: 650; font-size: 1.2rem; letter-spacing: -0.01em; white-space: nowrap; }
.puzzle-title { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.account-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.button { display: inline-block; text-decoration: none; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.9rem; }
a.button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.save-banner { background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; padding: 0.6rem 1rem; margin-bottom: 1rem; max-width: 50rem; }
.save-banner p { margin: 0.2rem 0 0.6rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.1; margin: 0 0 1rem; }
.lead { color: var(--muted); max-width: 46rem; font-size: 1.1rem; }
.start-form { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1.5rem 0 0.5rem; }
.start-form input { flex: 1 1 14rem; max-width: 24rem; }

.recent ul { list-style: none; padding: 0; }
.recent li { padding: 0.3rem 0; }

.recent h2 { margin-top: 2rem; }
.steps { padding-left: 1.2rem; max-width: 50rem; }
.steps li { margin-bottom: 0.7rem; }
.tips { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0.5rem 1.2rem; max-width: 50rem; }
.tips li { margin-bottom: 0.4rem; color: var(--muted); }
.credits { color: var(--muted); font-size: 0.85rem; margin-top: 2rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.92rem; }
.error { color: var(--danger); }
.warn { color: var(--accent); }

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border-radius: 999px; white-space: nowrap; }
.tabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.count { display: inline-block; min-width: 1.4em; padding: 0 0.35em; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.8em; font-weight: 700; }

.check { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); cursor: pointer; }



.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filters button { padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.9rem; }
.filters button.active { border-color: var(--accent); color: var(--accent-ink); background: #fff4dc; }

.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.piece-card { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0.6rem 0.2rem 0.3rem; min-height: 100px; }
.piece-card.failed { border-color: #f0b8b2; }
.piece-number { font-weight: 700; font-size: 0.9rem; }
.badge { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.badge.corner { color: var(--accent-ink); }
.badge.edge { color: var(--blue); }
.badge.failed { color: var(--danger); }


dialog {
  width: min(900px, 96vw);
  max-height: 92vh;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 1rem 1rem;
}
dialog::backdrop { background: rgba(31, 27, 22, 0.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--panel); z-index: 2; padding-top: 0.6rem; }
.dialog-head h2 { font-size: 1.15rem; margin: 0.4rem 0; }
.close { font-size: 1.4rem; line-height: 1; padding: 0.2rem 0.6rem; }
.dialog-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.debug-image { max-width: 100%; background: #fff; border-radius: 8px; }

.match-row { display: flex; gap: 1rem; align-items: center; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.match-side { display: flex; flex-direction: column; align-items: center; min-width: 90px; font-size: 0.85rem; }
.match-list { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.3rem; flex: 1; align-items: center; }
.match { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.4rem; flex: none; }
.match-label { font-size: 0.85rem; }
.prob { color: hsl(calc(var(--p) * 120), 70%, 36%); font-weight: 600; }

/* match 3 pieces: the L form and the ranked completed 2x2 boards */
.match-form { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1rem; }
.match-inputs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.match-input { width: 7rem; }
.match-arrangement { margin-bottom: 1rem; }
.match-candidate { display: flex; gap: 0.9rem; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem; margin: 0 0 0.5rem; background: var(--panel); cursor: pointer; }
.match-candidate:hover { border-color: var(--line-strong); }
.match-candidate .board-scroll { display: block; flex: none; max-height: none; }
.match-candidate-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.match-candidate-head { display: flex; gap: 0.5rem; align-items: baseline; }

.solve-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.solve-status { flex: 1; min-width: 14rem; }
/* stays under the top bar, so the find box is at hand after it scrolls to a piece */
.solve-options { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin: 0.5rem 0; padding: 0.5rem 0; color: var(--muted);
                 position: sticky; top: var(--topbar-height, 0); z-index: 5; background: rgba(248, 244, 236, 0.92); backdrop-filter: blur(6px); }
.solve-options[hidden] { display: none; }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid var(--muted); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -0.15em; margin-right: 0.5em; }
@keyframes spin { to { transform: rotate(360deg); } }

.group { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem; margin: 1rem 0; }
.group-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.group-head h3 { margin: 0; font-size: 1.05rem; }
.group-head button { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.spacer { flex: 1; }
.board-scroll { overflow: auto; max-height: 80vh; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.layout-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.layout-grid td { border: 1px solid var(--line); padding: 0.25rem 0.5rem; text-align: center; }

@media (max-width: 600px) {
  main { padding: 0.6rem; }
  .match-row { flex-direction: column; align-items: stretch; }
  .match-side { flex-direction: row; gap: 0.6rem; }
  .match-candidate { flex-direction: column; align-items: stretch; }
}

/* --- pieces drawn from their outlines --- */
.piece-svg { display: block; flex: none; overflow: visible; }
.piece-fill { fill: #e9e2d5; stroke: #6e665a; stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.piece-fill.other { fill: #ffe3a6; stroke: #b86e00; }
.piece-svg.failed .piece-fill { fill: #f8dcd8; stroke: var(--danger); }
.piece-label { fill: var(--text); font-weight: 700; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 3px; pointer-events: none; font-family: system-ui, sans-serif; }
.link-label { fill: #fff; font-size: 9px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; font-family: system-ui, sans-serif; }
.piece-card .piece-svg { margin: 4px 0 6px; }
.board { display: block; margin: 0 auto; }
.board-piece { cursor: pointer; }
.board-piece:hover .piece-fill { fill: #f6dfae; }
.board-piece.added .piece-fill { fill: #d3e5c4; stroke: #557a3c; }
.board-piece.added:hover .piece-fill { fill: #c2dbad; }
.added-swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 3px; background: #d3e5c4; border: 1px solid #557a3c; vertical-align: -0.1em; margin-right: 0.3em; }
.run select { font: inherit; margin-left: 0.3rem; padding: 0.25rem 0.4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); max-width: 19rem; }
.find input { width: 7rem; padding: 0.3rem 0.6rem; margin-left: 0.3rem; }
.find-result:empty { display: none; }
.board.searching .board-piece:not(.found) { opacity: 0.35; }
.board.searching .piece-label:not(.found) { opacity: 0.35; }
.board-piece.found .piece-fill { fill: var(--accent); stroke: var(--accent-ink); stroke-width: 3px; }
.board-piece.found { animation: found-pulse 1s ease-in-out 3; }
.piece-card.found { border-color: var(--accent-ink); background: #fff1cf; box-shadow: 0 0 0 3px var(--accent); }
.single-label.found { background: var(--accent); color: var(--accent-text); border-radius: 4px; padding: 0 0.2em; }
@keyframes found-pulse { 50% { opacity: 0.55; } }
.detail-shape { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.side-list { display: flex; gap: 0.8rem; flex-wrap: wrap; font-weight: 600; margin: 0.3rem 0; }
.label-edit { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.label-input { width: 6.5rem; font-weight: 700; }
.catalog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.scan-start { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; margin: 1rem 0; }
button.big { font-size: 1.15rem; padding: 0.8rem 1.4rem; }
.steps.compact li { margin-bottom: 0.4rem; color: var(--muted); }
.small-button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
input:not([type]).label-input { padding: 0.35rem 0.6rem; }

/* --- scanner (full screen camera) --- */
body.scanning { overflow: hidden; }
#scanner-host { position: fixed; inset: 0; z-index: 50; background: #000; }
.scanner { position: absolute; inset: 0; color: #fff; user-select: none; -webkit-user-select: none; }
.scanner-stage { position: absolute; inset: 0; }
.scanner-stage video, .scanner-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.scanner.has-result .scanner-guide { display: none; }
.scanner-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 0.6rem; padding: calc(env(safe-area-inset-top) + 0.6rem) 0.8rem 0.6rem; background: linear-gradient(rgba(0, 0, 0, 0.65), transparent); }
.scanner-top button { background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.scanner-label { font-size: 1.05rem; }
.scanner-label strong { font-size: 1.3rem; }
.scanner-top .muted { color: rgba(255, 255, 255, 0.75); }
.scanner-count { flex: 1; color: rgba(255, 255, 255, 0.75); font-size: 0.9rem; }
.scanner-close { font-size: 1.5rem; line-height: 1; padding: 0.2rem 0.7rem; }
.scanner-guide { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 7.5rem); text-align: center; pointer-events: none; text-shadow: 0 1px 4px #000, 0 0 12px #000; padding: 0 1rem; }
.guide-text { font-size: 1.35rem; font-weight: 700; }
.guide-sub { font-size: 0.95rem; color: rgba(255, 255, 255, 0.85); min-height: 1.3em; }
.scanner-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 2rem; padding: 1rem 1rem calc(env(safe-area-inset-bottom) + 1.2rem); background: linear-gradient(transparent, rgba(0, 0, 0, 0.65)); }
.scanner-bottom button { background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 255, 255, 0.25); color: #fff; min-width: 4.2rem; }
.scanner-bottom button.active { border-color: var(--accent); color: var(--accent); }
.scanner-shutter { width: 76px; height: 76px; min-width: 0 !important; padding: 0; border-radius: 50%; }
.scanner-shutter svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: rgba(255, 255, 255, 0.15); stroke: rgba(255, 255, 255, 0.8); stroke-width: 4; }
.ring { fill: none; stroke: var(--ok); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 213.6; stroke-dashoffset: 213.6; transition: stroke-dashoffset 0.15s linear; }
.scanner-level { position: absolute; top: calc(env(safe-area-inset-top) + 4rem); right: 1rem; width: 80px; height: 80px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.3); }
.scanner-level::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.85); }
.scanner-level .bubble { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: var(--accent); transition: transform 0.1s; }
.scanner-level.ok .bubble { background: var(--ok); }
.scanner-result { position: absolute; left: 0.6rem; right: 0.6rem; bottom: calc(env(safe-area-inset-bottom) + 0.6rem); max-height: 70%; overflow: auto; background: rgba(255, 255, 255, 0.97); border: 1px solid var(--line); border-radius: 16px; padding: 0.9rem; color: var(--text); z-index: 3; }
.result-card { display: flex; flex-direction: column; gap: 0.6rem; }
.result-images { display: flex; gap: 0.8rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.scanner-still { max-width: 45%; max-height: 180px; border-radius: 8px; }
.result-info h3 { margin: 0.2rem 0; }
.scanner-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.6rem; }
@media (min-width: 800px) {
  .scanner-result { left: auto; width: 440px; }
}
.card-tip { margin: 1rem 0; }
.card-tip h3 { margin: 0.6rem 0 0.2rem; font-size: 1rem; }
.scanner-photo { display: inline-flex; align-items: center; justify-content: center; min-width: 4.2rem; padding: 0.5rem 0.9rem; border-radius: 10px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; cursor: pointer; font-size: 1.1rem; }
.scanner-back { font-size: 0.95rem; font-weight: 600; }
.scanner-back[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.scanner-bottom { gap: 1.2rem; }
.scanner-result h3.error { margin-top: 0; }
.corner-dot { fill: #ff6a3d; stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.guide-sub.strong { color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.scanner .ring { stroke: #3ddc84; }
.scanner-level.ok .bubble { background: #3ddc84; }

/* --- landing page --- */
html.on-puzzle #home, html.on-puzzle .topnav { display: none; }
#home { max-width: none; padding: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.topnav { display: flex; gap: 1.2rem; font-size: 0.92rem; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.account-slot { display: flex; align-items: center; gap: 0.6rem; }

.eyebrow { display: flex; align-items: center; gap: 0.6rem; font: 600 0.74rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-ink); margin: 0 0 1rem; }
.eyebrow::before { content: ""; width: 1.6rem; height: 2px; border-radius: 1px; background: var(--accent); }
.section-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.04; letter-spacing: -0.025em; margin: 0 0 0.9rem; }
.section-title em, .final-cta em { font-style: italic; font-weight: 500; color: var(--accent-ink); }
.section-lead { color: var(--muted); max-width: 44rem; font-size: 1.1rem; }

.hero-band {
  padding: 3.5rem 0 2.5rem;
  background-image: linear-gradient(rgba(31, 27, 22, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(31, 27, 22, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  overflow: hidden; /* the pile may spill past the stage */
}
.hero-grid { display: grid; grid-template-columns: 1.08fr 1fr; gap: 1.5rem; align-items: center; }
.hero-copy h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 0.98; letter-spacing: -0.035em; margin: 0 0 1.4rem; }
.h1-turn { display: block; margin-top: 0.1em; }
.swoosh { position: relative; isolation: isolate; font-style: italic; font-weight: 500; white-space: nowrap; }
.swoosh svg { position: absolute; left: -4%; bottom: -0.16em; width: 108%; height: 0.32em; overflow: visible; z-index: -1; }
.swoosh path { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.9s 0.5s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hero-copy .lead { font-size: 1.15rem; color: var(--muted); }
.hero-art { margin: 0; }
.hero-art figcaption { max-width: 28rem; margin: 0.4rem auto 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; text-align: center; }

.cta { margin-top: 1.8rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.cta-note { color: var(--muted); font-size: 0.9rem; margin: 0.9rem 0 0; }
.cta-note .link-button { padding: 0; font-size: inherit; text-decoration: underline; }
body.signed-in .for-guest, body:not(.signed-in) .for-member { display: none; }
.welcome { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; margin: 0; }
.cta .start-form { margin-top: 0.8rem; }
.landing .big { border-radius: 999px; padding: 0.75rem 1.3rem; font-size: 1.02rem; }
.landing .cta .primary { box-shadow: 0 10px 24px -10px rgba(204, 128, 0, 0.7); }
.landing button:not(.primary):not(.link-button), .landing a.button:not(.primary) { background: var(--panel); border-color: var(--line-strong); }

/* hero: HTML pieces, so the animation only moves layers */
.hero-stage { position: relative; aspect-ratio: 4 / 3; }
.hero-scale { position: absolute; left: 0; top: 0; width: 640px; height: 480px; transform-origin: 0 0; transform: scale(var(--s, 1)); }
.hero-slot { position: absolute; border-radius: 4px; background: rgba(31, 27, 22, 0.05); box-shadow: inset 0 0 0 1.5px rgba(31, 27, 22, 0.1); }
.hp { position: absolute; will-change: transform; filter: drop-shadow(0 1px 1px rgba(60, 40, 10, 0.35)); animation: assemble 12s cubic-bezier(0.3, 0.7, 0.2, 1) var(--d) infinite both; }
.hp-lift { position: absolute; inset: 0; filter: blur(8px); transform: translate(8px, 16px); animation: lift 12s ease var(--d) infinite both; }
.hp-lift-shape { position: absolute; inset: 0; background: rgba(70, 45, 10, 0.38); }
.hp-face, .hp-bevel { position: absolute; inset: 0; }
.bevel-light { fill: none; stroke: rgba(255, 255, 255, 0.34); stroke-width: 2; }
.bevel-dark { fill: none; stroke: rgba(50, 30, 0, 0.24); stroke-width: 2; }
.piece-seam { fill: none; stroke: rgba(40, 25, 0, 0.32); stroke-width: 0.7; }
.hp-tag { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px; border-radius: 50%; background: #fff; color: var(--text); font: 700 10.5px/24px var(--font-mono); text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transform: rotate(var(--tr)); animation: tag 12s ease var(--d) infinite both; }
.hero-ring { position: absolute; width: 104px; height: 104px; margin: -52px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; animation: ring 12s ease-out var(--d) infinite both; }
@keyframes assemble {
  0%, 8% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); }
  30%, 86% { transform: none; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); }
}
@keyframes lift { 0%, 8% { opacity: 1; } 30%, 86% { opacity: 0; } 100% { opacity: 1; } }
@keyframes tag { 0%, 14% { opacity: 1; } 26%, 90% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ring {
  0%, 28% { opacity: 0; transform: scale(0.5); }
  31% { opacity: 0.9; transform: scale(0.6); }
  44%, 100% { opacity: 0; transform: scale(1.5); }
}

.strip { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; width: calc(100% - 2.5rem); max-width: calc(1100px - 2.5rem); margin: 1.5rem auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 40px -30px rgba(90, 60, 20, 0.35); }
.strip div { display: flex; flex-direction: column; gap: 0.1rem; padding: 1.2rem 1.4rem; }
.strip div + div { border-left: 1px solid var(--line); }
.strip strong { font-family: var(--font-display); font-weight: 600; font-size: 2.4rem; line-height: 1; letter-spacing: -0.03em; }
.strip small { font-size: 0.5em; margin-left: 0.1em; letter-spacing: 0; }
.strip span { color: var(--muted); font-size: 0.9rem; }

.how { padding-top: 5rem; padding-bottom: 1rem; }
.step { display: grid; grid-template-columns: 1fr 1fr; gap: 3.5rem; align-items: center; padding: 3rem 0; }
.step + .step { border-top: 1px solid var(--line); }
.step:first-of-type { margin-top: 1.5rem; }
.step:nth-of-type(even) .step-art { order: -1; }
.step-num { display: block; font: italic 400 3.2rem/1 var(--font-display); color: var(--accent-ink); letter-spacing: -0.02em; }
.step h3 { font-family: var(--font-display); font-weight: 600; font-size: 2rem; line-height: 1.1; letter-spacing: -0.02em; margin: 0.5rem 0 0.8rem; }
.step p, .hood-copy p { color: #4a443b; }
.checks { list-style: none; padding: 0; margin: 1.1rem 0 1.5rem; }
.checks li { position: relative; padding-left: 1.7rem; margin-bottom: 0.55rem; color: var(--muted); }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.step-art { margin: 0; display: flex; justify-content: center; padding: 1.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 24px 50px -36px rgba(90, 60, 20, 0.45); }
.step-art svg { width: 100%; max-width: 340px; height: auto; overflow: visible; }

.sheet-title { font: 600 13px var(--font-display); fill: var(--text); }
.sheet-text { font: 500 7.5px system-ui, sans-serif; fill: var(--muted); }
.cut-line { fill: none; stroke: #bdb3a2; stroke-width: 0.8; stroke-dasharray: 3 3; }
.scissors { font-size: 12px; fill: #8a8172; }
.check-line { fill: none; stroke: #111; stroke-width: 1.4; }
.phone { fill: #1b1c21; }
.phone-rim { fill: none; stroke: #3b3c44; stroke-width: 2; }
.phone-button { fill: #2a2b31; }
.table-grain { fill: none; stroke: rgba(110, 80, 40, 0.12); stroke-width: 2; }
.scan-frame { fill: none; stroke-width: 1.5; opacity: 0.6; animation: frame-ok 4.5s infinite; }
.scan-bracket { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; animation: frame-ok 4.5s infinite; }
.scan-trace { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: trace 4.5s ease-in-out infinite; }
.phone-pill { fill: rgba(0, 0, 0, 0.5); }
.phone-text { fill: #fff; font: 600 12px system-ui, sans-serif; text-anchor: middle; }
.phone-x { stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.phone-icon { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; }
.level { fill: rgba(0, 0, 0, 0.35); stroke: rgba(255, 255, 255, 0.6); stroke-width: 1.5; }
.level-target { fill: none; stroke: rgba(255, 255, 255, 0.9); }
.level-dot { fill: #3ddc84; }
.shutter { fill: rgba(255, 255, 255, 0.3); stroke: #fff; stroke-width: 3; }
.shutter-ring { fill: none; stroke: #3ddc84; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transform: rotate(-90deg); transform-origin: 160px 382px; animation: hold 4.5s linear infinite; }
@keyframes frame-ok { 0%, 10% { stroke: var(--accent); } 14%, 100% { stroke: #3ddc84; } }
@keyframes hold { 0%, 14% { stroke-dashoffset: 1; } 40%, 100% { stroke-dashoffset: 0; } }
@keyframes trace { 0%, 42% { stroke-dashoffset: 1; } 80%, 100% { stroke-dashoffset: 0; } }
.back-edge { fill: #9d8b6c; }
.back-fill { fill: #cbbb9b; }
.pencil-mark path { fill: none; stroke: #4f4c47; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.chip { fill: #fff; stroke: var(--line); filter: drop-shadow(0 6px 10px rgba(90, 60, 20, 0.15)); }
.chip-check { fill: var(--ok); }
.chip-text { fill: var(--text); font: 600 13px system-ui, sans-serif; }
.ui-window { fill: var(--bg); stroke: var(--line); }
.ui-tab { fill: #fff; stroke: var(--line); }
.ui-tab.active { fill: var(--text); stroke: var(--text); }
.ui-tab-text { fill: var(--muted); font: 600 10.5px system-ui, sans-serif; text-anchor: middle; }
.ui-tab-text.active { fill: #fff; }
.ui-title { fill: var(--text); font: 600 14px var(--font-display); }
.ui-match { fill: #fff4dc; stroke: #f0c66b; }
.ui-match-text { fill: var(--accent-ink); font: 600 10.5px var(--font-mono); text-anchor: middle; }
.solve-slot { fill: none; stroke: var(--accent-ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.solve-drop { transform-box: fill-box; transform-origin: center; animation: drop 5s cubic-bezier(0.3, 0.7, 0.2, 1) infinite both; }
@keyframes drop {
  0%, 15% { transform: translate(52px, -42px) rotate(14deg); }
  45%, 85% { transform: none; }
  100% { transform: translate(52px, -42px) rotate(14deg); }
}
.hood-piece { fill: var(--panel-2); }
.side-stroke { fill: none; stroke-width: 5; stroke-linecap: round; }
.side-stroke.side-out { stroke: #e89300; }
.side-stroke.side-in { stroke: var(--blue); }
.side-stroke.side-flat { stroke: #8f97a6; }
.dim-line, .note-line { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.note { fill: var(--text); font: 600 11px var(--font-mono); }

.band { margin-top: 3rem; padding: 5rem 0; background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.expect-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.expect { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 1.4rem 1.5rem; }
.expect h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; margin: 0 0 0.5rem; }
.expect p { color: var(--muted); margin: 0; }

.hood { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3.5rem; align-items: center; padding-top: 5rem; padding-bottom: 1rem; }
.hood-art { margin: 0; text-align: center; }
.hood-art svg { width: 100%; max-width: 340px; height: auto; overflow: visible; }

.faq { padding-top: 5rem; }
.faq details { max-width: 50rem; border-bottom: 1px solid var(--line); padding: 1.1rem 0; }
.faq summary { display: flex; justify-content: space-between; gap: 1rem; cursor: pointer; font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent-ink); font-family: var(--font-mono); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); margin: 0.7rem 0 0; }

.final-cta { width: calc(100% - 2.5rem); max-width: calc(1100px - 2.5rem); margin: 5rem auto 4rem; padding: 4.5rem 1.5rem; text-align: center; border-radius: 32px; background: var(--accent); color: var(--accent-text); }
.final-cta h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1.05; letter-spacing: -0.03em; max-width: 46rem; margin: 0 auto; }
.final-cta em { display: block; color: var(--accent-text); }
.final-cta .cta-row { justify-content: center; }
.final-cta .button.primary, .final-cta button.primary { background: var(--text); border-color: var(--text); color: #fff; box-shadow: none; }
.final-cta .cta-note, .final-cta .cta-note a { color: var(--accent-text); }

.site-footer { margin-top: 2rem; padding: 2.2rem 0 2.5rem; background: var(--panel-2); border-top: 1px solid var(--line); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1.5rem 3rem; }
.footer-grid p { margin: 0.4rem 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.site-footer .credits { margin-top: 1.4rem; font-size: 0.82rem; color: var(--muted); }
.site-footer .version { margin-top: 0.6rem; }

@media (max-width: 900px) {
  .hero-grid, .step, .hood { grid-template-columns: 1fr; gap: 1.5rem; }
  .step:nth-of-type(even) .step-art { order: 0; }
  .hero-art { max-width: 560px; width: 100%; margin: 0 auto; }
  .expect-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topnav { display: none; }
  .strip { grid-template-columns: 1fr 1fr; }
  .strip div:nth-child(3) { border-left: none; }
  .strip div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .hero-band { padding-top: 2rem; }
  .expect-grid { grid-template-columns: 1fr; }
  .cta-row > * { flex: 1 1 100%; text-align: center; }
  .account-name { display: none; }
  .topbar { gap: 0.5rem; padding: 0.6rem 0.75rem; }
  .brand { font-size: 1.05rem; gap: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hp, .hp-lift, .hp-tag, .hero-ring, .scan-frame, .scan-bracket, .scan-trace, .shutter-ring, .solve-drop, .swoosh path { animation: none; }
  .hp-lift, .hp-tag, .hero-ring { opacity: 0; }
  .scan-frame, .scan-bracket { stroke: #3ddc84; }
  .scan-trace, .shutter-ring, .swoosh path { stroke-dashoffset: 0; }
}
