:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --bg-elev: #121a29;
  --surface-1: #111a29;
  --surface-2: #162235;
  --surface-3: #1a2940;
  --text: #eef3fb;
  --muted: #9ca8bc;
  --line: #2a3950;
  --line-soft: #1f2a3d;
  --accent: #68a4ff;
  --accent-strong: #3d8bff;
  --danger: #f089a6;
  --success-bg: #133725;
  --error-bg: #472130;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font: 15px/1.55 "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 5% -20%, rgba(74, 129, 230, 0.2), transparent 60%),
    radial-gradient(900px 500px at 95% -25%, rgba(76, 94, 224, 0.14), transparent 55%),
    var(--bg);
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
}
.skip-link:focus {
  top: 10px;
}
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: #95beff; }

.container {
  max-width: 1140px;
  margin: 30px auto 42px;
  padding: 0 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(8px);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  color: var(--text);
  font-size: 23px;
  line-height: 1;
  letter-spacing: 0.3px;
  font-weight: 800;
}

.btn {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  background: rgba(25, 39, 60, 0.78);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.08s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}
.btn:hover {
  border-color: #476384;
  background: rgba(34, 53, 80, 0.92);
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.btn-primary {
  border-color: #5c86c3;
  background: #2f4f79;
}
.btn-primary:hover {
  border-color: #7ea8e0;
  background: #3a6294;
}
.btn-subtle {
  background: rgba(18, 29, 46, 0.5);
  border-color: #3b506d;
  color: #d7e4fb;
}
.btn-subtle:hover {
  background: rgba(77, 108, 150, 0.2);
  border-color: #57779f;
}
.btn.ghost {
  background: rgba(18, 29, 46, 0.32);
  border-color: #3b506d;
}
.btn.ghost:hover {
  background: rgba(77, 108, 150, 0.2);
  border-color: #57779f;
}

.card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow);
}

.narrow { max-width: 560px; margin: 42px auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; }
.tile img, .tile video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  max-height: 460px;
  object-fit: contain;
  background: #0a0f16;
}
.full {
  border-radius: 10px;
  border: 1px solid var(--line);
  max-height: 80vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #0a0f16;
  margin: 0 auto;
  display: block;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline, .nav-form { display: inline; margin: 0; }
.muted { color: var(--muted); }
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.meta-row p {
  margin: 0;
}
.meta-time {
  text-align: right;
  white-space: nowrap;
}
.messages { max-width: 1140px; margin: 10px auto 0; padding: 0 18px; }
.msg {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.msg.error {
  background: var(--error-bg);
  border-color: #6d3045;
}
.msg.success {
  background: var(--success-bg);
  border-color: #2a6746;
}

input, textarea {
  width: 100%;
  padding: 11px 12px;
  margin: 8px 0;
  border-radius: var(--radius-sm);
  border: 1px solid #304056;
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, 0.2);
}

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.68); display: grid; place-items: center; z-index: 40; }
.modal .panel {
  width: min(680px, 92vw);
  background: linear-gradient(180deg, var(--surface-3) 0%, var(--surface-2) 100%);
  border: 1px solid #314664;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.44);
  position: relative;
}
.modal .panel.compact {
  width: min(520px, 92vw);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #b8c8e6;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover {
  background: rgba(124, 151, 191, 0.16);
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: grid;
  place-items: center;
  background: rgba(8, 13, 22, 0.74);
  border: 2px dashed rgba(112, 162, 238, 0.5);
}
.drop-overlay-panel {
  padding: 18px 24px;
  border: 1px solid #3f5f8f;
  border-radius: 14px;
  background: rgba(22, 34, 54, 0.95);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.drop-overlay-panel h3 {
  margin-bottom: 6px;
}

.hidden { display: none; }
.markdown pre { background: #0a0f16; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; }

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stack-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-1);
}
.stack-actions {
  margin-top: 10px;
}
.tile-full {
  display: block;
}

.media-feed-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.media-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface-1);
}
.media-open {
  display: block;
}
.media-image {
  cursor: pointer;
}
.media-video {
  width: min(100%, 1100px);
}
.media-actions {
  justify-content: flex-end;
  margin-top: 8px;
}
.remove-from-album {
  border-color: #5a3242;
  color: #ffd9e6;
}
.remove-from-album:hover {
  border-color: #9d4d69;
  background: rgba(148, 54, 87, 0.18);
}
.solo-time {
  text-align: right;
  margin: 0 0 10px;
}
.album-upload-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(16, 30, 50, 0.6);
}
.album-upload-bar p {
  margin: 0;
}
#album-quick-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

h1, h2, h3 { margin-top: 0; letter-spacing: 0.2px; }

.paste-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.paste-editor form {
  margin: 0;
}
.paste-preview-pane {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(15, 24, 38, 0.7);
  padding: 14px;
  min-height: 100%;
}
#paste-preview {
  min-height: 420px;
}

.feedback-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
}
.feedback-toast {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.feedback-toast.error {
  background: var(--error-bg);
  border-color: #8f3f5a;
}
.feedback-toast.success {
  background: var(--success-bg);
  border-color: #377454;
}
.feedback-toast.fade {
  opacity: 0;
  transform: translateY(8px);
}

.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: rgba(14, 23, 36, 0.75);
}
.admin-list-item.empty {
  color: var(--muted);
  justify-content: flex-start;
}
.admin-list-link {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .feedback-region {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
  .admin-list-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 980px) {
  .paste-layout {
    grid-template-columns: 1fr;
  }
  #paste-preview {
    min-height: 220px;
  }
}
