:root {
  --bg: #0c0f14;
  --panel: #141a22;
  --panel-2: #1a222d;
  --border: #2a3544;
  --text: #e8edf4;
  --muted: #8b98a8;
  --gold: #c9a227;
  --europa: #6b9fd4;
  --danger: #c45c5c;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, #1a2433 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--europa); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 15, 20, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.sigil { font-size: 1.6rem; color: var(--gold); }
.brand strong { display: block; letter-spacing: 0.02em; }
.sub { display: block; font-size: 0.8rem; color: var(--muted); }

.top-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.user-chip {
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font: inherit;
}
.btn:hover { border-color: var(--muted); }
.btn.primary {
  background: linear-gradient(180deg, #3a5f8a, #2a4668);
  border-color: #4a74a4;
}
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.hidden { display: none !important; }
.loading, .hint, .muted { color: var(--muted); }
.status { color: var(--gold); font-size: 0.92rem; }
.error { color: var(--danger); }

h1, h2, h3 { margin: 0 0 0.6rem; font-weight: 600; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }

.row { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 0.8rem; }

label {
  display: block;
  margin: 0.7rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
input[type="text"],
input[type="email"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }

.cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.cat-card {
  display: block;
  padding: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s;
}
.cat-card:hover { border-color: var(--europa); text-decoration: none; }
.cat-card strong { color: var(--gold); }
.cat-card p { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted); }

.post-list { display: flex; flex-direction: column; gap: 0.7rem; }
.post-item {
  display: block;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
}
.post-item:hover { border-color: var(--europa); text-decoration: none; }
.post-item h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.meta {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.europa {
  border-color: var(--europa);
  color: var(--europa);
}

.thread-title { margin-bottom: 0.25rem; }
.thread-body {
  white-space: pre-wrap;
  margin: 0.8rem 0 1rem;
  line-height: 1.55;
}
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.6rem 0 1rem;
}
.attachments img {
  max-width: min(100%, 320px);
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.88rem;
}

.comments { margin-top: 1.4rem; }
.comment {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: var(--panel);
}
.comment.europa {
  border-color: var(--europa);
  background: linear-gradient(180deg, rgba(107,159,212,0.08), var(--panel));
}
.comment .author { font-weight: 600; margin-bottom: 0.25rem; }
.comment.europa .author { color: var(--europa); }
.comment .body { white-space: pre-wrap; }

.compose {
  margin-top: 1.2rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 2rem);
}
dialog::backdrop { background: rgba(0,0,0,0.55); }
dialog .panel { border: 0; }

.crumb {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--europa); }

@media (max-width: 600px) {
  .top { padding: 0.75rem; }
  .app { padding: 0.85rem; }
  .brand .sub { display: none; }
}
