@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800;900&family=Spectral:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0d0c;
  --bg-2: #0e1211;
  --surface: #121815;
  --surface-2: #182019;
  --border: rgba(201, 162, 39, 0.16);
  --border-strong: rgba(201, 162, 39, 0.42);
  --text: #e9e2d0;
  --text-dim: #a49a83;
  --text-faint: #6f6754;
  --accent: #c9a227;
  --accent-hover: #e8c96a;
  --accent-ink: #17120a;
  --gold: #c9a227;
  --gold-light: #e8c96a;
  --gold-pale: #f3dc95;
  --gold-dark: #8a671a;
  --success: #5fbf7a;
  --warn: #e8b45a;
  --danger: #e07a5f;
  --discord: #5865f2;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; background-color: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  background:
    var(--noise),
    radial-gradient(ellipse 60% 42% at 78% 6%, rgba(46, 88, 66, 0.16), transparent 60%),
    radial-gradient(ellipse 55% 40% at 12% 92%, rgba(26, 60, 70, 0.14), transparent 60%),
    linear-gradient(180deg, #0b0f0d 0%, #0a1210 45%, #080c0b 100%);
  color: var(--text);
  font-family: 'Spectral', Georgia, 'Times New Roman', serif;
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Cinzel', Georgia, serif; }

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold-pale); }
img { max-width: 100%; display: block; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ===== Nav ===== */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(8, 10, 9, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-bar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(201, 162, 39, 0.5) 50%, transparent 95%);
}

nav {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 26px;
  max-width: 900px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}
.brand img {
  width: 40px;
  height: 40px;
  -webkit-mask-image: radial-gradient(circle closest-side at 50% 50%, #000 74%, transparent 98%);
  mask-image: radial-gradient(circle closest-side at 50% 50%, #000 74%, transparent 98%);
  filter: drop-shadow(0 0 10px rgba(201, 162, 39, 0.3));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text .b1 {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold) 60%, var(--gold-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text .b2 {
  font-family: 'Cinzel', serif;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.4em;
  color: var(--text-dim);
  margin-top: 2px;
}

nav a.navlink {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  position: relative;
  padding: 6px 0;
  transition: color 0.15s ease;
}
nav a.navlink::after {
  content: "";
  position: absolute;
  left: 50%; right: 50%; bottom: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  transition: left 0.2s ease, right 0.2s ease;
}
nav a.navlink:hover { color: var(--gold-light); }
nav a.navlink:hover::after, nav a.navlink.active::after { left: 0; right: 0; }
nav a.navlink.active { color: var(--gold-light); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-pale) 0%, var(--gold-light) 20%, var(--gold) 55%, var(--gold-dark) 100%);
  color: var(--accent-ink);
  border-color: #060503;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 246, 215, 0.6), 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 22px rgba(201, 162, 39, 0.16);
}
.btn-primary:hover { color: var(--accent-ink); }

.btn-outline { background: rgba(201, 162, 39, 0.05); border-color: var(--border-strong); color: var(--gold-light); }
.btn-outline:hover { background: rgba(201, 162, 39, 0.12); color: var(--gold-pale); }

.btn-discord {
  background: linear-gradient(180deg, #6d79ff 0%, var(--discord) 45%, #3a44bd 100%);
  color: #fff; border-color: #060503;
  box-shadow: inset 0 1px 0 rgba(220, 225, 255, 0.4), 0 4px 14px rgba(0, 0, 0, 0.5);
}
.btn-discord:hover { color: #fff; }

.btn-danger-outline { background: transparent; border-color: rgba(224, 122, 95, 0.4); color: var(--danger); }
.btn-danger-outline:hover { border-color: var(--danger); }

.btn-sm { padding: 8px 15px; font-size: 0.7rem; }

/* ===== Dashboard header ===== */
.dash-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 12px;
}
.eyebrow {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.dash-header h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold) 62%, var(--gold-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
}
.dash-header .flank {
  display: flex; align-items: center; gap: 16px; margin-top: 6px;
}
.dash-header .flank::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

/* ===== Panels ===== */
.panel {
  max-width: 720px;
  margin: 0 auto 18px;
  padding: 26px;
  position: relative;
  background:
    var(--noise),
    radial-gradient(ellipse 100% 40% at 50% 0%, rgba(46, 88, 66, 0.12), transparent 65%),
    linear-gradient(170deg, #151b18 0%, #101412 55%, #0c0f0e 100%);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(232, 201, 106, 0.07), 0 12px 28px rgba(0, 0, 0, 0.45);
}
.panel::before {
  content: "";
  position: absolute; inset: 6px;
  border: 1px solid rgba(201, 162, 39, 0.1);
  border-radius: 8px;
  pointer-events: none;
}
.panel > * { position: relative; }
.panel h2 {
  font-size: 1.02rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--gold-light); margin-bottom: 4px;
}
.panel .sub { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 18px; }

/* ===== Profile row / badges ===== */
.profile-row { display: flex; align-items: center; gap: 14px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--border-strong); box-shadow: 0 0 14px rgba(201, 162, 39, 0.15); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: rgba(95, 191, 122, 0.12); color: var(--success); border: 1px solid rgba(95, 191, 122, 0.3); }
.badge-inactive { background: rgba(164, 154, 131, 0.1); color: var(--text-dim); border: 1px solid rgba(164, 154, 131, 0.22); }
.badge-warn { background: rgba(232, 180, 90, 0.13); color: var(--warn); border: 1px solid rgba(232, 180, 90, 0.3); }
.badge-danger { background: rgba(224, 122, 95, 0.13); color: var(--danger); border: 1px solid rgba(224, 122, 95, 0.3); }

/* ===== Row list (plan facts) ===== */
.fact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(201, 162, 39, 0.1);
  font-size: 0.94rem;
}
.fact-row:last-child { border-bottom: none; }
.fact-row .k { color: var(--text-dim); }
.fact-row .v { font-weight: 600; color: var(--text); }
.fact-row .v.gold { color: var(--gold-light); }
.fact-row .v.success { color: var(--success); }

/* ===== Auth code box ===== */
.code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(4, 8, 6, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 0.94rem;
  color: var(--gold-light);
  word-break: break-all;
}
.code-box.masked { color: var(--text-faint); letter-spacing: 0.12em; }

/* ===== CTA rows ===== */
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Tier grid (membership page) ===== */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 4px 0 8px;
}
.tier-card {
  position: relative;
  padding: 24px 12px 20px;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(170deg, #141a17, #0e1210);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(232, 201, 106, 0.06);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.tier-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.tier-card.selected {
  border-color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(232, 201, 106, 0.14), 0 0 0 1px var(--gold), 0 0 26px rgba(201, 162, 39, 0.2);
}
.tier-card .tier-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-family: 'Cinzel', serif; font-size: 0.56rem; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
  padding: 3px 11px; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold) 60%, var(--gold-dark));
  color: var(--accent-ink); border: 1px solid #060503;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}
.tier-card .tier-count {
  font-family: 'Cinzel', serif; font-size: 2rem; font-weight: 900; line-height: 1.1;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold) 60%, var(--gold-dark));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tier-card .tier-unit {
  font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
  margin: 4px 0 10px;
}
.tier-card .tier-price { font-size: 1.18rem; font-weight: 600; color: var(--text); }
.tier-card .tier-price span { font-size: 0.78rem; color: var(--text-dim); }
.tier-card .current-tag {
  margin-top: 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--success);
}
.tier-card .current-tag::before { content: "● "; }

/* ===== SDN script catalog ===== */
.sdn-toolbar {
  max-width: 1060px;
  margin: 0 auto 22px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.sdn-toolbar input, .sdn-toolbar select {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: rgba(4, 8, 6, 0.6);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: 'Spectral', serif;
  font-size: 0.95rem;
}
.sdn-toolbar input { flex: 1 1 260px; }
.sdn-toolbar input::placeholder { color: var(--text-faint); }
.sdn-toolbar select { flex: 0 0 auto; cursor: pointer; }

.script-grid {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.script-card {
  position: relative;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(170deg, #151b18, #0e1210);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(232, 201, 106, 0.06), 0 10px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.script-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(232, 201, 106, 0.1), 0 16px 32px rgba(0, 0, 0, 0.5), 0 0 26px rgba(201, 162, 39, 0.12);
}
.script-card .sc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.script-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--gold-light); }
.script-card .sc-version {
  font-family: 'Consolas', monospace;
  font-size: 0.74rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.script-card .sc-meta { font-size: 0.8rem; color: var(--text-dim); }
.script-card .sc-meta b { color: var(--text); font-weight: 600; }
.script-card .sc-desc { font-size: 0.9rem; color: var(--text); line-height: 1.5; }
.script-card .sc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.script-card .chip {
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--gold-light);
  background: rgba(201, 162, 39, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}
.script-card .sc-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(201, 162, 39, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.script-card .sc-access {
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.sdn-empty {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.98rem;
}
.sdn-empty.error { color: var(--danger); }

/* ===== Status / spinner / alerts ===== */
.status-line { text-align: center; color: var(--text-dim); padding: 110px 24px; }
.status-line.error { color: var(--danger); }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.alert {
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 0.9rem;
  margin: 0 auto 18px; max-width: 720px;
}
.alert-success { background: rgba(95, 191, 122, 0.1); color: var(--success); border: 1px solid rgba(95, 191, 122, 0.28); }
.alert-warn { background: rgba(232, 180, 90, 0.1); color: var(--warn); border: 1px solid rgba(232, 180, 90, 0.28); }

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 40px 24px 46px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
}
footer .fine { color: var(--text-dim); font-size: 0.84rem; max-width: 560px; margin: 0 auto; }
footer .fine b { color: var(--text); }
footer .marks { color: var(--text-faint); font-size: 0.76rem; margin-top: 14px; letter-spacing: 0.03em; }

/* ===== Admin-specific (kept from admin.html usage) ===== */
.status-line, .spinner { font-family: 'Spectral', serif; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  nav { flex-wrap: wrap; gap: 14px; padding: 12px 18px; }
  .tier-grid { grid-template-columns: 1fr 1fr; }
}
