@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Space+Mono:ital@0;1&display=swap');

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:         #08070c;
  --bg-card:    #12101a;
  --bg-card2:   #1a1626;
  --border:     rgba(255,255,255,.07);
  --border2:    rgba(255,255,255,.13);
  --text:       #f3eef7;
  --text-muted: #9c93b0;
  --text-dim:   #564f6b;
  --gold:       #f5b942;
  --red:        #e63946;
  --violet:     #9b5de5;
  --cyan:       #00f5d4;
  --green:      #56cfa1;
  --radius:     12px;
  --radius-sm:  6px;
  --font:       'Space Grotesk', system-ui, sans-serif;
  --font-mono:  'Space Mono', monospace;
  --nav-h:      62px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.6; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--gold); color: #000; padding: .4rem .8rem;
  border-radius: var(--radius-sm); font-size: .85rem; z-index: 999;
}
.skip-link:focus { top: 1rem; }

/* Orbs */
body::before, body::after {
  content: ''; position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%; filter: blur(120px);
}
body::before { width: 600px; height: 600px; top: -15%; left: -10%; background: rgba(245,185,66,.10); }
body::after  { width: 500px; height: 500px; bottom: -10%; right: -10%; background: rgba(230,57,70,.10); }

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  background: rgba(8,7,12,.8); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--gold), var(--red));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a {
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); transition: color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-btn {
  background: transparent; border: 1px solid var(--border2);
  color: var(--text-muted); padding: .3rem .75rem; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .75rem; font-weight: 600;
  letter-spacing: .06em; cursor: pointer; transition: all .2s;
}
.nav-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ─── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: clamp(5rem, 12vw, 9rem) clamp(1.25rem, 4vw, 3rem) clamp(3.5rem, 6vw, 5rem);
  display: flex; flex-direction: column; gap: 1.75rem;
  position: relative; z-index: 1; border-bottom: 1px solid var(--border);
}
.hero-label {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em;
  color: var(--gold); font-style: italic;
}
.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 5.5rem); font-weight: 800;
  line-height: 1.05; letter-spacing: -.03em; max-width: 18ch;
}
.hero h1 em {
  font-style: italic; font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--red));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: clamp(.9rem, 1.6vw, 1.1rem); color: var(--text-muted); max-width: 52ch; line-height: 1.85; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: linear-gradient(135deg, var(--gold), var(--red));
  color: #1a0d00; border: none; padding: .85rem 1.75rem; border-radius: var(--radius);
  font-family: var(--font); font-size: .88rem; font-weight: 700; letter-spacing: .04em;
  cursor: pointer; transition: opacity .2s, transform .15s;
  box-shadow: 0 0 32px rgba(245,185,66,.25);
}
.btn-primary:hover { opacity: .92; transform: translateY(-1px); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.75rem; border-radius: var(--radius);
  font-family: var(--font); font-size: .88rem; font-weight: 700; letter-spacing: .04em;
  border: 1px solid var(--border2); color: var(--text-muted);
  transition: border-color .2s, color .2s;
}
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

/* ─── How it works ────────────────────────────────────────────────────────── */
.how-section { padding: clamp(3.5rem,6vw,5rem) clamp(1.25rem,4vw,3rem); border-bottom: 1px solid var(--border); position: relative; z-index: 1; }
.section-label { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; color: var(--gold); margin-bottom: 1rem; }
.how-section h2 { font-size: clamp(1.8rem,3.5vw,2.8rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: 3rem; }
.how-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 1.5rem; }
.how-step { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; display: flex; flex-direction: column; gap: .75rem; transition: border-color .2s; }
.how-step:hover { border-color: var(--border2); }
.how-num { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 700; background: linear-gradient(135deg, var(--gold), var(--red)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.how-step strong { font-size: 1.05rem; font-weight: 700; }
.how-step p { font-size: .88rem; color: var(--text-muted); line-height: 1.75; }

/* ─── Filters ─────────────────────────────────────────────────────────────── */
.filters { padding: 1.25rem clamp(1.25rem,4vw,3rem); display: flex; align-items: center; gap: .75rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; position: relative; z-index: 1; }
.filters input[type="search"] { flex: 1; min-width: 180px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: .55rem 1rem; font-family: var(--font); font-size: .88rem; transition: border-color .2s; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--gold); }
.filters select { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: .55rem .9rem; font-family: var(--font); font-size: .85rem; cursor: pointer; }
.models-count { margin-left: auto; font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim); }

/* ─── Grid + movie card ───────────────────────────────────────────────────── */
.movies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 1.25rem; padding: 2.5rem clamp(1.25rem,4vw,3rem); position: relative; z-index: 1; }
.movie-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: .8rem; transition: border-color .2s, transform .2s, box-shadow .2s; position: relative; overflow: hidden; }
.movie-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--gold), var(--red)); opacity: 0; transition: opacity .2s; }
.movie-card:hover { border-color: var(--border2); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.movie-card:hover::before { opacity: 1; }
.movie-cat-tag { display: inline-flex; align-self: flex-start; background: rgba(245,185,66,.12); color: var(--gold); font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: .2rem .7rem; border-radius: 20px; border: 1px solid rgba(245,185,66,.2); }
.movie-title { font-size: 1.15rem; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
.movie-source { font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim); }
.movie-plot { font-size: .88rem; color: var(--text-muted); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.movie-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: .5rem; }
.movie-link-btn { color: var(--gold); font-size: .78rem; font-weight: 600; padding: .5rem .9rem; border: 1px solid rgba(245,185,66,.25); border-radius: var(--radius-sm); transition: background .2s; }
.movie-link-btn:hover { background: rgba(245,185,66,.08); }

/* ─── Funding bar ─────────────────────────────────────────────────────────── */
.fund-bar { height: 8px; background: var(--bg-card2); border-radius: 20px; overflow: hidden; }
.fund-bar.big { height: 12px; }
.fund-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); border-radius: 20px; transition: width .4s ease; }
.fund-meta { display: flex; align-items: center; gap: .75rem; font-size: .78rem; color: var(--text-muted); flex-wrap: wrap; }
.fund-meta.big { font-size: .9rem; margin-top: .5rem; }
.fund-pct { font-family: var(--font-mono); font-weight: 700; color: var(--gold); }
.fund-amt { color: var(--text-muted); }
.fund-backers { margin-left: auto; color: var(--text-dim); }

/* ─── Status pill ─────────────────────────────────────────────────────────── */
.status-pill { font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: .2rem .6rem; border-radius: 20px; border: 1px solid var(--border2); color: var(--text-muted); }
.status-active        { color: var(--gold);  border-color: rgba(245,185,66,.4); background: rgba(245,185,66,.08); }
.status-funded        { color: var(--green); border-color: rgba(86,207,161,.4); background: rgba(86,207,161,.08); }
.status-in_production { color: var(--cyan);  border-color: rgba(0,245,212,.4);  background: rgba(0,245,212,.08); }
.status-released      { color: var(--red);   border-color: rgba(230,57,70,.4);  background: rgba(230,57,70,.08); }

/* ─── Detail page ─────────────────────────────────────────────────────────── */
.detail-main { max-width: 980px; margin: 0 auto; padding: 2.5rem clamp(1.25rem,4vw,3rem); display: grid; grid-template-columns: 1.6fr 1fr; gap: 2rem; position: relative; z-index: 1; align-items: start; }
.detail-title { font-size: clamp(1.8rem,4vw,3rem); font-weight: 800; letter-spacing: -.03em; margin: .5rem 0; }
.detail-source { font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); }
.detail-creator { font-size: .85rem; color: var(--text-muted); margin: .3rem 0 .6rem; }
.detail-plot { font-size: 1rem; color: var(--text-muted); line-height: 1.85; margin: 1.25rem 0; }
.detail-specs { display: flex; flex-wrap: wrap; gap: .5rem .9rem; font-size: .82rem; color: var(--text-muted); }
.genre-pill { background: rgba(155,93,229,.12); color: var(--violet); border: 1px solid rgba(155,93,229,.22); padding: .1rem .55rem; border-radius: 20px; font-size: .72rem; }

.side-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(var(--nav-h) + 1rem); }
.panel-title { font-size: .95rem; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.mock-note { font-size: .76rem; color: var(--gold); background: rgba(245,185,66,.07); border: 1px solid rgba(245,185,66,.2); border-radius: var(--radius-sm); padding: .5rem .7rem; }
.my-pledge { font-size: .85rem; color: var(--text-muted); }
.closed-note { font-size: .85rem; color: var(--text-dim); }
.amount-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { background: var(--bg-card2); border: 1px solid var(--border2); color: var(--text-muted); padding: .35rem .8rem; border-radius: 20px; font-family: var(--font); font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--gold); color: var(--gold); }
.pledge-form { display: flex; flex-direction: column; gap: .9rem; }

/* ─── Vote panel ──────────────────────────────────────────────────────────── */
.vote-section { grid-column: 1 / -1; }
.vote-section h2 { font-size: 1.4rem; font-weight: 800; margin: 1rem 0; letter-spacing: -.02em; }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 1.25rem; }
.vote-topic { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.vote-topic h3 { font-size: .95rem; font-weight: 700; margin-bottom: .75rem; }
.vote-options { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.vote-opt { background: var(--bg-card2); border: 1px solid var(--border2); color: var(--text-muted); padding: .3rem .7rem; border-radius: var(--radius-sm); font-family: var(--font); font-size: .76rem; cursor: pointer; transition: all .15s; }
.vote-opt:hover { border-color: var(--gold); color: var(--gold); }
.vote-tally { display: flex; flex-direction: column; gap: .35rem; }
.tally-row { display: grid; grid-template-columns: 1fr 2fr auto; align-items: center; gap: .5rem; font-size: .74rem; color: var(--text-dim); }
.tally-row.leading .tally-opt { color: var(--gold); font-weight: 600; }
.tally-bar { height: 6px; background: var(--bg-card2); border-radius: 20px; overflow: hidden; }
.tally-bar div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); }
.tally-w { font-family: var(--font-mono); }

/* ─── Production ──────────────────────────────────────────────────────────── */
.prod-main { max-width: 820px; margin: 0 auto; padding: 2.5rem clamp(1.25rem,4vw,3rem); display: flex; flex-direction: column; gap: 1.5rem; position: relative; z-index: 1; }
.back-link { font-size: .82rem; color: var(--gold); }
.prod-step { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--text-dim); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.prod-step.status-done    { border-left-color: var(--green); }
.prod-step.status-running { border-left-color: var(--cyan); }
.prod-step.status-failed  { border-left-color: var(--red); }
.prod-step-head { display: flex; align-items: center; gap: .6rem; }
.prod-icon { font-size: 1.1rem; }
.prod-status { margin-left: auto; font-family: var(--font-mono); font-size: .7rem; color: var(--text-dim); text-transform: uppercase; }
.step-output { margin-top: .75rem; font-size: .85rem; color: var(--text-muted); line-height: 1.7; white-space: pre-wrap; }
.step-output.muted { color: var(--text-dim); font-style: italic; }
.step-output.error { color: var(--red); }
.step-output-link { color: var(--gold); }

/* ─── Auth ────────────────────────────────────────────────────────────────── */
.auth-main { min-height: calc(100vh - var(--nav-h)); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 24px 80px rgba(0,0,0,.5); overflow: hidden; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab { flex: 1; padding: 1rem; background: transparent; border: none; color: var(--text-muted); font-family: var(--font); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: color .2s; }
.auth-tab.active { color: var(--text); border-bottom: 2px solid var(--gold); margin-bottom: -1px; }
.auth-form { padding: 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.auth-form.hidden { display: none; }
.auth-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }

/* ─── Fields ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.field input, .field select, .field textarea { background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: .65rem .9rem; font-family: var(--font); font-size: .9rem; transition: border-color .2s; width: 100%; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-dim); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); background: rgba(245,185,66,.05); }
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: flex; gap: .75rem; }
.field-row .field { flex: 1; }
.form-status { font-size: .82rem; min-height: 1.2em; font-weight: 500; }
.form-status.error { color: var(--red); }
.form-status.ok { color: var(--green); }

/* ─── Propose form ────────────────────────────────────────────────────────── */
.form-main { max-width: 720px; margin: 0 auto; padding: 3rem clamp(1.25rem,4vw,3rem); position: relative; z-index: 1; }
.form-main h1 { font-size: clamp(2rem,4vw,3rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: 2rem; }
.propose-form { display: flex; flex-direction: column; gap: 1.25rem; }
.genre-box { display: flex; flex-wrap: wrap; gap: .5rem; }
.genre-check { display: inline-flex; align-items: center; gap: .35rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: .3rem .8rem; font-size: .78rem; color: var(--text-muted); cursor: pointer; }
.budget-box { background: var(--bg-card); border: 1px solid var(--gold); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.budget-box h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); }
.budget-row { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-muted); }
.budget-total-row { border-top: 1px solid var(--border); padding-top: .5rem; margin-top: .25rem; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.budget-total-row span:last-child { color: var(--gold); font-family: var(--font-mono); }

/* ─── Dashboard ───────────────────────────────────────────────────────────── */
.dash-main { max-width: 760px; margin: 0 auto; padding: 3rem clamp(1.25rem,4vw,3rem); display: flex; flex-direction: column; gap: 3rem; position: relative; z-index: 1; }
.dash-title { font-size: clamp(2.2rem,5vw,3.5rem); font-weight: 800; letter-spacing: -.04em; }
.dash-section-title { font-size: 1.05rem; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: .65rem; margin-bottom: 1.25rem; }
.my-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.1rem 1.25rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; transition: border-color .2s; }
.my-item:hover { border-color: var(--border2); }
.my-item-body { flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.my-item-title { font-size: 1rem; font-weight: 700; }
.my-item-title:hover { color: var(--gold); }
.delete-btn { background: transparent; border: 1px solid var(--border); color: var(--text-dim); width: 30px; height: 30px; border-radius: 50%; font-size: 1rem; cursor: pointer; flex-shrink: 0; transition: all .2s; }
.delete-btn:hover { border-color: var(--red); color: var(--red); }

/* ─── Toast / states / footer ─────────────────────────────────────────────── */
.toast { position: fixed; bottom: 2rem; right: 2rem; z-index: 600; padding: .8rem 1.5rem; border-radius: var(--radius); font-size: .85rem; font-weight: 600; box-shadow: 0 8px 32px rgba(0,0,0,.4); animation: toastIn .25s ease; }
.toast.ok { background: var(--gold); color: #1a0d00; }
.toast.error { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.empty-state, .loading-state { grid-column: 1/-1; padding: 4rem 2rem; text-align: center; color: var(--text-dim); font-size: .9rem; font-family: var(--font-mono); }
.empty-state a { color: var(--gold); }
.muted { color: var(--text-dim); font-size: .85rem; }
footer { padding: 2rem clamp(1.25rem,4vw,3rem); border-top: 1px solid var(--border); display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1.5rem; font-size: .78rem; color: var(--text-dim); margin-top: 4rem; position: relative; z-index: 1; }
footer a { color: var(--gold); }
footer a:hover { color: var(--red); }

.reveal { opacity: 0; transform: translateY(20px); transition: opacity .4s ease, transform .4s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 760px) {
  .detail-main { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}
@media (max-width: 640px) {
  .movies-grid { grid-template-columns: 1fr; padding: 1.5rem 1rem; }
  .field-row { flex-direction: column; }
  .nav-links { gap: .75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ✨ on-device AI helper button (Gemini Nano) — hidden until nano available */
.ai-btn {
  margin-top: 8px;
  padding: 6px 12px;
  font-size: .85rem;
  background: rgba(155,93,229,.14);
  color: #b98bee;
  border: 1px solid rgba(155,93,229,.4);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.ai-btn:hover:not(:disabled) { background: rgba(155,93,229,.26); }
.ai-btn:disabled { opacity: .5; cursor: default; }
