:root {
  --bg: #09111f;
  --panel: rgba(14, 24, 43, 0.88);
  --panel-strong: #13223e;
  --border: rgba(160, 190, 255, 0.18);
  --text: #edf2ff;
  --muted: #9db0d8;
  --accent: #77e0c6;
  --accent-strong: #59b49d;
  --danger: #ff8f8f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(52, 96, 160, 0.32), transparent 36%),
    radial-gradient(circle at top right, rgba(80, 173, 153, 0.18), transparent 24%),
    linear-gradient(180deg, #07101b 0%, #0d1830 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95em;
}

.page-shell,
.reader-shell,
.simple-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.hero,
.toolbar,
.book-card,
.reader-header,
.reader-frame-shell,
.missing-reader,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  margin-bottom: 1.25rem;
}

.eyebrow,
.book-meta,
.reader-meta,
.help-text {
  color: var(--muted);
}

.hero h1,
.book-card h2,
.reader-header h1,
.missing-reader h1,
.missing-reader h2,
.empty-state h2 {
  margin: 0 0 0.5rem;
}

.hero-copy,
.book-description,
.missing-reader p,
.empty-state p {
  margin: 0;
  line-height: 1.6;
  color: #d4dcf2;
}

.hero-actions,
.reader-controls {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  margin-bottom: 1.25rem;
}

.search-field,
.sort-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-field {
  flex: 1;
}

input[type="search"],
select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(4, 10, 20, 0.52);
  color: var(--text);
  border-radius: 999px;
  padding: 0.9rem 1rem;
  outline: none;
}

select {
  min-width: 140px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  background: var(--accent);
  color: #07231e;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  background: #8be9d1;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.button.small {
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
}

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

.book-card {
  border-radius: var(--radius);
  overflow: hidden;
}

.book-card-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  min-height: 260px;
  padding: 1.25rem;
}

.book-card-missing {
  border-color: rgba(255, 143, 143, 0.35);
}

.book-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(119, 224, 198, 0.12);
  color: var(--accent);
  font-size: 0.85rem;
}

.reader-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  margin-bottom: 1rem;
}

.reader-frame-shell {
  border-radius: 24px;
  overflow: hidden;
}

.reader-frame {
  width: 100%;
  min-height: calc(100vh - 180px);
  border: 0;
  background: white;
}

.missing-reader,
.empty-state {
  border-radius: 24px;
  padding: 2rem;
}

.simple-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 768px) {
  .hero,
  .toolbar,
  .reader-header,
  .book-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell,
  .reader-shell,
  .simple-shell {
    width: min(100% - 1rem, 1200px);
  }

  .reader-frame {
    min-height: calc(100vh - 210px);
  }
}

