:root {
  --ink: #141826;
  --ink-2: #1d2235;
  --cream: #f6f1e8;
  --paper: #fffdf8;
  --muted: #6b6a74;
  --line: #e4ddd0;
  --drive: #c65d3b;
  --strength: #d9a441;
  --world: #2e8b83;
  --way: #3e5c9a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--cream); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .wordmark { font-family: Fraunces, Georgia, serif; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.05; margin: .2em 0 .3em; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.15; margin: 0 0 .5em; }
h3 { font-size: 1.25rem; margin: .6em 0 .3em; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 1.8em 0 .7em; }
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; font-weight: 600; color: var(--strength); margin: 0; }
.lead { font-size: 1.15rem; max-width: 36em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; border: 0; border-radius: 999px; padding: .85em 1.6em; font: 600 1rem Inter, sans-serif; background: var(--drive); color: #fff; text-decoration: none; cursor: pointer; transition: transform .15s, background .15s, opacity .15s; }
.btn:hover { transform: translateY(-1px); background: #b04f30; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; background: var(--drive); }
.btn-ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-ghost:hover { background: rgba(128,128,128,.12); }
.btn-small { padding: .55em 1.1em; font-size: .9rem; }

/* nav */
.nav { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 20px 28px; color: var(--cream); }
.wordmark { font-size: 1.6rem; font-weight: 700; }
.wordmark.small { font-size: 1.2rem; }
.brand { text-decoration: none; }
.brand img { height: 36px; display: block; }
.nav nav { display: flex; gap: 22px; align-items: center; }
.nav nav a:not(.btn) { text-decoration: none; opacity: .85; font-weight: 500; }
.nav nav a:not(.btn):hover { opacity: 1; }
@media (max-width: 700px) { .nav nav a:not(.btn) { display: none; } }

/* hero */
.hero { position: relative; min-height: 92vh; display: flex; align-items: center; background: var(--ink); color: var(--cream); overflow: hidden; }
.hero-mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols, 24), 1fr); gap: 3px; padding: 3px; opacity: .8; }
.hero-mosaic span { border-radius: 3px; aspect-ratio: 1; transition: background-color 1.6s ease, opacity 1.6s ease; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 50%, rgba(20,24,38,.96) 0%, rgba(20,24,38,.82) 45%, rgba(20,24,38,.35) 100%); pointer-events: none; }
.hero-inner { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; padding: 120px 24px 80px; width: 100%; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 2em; }

/* how */
.how { padding: 100px 0 80px; }
.steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.steps li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.steps p { color: var(--muted); margin: 0; }
.step-tile { display: block; width: 44px; height: 44px; border-radius: 8px; transform: rotate(8deg); }
.t-drive { background: var(--drive); } .t-strength { background: var(--strength); } .t-world { background: var(--world); } .t-way { background: var(--way); }

/* builder */
.builder { padding: 80px 0 100px; background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.builder-head p { color: var(--muted); max-width: 40em; }
.facet-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 22px; }
.facet-tab { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: .5em 1.1em; font: 600 .92rem Inter, sans-serif; cursor: pointer; display: inline-flex; align-items: center; gap: .55em; color: var(--ink); }
.facet-tab .sw { width: 12px; height: 12px; border-radius: 3px; }
.facet-tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.facet-desc { width: 100%; color: var(--muted); font-size: .95rem; margin: 4px 2px 0; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile { position: relative; aspect-ratio: 1 / .82; border: 0; border-radius: 12px; padding: 14px; text-align: left; color: #fff; cursor: pointer; font: 600 1.02rem Inter, sans-serif; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; transition: transform .18s, box-shadow .18s, opacity .18s; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,0) 45%, rgba(0,0,0,.12)); pointer-events: none; }
.tile .tile-sub { font-weight: 400; font-size: .8rem; opacity: .88; line-height: 1.35; }
.tile:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.tile.picked { opacity: .45; transform: scale(.94); box-shadow: none; }
.tile.picked::after { content: "\2713"; position: absolute; bottom: 10px; right: 10px; width: 24px; height: 24px; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--ink); color: #fff; border-radius: 50%; }
.tile.picked .tile-sub { padding-right: 28px; }
.tile:focus-visible, .btn:focus-visible, .facet-tab:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.pathway-panel { margin-top: 36px; background: var(--ink); color: var(--cream); border-radius: 18px; padding: 26px; }
.pathway-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.pathway-top h3 { margin: 0; }
.hint { color: #a8a9b8; margin: .3em 0 0; font-size: .92rem; }
.counter { font-family: Fraunces, serif; font-size: 1.6rem; white-space: nowrap; }
.pathway { list-style: none; margin: 22px 0; padding: 18px 4px 8px; display: flex; gap: 12px; overflow-x: auto; min-height: 136px; position: relative; counter-reset: stone; }
.pathway:empty::before { content: "No tiles yet"; color: #6d7085; align-self: center; margin: 0 auto; }
.stone { position: relative; flex: 0 0 116px; height: 104px; border-radius: 10px; padding: 10px; color: #fff; font-weight: 600; font-size: .88rem; display: flex; flex-direction: column; justify-content: space-between; cursor: grab; user-select: none; animation: drop .32s cubic-bezier(.3,1.5,.6,1); }
.stone::before { counter-increment: stone; content: counter(stone); position: absolute; top: -12px; left: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--cream); color: var(--ink); font-size: .75rem; display: grid; place-items: center; font-weight: 700; }
.stone:not(:last-child)::after { content: ""; position: absolute; right: -12px; top: 50%; width: 12px; height: 2px; background: #5a5e75; }
.stone.dragging { opacity: .4; }
.stone-ctrls { display: flex; gap: 4px; justify-content: flex-end; }
.stone-ctrls button { width: 26px; height: 26px; border: 0; border-radius: 6px; background: rgba(0,0,0,.25); color: #fff; cursor: pointer; font-size: .85rem; line-height: 1; }
.stone-ctrls button:hover { background: rgba(0,0,0,.45); }
@keyframes drop { from { transform: translateY(-16px) scale(.8); opacity: 0; } }
.pathway-actions { display: flex; justify-content: flex-end; gap: 12px; }
.pathway-panel .btn-ghost { color: var(--cream); }

/* codex */
.codex { padding: 100px 0; background: var(--ink); color: var(--cream); }
.codex-grid { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 56px; align-items: start; }
@media (max-width: 860px) { .codex-grid { grid-template-columns: 1fr; } }
.codex-frame { background: #0c0f19; border-radius: 20px; padding: 18px; box-shadow: 0 0 0 1px #2a2f45, 0 30px 60px rgba(0,0,0,.4); }
.codex-frame svg { display: block; width: 100%; height: auto; }
.codex-frame rect { transform-box: fill-box; transform-origin: center; animation: set .5s backwards; }
@keyframes set { from { opacity: 0; transform: scale(.3); } }
.signature { color: #a8a9b8; font-size: .9rem; text-align: center; }
.signature code { color: var(--strength); font-size: 1rem; letter-spacing: .12em; margin-left: .4em; }
.reading { font-size: 1.1rem; color: #d7d4cc; max-width: 34em; }
.balance { display: grid; gap: 10px; }
.bal-row { display: grid; grid-template-columns: 130px 1fr 36px; align-items: center; gap: 12px; font-size: .92rem; }
.bal-track { height: 10px; background: #262b40; border-radius: 99px; overflow: hidden; }
.bal-fill { height: 100%; border-radius: 99px; width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.matches { display: grid; gap: 10px; }
.match { position: relative; display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; background: #1d2235; border-radius: 12px; padding: 14px 16px; overflow: hidden; }
.match .m-icon { width: 40px; height: 40px; border-radius: 9px; filter: blur(3px); }
.match .m-lines { filter: blur(5px); display: grid; gap: 7px; }
.match .m-lines i { display: block; height: 11px; border-radius: 4px; background: #5c6180; }
.match .m-lines i + i { height: 8px; background: #3c415a; }
.match .m-fit { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--strength); }
.locked-note { display: flex; gap: 10px; align-items: flex-start; color: #a8a9b8; font-size: .92rem; margin: 18px 0 22px; }
.locked-note svg { flex: none; margin-top: 2px; color: var(--strength); }

/* join */
.join { padding: 100px 0; }
.join-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
@media (max-width: 860px) { .join-grid { grid-template-columns: 1fr; } }
.unlocks { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.unlocks li { display: flex; gap: 12px; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 3px; flex: none; transform: rotate(10deg); }
.join-form { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 30px; display: grid; gap: 16px; box-shadow: 0 20px 50px rgba(20,24,38,.08); }
.join-form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.join-form input, .join-form select { font: 400 1rem Inter, sans-serif; padding: .75em .9em; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.join-form input:focus, .join-form select:focus { outline: none; border-color: var(--way); }
.saved { margin: 0; font-size: .9rem; color: var(--world); font-weight: 600; }
.form-msg { margin: 0; min-height: 1.4em; font-size: .95rem; }
.form-msg.ok { color: var(--world); font-weight: 600; }
.form-msg.err { color: var(--drive); }

.foot { background: var(--ink); color: #8d8fa3; padding: 28px 0; font-size: .9rem; }
.foot .wrap { display: flex; justify-content: space-between; align-items: center; }
.foot .wordmark { color: var(--cream); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
