:root {
  --bg: #0b0d12;
  --bg-2: #11141c;
  --stone: #171b25;
  --stone-2: #1f2431;
  --line: #2b3242;
  --text: #e9e6dc;
  --muted: #9aa0ad;
  --gold: #f2c14e;
  --gold-hi: #ffe9a8;
  --gold-lo: #9c6b1c;
  --gm: #f2c14e;
  --architect: #5aa9ff;
  --designer: #f27fc0;
  --developer: #7ee081;
  --devops: #ff9b54;
  --qa: #b48cff;
  --security: #ff5d5d;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(242, 193, 78, .10), transparent 60%),
    radial-gradient(900px 500px at 0% 30%, rgba(90, 169, 255, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.gated { overflow: hidden; }
a { color: var(--gold); }
code { font-family: var(--mono); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .01em; }
#embers { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: .7; }
main, .top, .foot { position: relative; z-index: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .6em;
  font: 600 15px var(--body); letter-spacing: .02em;
  padding: .7em 1.2em; border-radius: 4px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn-gold {
  color: #1c1405;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 45%, #c8922c);
  border-color: #ffe9a8;
  box-shadow: 0 0 0 1px #5b3d0c, 0 6px 24px rgba(242, 193, 78, .25), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.btn-gold:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px #5b3d0c, 0 8px 34px rgba(242, 193, 78, .45), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn-ghost { color: var(--text); border-color: var(--line); background: rgba(255, 255, 255, .02); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-hi); }
.btn-big { font-size: 17px; padding: .85em 1.5em; }
.btn-small { font-size: 13px; padding: .5em .9em; }
.btn-note { font: 400 12px var(--mono); opacity: .7; }
.btn-link { background: none; border: 0; color: var(--muted); font: 13px var(--mono); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.btn-link:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* Gate */
#gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; text-align: center;
  background: radial-gradient(700px 500px at 50% 45%, #1a1e2b, #07080c 75%);
  transition: opacity 1.2s ease, visibility 1.2s;
}
#gate.open { opacity: 0; visibility: hidden; }
#gate-embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.gate-inner { position: relative; padding: 24px; max-width: 820px; }
.sigil { width: 132px; height: 132px; filter: drop-shadow(0 0 28px rgba(242, 193, 78, .45)); }
.sigil-ring { transform-origin: 60px 60px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate-kicker { font: 12px var(--mono); letter-spacing: .35em; text-transform: uppercase; color: var(--gold); margin: 18px 0 8px; }
.gate-title { font-size: clamp(34px, 6vw, 56px); font-weight: 900; background: linear-gradient(180deg, #fff3cf, var(--gold) 60%, var(--gold-lo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate-sub { color: var(--muted); margin: 16px 0 30px; font-size: 17px; }
#gate .btn-link { display: block; margin: 18px auto 0; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(11, 13, 18, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 19px var(--display); letter-spacing: .04em; }
.brand b { color: var(--gold); font-weight: 700; }
.top nav { display: flex; align-items: center; gap: 22px; }
.top nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: 14px; }
.top nav a:not(.btn):hover { color: var(--gold-hi); }
.nav-hall { font-family: var(--mono); }
@media (max-width: 860px) { .top nav a:not(.btn) { display: none; } }

/* Hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 5vw, 64px); align-items: center;
  max-width: 1240px; margin: 0 auto; padding: clamp(40px, 8vw, 96px) clamp(16px, 4vw, 48px) 40px;
}
.kicker { font: 12px var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--developer); box-shadow: 0 0 12px var(--developer); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.hero h1 { font-size: clamp(46px, 8vw, 96px); font-weight: 900; text-shadow: 0 2px 0 #000, 0 0 60px rgba(242, 193, 78, .15); }
.hero h1 em { font-style: normal; text-shadow: none; background: linear-gradient(180deg, #fff3cf, var(--gold) 55%, var(--gold-lo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(17px, 1.6vw, 20px); color: #c9c6bb; max-width: 34em; margin: 24px 0 0; }
.lede-strong { color: var(--text); font-weight: 600; margin-top: 12px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 32px 0 26px; }
.agents { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.agents code { display: inline-block; padding: 3px 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg-2); color: var(--text); font-size: 12px; }
@media (max-width: 960px) { .hero { grid-template-columns: 1fr; } }

/* Ornate frame */
.frame {
  position: relative; background: linear-gradient(180deg, var(--stone), #10131a);
  border: 1px solid #6b4e17; border-radius: 6px;
  box-shadow: 0 0 0 1px #000, 0 0 0 4px #1a1408, 0 0 0 5px #6b4e17, 0 30px 80px rgba(0, 0, 0, .6), 0 0 80px rgba(242, 193, 78, .08);
  overflow: hidden;
}
.frame-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #232836, #171b25); font: 13px var(--mono); color: var(--muted); }
.frame-title b { color: var(--gold-hi); font-weight: 600; }
.frame-tag { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; border: 1px solid var(--line); padding: 2px 6px; border-radius: 3px; }
.party { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.unit { display: flex; gap: 8px; align-items: center; min-width: 0; }
.unit i { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 4px; font: 600 11px var(--mono); font-style: normal; color: #0b0d12; background: var(--c); box-shadow: 0 0 0 1px #000, 0 0 14px color-mix(in srgb, var(--c) 50%, transparent); }
.unit div { min-width: 0; flex: 1; }
.unit b { display: block; font: 600 11px var(--body); color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { display: block; height: 5px; background: #06070a; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar s { display: block; height: 100%; background: var(--c); animation: work 5s ease-in-out infinite alternate; }
.unit:nth-child(2n) .bar s { animation-duration: 7s; }
@keyframes work { from { transform: translateX(-18%); } to { transform: translateX(0); } }
@media (max-width: 520px) { .unit b { display: none; } .unit { justify-content: center; } .unit div { display: none; } }
.feed { list-style: none; margin: 0; padding: 12px 16px; height: 300px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font: 13px/1.5 var(--mono); }
.feed li { padding: 5px 0; border-bottom: 1px dashed rgba(255, 255, 255, .05); animation: rise .5s ease both; color: #c9c6bb; }
.feed li b { color: var(--c); font-weight: 600; }
.feed li u { text-decoration: none; color: var(--gold-hi); }
.feed li small { color: var(--muted); font-size: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.frame-foot { padding: 10px 16px; border-top: 1px solid var(--line); font: 12px var(--mono); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--security); animation: blink 1.2s infinite; }

/* Sections */
.divider { text-align: center; color: var(--gold-lo); position: relative; margin: 30px auto; max-width: 1240px; }
.divider::before, .divider::after { content: ""; position: absolute; top: 50%; width: 42%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-lo)); }
.divider::before { left: 4%; } .divider::after { right: 4%; transform: scaleX(-1); }
.section { max-width: 1240px; margin: 0 auto; padding: clamp(48px, 7vw, 90px) clamp(16px, 4vw, 48px); }
.eyebrow { font: 12px var(--mono); letter-spacing: .25em; text-transform: uppercase; color: var(--gold); margin: 0 0 12px; }
.section h2 { font-size: clamp(30px, 4.4vw, 52px); }
.section-lede { color: var(--muted); font-size: 18px; max-width: 44em; margin: 14px 0 36px; }
.fineprint { color: var(--muted); font-size: 13px; margin-top: 22px; }

/* Quest chain */
.quests { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; counter-reset: q; }
.quests li { position: relative; padding: 26px 18px 20px; background: linear-gradient(180deg, var(--stone), var(--bg-2)); border: 1px solid var(--line); border-top: 2px solid var(--gold-lo); border-radius: 4px; transition: transform .2s, border-color .2s; }
.quests li:hover { transform: translateY(-4px); border-color: var(--gold); }
.q-num { font: 900 15px var(--display); color: #1c1405; background: linear-gradient(180deg, var(--gold-hi), var(--gold)); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; position: absolute; top: -18px; left: 16px; box-shadow: 0 0 0 3px var(--bg), 0 0 18px rgba(242, 193, 78, .4); }
.quests h3 { font-size: 17px; margin: 6px 0 10px; line-height: 1.25; }
.quests p { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 1080px) { .quests { grid-template-columns: repeat(2, 1fr); row-gap: 30px; } }
@media (max-width: 560px) { .quests { grid-template-columns: 1fr; } }

/* Classes */
.classes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.class {
  text-align: left; color: var(--text); font: inherit; cursor: pointer; position: relative; padding: 20px 18px 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 9%, var(--stone)), var(--bg-2) 60%);
  border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: 4px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.class:hover, .class.picked { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 14px 40px rgba(0, 0, 0, .5), 0 0 30px color-mix(in srgb, var(--c) 22%, transparent); }
.class.picked::after { content: "✓ chosen"; position: absolute; top: 12px; right: 12px; font: 11px var(--mono); color: var(--c); }
.glyph { display: grid; place-items: center; width: 44px; height: 44px; font-size: 22px; color: var(--c); border: 1px solid var(--c); border-radius: 6px; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 14px color-mix(in srgb, var(--c) 25%, transparent); }
.role { display: block; font: 11px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 14px 0 2px; }
.class h3 { font-size: 21px; color: var(--c); }
.class p { font-size: 14px; color: #bcb9ae; margin: 10px 0 14px; }
.owns { font: 12px var(--mono); color: var(--muted); }
.owns b { color: var(--text); font-weight: 600; }
@media (max-width: 1080px) { .classes { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .classes { grid-template-columns: 1fr; } }

/* Forge demo */
.forge { display: grid; gap: 18px; max-width: 860px; }
.forge-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font: 13px var(--mono); color: var(--muted); }
.forge-pick button { font: 600 13px var(--body); color: var(--c); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 7px 14px; cursor: pointer; }
.forge-pick button.on { background: var(--c); color: #0b0d12; border-color: var(--c); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 40%, transparent); }
.asset { border: 1px solid #6b4e17; border-radius: 6px; background: linear-gradient(180deg, var(--stone), #10131a); box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0, 0, 0, .5); }
.asset-head { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.rarity { font: 11px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--qa); }
.asset-head h3 { font-size: 26px; color: var(--gold-hi); margin: 4px 0; }
.asset-head p { margin: 0; color: var(--muted); font-style: italic; font-size: 14px; }
.sides { display: grid; grid-template-columns: repeat(4, 1fr); }
.side { font: inherit; text-align: left; color: var(--text); background: transparent; border: 0; border-right: 1px solid var(--line); padding: 18px 20px; cursor: pointer; display: grid; gap: 2px; transition: background .2s; position: relative; }
.side:last-child { border-right: 0; }
.side:hover { background: color-mix(in srgb, var(--c) 10%, transparent); }
.side b { font: 700 16px var(--display); color: var(--c); }
.side span { font: 12px var(--mono); color: var(--muted); }
.side em { font: 600 12px var(--body); font-style: normal; color: var(--text); margin-top: 10px; opacity: .6; }
.side.mine::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); box-shadow: 0 0 16px var(--c); }
.side.mine em { opacity: 1; color: var(--c); }
.side.flash-ok { animation: ok .9s; } .side.flash-sug { animation: sug .9s; }
@keyframes ok { 30% { background: color-mix(in srgb, var(--developer) 35%, transparent); } }
@keyframes sug { 30% { background: color-mix(in srgb, var(--gold) 30%, transparent); } }
@media (max-width: 640px) { .sides { grid-template-columns: 1fr 1fr; } .side { border-bottom: 1px solid var(--line); } }
.forge-out { font: 14px/1.6 var(--mono); background: #06070a; border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; min-height: 76px; color: #c9c6bb; }
.prompt { color: var(--gold); }
.forge-out .ok { color: var(--developer); } .forge-out .sug { color: var(--gold-hi); }

/* Pillars */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pillars article { padding: 28px 24px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); }
.pillars h3 { font-size: 24px; color: var(--gold-hi); margin-bottom: 10px; }
.pillars p { margin: 0; color: var(--muted); }
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; } }

/* LFG */
.lfg { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg-2); max-width: 980px; }
.lfg-row { display: grid; grid-template-columns: 54px minmax(0, 1.2fr) minmax(0, 1.4fr) 70px; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.lfg-row:last-child { border-bottom: 0; }
.lfg-row:hover { background: var(--stone); }
.lfg-row i { font-style: normal; font-weight: 600; }
.lfg-row > span { color: var(--muted); }
.lfg-tag { font: 600 11px var(--mono); color: var(--developer) !important; border: 1px solid currentColor; border-radius: 3px; text-align: center; padding: 2px 0; }
.lfg-lfg { color: var(--architect) !important; }
.lfg-size { font-family: var(--mono); text-align: right; }
@media (max-width: 640px) { .lfg-row { grid-template-columns: 54px 1fr; } .lfg-row > span:nth-child(3), .lfg-size { grid-column: 2; text-align: left; } }

/* Join */
.join-frame { max-width: 720px; margin: 0 auto; text-align: center; padding: clamp(28px, 5vw, 56px); border: 1px solid #6b4e17; border-radius: 6px; background: radial-gradient(500px 260px at 50% 0, rgba(242, 193, 78, .12), transparent 70%), linear-gradient(180deg, var(--stone), #10131a); box-shadow: 0 0 0 1px #000, 0 0 0 4px #1a1408, 0 0 0 5px #6b4e17, 0 30px 90px rgba(0, 0, 0, .6); }
.join .section-lede { margin-left: auto; margin-right: auto; }
#join-form { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; text-align: left; }
#join-form label { font: 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: grid; gap: 6px; }
#join-form input, #join-form select { font: 16px var(--body); color: var(--text); background: #06070a; border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; width: 100%; }
#join-form input:focus, #join-form select:focus { border-color: var(--gold); outline: none; }
#join-form .btn { grid-column: 1 / -1; justify-content: center; }
.join-msg { min-height: 1.6em; margin: 16px 0 0; font-family: var(--mono); font-size: 14px; }
.join-msg.ok { color: var(--developer); } .join-msg.err { color: var(--security); }
@media (max-width: 560px) { #join-form { grid-template-columns: 1fr; } }

/* Footer */
.foot { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; padding: 28px clamp(16px, 4vw, 48px) 110px; border-top: 1px solid var(--line); color: var(--muted); font: 12px var(--mono); }

/* Bard */
.bard { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; width: 300px; max-width: calc(100vw - 32px); border: 1px solid #6b4e17; border-radius: 6px; background: rgba(17, 20, 28, .95); backdrop-filter: blur(8px); box-shadow: 0 12px 40px rgba(0, 0, 0, .6); overflow: hidden; }
.bard-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.bard-bar button { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--gold-lo); background: #06070a; color: var(--gold); cursor: pointer; font-size: 11px; }
.bard-bar button:hover { border-color: var(--gold-hi); color: var(--gold-hi); }
.bard-text { min-width: 0; flex: 1; line-height: 1.2; }
.bard-text b { display: block; font: 600 12px var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bard-text span { font: 11px var(--mono); color: var(--muted); }
#bard-vol { width: 84px; accent-color: var(--gold); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

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