/* ========== Theme tokens ========== */
:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --ink:#0f172a;
  --muted:#6b7280;
  --edge:#e5e7eb;
  --brand:#1e40af;
  --brand-ink:#0b1a5a;
  --accent:#0ea5e9;
}

/* ========== Base reset ========== */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--ink);
  background:radial-gradient(80rem 60rem at 70% -10%, #eef6ff 0%, var(--bg) 45%);
  line-height:1.5;
}

/* Reusable helpers */
.overline{color:var(--muted); letter-spacing:.2em; text-transform:uppercase; font-size:.75rem; margin:0 0 12px}
.muted{color:var(--muted)}
.small{font-size:.9rem}

/* ========== Top nav ========== */
.nav{
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 22px;
  background:rgba(255,255,255,.75);
  backdrop-filter:saturate(180%) blur(10px);
  border-bottom:1px solid var(--edge);
}

/* Brand (logo + wordmark) */
.brand{
  display:flex; align-items:center; gap:8px;
  font-weight:800; text-decoration:none; color:var(--ink);
}
.brand-text{ font-weight:800; letter-spacing:.8px; }

/* Circle M logo */
.logo-circle{
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; border-radius:50%;
  background:var(--brand); color:#fff; font-weight:800; font-size:.95rem;
  box-shadow:0 2px 6px rgba(2,6,23,.15);
}

/* Nav links */
.nav nav a{
  margin-left:14px; text-decoration:none; color:var(--ink); font-weight:600;
}
.nav nav a:hover{color:var(--brand)}

/* Dropdown */
.dropdown{ position:relative; display:inline-block; }
.dropbtn{
  background:transparent; border:none; cursor:pointer;
  font:inherit; color:var(--ink); font-weight:700; padding:8px 12px;
}
.dropbtn:hover{ color:var(--brand); }
.dropdown-content{
  display:none; position:absolute; background:#fff; min-width:200px;
  border:1px solid var(--edge); border-radius:12px;
  box-shadow:0 8px 16px rgba(2,6,23,.12); z-index:1000;
}
.dropdown-content a{
  display:block; padding:10px 14px; color:var(--ink); text-decoration:none;
}
.dropdown-content a:hover{ background:#f1f5f9; color:var(--brand) }
.dropdown:hover .dropdown-content{ display:block; }

/* ========== Buttons ========== */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 16px; border-radius:12px; border:1px solid var(--edge);
  background:#fff; color:var(--ink); text-decoration:none; font-weight:700;
  transition:transform .08s ease, box-shadow .2s ease, background .2s ease;
  box-shadow:0 1px 0 rgba(15,23,42,.04);
}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn.primary{background:linear-gradient(180deg,#e8f0ff,#dbeafe); color:var(--brand-ink); border-color:#cbd5e1}
.btn.ghost{background:transparent}
.btn.inline{padding:8px 10px}
/* button-specific small size */
.btn.small{padding:8px 12px; font-size:.92rem}

/* ========== Hero ========== */
.hero{ padding:80px 22px 40px; }
.hero-wrap{ max-width:1100px; margin:0 auto; position:relative; }
.hero h1{ font-size: clamp(2rem, 4vw, 4rem); line-height:1.05; margin:0 0 12px; }
.highlight{
  background:linear-gradient(90deg, var(--brand), var(--accent));
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.sub{max-width:720px; color:var(--muted); font-size:1.12rem}
.cta{display:flex; gap:12px; margin-top:18px}
.quick-join{margin-top:10px; color:var(--muted)}
.quick-join a{color:var(--brand); text-decoration:none}
.quick-join a:hover{text-decoration:underline}

.hero-marble{
  position:absolute; right:-40px; top:-30px; width:260px; height:260px;
  background:radial-gradient(circle at 30% 30%, #fff 0%, #eef2ff 50%, #dbeafe 100%);
  border-radius:50%; filter:blur(0.5px);
  box-shadow: inset 0 40px 60px rgba(30,64,175,.08), 0 28px 60px rgba(2,6,23,.08);
}

/* ========== Pillars / Cards ========== */
.pillars{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:18px; padding:24px 22px 10px; max-width:1100px; margin:0 auto;
}
.card{
  background:var(--card); border:1px solid var(--edge); border-radius:18px;
  padding:18px; box-shadow:0 6px 20px rgba(2,6,23,.04);
}
.pillar .emoji{font-size:26px; margin-bottom:6px}
.pillar h3{margin:6px 0 6px}

/* ========== Characters section (homepage) ========== */
.characters{ padding:30px 22px; max-width:1100px; margin:0 auto; }
.char-wrap{
  display:grid; grid-template-columns: 1.2fr 1fr; gap:18px; align-items:center;
}
.char-media{
  overflow:hidden; border-radius:16px; border:1px solid var(--edge); background:#f1f5f9;
}
.char-media img{ display:block; width:100%; height:auto; }
.char-copy h2{ margin:0 0 8px; }
.chips{ display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 14px; }
.chip{
  display:inline-block; padding:6px 10px; border-radius:999px; font-weight:700;
  background:#eef2ff; border:1px solid #c7d2fe; color:#1e3a8a; font-size:.85rem;
}
/* Mini character cards (e.g., MASU) */
.char-mini-grid{
  display:flex; flex-wrap:wrap; gap:12px; margin:10px 0 14px;
}
.char-card{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border:1px solid var(--edge);
  border-radius:14px;
  background:radial-gradient(140% 140% at 80% 0%, #ffffff 0%, #f6f9ff 45%, #eef2ff 100%);
  box-shadow:0 4px 14px rgba(2,6,23,.06);
}
.char-card .avatar{
  width:64px; height:64px; border-radius:12px;
  border:1px solid var(--edge);
  background:#fff; padding:6px; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}
.char-card .avatar img{ display:block; max-width:100%; max-height:100%; object-fit:contain; }
.char-card .name{ font-weight:800; line-height:1.2; }

/* Responsive */
@media (max-width: 900px){
  .char-wrap{ grid-template-columns: 1fr; }
}

/* ========== Timeline ========== */
.timeline{padding:30px 22px; max-width:1100px; margin:0 auto}
.timeline h2{margin-bottom:8px}
.steps{list-style:none; padding:0; margin:0; border-left:3px solid var(--edge)}
.steps li{padding:12px 12px 12px 16px; position:relative}
.steps li::before{content:""; position:absolute; left:-7px; top:18px; width:10px; height:10px; background:var(--brand); border-radius:50%}
.steps span{display:inline-block; min-width:64px; font-weight:700; margin-right:6px}

/* ========== Co-create area (polls) ========== */
.cocreate{padding:40px 22px 80px}
.cocreate-card{max-width:1000px; margin:0 auto}
.gate{display:grid; grid-template-columns:1fr auto; gap:10px; align-items:end; margin-top:10px}
.gate label{grid-column:1/-1; font-weight:600}
.gate input{
  border:1px solid var(--edge); border-radius:12px; padding:10px 12px; font-size:1rem;
}
.gate-hint{grid-column:1/-1; color:var(--muted); margin:6px 0 0; font-size:.9rem}
.hidden{display:none}

.polls-head{display:flex; align-items:baseline; gap:14px; margin:22px 0 10px}
.polls-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px}
.poll{padding:14px; border-radius:14px; border:1px solid var(--edge); background:#fff}
.poll h4{margin:6px 0 10px}
.poll .choices{display:grid; gap:8px}
.choice{display:flex; align-items:center; justify-content:space-between; gap:10px}
.choice button{border:1px solid var(--edge); background:#fff; border-radius:10px; padding:6px 10px; cursor:pointer}
.choice button[disabled]{opacity:.5; cursor:not-allowed}
.bar{height:10px; background:#eef2ff; border-radius:10px; overflow:hidden}
.fill{height:100%; width:0; background:linear-gradient(90deg,var(--brand),var(--accent))}
.badge-open{display:inline-block; padding:4px 8px; border-radius:999px; background:#ecfeff; border:1px solid #cffafe; color:#155e75; font-size:.76rem; font-weight:700}

/* Poll thumbnails */
.thumbs{ display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 6px; }
.thumb-img{
  width:74px; height:74px; object-fit:cover; border-radius:10px;
  border:1px solid var(--edge); box-shadow:0 2px 8px rgba(2,6,23,.06);
  cursor:pointer; background:#fff;
}

/* Lightbox (for poll thumbnails) */
#lb{ position:fixed; inset:0; display:none; z-index:9999; }
#lb.open{ display:block; }
.lb-backdrop{ position:absolute; inset:0; background:rgba(2,6,23,.6); }
.lb-panel{
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:min(92vw, 920px); background:#fff; border-radius:16px; overflow:hidden;
  box-shadow:0 24px 64px rgba(2,6,23,.3);
}
.lb-img{ display:block; width:100%; height:auto; background:#000; }
.lb-close{
  position:absolute; right:8px; top:8px; background:#fff; border:1px solid var(--edge);
  border-radius:10px; width:34px; height:34px; font-size:20px; cursor:pointer;
}
.lb-nav{ position:absolute; inset:auto 0 8px 0; display:flex; justify-content:space-between; padding:0 10px; }
.lb-prev,.lb-next{
  background:rgba(255,255,255,.95); border:1px solid var(--edge);
  border-radius:10px; width:40px; height:34px; cursor:pointer; font-size:22px; font-weight:800;
}

/* Suggestions box */
.suggest-box{margin-top:18px}
.suggest-box textarea{
  width:100%; border:1px solid var(--edge); border-radius:12px; padding:10px 12px;
}

/* Join boxes */
.join-build{ margin-top:26px; }
.public-join{ margin-top:18px; }
.join-grid{ display:grid; gap:18px; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); }
.join h4{ margin:6px 0 8px; }

/* ========== Rooms pages ========== */
.page-wrap{padding:24px 22px; max-width:1100px; margin:0 auto}
.page-wrap.narrow{max-width:900px}
.page-title{margin:8px 0 8px; font-size:clamp(1.6rem,3vw,2.2rem)}
.room-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px; margin-top:12px}
.room-thumb{
  background:#f1f5f9; border-radius:14px; height:160px;
  display:flex; align-items:center; justify-content:center; color:#64748b; font-weight:700;
  border:1px dashed #cbd5e1;
}
.room-top{display:flex; align-items:center; justify-content:space-between; gap:10px}
.badge{padding:4px 8px; border-radius:999px; font-size:.75rem; font-weight:700; border:1px solid var(--edge)}
.badge.proto{background:#fff7ed; border-color:#fed7aa; color:#9a3412}
.badge.wip{background:#f0f9ff; border-color:#bae6fd; color:#075985}
.badge.live{background:#ecfdf5; border-color:#a7f3d0; color:#065f46}
.room-actions{display:flex; gap:8px; margin-top:8px}

/* ========== About / stages ========== */
.stages-grid{
  display:grid; gap:18px;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
  margin:10px 0 18px;
}
.stage .kicker{
  display:inline-block; font-weight:800; font-size:.8rem; letter-spacing:.06em;
  text-transform:uppercase; color:#155e75;
  background:#ecfeff; border:1px solid #cffafe; border-radius:999px;
  padding:4px 10px; margin-bottom:8px;
}
.bullets{ padding-left:18px; }
.bullets li{ margin:6px 0; }

/* ========== Footer ========== */
.footer{margin-top:40px; padding:24px 22px; border-top:1px solid var(--edge); background:#fff}
.footer .footer-inner{max-width:1100px; margin:0 auto; display:flex; align-items:flex-start; justify-content:space-between}
.footer .foot-links a{display:block; color:var(--ink); text-decoration:none; margin:4px 0}
.footer .foot-links a:hover{color:var(--brand)}
.footer .tiny{color:var(--muted); text-align:center; margin-top:8px}
.footer.compact{background:transparent}
