:root {
  --bg: #0f1419;
  --surface: #1a222c;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d9bfd;
  --accent-dim: #2a6fad;
  --border: #2a3542;
  --danger: #e85d5d;
  --radius: 10px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #1c2a3a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent-dim);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #041018;
  font-weight: 600;
}

.btn-primary:hover {
  background: #5aadff;
}

.login-card {
  max-width: 380px;
  margin: 12vh auto;
  padding: 1.75rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
}

.login-card p {
  margin: 0 0 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  min-height: 1.2em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item h2 {
  margin: 0;
  font-size: 1.05rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  width: fit-content;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.player-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.player-panel audio,
.player-panel video {
  width: 100%;
  max-height: 70vh;
  background: #000;
}

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Reader */
.reader-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.reader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, #000);
}

.reader-bar .title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#viewer {
  width: 100%;
  height: 100%;
  background: #111;
}

.reader-nav {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
