/* ═══════════════════════════════════════════════════════════════
   SpeedRead — Shared Styles
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-elevated: #1a1a1a;
  --border: #222222;
  --text: #f0e8d8;
  --text-muted: #8a8070;
  --accent: #c9a84c;
  --accent-hover: #d4ad55;
  --green: #22c55e;
  --red: #e63946;
  --btn-bg: #1e1e1e;
  --btn-hover: #2a2a2a;
  --radius: 8px;
  --radius-lg: 12px;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f3ef;
  --bg-card: #ffffff;
  --bg-elevated: #eae7e1;
  --border: #d5d0c8;
  --text: #1a1a1a;
  --text-muted: #6b6560;
  --btn-bg: #e8e5e0;
  --btn-hover: #ddd9d2;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline:hover { background: rgba(201,168,76,0.1); }

.btn-lg { font-size: 16px; padding: 14px 32px; border-radius: var(--radius-lg); }
.btn-sm { font-size: 12px; padding: 6px 12px; }
.btn-danger { border-color: #3a1a1a; color: var(--red); }
.btn-danger:hover { background: #200a0a; }

/* ─── INPUTS ─── */
input, textarea, select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* ─── CARDS ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal h2 { font-size: 18px; font-weight: 600; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── TOAST ─── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: 90vw;
  max-width: 480px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--text);
  pointer-events: all;
  animation: slideUp 0.25s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ─── SPINNER ─── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── RANGE SLIDER ─── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  outline: none;
  cursor: pointer;
  border: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #000;
  box-shadow: 0 0 0 1px var(--accent);
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* ─── CONFETTI ─── */
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
.confetti-piece {
  position: fixed;
  width: 10px; height: 10px;
  top: -10px;
  z-index: 3000;
  animation: confettiFall 3s ease-in forwards;
  pointer-events: none;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .hide-mobile { display: none !important; }
}
