/* MasqueHall — masquerade ball theme: midnight velvet, antique gold, wine red. */
:root {
  --bg: #120c1a;
  --bg-glow: #2a1838;
  --surface: #1c1426;
  --surface-2: #241a31;
  --border: #3a2c48;
  --border-gold: rgba(212, 175, 55, 0.35);
  --text: #f3ead8;
  --muted: #a99bb5;
  --gold: #d4af37;
  --gold-light: #f0d78c;
  --gold-dark: #9a7420;
  --wine: #9b1e45;
  --wine-soft: rgba(155, 30, 69, 0.18);
  --up: #f0d78c;
  --down: #c27bd8;
  --success: #7fd1a8;
  --danger: #f08a9c;
  --radius: 12px;
  --display: 'Cinzel', 'Times New Roman', serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-glow), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M24 4l6 20-6 20-6-20z' fill='none' stroke='%23d4af37' stroke-opacity='0.05'/%3E%3Ccircle cx='0' cy='24' r='1.5' fill='%23d4af37' fill-opacity='0.06'/%3E%3Ccircle cx='48' cy='24' r='1.5' fill='%23d4af37' fill-opacity='0.06'/%3E%3C/svg%3E");
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold); color: #1a1022; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 20px;
  background: rgba(18, 12, 26, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-gold);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .logo { width: 40px; height: 22px; color: var(--gold); flex-shrink: 0; }
.brand .logo svg { width: 100%; height: 100%; display: block; }
.brand .wordmark {
  font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: 2px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 60%, var(--gold-dark));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.search {
  flex: 1; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,.12); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
.search input::placeholder { color: var(--muted); }
.search i { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border-gold); background: transparent; color: var(--text);
  cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 14px;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: rgba(212,175,55,.08); border-color: var(--gold); }
.btn:active { transform: scale(.98); }
.btn.primary {
  border: 0; color: #24160a;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 55%, #b8902a);
  box-shadow: 0 2px 12px rgba(212,175,55,.25), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 8px; font-size: 22px; color: var(--muted); }
.icon-btn:hover { color: var(--gold); }
.menu-btn { display: none; }
.auth { display: flex; align-items: center; gap: 8px; }

/* ---------- layout ---------- */
.layout { display: flex; max-width: 1180px; margin: 0 auto; }
.sidebar {
  width: 230px; flex-shrink: 0; padding: 20px 14px;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
  border-right: 1px solid var(--border);
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 2px; border-radius: 10px;
  color: var(--muted); font-size: 14px; transition: color .15s, background .15s;
}
.sidebar a i { font-size: 18px; }
.sidebar a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.sidebar a.active {
  color: var(--gold-light); background: linear-gradient(90deg, rgba(212,175,55,.16), transparent);
  box-shadow: inset 2px 0 0 var(--gold);
}
.sidebar hr { border: 0; height: 1px; margin: 14px 6px; background: linear-gradient(90deg, transparent, var(--border-gold), transparent); }
.sidebar .me { font-size: 12px; color: var(--muted); padding: 4px 12px; }
.sidebar .me strong { display: block; color: var(--gold-light); font-family: var(--serif); font-size: 17px; font-weight: 600; margin-top: 2px; }
.sidebar .me a { padding: 6px 0; color: var(--gold); background: none; box-shadow: none; }

.content { flex: 1; min-width: 0; padding: 24px 28px 72px; outline: none; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; text-align: center;
  padding: 36px 24px 30px; margin-bottom: 22px; border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(155,30,69,.35), transparent 65%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-gold);
}
.hero .hero-mask { display: block; width: 92px; height: 46px; color: var(--gold); margin: 0 auto 10px; filter: drop-shadow(0 4px 18px rgba(212,175,55,.35)); }
.hero .hero-mask svg { width: 100%; height: 100%; display: block; }
.hero h1 {
  font-family: var(--display); font-weight: 700; letter-spacing: 1.5px;
  font-size: clamp(22px, 4vw, 32px); margin: 0 0 6px; color: var(--text);
}
.hero p { color: var(--muted); margin: 0 auto 18px; max-width: 460px; }
.hero .btn.primary { height: 44px; padding: 0 22px; font-size: 15px; }
.hero .fine { font-size: 12px; color: var(--muted); margin-top: 10px; }

.ornament { display: flex; align-items: center; gap: 12px; color: var(--gold); margin: 6px 0 18px; }
.ornament::before, .ornament::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border-gold)); }
.ornament::after { transform: scaleX(-1); }
.ornament span { font-size: 11px; letter-spacing: 4px; font-family: var(--display); }

/* ---------- feed ---------- */
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.feed-head h1 { font-family: var(--display); font-size: 22px; letter-spacing: 1px; margin: 0; font-weight: 700; }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.tabs a { padding: 5px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.tabs a.active { background: var(--gold); color: #24160a; font-weight: 600; }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px;
}
.card::before {
  content: ''; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}
.post-card { display: block; cursor: pointer; transition: border-color .15s, transform .15s; }
.post-card:hover { border-color: var(--border-gold); transform: translateY(-1px); }

.meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.meta .name { color: var(--text); font-weight: 500; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: #0f0a15; border: 1px solid var(--border-gold);
}
.avatar svg { width: 20px; height: 10px; display: block; }
.chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 0 9px; font-size: 11px;
  color: var(--muted); background: rgba(255,255,255,.02);
}
a.chip:hover { color: var(--gold-light); border-color: var(--border-gold); }
.chip.op { color: var(--gold-light); border-color: var(--border-gold); background: rgba(212,175,55,.1); }
.post-title {
  font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.25;
  margin: 8px 0 4px; overflow-wrap: anywhere;
}
.post-card:hover .post-title { color: var(--gold-light); }
.excerpt { color: var(--muted); font-size: 14px; margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 14px; font-size: 15.5px; }

.actions { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.actions button, .actions .pill {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent;
  padding: 5px 9px; border-radius: 999px; cursor: pointer; color: var(--muted);
}
.actions button:hover, .actions .pill:hover { background: rgba(212,175,55,.08); color: var(--gold-light); }
.vote { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 999px; padding: 0 2px; }
.vote button { padding: 4px 6px; }
.vote .score { min-width: 22px; text-align: center; font-weight: 600; color: var(--text); }
.vote button.up.on { color: var(--up); }
.vote button.down.on { color: var(--down); }

.empty { text-align: center; color: var(--muted); padding: 52px 16px; }
.empty i { font-size: 38px; display: block; margin-bottom: 10px; color: var(--gold); opacity: .7; }
.more { display: flex; justify-content: center; margin-top: 10px; }

/* ---------- forms ---------- */
.form h1, .narrow h1 { font-family: var(--display); letter-spacing: 1px; font-weight: 700; }
.form label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  background: #0f0a15; border: 1px solid var(--border); color: var(--text);
}
.form input::placeholder, .form textarea::placeholder { color: #6f6279; }
.form textarea { min-height: 140px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,.12); }
.form select option { background: var(--surface); }
.form .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--muted); }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 1em; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--gold-light); }
.comment { border-left: 1px solid var(--border-gold); padding: 10px 0 10px 16px; margin: 0 0 6px 6px; }
.comment.removed .body { color: var(--muted); font-style: italic; }
.section-title { font-family: var(--display); font-size: 15px; letter-spacing: 1px; margin: 24px 0 12px; color: var(--gold-light); }

/* ---------- auth + membership ---------- */
.narrow { max-width: 460px; margin: 0 auto; }
.narrow .mask-top { display: block; width: 64px; height: 32px; color: var(--gold); margin: 0 auto 8px; }
.narrow .mask-top svg { width: 100%; height: 100%; display: block; }
.center { text-align: center; }
.links { font-size: 13px; color: var(--muted); margin-top: 16px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.links a { color: var(--gold); }
.links a:hover { color: var(--gold-light); }

.invite { text-align: center; padding: 30px 26px; border-color: var(--border-gold); }
.invite .eyebrow { font-family: var(--display); letter-spacing: 4px; font-size: 11px; color: var(--gold); }
.price { font-family: var(--display); font-size: 48px; font-weight: 700; line-height: 1.1; margin: 10px 0 0; color: var(--gold-light); }
.price span { font-family: var(--sans); font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.perks { list-style: none; padding: 0; margin: 20px auto; text-align: left; max-width: 320px; }
.perks li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14px; }
.perks i { color: var(--gold); margin-top: 3px; }

.code {
  font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 2px; text-align: center;
  color: var(--gold-light); background: #0f0a15; border: 1px dashed var(--border-gold); border-radius: 10px;
  padding: 16px; margin: 14px 0; user-select: all;
}
.cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 10px; border-radius: 999px; }
.status.on { background: rgba(127,209,168,.12); color: var(--success); border: 1px solid rgba(127,209,168,.3); }
.status.off { color: var(--muted); border: 1px solid var(--border); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-of-type { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.card ol, .card ul { padding-left: 20px; }
.card li { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-gold);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 32px);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  .menu-btn { display: inline-flex; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand .wordmark { display: none; }
  .search { min-width: 0; margin: 0; }
  .auth .label { display: none; }
  .auth .btn { padding: 0 11px; }
  .sidebar {
    position: fixed; left: 0; top: 64px; z-index: 15; background: var(--bg);
    transform: translateX(-100%); transition: transform .2s; box-shadow: 8px 0 30px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: none; }
  .content { padding: 16px 16px 64px; }
  .hero { padding: 28px 18px 24px; }
}
