:root {
  --bg: radial-gradient(circle at 20% 20%, #0a0a0f 0, #030306 55%, #020204 100%);
  --panel: rgba(255, 255, 255, 0.05);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f7f8ff;
  --muted: #aab0c6;
  --accent: #d7f46a;
  --accent-2: #9fb8ff;
  --danger: #ff9b9b;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  --radius: 16px;
  --font: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
}

.app {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.reader-panel {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.008));
}

.reader__chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.reader__status {
  font-weight: 600;
  color: var(--muted);
}

.reader__nav {
  display: inline-flex;
  gap: 8px;
}

.reader__viewport {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  overflow: hidden;
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.reader__image {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  display: none;
  background: rgba(255, 255, 255, 0.02);
}

.reader__placeholder {
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.fab {
  position: fixed;
  bottom: 14px;
  right: 14px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #d7f46a, #9fb8ff);
  color: #0a0a0f;
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 40;
}

.fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 10, 0.8);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
}

.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.overlay-open .reader-panel {
  filter: blur(2px);
  opacity: 0.35;
  pointer-events: none;
}

.overlay__panel {
  width: min(1200px, 94vw);
  max-height: 86vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.overlay__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.overlay__header h1 {
  margin: 4px 0 4px;
  font-size: 24px;
}

.overlay__lead {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
}

.overlay__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  overflow: hidden;
}

.panel__section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  min-height: 220px;
}

.panel__section--gallery {
  overflow: auto;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel__header h2 {
  margin: 0;
  font-size: 18px;
}

.counter {
  color: var(--muted);
  font-weight: 600;
}

.dropzone {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: calc(var(--radius) + 2px);
  padding: 32px 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.dropzone__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(159, 184, 255, 0.18), transparent 50%);
  filter: blur(18px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.dropzone__content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.dropzone__title {
  margin: 0;
  font-weight: 700;
  font-size: 20px;
}

.dropzone__subtitle {
  margin: 4px 0 6px;
  color: var(--muted);
}

.dropzone__hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.inline-link {
  color: var(--accent);
  font-weight: 600;
}

.dropzone.is-dragover {
  border-color: rgba(215, 244, 106, 0.9);
  box-shadow: 0 0 0 1px rgba(215, 244, 106, 0.5);
}

.dropzone.is-dragover .dropzone__glow {
  opacity: 1;
}

.status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(215, 244, 106, 0.7);
}

.card.is-active {
  border-color: rgba(215, 244, 106, 0.9);
  box-shadow: 0 0 0 1px rgba(215, 244, 106, 0.4);
}

.thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
}

.card__info {
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.card__name {
  margin: 0;
  font-size: 14px;
  color: #f5f7ff;
  word-break: break-all;
}

.card__meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.button, .pill, .pill--ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.button:hover, .pill:hover, .pill--ghost:hover {
  border-color: rgba(215, 244, 106, 0.7);
  transform: translateY(-1px);
}

.pill--ghost {
  background: rgba(255, 255, 255, 0.02);
}

.link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  margin: 0;
}

@media (max-width: 900px) {
  .overlay__body {
    grid-template-columns: 1fr;
    max-height: 60vh;
  }

  .overlay__panel {
    max-height: 80vh;
  }

  .reader__viewport {
    min-height: calc(100vh - 140px);
  }
}

@media (max-width: 640px) {
  .reader-panel { padding: 6px; }
  .reader__chrome { padding: 6px 8px; }
  .reader__viewport { min-height: calc(100vh - 96px); }
  .fab { width: 52px; height: 52px; font-size: 18px; bottom: 12px; right: 12px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
