/* ============================================================
   ClearMind — App Styles
   ============================================================ */

:root {
  --ink: #0d0d0f;
  --paper: #f5f3ee;
  --cream: #ede9e0;
  --sage: #4a7c6f;
  --sage-light: #6aaa99;
  --amber: #d4882a;
  --amber-light: #f0b455;
  --muted: #7a7870;
  --border: #dbd7ce;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --shadow: 0 4px 24px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

body.dark {
  /* Warm-neutral charcoal ramp — deliberate elevation steps, no blue cast.
     paper (page) → card (surface) → cream (raised inset). */
  --ink: #ece8e0;
  --paper: #0c0c0b;
  --cream: #201f1c;
  --sage: #5faa98;
  --sage-light: #7ec4b4;
  --amber: #e5a040;
  --muted: #989189;
  --border: #2a2925;
  --card: #161614;
  --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 14px 32px -10px rgba(0,0,0,0.6);
  --shadow-lg: 0 1px 2px rgba(0,0,0,0.5), 0 24px 56px -12px rgba(0,0,0,0.7);
  /* Dark-only depth helpers (reused by scoped rules in themes.css) */
  --hairline: rgba(255,255,255,0.07);
  --lift: inset 0 1px 0 rgba(255,255,255,0.055);
  --surface-sheen: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0) 42%);
  /* Light text on dark renders too heavy with subpixel AA — smooth it */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3, h4, .brand { font-family: 'Syne', sans-serif; }

a { color: inherit; }

button { cursor: pointer; font-family: 'DM Sans', sans-serif; }

input, textarea, select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
}

/* ── Cosmic Loading Screen ──────────────────────────── */

.cosmic-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #05060c;
  opacity: 1;
  transition: opacity 0.7s ease;
}

.cosmic-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Deep-space nebula backdrop */
.cosmic-bg {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 50% at 28% 30%, rgba(74,124,111,0.45), transparent 70%),
    radial-gradient(45% 55% at 75% 68%, rgba(212,136,42,0.30), transparent 72%),
    radial-gradient(60% 70% at 50% 50%, rgba(40,52,86,0.55), transparent 80%),
    radial-gradient(120% 120% at 50% 50%, #0a0b18 0%, #05060c 60%, #020309 100%);
  animation: nebula-drift 18s ease-in-out infinite alternate;
  filter: saturate(1.15);
}

@keyframes nebula-drift {
  0%   { transform: scale(1)    translate(0, 0)      rotate(0deg); }
  50%  { transform: scale(1.12) translate(-2%, 1.5%) rotate(4deg); }
  100% { transform: scale(1.05) translate(2%, -1.5%) rotate(-3deg); }
}

/* Starfield (stars injected by JS) */
.cosmic-stars { position: absolute; inset: 0; }

.cosmic-star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.7;
  animation: twinkle var(--dur, 3s) ease-in-out var(--delay, 0s) infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.6); }
  50%      { opacity: 1;    transform: scale(1.3); }
}

/* Shooting stars */
.cosmic-shoot {
  position: absolute;
  top: var(--top, 20%);
  left: -10%;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fff, rgba(106,170,153,0.9));
  border-radius: 2px;
  opacity: 0;
  transform: rotate(18deg);
  animation: shoot 6s ease-in var(--delay, 0s) infinite;
}

@keyframes shoot {
  0%       { opacity: 0; transform: translate(0, 0) rotate(18deg); }
  3%       { opacity: 1; }
  16%      { opacity: 1; }
  22%      { opacity: 0; transform: translate(135vw, 42vh) rotate(18deg); }
  100%     { opacity: 0; transform: translate(135vw, 42vh) rotate(18deg); }
}

/* Center stage */
.cosmic-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.4rem;
  animation: cosmic-rise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cosmic-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Orbit system */
.cosmic-orbits {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.orbit-1 { width: 130px;  height: 130px;  animation: orbit-spin 6s linear infinite; }
.orbit-2 { width: 190px;  height: 190px;  animation: orbit-spin 10s linear infinite reverse; }
.orbit-3 { width: 240px;  height: 240px;  animation: orbit-spin 16s linear infinite; }

@keyframes orbit-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.planet {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--sage-light);
  box-shadow: 0 0 12px 2px rgba(106,170,153,0.8);
}

.planet-amber {
  background: var(--amber-light);
  box-shadow: 0 0 14px 3px rgba(240,180,85,0.8);
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  top: -6.5px;
}

.planet-small {
  width: 6px;
  height: 6px;
  margin-left: -3px;
  top: -3px;
  background: #fff;
  box-shadow: 0 0 10px 2px rgba(255,255,255,0.7);
}

/* Glowing logo core */
.cosmic-core {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74,124,111,0.35), transparent 70%);
  animation: core-pulse 3.2s ease-in-out infinite;
}

@keyframes core-pulse {
  0%, 100% { box-shadow: 0 0 30px 6px rgba(74,124,111,0.35); }
  50%      { box-shadow: 0 0 55px 14px rgba(106,170,153,0.55); }
}

.cosmic-loader .loading-logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 0 18px rgba(255,255,255,0.45);
  white-space: nowrap;
}

/* Per-letter "assemble in from the void" animation */
.cosmic-loader .loading-logo .cm-letter {
  display: inline-block;
  opacity: 0;
  transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, 0)) scale(0.3);
  animation: letter-assemble 0.85s cubic-bezier(0.18, 0.9, 0.25, 1) var(--delay, 0s) forwards;
}

.cosmic-loader .loading-logo .cm-letter.cm-accent {
  background: linear-gradient(120deg, var(--sage-light), var(--amber-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes letter-assemble {
  0%   { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.3); filter: blur(4px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); filter: blur(0); }
}

/* Greeting + dots */
.cosmic-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.cosmic-greeting {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  letter-spacing: 0.01em;
  text-align: center;
  min-height: 1.4em;
  opacity: 0;
}

.cosmic-greeting .cosmic-name {
  background: linear-gradient(120deg, var(--sage-light), var(--amber-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.cosmic-greeting.show {
  animation: greeting-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both;
}

@keyframes greeting-in {
  from { opacity: 0; transform: translateY(8px); letter-spacing: 0.25em; filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);   letter-spacing: 0.01em; filter: blur(0); }
}

.cosmic-tagline {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  opacity: 0;
  animation: greeting-in 0.9s ease 0.55s both;
}

.cosmic-dots {
  display: flex;
  gap: 0.5rem;
}

.cosmic-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage-light);
  opacity: 0.4;
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.cosmic-dots span:nth-child(2) { animation-delay: 0.18s; background: var(--amber-light); }
.cosmic-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dot-bounce {
  0%, 100% { opacity: 0.3; transform: translateY(0) scale(0.85); }
  40%      { opacity: 1;   transform: translateY(-7px) scale(1.1); }
}

/* Interactive stars that flee the cursor (login hold screen) */
.cosmic-istars { position: absolute; inset: 0; z-index: 1; }

.cosmic-istar {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 1px rgba(255,255,255,0.6);
  transform: translate(0, 0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  animation: istar-glow var(--dur, 3s) ease-in-out var(--delay, 0s) infinite;
  will-change: transform;
}

@keyframes istar-glow {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.95; }
}

/* Continue-to-dashboard button (login hold screen) */
.cosmic-continue {
  margin-top: 0.2rem;
  padding: 0.7rem 1.6rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, rgba(74,124,111,0.9), rgba(212,136,42,0.85));
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(106,170,153,0.4);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: continue-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s forwards;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cosmic-continue:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 36px rgba(240,180,85,0.55);
}

.cosmic-continue span {
  display: inline-block;
  transition: transform 0.25s ease;
}

.cosmic-continue:hover span { transform: translateX(4px); }

@keyframes continue-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Personalized (logged-in) variant — richer, warmer */
.cosmic-loader.personalized .cosmic-core {
  background: radial-gradient(circle, rgba(212,136,42,0.4), transparent 70%);
}
.cosmic-loader.personalized .orbit { border-color: rgba(255,255,255,0.14); }
.cosmic-loader.personalized .orbit-1 { animation-duration: 4.5s; }

@media (prefers-reduced-motion: reduce) {
  .cosmic-bg, .cosmic-star, .cosmic-shoot, .orbit, .cosmic-core,
  .cosmic-center, .cosmic-greeting, .cosmic-tagline, .cosmic-dots span,
  .cosmic-istar, .cosmic-loader .loading-logo .cm-letter, .cosmic-continue {
    animation: none !important;
  }
  .cosmic-greeting, .cosmic-tagline, .cosmic-continue { opacity: 1; }
  .cosmic-continue { transform: none; }
  .cosmic-loader .loading-logo .cm-letter {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Brand ──────────────────────────────────────────── */

.brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand span { color: var(--sage); }

/* ── Buttons ────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--sage); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: rippleOut 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleOut { to { transform: scale(3); opacity: 0; } }

/* ── Toast ──────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 220px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}

.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid #ef4444; }
.toast-warning { border-left: 3px solid #f59e0b; }
.toast-info    { border-left: 3px solid var(--sage); }

/* ── Modal ──────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

#modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
}

/* ── Forms ──────────────────────────────────────────── */

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

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

.form-group input,
.form-group textarea,
.form-group select,
.form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-select:focus {
  border-color: var(--sage);
}

.form-group textarea { resize: vertical; min-height: 70px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

/* ── App Nav (logged in) ────────────────────────────── */

.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--nav-h);
  background: rgba(245,243,238,0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav-links-center {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}

.nav-link {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s;
  position: relative;
}

.nav-link:hover { color: var(--ink); background: var(--cream); }
.nav-link.active { color: var(--ink); background: transparent; font-weight: 600; }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sage);
}

.nav-right { position: relative; display: flex; align-items: center; gap: 0.7rem; }

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

.nqa-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}
.nqa-btn:hover { border-color: var(--sage); background: var(--cream); transform: translateY(-1px); }

.nav-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem 0.35rem 0.35rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: all 0.2s;
  user-select: none;
}

.nav-profile:hover { border-color: var(--sage); }

.nav-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.nav-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.nav-avatar-initials {
  width: 100%;
  height: 100%;
  background: var(--sage);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
}

.nav-name { font-size: 0.85rem; font-weight: 500; }
.nav-caret { font-size: 0.75rem; color: var(--muted); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  overflow: hidden;
  z-index: 200;
}

.nav-dropdown.hidden { display: none; }

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.7rem 1.2rem;
  text-align: left;
  font-size: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s;
}

.dropdown-item:hover { background: var(--cream); }

.dropdown-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

.dropdown-logout { color: #ef4444; }

.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--ink);
  cursor: pointer;
  padding: 0.4rem;
}

/* ── Page content ───────────────────────────────────── */

.page-content {
  padding-top: calc(var(--nav-h) + 1.5rem);
  padding-left: 2rem;
  padding-right: 2rem;
  padding-bottom: 3rem;
  min-height: 100vh;
  max-width: 1300px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-sub { color: var(--muted); font-size: 0.95rem; margin-top: 0.2rem; }

/* ── Dashboard Layout ───────────────────────────────── */

.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 1.5rem;
  padding-top: calc(var(--nav-h) + 1.5rem);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-bottom: 2rem;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

.dash-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.dash-widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sage);
  border-radius: var(--radius);
  padding: 1.2rem;
  animation: widgetFadeUp 0.45s ease both;
}
@keyframes widgetFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.widget-icon { font-size: 1rem; }
.widget-title { font-family: 'Syne', sans-serif; font-size: 0.85rem; font-weight: 700; flex: 1; }
.widget-add-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.widget-add-btn:hover { border-color: var(--sage); color: var(--sage); }

.widget-empty { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.widget-link { display: block; font-size: 0.8rem; color: var(--sage); text-decoration: none; margin-top: 0.6rem; }

/* Goal */
.goal-bar-wrap {
  height: 8px;
  background: var(--cream);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.goal-bar { height: 100%; background: var(--sage); border-radius: 999px; transition: width 0.4s ease; }
.goal-stats { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.4rem; }
.goal-pct { font-size: 0.8rem; font-weight: 500; color: var(--sage); }
.goal-done { color: #22c55e; }

/* Dash task items */
.dash-task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.dash-task-item:last-child { border-bottom: none; }
.task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.task-name { font-size: 0.85rem; font-weight: 500; }
.task-meta { font-size: 0.75rem; color: var(--muted); }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.qa-btn {
  padding: 0.55rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  color: var(--ink);
}
.qa-btn:hover { border-color: var(--sage); background: var(--cream); }

/* Upcoming */
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.upcoming-info { flex: 1; min-width: 0; }
.upcoming-title { font-size: 0.82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-sub { font-size: 0.72rem; color: var(--muted); }
.upcoming-date { font-size: 0.72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stat-item { text-align: center; background: var(--cream); border-radius: var(--radius-sm); padding: 0.6rem; }
.stat-num { display: block; font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 800; }
.stat-label { font-size: 0.72rem; color: var(--muted); }

/* ── Dashboard Chat ──────────────────────────────────── */

.dash-main { display: flex; flex-direction: column; gap: 1rem; }

.dash-greeting { }
.dash-greeting h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.dash-greeting p { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }

.chat-with-history {
  flex: 1;
  display: flex;
  gap: 1rem;
  min-height: 440px;
  max-height: 560px;
}

.chat-history-rail {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  overflow-y: auto;
}

.chat-new-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-new-btn:hover { background: var(--sage); }

.chat-session-list { display: flex; flex-direction: column; gap: 0.3rem; overflow-y: auto; }

.chat-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.chat-session-item:hover { background: var(--cream); }
.chat-session-item.active { background: var(--cream); border-color: var(--sage); }

.chat-session-title {
  font-size: 0.78rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-session-del {
  font-size: 0.7rem;
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.chat-session-item:hover .chat-session-del { opacity: 0.6; }
.chat-session-del:hover { opacity: 1 !important; }

.chat-container {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 440px;
  max-height: 560px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-bubble {
  display: flex;
  gap: 0.7rem;
  max-width: 85%;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bubble-content {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
}

.chat-bubble.ai .bubble-content {
  background: var(--cream);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-bubble.user .bubble-content {
  background: var(--sage);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.user .bubble-content a { color: #fff; }

.ai-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Typing dots */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.chat-input-area {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
}

.chat-input-wrap {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  margin-bottom: 0.6rem;
}

#chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s;
}
#chat-input:focus {
  border-color: var(--sage);
  animation: inputFocusPulse 0.45s ease-out forwards;
}
@keyframes inputFocusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(95,170,152,0.45); }
  100% { box-shadow: 0 0 0 7px rgba(95,170,152,0); }
}

.chat-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--sage);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send-btn:hover { background: var(--sage-light); }

.chat-icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-icon-btn:hover { border-color: var(--sage); background: var(--cream); }
.chat-icon-btn.mic-active { background: var(--sage); border-color: var(--sage); animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(74,124,111,0.4); } 50% { box-shadow: 0 0 0 8px rgba(74,124,111,0); } }

.chat-attachment-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}
.chat-attachment-preview.hidden { display: none; }

.attachment-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.attachment-thumb-video { display: flex; align-items: center; justify-content: center; background: var(--paper); font-size: 1rem; }
.attachment-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.attachment-remove { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.attachment-remove:hover { color: #ef4444; }

.bubble-attachment {
  display: block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 0.5rem;
}
.bubble-attachment.attachment-thumb-video {
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(255,255,255,0.15);
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
}

.chat-hints { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.hint-chip {
  padding: 0.3rem 0.75rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.hint-chip:hover { border-color: var(--sage); color: var(--ink); }

/* Bubble text formatting */
.bubble-content p { margin: 0 0 0.4em; }
.bubble-content p:last-child { margin-bottom: 0; }
.bubble-content strong { font-weight: 600; }
.bubble-content code {
  background: rgba(0,0,0,0.08);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
}
.chat-bubble.user .bubble-content code { background: rgba(255,255,255,0.15); }

/* ── Landing page ───────────────────────────────────── */

nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 7rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(74,124,111,0.10) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(212,136,42,0.08) 0%, transparent 70%);
}

.hero-inner {
  max-width: 1100px; margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center;
  position: relative; z-index: 1;
}

.hero-tag {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--cream); border: 1px solid var(--border);
  padding: 0.35rem 0.9rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 500; color: var(--muted);
  margin-bottom: 1.5rem;
}
.hero-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); display: inline-block; }

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800; line-height: 1.08; letter-spacing: -0.04em;
  margin-bottom: 1.2rem;
}
.hero h1 .accent { color: var(--sage); }

.hero p {
  font-size: 1.05rem; color: var(--muted); line-height: 1.7;
  margin-bottom: 2rem; max-width: 440px;
}

.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.hero-visual {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 40px rgba(0,0,0,0.08);
}

.chat-preview-bar {
  background: var(--cream); padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.8rem; font-weight: 600; font-family: 'Syne', sans-serif;
}
.chat-preview-bar .avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--sage);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.65rem; font-weight: 700;
}

.chat-preview-body { padding: 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }

.chat-preview-body .chat-bubble {
  padding: 0.7rem 1rem; border-radius: 12px;
  font-size: 0.85rem; line-height: 1.5; max-width: 85%;
  display: block;
}
.chat-preview-body .chat-bubble.user {
  background: var(--sage); color: #fff; align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-preview-body .chat-bubble.ai {
  background: var(--cream); color: var(--ink); align-self: flex-start;
  border-bottom-left-radius: 4px; border: 1px solid var(--border);
}
.chat-preview-body .chat-bubble.ai .highlight { color: var(--sage); font-weight: 500; }

.section { padding: 5rem 2rem; }
.section-inner { max-width: 1100px; margin: 0 auto; }

.section-label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sage); margin-bottom: 0.8rem;
}
.section h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.15;
  margin-bottom: 1rem;
}
.section-sub { color: var(--muted); font-size: 1rem; max-width: 520px; margin-bottom: 3rem; }

.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem;
}

.feature-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.8rem;
  transition: box-shadow 0.22s, transform 0.22s;
  will-change: transform;
}
.feature-card:hover { box-shadow: var(--shadow); transform: translateY(-3px) scale(1.01); }
.feature-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem; font-size: 1.3rem;
}
.fi-sage { background: rgba(74,124,111,0.12); }
.fi-amber { background: rgba(212,136,42,0.12); }
.fi-blue { background: rgba(59,130,246,0.12); }
.fi-purple { background: rgba(139,92,246,0.12); }
.fi-red { background: rgba(239,68,68,0.12); }
.fi-teal { background: rgba(20,184,166,0.12); }

.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.feature-card p { font-size: 0.875rem; color: var(--muted); line-height: 1.6; }

.app-section { background: var(--cream); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.how-step { text-align: center; }
.how-num {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--sage); color: #fff;
  font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.how-step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.how-step p { font-size: 0.875rem; color: var(--muted); line-height: 1.6; }

.cta-section { text-align: center; padding: 5rem 2rem; }
.cta-section h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 1rem; }
.cta-section p { color: var(--muted); margin-bottom: 2rem; font-size: 1rem; max-width: 400px; margin-left: auto; margin-right: auto; }
.cta-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

footer {
  border-top: 1px solid var(--border); padding: 2rem;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 0.8rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-content > * { animation: fadeUp 0.6s ease both; }
.hero-content > *:nth-child(1) { animation-delay: 0.1s; }
.hero-content > *:nth-child(2) { animation-delay: 0.2s; }
.hero-content > *:nth-child(3) { animation-delay: 0.3s; }
.hero-content > *:nth-child(4) { animation-delay: 0.4s; }
.hero-visual { animation: fadeUp 0.7s 0.3s ease both; }

/* ── Auth Modal ─────────────────────────────────────── */

.auth-modal { width: 100%; }

.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-logo { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; }
.auth-logo span { color: var(--sage); }
.auth-sub { color: var(--muted); font-size: 0.875rem; margin-top: 0.3rem; }

.auth-tabs {
  display: flex;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem;
  border: none;
  background: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
}

.auth-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
  color: var(--ink);
  margin-bottom: 1rem;
}
.btn-google:hover { border-color: var(--sage); }

.auth-divider {
  text-align: center;
  position: relative;
  margin: 0.8rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-error { color: #ef4444; font-size: 0.825rem; min-height: 1.2rem; margin-bottom: 0.5rem; }
.auth-submit { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* ── Onboarding ──────────────────────────────────────── */

.onboarding-modal { }
.onboard-header { text-align: center; margin-bottom: 1.8rem; }
.onboard-emoji { font-size: 2.5rem; margin-bottom: 0.5rem; }
.onboard-header h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.3rem; }
.onboard-header p { color: var(--muted); font-size: 0.9rem; }

/* ── Study Mode ──────────────────────────────────────── */

.study-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  max-width: 1000px;
  padding-top: calc(var(--nav-h) + 1.5rem);
}

.study-main { display: flex; flex-direction: column; gap: 1rem; }

.timer-mode-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.timer-tab {
  padding: 0.5rem 1.2rem;
  border: none;
  background: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
}

.timer-tab.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.timer-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

/* Pomodoro ring */
.pomo-phase-label {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sage);
}

.pomo-session-track { display: flex; gap: 8px; }
.session-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.session-dot.done { background: var(--sage); }
.session-dot.active { background: var(--amber); box-shadow: 0 0 0 2px var(--amber-light); }

.timer-ring-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.ring-bg { fill: none; stroke: var(--cream); stroke-width: 12; }
.ring-progress {
  fill: none;
  stroke: var(--sage);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 553;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s;
}

.timer-center {
  position: absolute;
  text-align: center;
}

.timer-display {
  font-family: 'Syne', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.timer-display-lg {
  font-family: 'Syne', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  padding: 2rem 0;
}

.timer-sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }

.timer-controls { display: flex; gap: 0.8rem; align-items: center; }

.timer-btn {
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.timer-btn-primary {
  padding: 0.7rem 2rem;
  border-radius: 999px;
  background: var(--sage);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}
.timer-btn-primary:hover { background: var(--sage-light); }

.timer-btn-secondary {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 1.1rem;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.timer-btn-secondary:hover { border-color: var(--sage); }
.timer-btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.pomo-settings-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  width: 100%;
}

.pomo-cfg { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; }
.pomo-cfg label { color: var(--muted); white-space: nowrap; }
.pomo-cfg input { width: 52px; padding: 0.3rem 0.5rem; border: 1.5px solid var(--border); border-radius: 6px; background: var(--paper); color: var(--ink); text-align: center; }
.pomo-cfg span { color: var(--muted); }

/* Countdown */
.timer-set-row { display: flex; gap: 0.6rem; align-items: center; }
.ct-input-group { display: flex; align-items: center; gap: 0.3rem; }
.ct-input-group input {
  width: 72px;
  text-align: center;
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
.ct-input-group label { font-size: 1rem; color: var(--muted); }

/* Stopwatch */
.lap-list {
  width: 100%;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.lap-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

/* Study sidebar widgets */
.study-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.study-widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}
.study-widget-todo { flex: 1; }
.goal-display { }

/* Todo */
.todo-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.todo-empty { font-size: 0.82rem; color: var(--muted); text-align: center; padding: 1rem; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}
.todo-item.todo-active { border-color: var(--sage); background: rgba(74,124,111,0.05); }
.todo-item.todo-done { opacity: 0.5; }

.todo-check {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  padding: 0;
  width: 22px;
  text-align: center;
}
.check-circle {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin: 0 auto;
}

.todo-content { flex: 1; min-width: 0; }
.todo-title { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-meta { display: flex; gap: 0.4rem; margin-top: 0.2rem; align-items: center; flex-wrap: wrap; }
.todo-subject {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.todo-pomos { font-size: 0.72rem; color: var(--muted); }

.todo-actions { display: flex; gap: 0.3rem; }
.todo-set-active, .todo-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.15rem;
  color: var(--muted);
  transition: color 0.15s;
}
.todo-set-active:hover { color: var(--sage); }
.todo-delete:hover { color: #ef4444; }

.todo-from-tracker select { width: 100%; }

/* ── Tracker Page ────────────────────────────────────── */

.tracker-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.filter-tabs { display: flex; gap: 0.4rem; }
.filter-tab {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
}
.filter-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.sort-select { width: auto; padding: 0.45rem 0.8rem; }

.tracker-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.5rem;
}
.tstat-num { font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800; }
.tstat-label { font-size: 0.75rem; color: var(--muted); }

.assignments-list { display: flex; flex-direction: column; gap: 0.7rem; }

.assignment-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  transition: all 0.22s;
  will-change: transform;
}
.assignment-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.assignment-card.completed { opacity: 0.6; }
.assignment-card.overdue { border-color: #fca5a5; }

.acard-left { flex-shrink: 0; }
.acard-check {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
}
.check-circle { width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 50%; }

.acard-body { flex: 1; min-width: 0; }
.acard-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.3rem; }
.strikethrough { text-decoration: line-through; }
.acard-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.acard-subject { font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; }
.acard-type { font-size: 0.75rem; color: var(--muted); }
.acard-pomos { font-size: 0.75rem; color: var(--muted); }
.acard-notes { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }

.acard-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; flex-shrink: 0; }
.acard-due { font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.overdue-text { color: #ef4444; }

.acard-actions { display: flex; gap: 0.3rem; }
.acard-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.acard-btn:hover { opacity: 1; }
.acard-btn-danger:hover { color: #ef4444; opacity: 1; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; font-weight: 700; color: var(--ink); margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 1.5rem; }

.loading-inline { text-align: center; padding: 3rem; color: var(--muted); }

/* ── Settings Page ───────────────────────────────────── */

.settings-layout { max-width: 900px; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sage);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.settings-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}

.settings-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.settings-avatar-initials {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
}

.settings-display-name { font-weight: 600; }
.settings-email { font-size: 0.82rem; color: var(--muted); }

/* Theme swatches */
.theme-swatches { display: flex; gap: 0.7rem; margin-bottom: 0.4rem; }
.theme-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  font-size: 0.75rem;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s;
}
.theme-swatch.active { border-color: var(--ink); }

.theme-names { display: flex; gap: 0.7rem; }
.theme-name {
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s;
  white-space: nowrap;
}
.theme-name.active { color: var(--ink); font-weight: 600; }

.toggle-row { display: flex; gap: 0.5rem; }
.mode-btn {
  flex: 1;
  padding: 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted);
  transition: all 0.2s;
}
.mode-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Toggle switch */
.toggle-setting { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.setting-label { font-size: 0.9rem; font-weight: 500; }
.setting-desc { font-size: 0.8rem; color: var(--muted); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
input:checked + .toggle-slider { background: var(--sage); }
input:checked + .toggle-slider::before { transform: translateX(20px); }

.settings-danger { border-color: #fca5a5; }
.btn-logout { color: #ef4444; border-color: #fca5a5; }
.btn-logout:hover { background: #fef2f2; }

/* ── Calendar Page (Google Calendar style) ───────────── */

/* Full-page layout — no .page-content wrapper */
.gcal-page {
  display: flex;
  height: 100vh;
  padding-top: var(--nav-h);
  overflow: hidden;
  background: var(--paper);
}

/* Sidebar */
.gcal-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--border);
  background: var(--paper);
  overflow-y: auto;
  padding: 1rem 0.8rem;
}

.gcal-new-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s;
  margin-bottom: 1rem;
  width: 100%;
  justify-content: center;
}
.gcal-new-btn:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.gcal-new-btn span { font-size: 1.3rem; line-height: 1; color: var(--sage); }

/* Mini calendar */
.mini-cal-wrap { margin-bottom: 0.5rem; }

.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.2rem 0.6rem;
}
.mini-cal-month { font-size: 0.82rem; font-weight: 600; }
.mini-cal-nav {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.mini-cal-nav:hover { background: var(--cream); }

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.mini-hdr {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.2rem 0;
}
.mini-day {
  text-align: center;
  font-size: 0.75rem;
  padding: 0.22rem 0;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  margin: 1px auto;
}
.mini-day:hover { background: var(--cream); }
.mini-day.today { color: var(--sage); font-weight: 700; }
.mini-day.selected { background: var(--sage); color: #fff; font-weight: 700; }
.mini-day.selected.today { background: var(--sage); }
.mini-day.other { color: var(--border); cursor: default; }
.mini-dot {
  position: absolute;
  bottom: 1px;
  left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--sage);
}
.mini-day.selected .mini-dot { background: #fff; }

/* Sidebar sections */
.gcal-sidebar-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.gcal-sidebar-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.6rem; }

.gcal-upcoming-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.4rem 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.gcal-upcoming-item:hover { background: var(--cream); padding-left: 0.3rem; }
.gcal-upcoming-bar { width: 3px; border-radius: 3px; flex-shrink: 0; align-self: stretch; min-height: 24px; }
.gcal-upcoming-body { flex: 1; min-width: 0; }
.gcal-upcoming-title { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcal-upcoming-meta { font-size: 0.72rem; color: var(--muted); }
.gcal-upcoming-empty { font-size: 0.8rem; color: var(--muted); font-style: italic; }

/* Legend */
.gcal-legend { display: flex; flex-direction: column; gap: 0.35rem; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; text-transform: capitalize; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Main area */
.gcal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Top bar */
.gcal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  flex-shrink: 0;
  gap: 1rem;
  flex-wrap: wrap;
}
.gcal-topbar-left { display: flex; align-items: center; gap: 0.6rem; }
.gcal-topbar-right { display: flex; align-items: center; gap: 0.6rem; }

.gcal-today-btn {
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s;
}
.gcal-today-btn:hover { border-color: var(--sage); }

.gcal-nav { display: flex; gap: 2px; }
.gcal-nav-btn {
  width: 32px; height: 32px;
  border: none;
  background: none;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.gcal-nav-btn:hover { background: var(--cream); }

.gcal-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gcal-ai-btn {
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--sage);
  border-radius: 999px;
  background: rgba(74,124,111,0.08);
  color: var(--sage);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.gcal-ai-btn:hover { background: var(--sage); color: #fff; }

.gcal-view-tabs {
  display: flex;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.gcal-view-tab {
  padding: 0.35rem 0.8rem;
  border: none;
  background: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.gcal-view-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* Grid wrapper */
.gcal-grid-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Month view ─────────────────────── */
.gcal-month { display: flex; flex-direction: column; height: 100%; }

.month-hdr-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.month-hdr {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  flex: 1;
  overflow-y: auto;
}

.month-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 90px;
  overflow: hidden;
}
.month-cell:nth-child(7n) { border-right: none; }
.month-cell:hover { background: var(--cream); }
.month-cell.today { background: rgba(74,124,111,0.04); }
.month-cell.other-month { opacity: 0.4; }

.month-cell-num {
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.today-circle { background: var(--sage); color: #fff; font-weight: 700; }

.month-cell-events { display: flex; flex-direction: column; gap: 2px; }
.month-event {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.15s;
}
.month-event:hover { opacity: 0.85; }
.month-more { font-size: 0.68rem; color: var(--muted); padding: 0 4px; }

/* ── Time grid (week + day) ─────────── */
.time-grid-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.time-grid-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.time-gutter-label {
  width: 52px;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--muted);
}
.allday-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}

.time-grid-days-header {
  display: grid;
  grid-template-columns: repeat(var(--day-cols, 7), 1fr);
  flex: 1;
}

.time-day-header {
  text-align: center;
  padding: 0.6rem 0.3rem;
  border-left: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.time-day-header:hover { background: var(--cream); }
.time-day-header.today { color: var(--sage); }

.time-day-name { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.time-day-num {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0.2rem auto 0;
}
.time-day-header.today .time-day-num.today-circle {
  background: var(--sage); color: #fff;
}
.time-day-header.today .time-day-name { color: var(--sage); }

/* All-day row */
.time-allday-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 32px;
}
.allday-cell {
  border-left: 1px solid var(--border);
  flex: 1;
  padding: 2px 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.allday-event {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Scrollable time body */
.time-grid-body { flex: 1; overflow: hidden; }
.time-grid-scroll {
  height: 100%;
  overflow-y: auto;
}
.time-grid-inner {
  display: flex;
  position: relative;
}

.time-gutter {
  width: 52px;
  flex-shrink: 0;
}
.time-gutter-slot {
  position: relative;
  border-bottom: 1px solid var(--border);
}
.time-label {
  position: absolute;
  top: -0.55em;
  right: 6px;
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

.time-days-grid {
  display: grid;
  grid-template-columns: repeat(var(--day-cols, 7), 1fr);
  flex: 1;
}

.time-day-col {
  border-left: 1px solid var(--border);
  position: relative;
}
.time-day-col.today-col { background: rgba(74,124,111,0.02); }

.time-slot {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.time-slot-half { flex: 1; transition: background 0.1s; }
.time-slot-half:hover { background: rgba(74,124,111,0.06); }

/* Now line */
.now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 5;
  pointer-events: none;
}
.now-dot {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ef4444;
}

/* Timed events */
.timed-event {
  position: absolute;
  border-radius: 4px;
  padding: 2px 5px;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  box-sizing: border-box;
  transition: opacity 0.15s, filter 0.15s;
  color: #fff;
  min-width: 0;
}
.timed-event:hover { opacity: 0.88; filter: brightness(1.05); }
.timed-event-title { font-size: 0.72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timed-event-time  { font-size: 0.65rem; opacity: 0.85; white-space: nowrap; }

/* Event detail modal */
.event-detail-header {
  padding: 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.event-detail-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.event-detail-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.event-detail-meta span { font-size: 0.82rem; color: var(--muted); }
.event-detail-notes { font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; font-style: italic; }
.event-type-badge { padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; }

/* Misc reused */
.link-btn { background: none; border: none; color: var(--sage); cursor: pointer; font-size: 0.875rem; text-decoration: underline; }

/* ── Quiz Page ───────────────────────────────────────── */

.quiz-section { margin-bottom: 2rem; }
.quiz-section-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

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

.quiz-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: box-shadow 0.22s, transform 0.22s;
  will-change: transform;
}
.quiz-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.qcard-icon { font-size: 2rem; }
.qcard-body { flex: 1; }
.qcard-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.4rem; }
.qcard-meta { display: flex; gap: 0.5rem; align-items: center; }
.qcard-subject { font-size: 0.75rem; color: var(--sage); font-weight: 600; }
.qcard-count { font-size: 0.75rem; color: var(--muted); }
.qcard-score { font-size: 0.8rem; color: var(--amber); font-weight: 500; }

.qcard-actions { display: flex; align-items: center; justify-content: space-between; }
.qcard-start { flex: 1; justify-content: center; }
.qcard-delete { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); padding: 0.2rem; transition: color 0.15s; }
.qcard-delete:hover { color: #ef4444; }

/* Quiz session */
.quiz-session, .flashcard-session {
  max-width: 700px;
  margin: 0 auto;
}

.quiz-session-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.quiz-progress-wrap {
  flex: 1;
  height: 6px;
  background: var(--cream);
  border-radius: 999px;
  overflow: hidden;
}
.quiz-progress-bar {
  height: 100%;
  background: var(--sage);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.quiz-progress-label { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.question-num { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-bottom: 0.6rem; }
.question-text { font-size: 1.05rem; font-weight: 600; margin-bottom: 1.5rem; line-height: 1.5; }

.options-list { display: flex; flex-direction: column; gap: 0.6rem; }
.option-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.option-btn:hover { border-color: var(--sage); background: var(--cream); }
.option-btn.selected { border-color: var(--sage); background: rgba(74,124,111,0.08); }

.option-letter {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--cream);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.option-btn.selected .option-letter { background: var(--sage); color: #fff; border-color: var(--sage); }

.short-answer-input {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
}
.short-answer-input:focus { border-color: var(--sage); }

.quiz-nav { display: flex; justify-content: space-between; gap: 0.8rem; }

/* Results */
.quiz-results { max-width: 700px; margin: 0 auto; }
.results-header { text-align: center; padding: 2rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.5rem; }
.results-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.results-score { font-family: 'Syne', sans-serif; font-size: 3.5rem; font-weight: 800; color: var(--sage); }
.results-sub { color: var(--muted); margin-top: 0.3rem; }

.results-review { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.results-review h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.review-item { padding: 0.8rem; border-radius: var(--radius-sm); margin-bottom: 0.6rem; }
.review-item.correct { background: rgba(34,197,94,0.08); border-left: 3px solid #22c55e; }
.review-item.incorrect { background: rgba(239,68,68,0.08); border-left: 3px solid #ef4444; }
.review-q { display: flex; gap: 0.5rem; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.3rem; }
.review-status { flex-shrink: 0; }
.review-ans { font-size: 0.82rem; color: var(--muted); padding-left: 1.5rem; }
.review-explanation { font-size: 0.8rem; color: var(--sage); margin-top: 0.3rem; padding-left: 1.5rem; font-style: italic; }

/* Flashcards */
.fc-container { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; width: 100%; }
.flashcard {
  width: 100%;
  max-width: 480px;
  height: 240px;
  perspective: 1000px;
  cursor: pointer;
}
.flashcard { position: relative; transform-style: preserve-3d; transition: transform 0.4s; }
.flashcard.flipped { transform: rotateY(180deg); }
.fc-front, .fc-back {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  backface-visibility: hidden;
  text-align: center;
}
.fc-back {
  transform: rotateY(180deg);
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}
.fc-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.6; margin-bottom: 0.8rem; }
.fc-text { font-size: 1rem; font-weight: 500; line-height: 1.5; }
.fc-hint { font-size: 0.8rem; color: var(--muted); }

/* Difficulty buttons */
.difficulty-btns { display: flex; gap: 0.5rem; }
.diff-btn {
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  transition: all 0.2s;
}
.diff-btn.active { background: var(--sage); color: #fff; border-color: var(--sage); }

/* ════════════════════════════════════════════════════════
   Practice & Tests
   ════════════════════════════════════════════════════════ */

.page-header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.modal-sub { color: var(--muted); font-size: 0.85rem; margin: -0.4rem 0 1.1rem; }
.modal-actions { display: flex; gap: 0.8rem; margin-top: 1.2rem; }
.gen-progress { font-size: 0.85rem; color: var(--sage); background: rgba(74,124,111,0.10); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; margin-bottom: 0.9rem; text-align: center; font-weight: 500; }
.gen-progress.hidden { display: none; }

.diff-pill { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.12rem 0.45rem; border-radius: 999px; }
.diff-easy   { background: rgba(34,197,94,0.16);  color: #16a34a; }
.diff-medium { background: rgba(212,136,42,0.18); color: var(--amber); }
.diff-hard   { background: rgba(239,68,68,0.15);  color: #ef4444; }
.diff-expert { background: rgba(139,92,246,0.18); color: #8b5cf6; }

.test-card { border-left: 3px solid var(--amber); }

/* ── Test cover ── */
.test-cover { max-width: 640px; margin: 0 auto; }
.test-cover-back { margin-bottom: 1rem; }
.test-cover-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.4rem 2rem; text-align: center; box-shadow: var(--shadow); }
.test-cover-emoji { font-size: 3rem; }
.test-cover-title { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; margin: 0.4rem 0 0.3rem; }
.test-cover-sub { color: var(--muted); margin-bottom: 1.6rem; display: flex; gap: 0.5rem; align-items: center; justify-content: center; }
.test-cover-stats { display: flex; justify-content: center; gap: 2.2rem; padding: 1.2rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 1.4rem; }
.tc-stat-num { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--sage); }
.tc-stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.test-instructions { list-style: none; text-align: left; max-width: 470px; margin: 0 auto 1.6rem; display: flex; flex-direction: column; gap: 0.6rem; }
.test-instructions li { font-size: 0.875rem; color: var(--ink); line-height: 1.45; }
.test-cover-best { font-size: 0.875rem; color: var(--amber); margin-bottom: 1.2rem; }

/* ── Running test bar + timer ── */
.test-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.55rem 0.8rem; margin-bottom: 1rem; }
.test-bar-mid { flex: 1; text-align: center; }
.test-answered { font-size: 0.8rem; color: var(--muted); }
.test-timer { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--ink); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.test-timer-low { color: #ef4444; animation: timerPulse 1s ease-in-out infinite; }
@keyframes timerPulse { 50% { opacity: 0.45; } }

.test-section-head { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.95rem; color: var(--sage); margin: 0.4rem 0 0.8rem; display: flex; flex-direction: column; gap: 0.15rem; }
.test-section-head span { font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: 0.78rem; color: var(--muted); }

.question-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.6rem; }
.flag-btn { background: none; border: 1px solid var(--border); border-radius: 999px; font-size: 0.72rem; padding: 0.25rem 0.65rem; cursor: pointer; color: var(--muted); transition: all 0.15s; white-space: nowrap; }
.flag-btn:hover { border-color: var(--amber); color: var(--amber); }
.flag-btn.flagged { background: rgba(212,136,42,0.15); border-color: var(--amber); color: var(--amber); font-weight: 600; }

.ms-hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.7rem; font-style: italic; }
.option-letter.option-box { border-radius: 6px; }

.test-review-link { display: block; margin: 1rem auto 0; background: none; border: none; color: var(--muted); font-size: 0.8rem; cursor: pointer; text-decoration: underline; }
.test-review-link:hover { color: var(--sage); }

/* ── Review-before-submit grid ── */
.test-review-head { text-align: center; margin-bottom: 1.4rem; }
.test-review-head h2 { font-family: 'Syne', sans-serif; font-size: 1.4rem; margin-bottom: 0.3rem; }
.test-review-head p { color: var(--muted); font-size: 0.875rem; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 0.5rem; margin-bottom: 1.6rem; }
.review-cell { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--card); font-weight: 700; font-size: 0.9rem; cursor: pointer; color: var(--ink); transition: all 0.15s; }
.review-cell:hover { border-color: var(--sage); transform: translateY(-1px); }
.review-cell.done { background: rgba(74,124,111,0.14); border-color: var(--sage); color: var(--sage); }
.review-cell.todo { color: var(--muted); }
.review-cell.flagged { border-color: var(--amber); }
.cell-flag { position: absolute; top: -7px; right: -5px; font-size: 0.62rem; }
.test-submit-row { max-width: 100%; }

/* ── Results: grade badge + section breakdown ── */
.grade-badge { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 2.5rem; width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.7rem; color: #fff; }
.grade-a, .grade-a-bg { background: #16a34a; }
.grade-b, .grade-b-bg { background: var(--sage); }
.grade-c, .grade-c-bg { background: var(--amber); }
.grade-f, .grade-f-bg { background: #ef4444; }

.section-breakdown { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.8rem; }
.sb-row { display: flex; align-items: center; gap: 0.8rem; }
.sb-title { flex: 0 0 42%; font-size: 0.82rem; font-weight: 600; }
.sb-bar { flex: 1; height: 8px; background: var(--cream); border-radius: 999px; overflow: hidden; }
.sb-fill { height: 100%; border-radius: 999px; }
.sb-pct { font-size: 0.8rem; font-weight: 700; color: var(--muted); min-width: 36px; text-align: right; }

.results-actions { display: flex; gap: 0.8rem; margin-top: 2rem; justify-content: center; flex-wrap: wrap; }
.review-pts { margin-left: auto; font-size: 0.75rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.review-item.selfcheck { background: rgba(212,136,42,0.08); border-left: 3px solid var(--amber); }
.review-model { font-size: 0.8rem; color: var(--ink); margin-top: 0.4rem; padding-left: 1.5rem; }

.fill-input { width: 100%; padding: 0.85rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-size: 1rem; font-family: inherit; outline: none; }
.fill-input:focus { border-color: var(--sage); }

/* ── Practice instant feedback ── */
.pf { margin-top: 1rem; padding: 0.9rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; animation: pfIn 0.2s ease; }
.pf-head { font-weight: 700; margin-bottom: 0.2rem; }
.pf-correct { background: rgba(34,197,94,0.1); border-left: 3px solid #22c55e; }
.pf-wrong { background: rgba(239,68,68,0.09); border-left: 3px solid #ef4444; }
.pf-self { background: rgba(212,136,42,0.08); border-left: 3px solid var(--amber); }
.pf-exp { margin-top: 0.4rem; color: var(--muted); font-style: italic; }
.pf-model { margin-top: 0.4rem; font-weight: 500; }
@keyframes pfIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Flashcard rating ── */
.fc-rate { display: flex; gap: 0.8rem; }
.fc-rate .btn { flex: 1; justify-content: center; }
.fc-hint-text { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); }
.fc-mastered { font-weight: 600; color: var(--sage); align-self: center; }

/* ── Responsive ──────────────────────────────────────── */

/* ── Large laptops (≤1200px) ── */
@media (max-width: 1200px) {
  .dashboard-layout {
    grid-template-columns: 220px 1fr 220px;
    gap: 1rem;
  }
}

/* ── Small laptops / landscape tablets (≤1024px) ── */
@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 220px 1fr;
    padding: calc(var(--nav-h) + 1rem) 1rem 2rem;
  }
  .dash-sidebar:last-child { display: none; }

  .study-layout { grid-template-columns: 1fr 260px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .how-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-inner { gap: 2rem; }

  .quiz-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Portrait tablets / large phones (≤768px) ── */
@media (max-width: 768px) {

  /* Landing nav */
  nav { padding: 0.8rem 1rem; }
  .nav-links { display: none; }
  .hero { padding: 6rem 1.2rem 3rem; }
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; }
  .hero-visual { display: none; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 0.95rem; }
  .hero-actions { flex-direction: column; }
  .btn-lg { width: 100%; justify-content: center; }
  .section { padding: 3rem 1.2rem; }
  .cta-section { padding: 3rem 1.2rem; }
  .features-grid { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  footer { flex-direction: column; gap: 0.5rem; text-align: center; }

  /* App nav → hamburger */
  .app-nav { padding: 0 1rem; }
  .nav-links-center { display: none; }
  .nav-links-center.nav-links-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--border);
    padding: 0.8rem;
    gap: 0.2rem;
    z-index: 99;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  }
  .nav-links-center.nav-links-open .nav-link {
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
  }
  .nav-mobile-toggle { display: flex; }
  .nav-name { display: none; }
  .nav-caret { display: none; }

  /* Page content */
  .page-content {
    padding: calc(var(--nav-h) + 1rem) 1rem 2rem;
  }

  /* Dashboard */
  .dashboard-layout {
    grid-template-columns: 1fr;
    padding: calc(var(--nav-h) + 1rem) 1rem 2rem;
    gap: 1rem;
  }
  .dash-sidebar:last-child { display: none; }
  .dash-sidebar:first-of-type { order: 2; }
  .dash-main { order: 1; }
  .chat-container { min-height: 300px; max-height: 400px; }
  .chat-with-history { max-height: 400px; }
  .chat-history-rail { display: none; }
  .chat-hints { display: none; }
  .dash-greeting h1 { font-size: 1.2rem; }
  .dash-greeting p { display: none; }

  /* Study mode */
  .study-layout {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  .study-sidebar { order: 2; }
  .study-main { order: 1; }
  .timer-panel { padding: 1.5rem 1rem; }
  .timer-ring { width: 160px; height: 160px; }
  .timer-display { font-size: 2.2rem; }
  .timer-display-lg { font-size: 2.8rem; }
  .pomo-settings-row { flex-wrap: wrap; gap: 0.6rem; }
  .timer-mode-tabs { width: 100%; justify-content: stretch; }
  .timer-tab { flex: 1; text-align: center; font-size: 0.8rem; padding: 0.45rem 0.5rem; }

  /* Tracker */
  .tracker-controls { flex-direction: column; align-items: stretch; }
  .filter-tabs { justify-content: center; }
  .tracker-stats { justify-content: center; }
  .tstat { flex: 1; min-width: 70px; padding: 0.6rem 0.5rem; }
  .acard-notes { display: none; }
  .acard-right { align-items: flex-end; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .btn { width: 100%; justify-content: center; }
  .page-header > div:first-child + div { width: 100%; }

  /* Calendar */
  .gcal-sidebar { display: none; }
  .gcal-topbar { padding: 0.5rem 0.8rem; gap: 0.5rem; }
  .gcal-title { font-size: 0.95rem; }
  .gcal-view-tab { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
  .gcal-today-btn { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
  .gcal-ai-btn { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
  .time-day-num { font-size: 1rem; width: 28px; height: 28px; }
  .time-day-name { font-size: 0.65rem; }
  .month-cell { min-height: 60px; padding: 0.3rem; }
  .month-event { font-size: 0.65rem; }

  /* Settings */
  .settings-grid { grid-template-columns: 1fr; }
  .settings-layout { max-width: 100%; }

  /* Quiz */
  .quiz-cards-grid { grid-template-columns: 1fr; }
  .quiz-session, .flashcard-session { max-width: 100%; }
  .question-card { padding: 1.2rem; }
  .question-text { font-size: 0.95rem; }
  .flashcard { height: 200px; }
  .fc-text { font-size: 0.9rem; }
  .results-score { font-size: 2.5rem; }
  .quiz-nav { gap: 0.5rem; }
  .quiz-nav .btn { padding: 0.6rem 1rem; font-size: 0.85rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }

  /* Modals */
  #modal-content { padding: 1.5rem; border-radius: 16px; }
  .auth-modal { }

  /* Toast */
  #toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ── Phones (≤480px) ── */
@media (max-width: 480px) {
  /* Landing */
  .hero h1 { font-size: 1.75rem; }
  .hero-tag { font-size: 0.72rem; }

  /* Nav */
  .brand { font-size: 1.1rem; }
  .nav-profile { padding: 0.3rem 0.5rem 0.3rem 0.3rem; }
  .nav-quick-actions { display: none; }

  /* Dashboard */
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-num { font-size: 1rem; }
  .stat-label { font-size: 0.65rem; }

  /* Tracker */
  .tstat-num { font-size: 1.3rem; }
  .tracker-stats { gap: 0.5rem; }
  .assignment-card { padding: 0.8rem; gap: 0.5rem; }
  .acard-title { font-size: 0.875rem; }
  .acard-actions { gap: 0.1rem; }

  /* Study */
  .timer-ring { width: 140px; height: 140px; }
  .timer-display { font-size: 1.9rem; }
  .timer-display-lg { font-size: 2.4rem; padding: 1.5rem 0; }
  .timer-btn-primary { padding: 0.65rem 1.5rem; font-size: 0.875rem; }
  .timer-btn-secondary { width: 36px; height: 36px; font-size: 1rem; }
  .ct-input-group input { width: 60px; font-size: 1.2rem; }

  /* Calendar */
  .gcal-topbar-right { gap: 0.4rem; }
  .gcal-ai-btn { display: none; }
  .time-gutter-label { width: 36px; }
  .time-gutter { width: 36px; }
  .time-label { font-size: 0.58rem; right: 3px; }
  .month-cell { min-height: 44px; }
  .month-event { display: none; }
  .month-more { display: none; }
  .month-cell-num { font-size: 0.72rem; }

  /* Quiz */
  .difficulty-btns { flex-wrap: wrap; }
  .diff-btn { flex: 1; }
  .option-btn { padding: 0.65rem 0.8rem; font-size: 0.85rem; }
  .option-letter { width: 22px; height: 22px; font-size: 0.7rem; }

  /* Modal */
  #modal-content { padding: 1.2rem; margin: 0.5rem; border-radius: 14px; }
  .modal-card h3 { font-size: 1.1rem; }

  /* Settings */
  .theme-swatches { flex-wrap: wrap; }
  .theme-names { flex-wrap: wrap; }

  /* Buttons */
  .btn { padding: 0.6rem 1.1rem; font-size: 0.875rem; }
  .btn-lg { padding: 0.8rem 1.5rem; font-size: 0.95rem; }
}

/* ── Study Lockdown Mode ─────────────────────────────── */

.lockdown-setup {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--paper);
}

.lockdown-setup-card {
  max-width: 440px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.lockdown-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.lockdown-setup-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.6rem; }
.lockdown-sub { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin-bottom: 0.8rem; }
.lockdown-caveat {
  font-size: 0.78rem;
  color: var(--amber);
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.2rem;
  text-align: left;
}

.lockdown-active {
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

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

.lockdown-badge { font-weight: 700; font-size: 0.9rem; }

.lockdown-body {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.lockdown-timer-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sage);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  height: fit-content;
}

.lockdown-phase { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.8rem; }
.lockdown-time { font-family: 'Syne', sans-serif; font-size: 3rem; font-weight: 800; margin-bottom: 1.2rem; }
.lockdown-timer-controls { display: flex; gap: 0.6rem; justify-content: center; }

.lockdown-chat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 440px;
  overflow: hidden;
}

.lockdown-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(5, 6, 12, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lockdown-gate-card {
  max-width: 360px;
  width: 90%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.lockdown-gate-card h2 { font-size: 1.2rem; margin-bottom: 0.4rem; }
.lockdown-gate-card p { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }
.lockdown-gate-card input {
  width: 100%;
  padding: 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
}

@media (max-width: 768px) {
  .lockdown-body { grid-template-columns: 1fr; }
}

/* ── Lofi player widget ──────────────────────────────── */

.lofi-track { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.lofi-art {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.lofi-track-info { min-width: 0; }
.lofi-track-name { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lofi-track-artist { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lofi-controls { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 0.6rem; }
.lofi-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--paper);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.lofi-btn:hover { border-color: var(--sage); background: var(--cream); }
.lofi-btn-main { background: var(--sage); color: #fff; border-color: var(--sage); }
.lofi-btn-main:hover { background: var(--sage-light); }

.lofi-volume { width: 100%; margin-bottom: 0.6rem; accent-color: var(--sage); }

.lofi-track-select { width: 100%; }
