/* Minimalist Monochrome Reader Stylesheet */
:root {
  --bg: #121212;
  --surface: #1c1c1c;
  --elevated: #242424;
  --border: #2e2e2e;
  --border-focus: #555555;
  --text: #ffffff;
  --text-muted: #8e8e8e;
  --text-dim: #606060;
  --accent: #ffffff;
  --danger: #cf6679;
  --success: #81c784;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Utilities */
.hidden { display: none !important; }
.hidden-input { display: none; }

/* Navigation Top Bar */
.top-bar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.status-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.status-btn:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-dim);
}
.status-dot.connected {
  background-color: var(--success);
}

/* Read Switcher in Top Bar */
.read-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
}
.icon-btn:hover { background: var(--elevated); }

.nav-text-btn {
  background: transparent;
  border: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-text-btn:hover { background: var(--elevated); }

.pill {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--elevated);
  padding: 2px 5px;
  border-radius: 3px;
}

.telemetry-box {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Minimalist Buttons */
.btn {
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: #303030;
  border-color: var(--border-focus);
}

.btn-primary {
  background: #ffffff;
  color: #121212;
  border-color: #ffffff;
  font-weight: 600;
}
.btn-primary:hover {
  background: #e0e0e0;
  border-color: #e0e0e0;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(207, 102, 121, 0.3);
  background: transparent;
}
.btn-danger:hover {
  background: rgba(207, 102, 121, 0.1);
}

.btn-large {
  padding: 10px 20px;
  font-size: 0.9rem;
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.select-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}
.select-btn:focus { border-color: var(--border-focus); }

/* Main Drop Zone (Empty State) */
.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 52px);
  padding: 2rem 1rem;
}

.drop-card {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3rem 2.5rem;
  text-align: center;
}

.drop-card.drag-over {
  border-color: #ffffff;
}

.drop-heading {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.drop-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.drop-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.format-list {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* Storage Notice Card */
.storage-notice-card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.notice-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.notice-text strong {
  color: var(--text);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(18, 18, 18, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2rem;
  min-width: 280px;
  text-align: center;
}

.loading-text {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--elevated);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 100%;
  background: #ffffff;
  transition: width 0.2s;
}

.loading-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Reader Viewport */
.reader-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sticky Edit Order Bar */
.edit-bar {
  position: sticky;
  top: 52px;
  left: 0;
  right: 0;
  z-index: 95;
  width: 100%;
  background: #202020;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edit-bar-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.edit-bar-info strong {
  color: #ffffff;
}

.edit-bar-btns {
  display: flex;
  gap: 0.5rem;
}

/* Edit Mode Cards List */
.edit-cards-container {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.edit-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  user-select: none;
}
.edit-card:hover {
  border-color: var(--border-focus);
}
.edit-card.dragging {
  opacity: 0.3;
}
.edit-card.drag-over {
  border-color: #ffffff;
}

.edit-card-handle {
  cursor: grab;
  color: var(--text-dim);
  font-size: 1.1rem;
}

.edit-card-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 32px;
}

.edit-card-thumb {
  width: 44px;
  height: 56px;
  object-fit: cover;
  border-radius: 2px;
  background: #000;
}

.edit-card-title {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-card-actions {
  display: flex;
  gap: 0.25rem;
}

/* The Strip Outer & Container */
.strip-outer {
  width: 100%;
  margin: 0 auto;
  transition: max-width 0.2s ease;
}

.width-760 { max-width: 760px; }
.width-960 { max-width: 960px; }
.width-1200 { max-width: 1200px; }
.width-100\% { max-width: 100%; padding: 0 0.5rem; }

.strip-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 0px; /* Zero gap seamless strip */
}

.strip-page {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  background: #000;
}

.strip-page img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
}

.page-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0.2;
  transition: opacity 0.2s;
}
.strip-page:hover .page-badge {
  opacity: 0.9;
}

/* Reader Footer */
.reader-footer {
  width: 100%;
  padding: 3rem 1rem 5rem;
  text-align: center;
}

.footer-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.footer-btns {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.modal-card-wide {
  max-width: 720px;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-intro {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

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

.form-group label {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.text-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  outline: none;
}
.text-input:focus { border-color: var(--border-focus); }

.field-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-footer-right {
  display: flex;
  gap: 0.5rem;
}

/* Library Grid */
.library-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.library-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  cursor: pointer;
}
.library-card:hover { border-color: var(--border-focus); }
.library-card.active-read { border-color: #ffffff; }

.library-thumb {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: 2px;
  background: #000;
}

.library-info { flex: 1; min-width: 0; }
.library-title { font-size: 0.85rem; font-weight: 600; }
.library-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

.library-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.library-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.library-btn:hover {
  background: var(--elevated);
  border-color: var(--border-focus);
  color: var(--text);
}

.library-btn-danger {
  color: var(--danger);
  border-color: rgba(207, 102, 121, 0.3);
}
.library-btn-danger:hover {
  background: rgba(207, 102, 121, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-del-page {
  background: transparent;
  border: 1px solid rgba(207, 102, 121, 0.25);
  color: var(--danger);
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-del-page:hover {
  background: rgba(207, 102, 121, 0.15);
}

@media (max-width: 600px) {
  .top-bar { padding: 0 0.75rem; }
  .drop-card { padding: 2rem 1.25rem; }
  .drop-actions { flex-direction: column; }
  .storage-notice-card { flex-direction: column; align-items: flex-start; }
}
