/* Slopverse — the deliberately AI-generated look. */

:root {
  --bg-0: #08060f;
  --bg-1: #120c2a;
  --ink: #ece9ff;
  --muted: #9a93c4;
  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hi: rgba(255, 255, 255, 0.07);
  --grad-1: linear-gradient(135deg, #a855f7 0%, #ec4899 45%, #3b82f6 100%);
  --grad-2: linear-gradient(135deg, #22d3ee 0%, #a855f7 100%);
  --grad-3: linear-gradient(120deg, #ff8a4c 0%, #ec4899 60%, #8b5cf6 100%);
  --accent: #c4b5fd;
  --error: #ff7a90;
  --ok: #6ee7b7;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root { color-scheme: dark; }

body {
  background:
    radial-gradient(60rem 60rem at 80% -10%, rgba(168, 85, 247, 0.18), transparent 60%),
    radial-gradient(50rem 50rem at -10% 20%, rgba(59, 130, 246, 0.16), transparent 60%),
    radial-gradient(40rem 40rem at 60% 110%, rgba(236, 72, 153, 0.18), transparent 60%),
    var(--bg-0);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Inter", sans-serif;
  min-height: 100vh;
  letter-spacing: 0.005em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; text-decoration-color: rgba(196, 181, 253, 0.6); }

.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(8, 6, 15, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-weight: 800; font-size: 1.35rem; letter-spacing: -0.01em;
  background: var(--grad-1);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.brand::before { content: "✨"; -webkit-text-fill-color: initial; }

.site-header nav { display: flex; align-items: center; gap: 1rem; }
.site-header nav a, .site-header nav .linklike {
  color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer;
  padding: 0.35rem 0.6rem; border-radius: 10px; transition: background 120ms ease;
}
.site-header nav a:hover, .site-header nav .linklike:hover {
  background: var(--glass-hi); text-decoration: none; color: #fff;
}

.container { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem 1rem; }

.site-footer {
  margin: 4rem auto 0; padding: 2rem 1.5rem; text-align: center;
  color: var(--muted); border-top: 1px solid var(--border);
  max-width: 860px;
}
.site-footer small { display: block; }
.ai-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.75rem; padding: 0.3rem 0.7rem; font-size: 0.8rem;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 999px; color: var(--accent);
}
.ai-badge::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--grad-2);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.8);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

input, textarea, select, button {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 0.6rem 0.85rem; font: inherit;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
select {
  /* Replace the default OS arrow with a chevron that matches the palette. */
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23c4b5fd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px 8px;
}
/* The popup itself is rendered by the OS, but most browsers honor color/background on <option>. */
select option {
  background: #14102a;
  color: var(--ink);
}
select option:disabled { color: var(--muted); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.12);
  background: var(--glass-hi);
}
textarea { resize: vertical; font-family: inherit; }
button { cursor: pointer; }
button[type=submit] {
  background: var(--grad-1); border: 0; color: #fff; font-weight: 600;
  padding: 0.6rem 1.2rem; border-radius: 12px;
  box-shadow: 0 4px 24px -8px rgba(168, 85, 247, 0.5);
}
button[type=submit]:hover { filter: brightness(1.1); transform: translateY(-1px); }
button[type=submit]:active { transform: translateY(0); }

.form { display: flex; flex-direction: column; gap: 1.1rem; }
.form label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 500; }
.form small { color: var(--muted); font-weight: 400; }

/* Labels that wrap a checkbox or radio lay out inline so the control sits next to the text. */
.form label:has(> input[type=checkbox]),
.form label:has(> input[type=radio]) {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
input[type=checkbox], input[type=radio] {
  padding: 0;
  width: auto;
  min-width: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #a855f7;
}

.search { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.search input[type=search] { flex: 1 1 12rem; min-width: 0; }
.search select, .search button { flex: 0 0 auto; }

.story-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.story-card {
  background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.story-card::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  padding: 1px; pointer-events: none;
  background: var(--grad-1);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 180ms ease;
}
.story-card:hover { transform: translateY(-2px); background: var(--glass-hi); }
.story-card:hover::before { opacity: 0.5; }
.story-card h2, .story-card h3 { margin: 0 0 0.4rem; font-weight: 700; letter-spacing: -0.01em; }
.story-card h2 a, .story-card h3 a { color: var(--ink); }
.story-card h2 a:hover, .story-card h3 a:hover { color: #fff; text-decoration: none; }
.meta { color: var(--muted); font-size: 0.88rem; margin: 0.3rem 0; }
.prompt { font-size: 0.95rem; color: rgba(236, 233, 255, 0.8); }
.prompt em { color: var(--accent); font-style: normal; font-weight: 600; margin-right: 0.2rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.tag, .tag-chip {
  background: var(--glass); border: 1px solid var(--border); color: var(--accent);
  padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.82rem;
  cursor: pointer; transition: all 120ms ease;
}
.tag:hover, .tag-chip:hover {
  border-color: rgba(168, 85, 247, 0.6); background: var(--glass-hi);
  color: #fff; text-decoration: none;
}

.story h1 {
  margin-bottom: 0.25rem; font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em;
  background: var(--grad-3);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}
.story .prompt-block {
  background: var(--glass); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.2rem; margin: 1.5rem 0;
  position: relative;
}
.story .prompt-block h3 {
  margin: 0 0 0.35rem; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--accent); font-weight: 700;
}
.story .prompt-block h3::before { content: "▸ "; }
.story .body { font-size: 1.05rem; }
.story .body p { margin: 0 0 1.1em; }
.story .body code {
  background: rgba(255, 255, 255, 0.06); padding: 0.1em 0.4em;
  border-radius: 6px; font-size: 0.92em;
}
.story .body pre {
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem; overflow-x: auto;
}

.story-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 2rem; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

.like-btn {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 1rem; font: inherit; cursor: pointer;
  transition: all 150ms ease;
}
.like-btn:hover { border-color: rgba(236, 72, 153, 0.6); }
.like-btn.liked {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  box-shadow: 0 4px 20px -8px rgba(236, 72, 153, 0.6);
}
button.danger {
  background: transparent; color: var(--error); border-color: rgba(255, 122, 144, 0.4);
  font-weight: 500;
}
button.danger:hover { background: rgba(255, 122, 144, 0.1); color: #fff; }
.danger-link { color: var(--error) !important; background: none; border: 0; padding: 0; cursor: pointer; font-size: 0.85rem; }

.comments { margin-top: 3rem; }
.comments h2 { font-size: 1.3rem; font-weight: 700; }
.comment-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.comment {
  background: var(--glass); border: 1px solid var(--border); border-radius: 14px;
  padding: 0.9rem 1.1rem;
}
.comment p { margin: 0.25rem 0; }
.comment-form { margin-top: 1.5rem; }
.comment-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center;
  margin: 0.3rem 0 0; font-size: 0.85rem;
}
.comment-actions a { color: var(--muted); }
.comment-actions a:hover { color: var(--accent); }
.comment-thread { list-style: none; padding: 0; margin: 0; }
.comment-replies {
  margin: 0.6rem 0 0 1.25rem;
  border-left: 2px solid rgba(168, 85, 247, 0.25);
  padding-left: 1rem;
  list-style: none;
}
.comment-reply { background: rgba(255, 255, 255, 0.02); }
.comment, .comment-reply { word-wrap: break-word; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .comment-replies {
    margin-left: 0.5rem;
    padding-left: 0.65rem;
  }
  .comment, .comment-reply { padding: 0.7rem 0.85rem; }
}

.body-editor { display: grid; gap: 1rem; }
@media (min-width: 800px) {
  .body-editor:has(.body-preview:not([hidden])) {
    grid-template-columns: 1fr 1fr;
  }
}
.body-preview {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem;
  max-height: 32rem; overflow-y: auto;
}
.body-preview .body { font-size: 1rem; }
.body-preview p { margin: 0 0 1em; }
.muted { color: var(--muted); }

.format-toggle { border: 1px solid var(--border); border-radius: 12px; padding: 0.6rem 0.85rem; background: var(--glass); }
.format-toggle legend { color: var(--muted); padding: 0 0.4rem; font-size: 0.85rem; }
.format-toggle label { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 1rem; cursor: pointer; }

.tag-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: -0.5rem; }
.actions { display: flex; gap: 0.75rem; align-items: center; }
.pager { display: flex; gap: 1rem; margin-top: 2rem; justify-content: center; }
.pager a {
  background: var(--glass); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 1rem;
}

.error { color: var(--error); }
.ok    { color: var(--ok); }

.profile-header { border-bottom: 1px solid var(--border); padding-bottom: 1.25rem; margin-bottom: 1.75rem; }
.profile-header h1 {
  font-size: 2rem; font-weight: 800; letter-spacing: -0.02em;
  background: var(--grad-2);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.admin-table {
  width: 100%; border-collapse: collapse; margin-top: 0.5rem;
  background: var(--glass); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }

.draft-badge {
  display: inline-block;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: rgba(255, 200, 100, 0.12);
  border: 1px solid rgba(255, 200, 100, 0.35);
  color: #ffd28a;
  vertical-align: middle;
  margin-left: 0.5rem;
  -webkit-text-fill-color: #ffd28a;
}

button.btn-secondary {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--border); box-shadow: none;
}
button.btn-secondary:hover { background: var(--glass-hi); transform: none; filter: none; }

.persona-line { margin: 0.4rem 0 0; }
.persona-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.25rem 0.7rem; border-radius: 999px;
  background: linear-gradient(135deg, rgba(168,85,247,0.18), rgba(34,211,238,0.18));
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #e9d5ff;
  -webkit-text-fill-color: #e9d5ff;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;
}
a.persona-chip:hover {
  border-color: rgba(168, 85, 247, 0.8);
  text-decoration: none;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .site-header { padding: 0.75rem 1rem; }
  .container { padding: 1.25rem 1rem; }
  .story h1 { font-size: 1.7rem; }
  .site-header nav { gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; }
  .site-header nav a, .site-header nav .linklike { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
  .search input[type=search] { flex-basis: 100%; }
  .story-card { padding: 1rem 1.1rem; }
}
