:root {
  --ink: #0b0a09;
  --ink-2: #13110f;
  --panel: rgba(255, 248, 235, 0.035);
  --line: rgba(233, 222, 200, 0.12);
  --line-2: rgba(233, 222, 200, 0.22);
  --text: #ece6da;
  --muted: #8f887b;
  --gold: #d8b779;
  --gold-2: #f1d9a6;
  --danger: #e38b78;
  --serif: "Cormorant", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

* { box-sizing: border-box; }
html { background: var(--ink); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(216, 183, 121, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(216, 183, 121, 0.06), transparent 60%),
    var(--ink);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
code { font: 400 0.86em var(--mono); color: var(--gold-2); }
a { color: inherit; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.beam {
  position: fixed; top: -30vh; right: 8vw; width: 36vw; height: 140vh; pointer-events: none;
  background: linear-gradient(180deg, rgba(241, 217, 166, 0.10), transparent 70%);
  transform: rotate(18deg); filter: blur(40px); opacity: 0.8;
  animation: sway 14s ease-in-out infinite alternate;
}
@keyframes sway { to { transform: rotate(24deg) translateX(-4vw); opacity: 0.5; } }

.eyebrow {
  margin: 0 0 10px; font: 600 11px/1 var(--sans); letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold);
}
.display {
  margin: 0; font: 400 clamp(44px, 6.4vw, 92px)/0.95 var(--serif); letter-spacing: -0.02em;
}
.display em { font-style: italic; color: var(--gold-2); }
.display.sm { font-size: clamp(28px, 3vw, 40px); line-height: 1.05; }
.muted { color: var(--muted); }
.lead { font-size: 17px; max-width: 34ch; margin: 22px 0 0; }

/* Mark */
.mark { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; margin-bottom: 26px; box-shadow: 0 0 40px rgba(216, 183, 121, 0.25); }
.mark span { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 18px var(--gold); }
.mark.sm { width: 30px; height: 30px; margin: 0; box-shadow: none; }
.mark.sm span { width: 8px; height: 8px; }

/* Buttons & fields */
.btn {
  appearance: none; border: 1px solid var(--line-2); background: transparent; color: var(--text);
  font: 500 14px/1 var(--sans); letter-spacing: 0.02em; padding: 14px 22px; border-radius: 999px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .dropzone:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a140a; border-color: transparent; font-weight: 600; }
.btn-gold:hover { box-shadow: 0 8px 30px rgba(216, 183, 121, 0.35); }
.btn-gold[disabled] { opacity: 0.6; cursor: progress; }
.btn-ghost { background: var(--panel); }
.btn.sm { padding: 9px 14px; font-size: 13px; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--muted); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { font: 500 12px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field em { font-style: normal; text-transform: none; letter-spacing: 0; opacity: 0.7; }
.field input {
  width: 100%; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
  font: 400 16px/1.2 var(--sans); padding: 14px 16px; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(216, 183, 121, 0.12); }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.slug-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(216, 183, 121, 0.12); }
.slug-input .prefix { font: 400 14px/1 var(--mono); color: var(--muted); padding: 0 2px 0 16px; display: flex; align-items: center; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.slug-input input { border: 0; background: transparent; font-family: var(--mono); font-size: 15px; padding-left: 0; box-shadow: none !important; color: var(--gold-2); }
.note { color: var(--muted); font-size: 13px; min-height: 1em; }
.note.warn { color: var(--gold); }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 0 0 14px; }

/* Gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px; position: relative; z-index: 1; }
.gate-card { width: min(440px, 100%); animation: rise 0.9s var(--ease) both; }
.gate-card .display { font-size: clamp(48px, 9vw, 72px); margin-bottom: 14px; }
.gate-card form { margin-top: 34px; }
.gate-card .btn { width: 100%; justify-content: center; }

/* Studio layout */
.studio { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.top { display: flex; justify-content: space-between; align-items: center; padding: 26px 0; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand strong { display: block; font: 500 15px/1.1 var(--sans); letter-spacing: 0.04em; }
.brand span { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.host-chip { display: inline-flex; align-items: center; gap: 8px; font: 400 12px/1 var(--mono); color: var(--muted); border: 1px solid var(--line); padding: 9px 12px; border-radius: 999px; }
.host-chip i { width: 7px; height: 7px; border-radius: 50%; background: #8fcf9a; box-shadow: 0 0 10px #8fcf9a; }

.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(28px, 5vw, 80px); align-items: center; padding: clamp(48px, 9vh, 110px) 0 clamp(40px, 7vh, 80px); }
.hero-copy > * { animation: rise 0.9s var(--ease) both; }
.hero-copy > *:nth-child(2) { animation-delay: 0.08s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.16s; }

.dropzone {
  position: relative; aspect-ratio: 1 / 0.92; border-radius: 28px; cursor: pointer; display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(216, 183, 121, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(255, 248, 235, 0.04), rgba(255, 248, 235, 0.01));
  border: 1px dashed var(--line-2); overflow: hidden;
  transition: border-color 0.3s, transform 0.4s var(--ease), background 0.3s;
  animation: rise 1s 0.2s var(--ease) both;
}
.dropzone:hover { border-color: rgba(216, 183, 121, 0.55); }
.dropzone.over, body.dragging .dropzone { border-color: var(--gold); border-style: solid; transform: scale(1.015); }
.dropzone.busy { pointer-events: none; }
.ring { position: absolute; width: 58%; aspect-ratio: 1; display: grid; place-items: center; top: 12%; }
.ring span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(216, 183, 121, 0.28); animation: pulse 4.5s var(--ease) infinite; }
.ring span:nth-child(2) { animation-delay: 1.5s; }
.ring span:nth-child(3) { animation-delay: 3s; }
.ring::after { content: ""; width: 22%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--gold-2), var(--gold) 45%, transparent 72%); box-shadow: 0 0 60px rgba(216, 183, 121, 0.6); transition: transform 0.4s var(--ease); }
.dropzone.over .ring::after, body.dragging .ring::after { transform: scale(1.5); }
.dropzone.busy .ring span { animation-duration: 1.2s; }
@keyframes pulse { 0% { transform: scale(0.35); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
.dz-text { position: absolute; bottom: 12%; text-align: center; display: grid; gap: 6px; }
.dz-text strong { font: 400 30px/1 var(--serif); }
.dz-text span { color: var(--muted); font-size: 14px; }

/* Sheet */
.sheet { margin: 0 0 64px; }
.sheet-card {
  position: relative; overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--radius); padding: clamp(22px, 3vw, 36px);
  background: linear-gradient(180deg, rgba(28, 24, 19, 0.9), rgba(16, 14, 12, 0.9)); backdrop-filter: blur(12px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); animation: rise 0.6s var(--ease) both;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.file-name { margin: 0; font: 400 15px/1.3 var(--mono); color: var(--text); word-break: break-all; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.done { text-align: left; }
.done-glow { position: absolute; right: -120px; top: -120px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(216, 183, 121, 0.35), transparent 65%); pointer-events: none; }
.link-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 22px 0 26px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, 0.35); }
.link-row a { font: 400 17px/1.3 var(--mono); color: var(--gold-2); text-decoration: none; flex: 1; min-width: 0; word-break: break-all; }
.link-row a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Library */
.library { padding: 12px 0 72px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.list { display: grid; }
.row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 120px auto; gap: 20px; align-items: center;
  padding: 20px 4px; border-bottom: 1px solid var(--line); transition: background 0.25s; animation: rise 0.5s var(--ease) both;
}
.row:hover { background: rgba(255, 248, 235, 0.02); }
.row.over { background: rgba(216, 183, 121, 0.08); outline: 1px dashed var(--gold); outline-offset: -1px; }
.row-title { font: 400 24px/1.1 var(--serif); margin: 0 0 4px; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-link { font: 400 13px/1.3 var(--mono); color: var(--gold-2); text-decoration: none; word-break: break-all; }
.row-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.stat { font-size: 13px; color: var(--muted); line-height: 1.4; }
.stat b { display: block; font: 400 22px/1 var(--serif); color: var(--text); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.empty { padding: 56px 0; text-align: center; color: var(--muted); }
.empty strong { display: block; font: 400 28px/1.2 var(--serif); color: var(--text); margin-bottom: 6px; }
.skeleton { height: 86px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, rgba(255, 248, 235, 0.04), transparent); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Domain */
.domain { padding-bottom: 64px; }
.domain-card { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(24px, 5vw, 72px); padding: clamp(24px, 4vw, 48px); border: 1px solid var(--line); border-radius: 24px; background: var(--panel); }
.domain-card .muted { max-width: 38ch; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 18px; }
.steps li { counter-increment: s; position: relative; padding-left: 52px; color: #cfc8ba; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: -2px; font: 400 26px/1 var(--serif); color: var(--gold); }
.steps b { color: var(--text); font-weight: 500; }

.foot { padding: 28px 0 40px; border-top: 1px solid var(--line); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #f1e7d2; color: #1a140a; padding: 12px 18px; border-radius: 999px; font-weight: 500; font-size: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); transition: opacity 0.3s, transform 0.4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .hero, .domain-card { grid-template-columns: 1fr; }
  .dropzone { aspect-ratio: 1 / 0.8; }
  .row { grid-template-columns: 1fr auto; }
  .row .row-linkcell { grid-column: 1 / -1; order: 3; }
  .row .row-actions { grid-column: 1 / -1; justify-content: flex-start; order: 4; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .host-chip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
