:root {
  color-scheme: dark;
  --ink: #15141f;
  --ink-soft: #242235;
  --dirt: #5b3b28;
  --timber: #7b5032;
  --timber-light: #ad7548;
  --paper: #e8d8a5;
  --paper-dark: #c4aa70;
  --text: #f5ecd0;
  --dim: #c5b993;
  --gold: #f6c744;
  --green: #64c466;
  --red: #dc4f45;
  --blueprint: #213a49;
  --shadow: 5px 5px 0 #09080c;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; background: linear-gradient(rgba(255,255,255,.018) 50%,transparent 50%) 0 0 / 100% 4px,var(--ink); color: var(--text); font-size: 14px; line-height: 1.45; }
body[data-busy="true"] { cursor: progress; }
[hidden] { display: none !important; }
a { color: inherit; }
button,input { font: inherit; }
button { cursor: pointer; }
button,.header-links a,.hero-actions a { min-height: 42px; border: 3px solid #241b17; border-radius: 0; padding: 8px 12px; background: var(--gold); box-shadow: 3px 3px 0 #09080c; color: #1b1710; font-weight: 900; letter-spacing: .02em; transition: filter 100ms linear,transform 100ms linear,box-shadow 100ms linear; }
button:hover:not(:disabled),.header-links a:hover,.hero-actions a:hover { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translate(3px,3px); box-shadow: none; }
button:disabled { cursor: not-allowed; filter: grayscale(.5); opacity: .48; }
button.ghost,.ghost-link { border-color: #4b4560 !important; background: var(--ink-soft) !important; color: var(--text) !important; }
:focus-visible { outline: 3px solid #fff8ca; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-150%); background: var(--gold); color: var(--ink); font-weight: 900; }
.skip-link:focus { transform: none; }

.topbar { position: relative; z-index: 30; display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px clamp(12px,3vw,28px); border-bottom: 4px solid #09080c; background: #211a18; }
.brand { display: flex; align-items: center; gap: 10px; min-width: max-content; color: var(--paper); text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 3px solid #08070a; background: var(--gold); box-shadow: 3px 3px 0 var(--timber); color: #1a1510; font-size: 22px; }
.brand b,.brand small { display: block; }
.brand b { font-size: 18px; line-height: 1; letter-spacing: .08em; }
.brand small { margin-top: 5px; color: var(--timber-light); font-size: 9px; letter-spacing: .14em; }
.header-links { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 7px; }
.header-links a { display: inline-flex; align-items: center; border-color: #4b4560; background: var(--ink-soft); color: var(--text); font-size: 9px; text-decoration: none; text-transform: uppercase; }
.wallet-button { min-width: 138px; }
.network-strip { display: flex; justify-content: space-between; gap: 12px; padding: 8px clamp(12px,3vw,28px); border-bottom: 3px solid #09080c; background: #2d211b; color: var(--dim); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.network-strip span { display: inline-flex; align-items: center; gap: 7px; }
.network-strip i { width: 8px; height: 8px; background: var(--gold); }
body[data-wallet-state="connected"] .network-strip i { background: var(--green); }
body[data-wallet-state="wrong-chain"] .network-strip i { background: var(--red); animation: blink .8s steps(1) infinite; }

main { width: min(1440px,100%); margin: 0 auto; padding: clamp(16px,2.5vw,30px); }
.eyebrow { margin: 0 0 4px; color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1,h2,h3,p { margin-top: 0; }
.hero { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(420px,.9fr); gap: 24px; align-items: stretch; margin-bottom: 20px; }
.hero-copy { display: flex; min-height: 410px; flex-direction: column; justify-content: center; padding: clamp(15px,3vw,35px); border: 4px solid #09080c; background: #29242f; box-shadow: var(--shadow); }
h1 { max-width: 900px; margin: 0; color: var(--paper); font-size: clamp(34px,5.6vw,70px); line-height: .9; letter-spacing: -.025em; text-transform: uppercase; }
h1 em { color: var(--gold); font-style: normal; }
.hero-copy > p:not(.eyebrow) { max-width: 760px; margin: 18px 0; color: var(--dim); font-size: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.hero-actions a { display: inline-flex; align-items: center; text-decoration: none; text-transform: uppercase; }
.foundry-scene { position: relative; min-height: 410px; overflow: hidden; border: 4px solid #09080c; background: linear-gradient(180deg,#33271f 0 58%,#16141a 58%); box-shadow: var(--shadow); }
.foundry-scene::before { content:""; position:absolute; inset:0; background: repeating-linear-gradient(90deg,transparent 0 82px,rgba(9,8,12,.68) 82px 91px),linear-gradient(130deg,transparent 0 45%,rgba(246,199,68,.08) 45% 57%,transparent 57%); }
.miner { position: absolute; z-index: 2; width: clamp(110px,12vw,170px); filter: drop-shadow(6px 8px 0 rgba(0,0,0,.5)); image-rendering: pixelated; animation: work 1.2s steps(2) infinite alternate; }
.miner-a { left: 2%; bottom: 71px; }
.miner-b { right: 3%; bottom: 69px; animation-delay: -.5s; }
.miner-c { left: 38%; bottom: 107px; width: clamp(95px,10vw,145px); animation-delay: -.8s; }
.conveyor { position: absolute; z-index: 3; right: -4px; bottom: 43px; left: -4px; display: flex; height: 62px; align-items: center; justify-content: space-around; border: 4px solid #09080c; background: #4e3426; }
.conveyor i { position:absolute; bottom:-19px; width:35px; height:35px; border:4px solid #09080c; border-radius:50%; background:var(--timber); }
.conveyor i:nth-child(1){left:12%}.conveyor i:nth-child(2){left:47%}.conveyor i:nth-child(3){right:12%}
.conveyor span { display:grid; width:44px; height:44px; place-items:center; border:3px solid #09080c; background:var(--paper); color:#241b17; font-weight:900; }
.stamp { position:absolute; z-index:4; top:16px; right:16px; transform:rotate(4deg); border:4px double var(--gold); padding:9px; color:var(--gold); font-size:9px; text-align:center; }
.stamp b { font-size:17px; }
.sparks { position:absolute; z-index:4; top:75px; left:40%; color:var(--gold); font-size:22px; animation:blink .7s steps(1) infinite; }

.mechanism,.launch-workbench,.directory,.truth-board { margin-bottom:20px; border:4px solid #09080c; background:#211d27; box-shadow:var(--shadow); }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:16px; padding:13px 15px; border-bottom:3px solid #09080c; background:#30261f; }
.section-heading h2,.truth-board h2 { margin:0; color:var(--paper); font-size:clamp(17px,2.5vw,25px); letter-spacing:.06em; text-transform:uppercase; }
.section-heading > span { color:var(--dim); font-size:8px; text-align:right; text-transform:uppercase; }
.mechanism-steps { display:grid; grid-template-columns:repeat(3,1fr); }
.mechanism-steps article { display:flex; gap:12px; min-height:130px; padding:18px; border-right:3px solid #09080c; background:#29242f; }
.mechanism-steps article:last-child { border-right:0; }
.mechanism-steps strong { color:var(--gold); font-size:32px; line-height:1; }
.mechanism-steps b { color:var(--paper); font-size:13px; text-transform:uppercase; }
.mechanism-steps p { margin:5px 0 0; color:var(--dim); font-size:9px; }

.workbench-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(350px,.75fr); }
#launchForm { padding:18px; border-right:4px solid #09080c; background:#24212b; }
fieldset { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin:0 0 15px; border:2px solid #4d4135; padding:14px; }
legend { padding:0 7px; color:var(--gold); font-size:9px; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }
label { display:grid; gap:5px; color:var(--paper); font-size:9px; font-weight:900; text-transform:uppercase; }
label small { color:var(--dim); font-size:7px; font-weight:400; text-transform:none; }
input { width:100%; min-height:45px; border:3px solid #09080c; border-radius:0; padding:8px 10px; background:#151318; color:var(--text); box-shadow:inset 2px 2px 0 rgba(255,255,255,.04); }
input:focus { border-color:var(--gold); }
input[type="checkbox"] { width:20px; min-height:20px; accent-color:var(--gold); }
.wide-fields { grid-template-columns:1fr; }
.acknowledgements { display:grid; gap:8px; margin-bottom:14px; border-left:4px solid var(--gold); padding:11px; background:#1c1920; }
.acknowledgements label { display:flex; grid-template-columns:none; align-items:flex-start; gap:9px; color:var(--dim); font-size:8px; line-height:1.45; text-transform:none; }
.primary-action { width:100%; min-height:55px; text-transform:uppercase; }
.form-status { margin:10px 0 0; color:var(--dim); font-size:8px; text-align:center; }
.form-status.error { color:#ffb6ae; }
.blueprint { min-width:0; padding:20px; background:repeating-linear-gradient(0deg,transparent 0 23px,rgba(160,205,225,.08) 23px 24px),repeating-linear-gradient(90deg,transparent 0 23px,rgba(160,205,225,.08) 23px 24px),var(--blueprint); color:#d4e8ed; }
.blueprint-title { display:flex; justify-content:space-between; gap:10px; border-bottom:2px solid #8cafbb; padding-bottom:7px; font-size:8px; letter-spacing:.1em; }
.blueprint h3 { margin:18px 0 12px; color:white; font-size:25px; text-transform:uppercase; }
.blueprint dl { margin:0; border:2px solid #8cafbb; }
.blueprint dl div { display:grid; grid-template-columns:130px minmax(0,1fr); border-bottom:1px solid #6d94a3; }
.blueprint dl div:last-child { border-bottom:0; }
.blueprint dt,.blueprint dd { margin:0; padding:8px; font-size:8px; overflow-wrap:anywhere; }
.blueprint dt { border-right:1px solid #6d94a3; color:#9ec3ce; text-transform:uppercase; }
.blueprint dd { color:white; font-weight:900; text-align:right; }
.blueprint-rule { margin-top:12px; border:1px solid #8cafbb; padding:9px; background:rgba(0,0,0,.14); }
.blueprint-rule b,.blueprint-rule span { display:block; }
.blueprint-rule b { color:white; font-size:8px; text-transform:uppercase; }
.blueprint-rule span { margin-top:3px; color:#b9d5dc; font-size:8px; }
#reviewWarning { margin:12px 0 0; border-left:4px solid var(--gold); padding:8px; background:rgba(0,0,0,.22); color:#f6e2a3; font-size:8px; }

.directory-summary { display:flex; justify-content:space-between; gap:14px; padding:10px 15px; border-bottom:2px solid #09080c; background:#19171d; color:var(--dim); font-size:8px; text-transform:uppercase; }
.directory-summary b { color:var(--gold); }
.collection-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; padding:14px; }
.collection-card,.empty-card { min-width:0; border:3px solid #09080c; padding:14px; background:#29242f; box-shadow:3px 3px 0 #09080c; }
.collection-card > header { display:flex; justify-content:space-between; gap:10px; padding-bottom:10px; border-bottom:2px solid #4d4135; }
.collection-card h3,.empty-card h3 { margin:0; color:var(--paper); font-size:16px; text-transform:uppercase; }
.collection-card header span { color:var(--gold); font-size:9px; font-weight:900; }
.collection-address { display:block; margin-top:4px; color:var(--dim); font-size:7px; overflow-wrap:anywhere; }
.collection-stats { display:grid; grid-template-columns:repeat(2,1fr); margin:11px 0; border:2px solid #09080c; }
.collection-stats div { padding:8px; border-right:1px solid #09080c; border-bottom:1px solid #09080c; background:#19171d; }
.collection-stats div:nth-child(even){border-right:0}.collection-stats div:nth-last-child(-n+2){border-bottom:0}
.collection-stats dt { color:var(--dim); font-size:7px; text-transform:uppercase; }
.collection-stats dd { margin:3px 0 0; color:var(--paper); font-size:10px; font-weight:900; }
.supply-bar { height:10px; border:2px solid #09080c; background:#151318; }
.supply-bar i { display:block; height:100%; background:var(--gold); }
.collection-note { min-height:32px; margin:8px 0; color:var(--dim); font-size:7px; }
.card-actions { display:grid; grid-template-columns:1fr auto; gap:7px; }
.card-actions input { min-width:0; min-height:40px; }
.card-actions button { min-height:40px; padding-inline:9px; font-size:8px; text-transform:uppercase; }
.card-actions .full { grid-column:1/-1; }
.owner-actions { display:flex; gap:7px; margin-top:7px; }
.owner-actions button,.owner-actions a { flex:1; min-height:34px; border:2px solid #4b4560; padding:6px; background:#211d27; color:var(--text); font-size:7px; font-weight:900; text-align:center; text-decoration:none; text-transform:uppercase; }
.empty-card { grid-column:1/-1; padding:35px; text-align:center; }
.empty-card > span { color:var(--gold); font-size:45px; }
.empty-card p { max-width:560px; margin:8px auto 0; color:var(--dim); font-size:9px; }

.truth-board { padding:17px; }
.truth-board > div { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:13px; }
.truth-board article { border:2px solid #4d4135; padding:11px; background:#29242f; }
.truth-board article b { color:var(--paper); font-size:9px; text-transform:uppercase; }
.truth-board article p { margin:5px 0 0; color:var(--dim); font-size:8px; }
.randomness-note { margin:12px 0 0; border-left:4px solid var(--red); padding:9px 11px; background:#2c1d1d; color:#f2c6b7; font-size:8px; }
.toast-log { position:fixed; z-index:300; right:14px; bottom:14px; display:grid; width:min(380px,calc(100vw - 28px)); gap:7px; pointer-events:none; }
.toast { border:3px solid #09080c; padding:10px 12px; background:var(--paper); box-shadow:4px 4px 0 #09080c; color:#211812; font-size:9px; font-weight:900; }
.toast.error { background:var(--red); color:white; }
footer { display:flex; align-items:end; justify-content:space-between; gap:20px; margin-top:30px; border-top:3px solid #09080c; padding:24px clamp(14px,3vw,30px); background:#211a18; color:var(--dim); }
footer b { color:var(--paper); }
footer p { margin:4px 0 0; font-size:9px; }
footer > div:last-child { display:grid; gap:4px; font-size:8px; text-align:right; text-transform:uppercase; }
.noscript { padding:16px; background:var(--red); color:white; text-align:center; }

@keyframes blink { 50% { opacity:.3; } }
@keyframes work { to { transform:translateY(-5px) rotate(1deg); } }

@media (max-width:1080px) {
  .hero { grid-template-columns:1fr; }
  .foundry-scene { min-height:360px; }
  .workbench-grid { grid-template-columns:1fr; }
  #launchForm { border-right:0; border-bottom:4px solid #09080c; }
  .collection-grid { grid-template-columns:repeat(2,1fr); }
  .truth-board > div { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:780px) {
  .topbar { flex-wrap:wrap; }
  .brand { width:100%; }
  .header-links { order:3; width:100%; display:grid; grid-template-columns:repeat(4,1fr); }
  .header-links a { justify-content:center; padding-inline:4px; }
  .wallet-button { position:absolute; top:10px; right:12px; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .mechanism-steps { grid-template-columns:1fr; }
  .mechanism-steps article { border-right:0; border-bottom:3px solid #09080c; }
  .mechanism-steps article:last-child { border-bottom:0; }
  .collection-grid { grid-template-columns:1fr; }
}
@media (max-width:520px) {
  .network-strip,.directory-summary { align-items:flex-start; flex-direction:column; }
  .hero-copy { min-height:360px; }
  .foundry-scene { min-height:300px; }
  .miner { width:105px; }
  fieldset { grid-template-columns:1fr; }
  .section-heading { align-items:flex-start; flex-direction:column; }
  .blueprint { padding:14px; }
  .blueprint dl div { grid-template-columns:100px minmax(0,1fr); }
  .truth-board > div { grid-template-columns:1fr; }
  footer { align-items:flex-start; flex-direction:column; }
  footer > div:last-child { text-align:left; }
}
@media (prefers-reduced-motion:reduce) { html{scroll-behavior:auto}.miner,.sparks,.network-strip i{animation:none!important} }
