* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #080d18;
  --card: #111927;
  --card-soft: #172130;
  --accent: #6c8cff;
  --accent-hover: #8aa2ff;
  --text: #f3f5f8;
  --muted: #9aa7b8;
  --gold: #f2b54a;
  --danger: #ef5f66;
  --success: #4cc38a;
  --border: #26344a;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
html { scroll-behavior: smooth; }
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(108, 140, 255, .16), transparent 32rem),
    radial-gradient(circle at 88% 12%, rgba(242, 181, 74, .09), transparent 28rem),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

.container { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 1rem 3rem; }
.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  min-height: 68px; padding: .9rem 1.5rem;
  background: rgba(9, 15, 26, .86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 50;
}
.nav .brand { font-weight: 800; font-size: 1.12rem; color: var(--gold); letter-spacing: .2px; white-space: nowrap; }
.nav-tabs { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav-tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .82rem; border-radius: 9px; color: var(--muted);
  font-size: .92rem; font-weight: 600; text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.nav-tab:hover { background: #1a2536; color: var(--text); text-decoration: none; }
.nav-tab.active { background: #1d2b42; color: #fff; }
.nav-tab.locked { color: #738198; cursor: not-allowed; }
.nav-tab.locked:hover { background: transparent; color: #738198; }
.lock-icon { width: 13px; height: 13px; opacity: .8; }
.nav .links { display: flex; gap: .75rem; align-items: center; }
.nav .links a { color: var(--text); font-size: .92rem; }
.nav .links button { background: transparent; border: none; color: var(--text); cursor: pointer; font: inherit; }
.user-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .65rem; border: 1px solid var(--border); border-radius: 999px;
  background: #111b2b; font-size: .84rem; white-space: nowrap;
}
.user-avatar { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; }
.user-fallback { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 800; }
.role-badge { padding: .12rem .45rem; border-radius: 4px; font-size: .68rem; text-transform: uppercase; font-weight: 800; margin-left: .25rem; }
.role-admin { background: var(--accent); color: #fff; }
.role-member { background: #26344a; color: var(--muted); }

.card {
  background: linear-gradient(180deg, rgba(23, 33, 48, .94), rgba(17, 25, 39, .94));
  border: 1px solid var(--border); border-radius: 14px;
  padding: 1.25rem; box-shadow: var(--shadow);
}
.card h2, .card h3 { line-height: 1.3; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.1rem; border: 1px solid transparent; border-radius: 9px;
  font-weight: 700; cursor: pointer; transition: transform .15s ease, background .18s ease, border-color .18s ease;
  font-size: .95rem; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-gold { background: var(--gold); color: #131a26; }
.btn-gold:hover { background: #ffc861; }
.btn-outline { background: transparent; border-color: #34445c; color: var(--text); }
.btn-outline:hover { border-color: #5d7392; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #07170f; }
.btn-sm { padding: .45rem .75rem; font-size: .84rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

form { display: grid; gap: 1rem; max-width: 520px; }
label { font-size: .82rem; color: var(--muted); display: block; margin-bottom: .3rem; font-weight: 700; letter-spacing: .2px; }
input, select, textarea {
  width: 100%; padding: .7rem .75rem; border-radius: 9px;
  border: 1px solid var(--border); background: #0b1322; color: var(--text);
  font-size: .95rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(108, 140, 255, .45); border-color: transparent; }

.alert { padding: .9rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; }
.alert-error { background: rgba(239, 95, 102, .12); color: #ffb4b8; border: 1px solid rgba(239, 95, 102, .45); }
.alert-success { background: rgba(76, 195, 138, .12); color: #a9e9c9; border: 1px solid rgba(76, 195, 138, .4); }
.empty { color: var(--muted); font-style: italic; font-size: .9rem; }

.home-layout {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
  gap: 1.75rem; align-items: start; margin-top: 2rem;
}
.home-hero h1 { font-size: clamp(2.1rem, 4vw, 3.5rem); margin: .7rem 0 1rem; color: var(--gold); letter-spacing: -.04em; }
.home-hero p { color: #c4cedb; font-size: 1.04rem; max-width: 58ch; }
.home-hero .eyebrow { color: #aeb9c9; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.home-actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.home-actions .btn-primary { background: linear-gradient(135deg, #61d6ff, #8b7bff); }
.home-actions .btn-primary:hover { background: linear-gradient(135deg, #7de0ff, #9d8fff); }
.home-actions .btn-outline { border-color: #36465e; }

.feature-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.feature-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; min-height: 122px; display: flex; flex-direction: column; gap: .5rem;
  transition: transform .18s ease, border-color .18s ease;
}
.feature-tile:hover { transform: translateY(-2px); border-color: #3e5372; }
.feature-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #1b2940; color: var(--gold); }
.feature-icon svg { width: 18px; height: 18px; }
.feature-tile h3 { font-size: .98rem; }
.feature-tile p { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.feature-tile.locked { opacity: .72; }
.feature-tile.locked .feature-icon { color: #8896aa; }
.feature-tile.locked h3 { color: #dbe3ee; }

.how-card { margin-top: 1.25rem; }
.how-card h2 { font-size: 1.15rem; margin-bottom: .9rem; }
.how-list { list-style: none; display: grid; gap: .55rem; counter-reset: step; }
.how-list li { display: flex; gap: .7rem; align-items: flex-start; color: #d5dde8; font-size: .94rem; }
.step-num {
  width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center;
  border-radius: 50%; background: #1e3355; color: #b9d2ff; font-size: .76rem; font-weight: 800;
  margin-top: .1rem;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin: 1.75rem 0 1.25rem; }
.page-head h1 { font-size: 1.7rem; letter-spacing: -.02em; }
.page-head p { color: var(--muted); max-width: 62ch; margin-top: .35rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { text-align: left; padding: .72rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.status { padding: .22rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.status-pending { background: rgba(242, 181, 74, .14); color: var(--gold); }
.status-approved { background: rgba(76, 195, 138, .14); color: var(--success); }
.status-rejected { background: rgba(239, 95, 102, .14); color: var(--danger); }

.login-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 2rem 1rem; }
.login-card { width: min(420px, 100%); text-align: center; padding: 2rem; }
.login-card h1 { font-size: 1.65rem; margin-bottom: .5rem; }
.login-card p { color: var(--muted); margin-bottom: 1.4rem; }
.discord-icon { width: 52px; height: 52px; margin: 0 auto 1rem; display: grid; place-items: center; border-radius: 14px; background: #5865f2; color: #fff; }
.discord-icon svg { width: 28px; height: 28px; }

.builder-shell { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 1.25rem; margin-top: 1.5rem; }
.hero-pool { display: grid; gap: .5rem; }
.hero-btn { border: 1px solid var(--border); padding: .6rem .7rem; border-radius: 9px; background: #0d1626; cursor: pointer; font-size: .86rem; text-align: left; color: var(--text); }
.hero-btn:hover { border-color: #43597a; }
.hero-btn.selected { border-color: var(--accent); background: #172a4a; }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: .65rem; margin: 1rem 0; }
.slot {
  border: 1px dashed #3d506b; min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px; font-size: .75rem; text-align: center; color: #8595aa; cursor: pointer; padding: .5rem;
  transition: border-color .15s ease, background .15s ease;
}
.slot:hover { border-color: #6c8cff; }
.slot.filled { border-style: solid; border-color: var(--accent); background: #14263f; color: #eaf0fa; font-weight: 700; }
.slot small { display: block; color: #8fa5c2; font-weight: 500; margin-top: .2rem; }
.locked-panel { text-align: center; padding: 2.5rem 1.5rem; }
.locked-panel .lock-icon { width: 28px; height: 28px; color: var(--gold); }
.locked-panel h2 { margin: .8rem 0 .4rem; }
.locked-panel p { color: var(--muted); max-width: 48ch; margin: 0 auto 1.25rem; }

.form-embed-card { padding: .75rem; }
.form-embed {
  width: 100%;
  min-height: 1400px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  display: block;
}

.debug-json { background: #0b1322; border: 1px solid var(--border); border-radius: 10px; padding: 1rem; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }

@media (max-width: 920px) {
  .home-layout { grid-template-columns: 1fr; }
  .feature-panel { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .builder-shell { grid-template-columns: 1fr; }
  .nav { align-items: flex-start; flex-direction: column; }
  .nav-tabs { width: 100%; overflow-x: auto; }
  .nav .links { width: 100%; justify-content: flex-end; }
}
@media (max-width: 560px) {
  .feature-panel { grid-template-columns: 1fr; }
  .slots { grid-template-columns: repeat(2, 1fr); }
}
