/*
 * StudyFlow — Theme Refresh v2
 * Glassmorphism, Geist font, Lucide icons, and fluid animation layer.
 * Applied on top of styles.css. Does not change markup or JS behaviour.
 */

/* ============================================================
   1. Design tokens
   ============================================================ */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --soft: #eef0f8;
  --ink: #12131e;
  --muted: #61657c;
  --line: rgba(18, 19, 30, 0.08);

  --accent: #4f46e5;
  --accent-deep: #3730a3;
  --accent-light: rgba(79, 70, 229, 0.12);

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow:
    0 12px 40px rgba(31, 38, 135, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --class: #4a5bd4;
  --study: #8b5cf6;
  --homework: #e8862e;
  --exam: #e5576b;
  --personal: #14b8a6;
  --success: #10b981;

  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  --shadow-card: 0 2px 12px rgba(18, 19, 30, 0.06), 0 1px 3px rgba(18, 19, 30, 0.04);
  --shadow-hero: 0 24px 56px rgba(70, 62, 200, 0.28);
  --shadow-float: 0 10px 28px rgba(18, 19, 30, 0.12);

  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
}

[data-theme="dark"] {
  --bg: #0b0c13;
  --surface: #181924;
  --soft: #20212d;
  --ink: #edeef6;
  --muted: #9a9db5;
  --line: rgba(255, 255, 255, 0.08);

  --accent: #818cf8;
  --accent-deep: #a5b4fc;
  --accent-light: rgba(129, 140, 248, 0.16);

  --glass-bg: rgba(11, 12, 19, 0.55);
  --glass-bg-strong: rgba(13, 14, 23, 0.8);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);

  --shadow-card: 0 2px 14px rgba(0, 0, 0, 0.3);
  --shadow-hero: 0 24px 60px rgba(60, 55, 180, 0.4);
  --shadow-float: 0 10px 28px rgba(0, 0, 0, 0.42);
}

/* ============================================================
   2. Body — layered ambient gradients for the glass to blur
   ============================================================ */
body {
  background:
    radial-gradient(60% 45% at 10% -5%, rgba(97, 89, 255, 0.12), transparent 62%),
    radial-gradient(45% 38% at 108% 8%, rgba(124, 82, 219, 0.12), transparent 60%),
    radial-gradient(55% 45% at 50% 118%, rgba(47, 168, 130, 0.09), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  letter-spacing: -0.01em;
}

[data-theme="dark"] body {
  background:
    radial-gradient(60% 45% at 12% -5%, rgba(79, 70, 229, 0.16), transparent 62%),
    radial-gradient(45% 38% at 105% 8%, rgba(124, 82, 219, 0.12), transparent 60%),
    radial-gradient(55% 45% at 50% 118%, rgba(20, 120, 92, 0.08), transparent 62%),
    #0b0c13;
  background-attachment: fixed;
}

/* ============================================================
   3. Icon atoms (Lucide — replaced in place by createIcons)
   ============================================================ */
.uic {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  line-height: 0;
}
.uic svg {
  width: 1.15em;
  height: 1.15em;
  stroke: currentColor;
  stroke-width: 2;
  display: block;
}
.side nav button .uic svg,
.mobile button .uic svg { width: 18px; height: 18px; }
.actions button svg,
#command-mobile svg { width: 18px; height: 18px; }
.dialog-head > button svg,
.gemini-panel-head > button svg { width: 14px; height: 14px; }
.types button .uic svg { width: 20px; height: 20px; }
.features button > i svg { width: 20px; height: 20px; }
.install-card .uic svg,
.account-summary .uic svg { width: 18px; height: 18px; }
.recommend-icon svg { width: 24px; height: 24px; }
.search-input > .uic svg { width: 18px; height: 18px; }
.focus-modal #complete .uic svg { width: 26px; height: 26px; }
#focus .uic svg { width: 16px; height: 16px; }

/* ============================================================
   4. Side navigation — frosted glass
   ============================================================ */
.side {
  width: 260px;
  padding: 28px 18px 22px;
  border-right: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(32px) saturate(1.8);
  -webkit-backdrop-filter: blur(32px) saturate(1.8);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.45);
}
[data-theme="dark"] .side {
  background: var(--glass-bg);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}
.brand { gap: 12px; font-size: 17px; font-weight: 830; letter-spacing: -0.05em; }
.brand b {
  width: 32px; height: 32px; border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
  font-family: Georgia, serif; font-size: 18px;
}
.side nav { gap: 4px; margin-top: 36px; }
.side nav button {
  border-radius: 13px;
  min-height: 44px;
  padding: 10px 13px;
  font-size: 14px; font-weight: 650;
  color: var(--muted);
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.side nav button:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(31, 38, 135, 0.06);
}
[data-theme="dark"] .side nav button:hover { background: rgba(255, 255, 255, 0.05); }
.side nav button.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 750;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14);
}
[data-theme="dark"] .side nav button.active {
  background: var(--accent-light);
  color: #a5b4fc;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.2);
}
.side-bottom > button {
  border-radius: 13px;
  padding: 10px 13px;
  font-size: 12.5px;
}
.profile i {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #d5e4ff, #c2d5ff);
  color: var(--accent-deep);
  font-weight: 800;
}
[data-theme="dark"] .profile i {
  background: linear-gradient(135deg, #1e2a50, #1a234a);
  color: #a5b4fc;
}

/* ============================================================
   5. Main layout
   ============================================================ */
main {
  width: calc(100% - 260px);
  margin-left: 260px;
  padding: 40px clamp(22px, 4vw, 64px) 72px;
}

/* ============================================================
   6. Typography
   ============================================================ */
h1 {
  font-size: clamp(24px, 3vw, 28px);
  letter-spacing: -0.045em;
  font-weight: 800;
  margin-bottom: 2px;
  line-height: 1.08;
}
h2 { letter-spacing: -0.04em; font-weight: 760; }
h3 { letter-spacing: -0.03em; }
p { line-height: 1.6; }
.section-label {
  font-size: 11px; font-weight: 750; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase; margin: 0 0 6px;
}
.eyebrow { font-size: 10px; font-weight: 780; letter-spacing: 0.13em; color: var(--muted); }
header { margin-bottom: 36px; }

.actions button,
.toolbar > button,
.toolbar > div button,
.dialog-head > button {
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--glass-bg);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s, transform 0.18s, background 0.18s;
}
.actions button:hover,
.toolbar > button:hover {
  box-shadow: var(--shadow-float);
  transform: translateY(-1px);
  background: var(--glass-bg-strong);
}

/* Header — quick add, settings icon, account avatar */
.actions .add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  height: 38px;
  padding: 0 15px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
}
[data-theme="dark"] .actions .add-btn { color: #fff; background: #6366f1; }
.actions .add-btn .uic svg { width: 16px; height: 16px; }
.actions .add-btn:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}
.actions .icon-btn { width: 38px; height: 38px; }
.actions .profile-account {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
.actions .profile-account i {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 800;
  font-size: 15px;
  background: linear-gradient(135deg, #d5e4ff, #c2d5ff);
  color: var(--accent-deep);
}
[data-theme="dark"] .actions .profile-account i {
  background: linear-gradient(135deg, #1e2a50, #1a234a);
  color: #a5b4fc;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   7. Hero
   ============================================================ */
.hero {
  min-height: 256px;
  padding: 30px 32px;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 80% 110%, rgba(255, 255, 255, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 10% -20%, rgba(255, 255, 255, 0.14) 0%, transparent 50%),
    linear-gradient(128deg, #4439c4 0%, #6f62dc 52%, #8a72dd 100%);
  box-shadow: var(--shadow-hero);
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
  overflow: hidden;
}
.hero:after {
  width: 360px; height: 360px;
  right: -100px; bottom: -200px;
  background: rgba(255, 255, 255, 0.09);
}
.hero-top span {
  padding: 5px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 9px; letter-spacing: 0.1em; font-weight: 800;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.next { margin: 32px 0; gap: 18px; }
.next > i {
  width: 58px; height: 58px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 26px;
}
.next h2 { font-size: 27px; letter-spacing: -0.04em; }
.hero button, .primary {
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 12.5px; font-weight: 800;
  background: #fff; color: #3f3aa8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s, box-shadow 0.2s;
}
#focus { display: inline-flex; align-items: center; gap: 7px; }
.hero button:hover, .primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18), 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* ============================================================
   8. Cards & metrics — frosted glass
   ============================================================ */
.metrics { gap: 16px; margin: 18px 0 32px; }
.metrics article, .card {
  padding: 20px 21px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--glass-shadow);
  transition: box-shadow 0.24s, transform 0.24s, border-color 0.24s;
}
[data-theme="dark"] .metrics article, [data-theme="dark"] .card {
  background: var(--glass-bg-strong);
}
.metrics article:hover, .card:hover {
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.3);
  transform: translateY(-3px);
}
.metrics strong { font-size: 22px; letter-spacing: -0.05em; font-weight: 800; }
.metrics i { height: 6px; border-radius: 99px; background: var(--soft); margin-top: 14px; }
.metrics b { border-radius: 99px; background: linear-gradient(90deg, var(--accent), #8a7df5); }

/* ============================================================
   9. Section head
   ============================================================ */
.section-head { margin-bottom: 16px; }
.section-head h2 { font-size: 20px; font-weight: 780; }
.section-head button, .study-intro button {
  font-size: 12px; font-weight: 780; color: var(--accent);
}

/* ============================================================
   10. Timeline
   ============================================================ */
.timeline { border-left: 2px solid var(--line); margin-left: 10px; padding-left: 26px; }
.event-row:before {
  width: 10px; height: 10px; left: -34px; top: 7px;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--event, var(--accent));
}
.event-row button {
  border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--shadow-card); border: 1px solid var(--line);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: box-shadow 0.2s, transform 0.2s;
}
.event-row button:hover { box-shadow: var(--shadow-float); transform: translateX(4px); }

/* ============================================================
   11. Nudge
   ============================================================ */
.nudge {
  padding: 20px; border-radius: 20px;
  background: linear-gradient(140deg, rgba(228, 245, 238, 0.85), rgba(216, 240, 231, 0.7));
  color: #1e5540; border: 1px solid rgba(193, 232, 211, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}
[data-theme="dark"] .nudge {
  background: linear-gradient(140deg, rgba(26, 58, 44, 0.7), rgba(22, 51, 39, 0.55));
  color: #a5dfc5; border-color: rgba(31, 68, 52, 0.9);
}
.nudge h3 { font-size: 16px; font-weight: 770; }

/* ============================================================
   12. Recommend strip
   ============================================================ */
.recommend {
  margin-top: 32px; padding: 24px 26px;
  border-radius: var(--radius);
  border: 1px solid rgba(79, 70, 229, 0.16);
  background: linear-gradient(120deg, rgba(79, 70, 229, 0.1) 0%, rgba(244, 245, 251, 0.4) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}
[data-theme="dark"] .recommend {
  background: linear-gradient(120deg, rgba(129, 140, 248, 0.12) 0%, rgba(13, 14, 23, 0.35) 100%);
  border-color: rgba(129, 140, 248, 0.24);
}
.recommend-icon { color: var(--accent); }
.recommend h2 { font-size: 18px; font-weight: 780; }

/* ============================================================
   13. Page head
   ============================================================ */
.page-head { margin-bottom: 28px; }
.page-head h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.05em; }
.recommend button, .page-head > button, .ring-card > button, .settings-form button {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--glass-bg-strong);
  color: var(--ink);
  padding: 10px 15px;
  font-size: 12px; font-weight: 750;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: box-shadow 0.18s, transform 0.18s;
}
.recommend button:hover, .page-head > button:hover, .ring-card > button:hover {
  box-shadow: var(--shadow-float);
  transform: translateY(-1px);
}

/* ============================================================
   14. Tabs
   ============================================================ */
.tabs {
  padding: 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--shadow-card);
}
.tabs button { border-radius: 10px; font-size: 11.5px; font-weight: 750; padding: 7px 12px; }
.tabs button.active { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .tabs button.active { color: #a5b4fc; }

/* ============================================================
   15. Calendar
   ============================================================ */
.calendar {
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.month-day.today { background: var(--accent-light); }
.month-day.today .daynum {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.4);
}
[data-theme="dark"] .month-day.today { background: rgba(129, 140, 248, 0.14); }

/* ============================================================
   16. Study pages
   ============================================================ */
.study-intro {
  padding: 24px 26px; border-radius: var(--radius);
  border: 1px solid rgba(124, 82, 219, 0.18);
  background: linear-gradient(118deg, rgba(237, 234, 255, 0.8), rgba(236, 248, 243, 0.75));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}
[data-theme="dark"] .study-intro {
  background: linear-gradient(118deg, rgba(32, 31, 69, 0.7), rgba(24, 46, 37, 0.6));
  border-color: rgba(129, 140, 248, 0.22);
}
.study-intro h3 { font-size: 19px; font-weight: 780; }
.ring-card {
  padding: 22px; border-radius: var(--radius);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--glass-shadow);
}
[data-theme="dark"] .ring-card { background: var(--glass-bg-strong); }

/* ============================================================
   17. More page — feature chips
   ============================================================ */
.features { display: grid; gap: 10px; }
.features button {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass-bg-strong);
  color: var(--ink); text-align: left;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  transition: box-shadow 0.24s, transform 0.24s, border-color 0.24s, background 0.24s;
}
.features button:hover {
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(79, 70, 229, 0.16);
  border-color: rgba(79, 70, 229, 0.34);
  transform: translateX(6px);
}
.features button > i {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--soft); color: var(--accent);
  font-style: normal;
  flex: 0 0 42px;
  transition: background 0.24s, transform 0.24s, box-shadow 0.24s;
}
.features button:hover > i {
  background: var(--accent-light);
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.28);
}
.features button strong { font-size: 14px; font-weight: 750; display: block; }
.features button small { font-size: 12px; color: var(--muted); margin-top: 2px; display: block; }
.features button > b { margin-left: auto; color: var(--muted); font-weight: 600; }

/* Secondary / lower-priority feature group on the More page */
.features-secondary { margin-top: 34px; }
.features-secondary > .section-label { margin-bottom: 10px; }
.features-secondary .features { display: grid; gap: 10px; }
.features-secondary button {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: transparent;
  color: var(--ink); text-align: left;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.features-secondary button:hover {
  background: var(--soft);
  border-color: var(--line);
  transform: translateX(3px);
}
.features-secondary button > i {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--soft); color: var(--muted);
  font-style: normal; flex: 0 0 36px;
}
.features-secondary button:hover > i { color: var(--accent); }
.features-secondary button strong { font-size: 13.5px; font-weight: 700; display: block; }
.features-secondary button small { font-size: 12px; color: var(--muted); margin-top: 2px; display: block; }
.features-secondary button > b { margin-left: auto; color: var(--muted); font-weight: 600; }

/* ============================================================
   18. Dialogs — frosted glass + spring entrances
   ============================================================ */
dialog {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(40px) saturate(2);
  -webkit-backdrop-filter: blur(40px) saturate(2);
  box-shadow: 0 28px 80px rgba(12, 13, 22, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  padding: 28px; max-width: 480px; width: calc(100% - 32px);
  opacity: 1;
  transform: scale(1) translateY(0);
  transition:
    opacity 0.25s ease,
    transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    display 0.32s allow-discrete,
    overlay 0.32s allow-discrete;
}
[data-theme="dark"] dialog {
  background: rgba(13, 14, 23, 0.82);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}
dialog::backdrop {
  background: rgba(10, 11, 18, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.25s ease;
}
@starting-style {
  dialog[open] {
    opacity: 0;
    transform: scale(0.92) translateY(14px);
  }
  dialog[open]::backdrop {
    background: rgba(10, 11, 18, 0);
  }
}
.dialog-head { margin-bottom: 20px; }
.dialog-head h2 { font-size: 22px; font-weight: 800; margin: 0; }
.dialog-actions { display: flex; gap: 10px; margin-top: 20px; }

/* Form inputs */
.form input, .form select,
.settings-form input, .settings-form select,
.search-input input,
.onboard-panel input, .onboard-panel select {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: rgba(244, 245, 251, 0.65);
  color: var(--ink);
  font-size: 14px; font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
[data-theme="dark"] .form input, [data-theme="dark"] .form select,
[data-theme="dark"] .settings-form input, [data-theme="dark"] .settings-form select,
[data-theme="dark"] .search-input input,
[data-theme="dark"] .onboard-panel input, [data-theme="dark"] .onboard-panel select {
  background: rgba(32, 33, 45, 0.6);
}
.form input:focus, .form select:focus,
.settings-form input:focus, .settings-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
  outline: none; background: var(--surface);
}
label { font-size: 12.5px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 14px; }
label input, label select { margin-top: 6px; }

.types button {
  border-radius: var(--radius-xs);
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.types button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
}

/* ============================================================
   19. Search dialog
   ============================================================ */
#search { max-width: 560px; }
.search-input {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--soft); color: var(--muted); margin-bottom: 18px;
}
.search-input input {
  border: none; background: transparent; padding: 0; font-size: 15px; color: var(--ink);
}
.search-input input:focus { outline: none; box-shadow: none; }

/* ============================================================
   20. Install banner
   ============================================================ */
.install-card {
  border-radius: var(--radius);
  border: 1px solid rgba(79, 70, 229, 0.2);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--shadow-float);
}

/* ============================================================
   21. Footer
   ============================================================ */
.site-footer { border-top: 1px solid var(--line); padding-top: 20px; color: var(--muted); font-size: 12px; }
.site-footer a { color: var(--muted); text-decoration: none; font-weight: 600; transition: color 0.15s; }
.site-footer a:hover { color: var(--accent); }

/* ============================================================
   22. Focus mode — pulsing timer ring
   ============================================================ */
.focus-modal { border-radius: var(--radius); }
#timer {
  font-size: clamp(52px, 10vw, 80px);
  font-weight: 830;
  letter-spacing: -0.06em;
  position: relative;
}
#focus-screen time::after {
  content: "";
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.25;
  animation: focus-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes focus-pulse {
  0%   { transform: scale(0.9); opacity: 0.35; }
  70%  { transform: scale(1.16); opacity: 0; }
  100% { transform: scale(1.16); opacity: 0; }
}

/* ============================================================
   23. Gemini dock
   ============================================================ */
.gemini-dock {
  right: 30px; bottom: 30px;
  padding: 12px 18px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(30, 29, 56, 0.92), rgba(18, 19, 30, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(129, 140, 248, 0.12);
  font-size: 12.5px; font-weight: 800; letter-spacing: -0.01em; gap: 9px;
}
.gemini-dock svg { color: #b8b4ff; width: 16px; height: 16px; }
.gemini-dock:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4), 0 0 20px rgba(129, 140, 248, 0.28);
}

/* ============================================================
   24. Gemini floating panel drawer
   ============================================================ */
body.gemini-panel-open { overflow: hidden; }
.gemini-panel-drawer {
  position: fixed; inset: 0; z-index: 120;
  visibility: hidden;
  pointer-events: none;
}
.gemini-panel-drawer.open { visibility: visible; pointer-events: auto; }
.gemini-panel-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 11, 18, 0.34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gemini-panel-drawer.open .gemini-panel-backdrop { opacity: 1; }
.gemini-panel-inner {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(430px, 94vw);
  transform: translateX(103%);
  transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(44px) saturate(1.9);
  -webkit-backdrop-filter: blur(44px) saturate(1.9);
  border-left: 1px solid var(--glass-border);
  box-shadow: -28px 0 72px rgba(18, 19, 30, 0.26);
  padding: 26px 24px 30px;
  overflow-y: auto;
}
[data-theme="dark"] .gemini-panel-inner {
  background: rgba(13, 14, 23, 0.84);
  box-shadow: -28px 0 72px rgba(0, 0, 0, 0.55);
}
.gemini-panel-drawer.open .gemini-panel-inner { transform: translateX(0); }
.gemini-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 4px;
}
.gemini-panel-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 820; letter-spacing: -0.03em;
}
.gemini-panel-title .uic svg { width: 20px; height: 20px; color: var(--accent); }
.gemini-panel-title small {
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0;
}
.gemini-panel-head > button {
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--glass-bg);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s, transform 0.18s;
}
.gemini-panel-head > button:hover { box-shadow: var(--shadow-float); transform: rotate(90deg); }
.gemini-panel-intro { color: var(--muted); font-size: 13px; margin: 10px 0 18px; }
.gemini-panel-actions {
  display: grid; gap: 9px;
}
.gemini-panel-actions button {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  padding: 12px 15px;
  font-size: 13px; font-weight: 750; text-align: left;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
[data-theme="dark"] .gemini-panel-actions button { background: rgba(255, 255, 255, 0.04); }
.gemini-panel-actions button:hover {
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(79, 70, 229, 0.16);
  border-color: rgba(79, 70, 229, 0.3);
  transform: translateX(3px);
}
.gemini-panel-actions button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border-color: transparent;
  justify-content: center;
}
.gemini-panel-actions button.primary .uic svg { color: #fff; }
.gemini-panel-actions .uic svg { width: 18px; height: 18px; color: var(--accent); }
.privacy-note { color: var(--muted); font-size: 11.5px; margin: 14px 0 0; line-height: 1.5; }
.gemini-panel-output {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  min-height: 64px;
}
.gemini-panel-hint {
  color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.gemini-panel-output.has-result .gemini-panel-hint { display: none; }
.gemini-panel-output .insight {
  animation: type-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(244, 245, 251, 0.7);
  box-shadow: var(--shadow-card);
}
[data-theme="dark"] .gemini-panel-output .insight { background: rgba(32, 33, 45, 0.55); }
.gemini-panel-output .insight button {
  margin-top: 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 13px;
  font-size: 12px; font-weight: 750; color: var(--accent);
  box-shadow: var(--shadow-card);
}
.gemini-panel-output .insight button:hover { box-shadow: var(--shadow-float); }
@keyframes type-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   25. Mobile nav — deeper glass + pill active indicator
   ============================================================ */
.mobile {
  background: rgba(244, 245, 251, 0.78);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -8px 32px rgba(31, 38, 135, 0.12);
}
[data-theme="dark"] .mobile {
  background: rgba(11, 12, 19, 0.78);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}
.mobile button {
  color: var(--muted);
  border-radius: 12px;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.mobile button.active {
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14);
}
[data-theme="dark"] .mobile button.active {
  color: #a5b4fc;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.2);
}

/* ============================================================
   26. Quick-add FAB
   ============================================================ */
.add {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.46), 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-size: 26px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.add:hover {
  transform: scale(1.08) rotate(4deg);
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.56), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* ============================================================
   27. Page animation
   ============================================================ */
@keyframes enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page { animation: enter 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ============================================================
   28. Scroll-driven card reveals (progressively enhanced)
   ============================================================ */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@supports (animation-timeline: view()) {
  .metrics article,
  .card:not(dialog),
  .features button,
  .study-deep article,
  .weekly-review {
    animation: reveal-up linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 34%;
  }
}

/* ============================================================
   29. Reduced motion — everything calm
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   30. Responsive
   ============================================================ */
@media (max-width: 950px) {
  .side { width: 76px; padding: 24px 10px; }
  main  { width: calc(100% - 76px); margin-left: 76px; }
}
@media (max-width: 700px) {
  .side { display: none; }
  main  { width: 100%; margin: 0; padding: 22px 16px 100px; }
  .mobile { box-shadow: 0 -1px 0 var(--glass-border); }
  .gemini-panel-inner { width: 94vw; }
}

/* ============================================================
   31. Keyboard focus rings
   ============================================================ */
:where(button, a, input, select, textarea, summary, dialog, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.side nav button:focus-visible,
.mobile button:focus-visible {
  outline-offset: 3px;
}

/* ============================================================
   32. Toast + Undo
   ============================================================ */
#toast {
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(480px, calc(100vw - 32px));
}
#toast button {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 9px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
  transition: background 0.15s;
}
#toast button:hover { background: rgba(255, 255, 255, 0.26); }

/* ============================================================
   33. Progress — weekly consistency strip
   ============================================================ */
.streak-card { margin-top: 18px; }
.streak-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.streak-day {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--muted);
  text-align: center;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.streak-day .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(18, 19, 30, 0.14);
  box-shadow: inset 0 0 0 1px rgba(18, 19, 30, 0.12);
}
[data-theme="dark"] .streak-day .dot {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.streak-day small {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.streak-day b {
  font-size: 10px;
  font-weight: 750;
}
.streak-day.on {
  background: var(--accent-light);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.18);
}
.streak-day.on .dot {
  background: linear-gradient(135deg, var(--accent), #8a7df5);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.42);
}
.streak-day.today { border: 1px dashed rgba(79, 70, 229, 0.4); }

/* ============================================================
   34. Icon atoms in dynamic content
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge .uic svg { width: 12px; height: 12px; }
.badge.earned .uic svg { color: #7b5e12; }
[data-theme="dark"] .badge.earned .uic svg { color: #ffd76b; }
.history-item i.uic svg { width: 12px; height: 12px; }
.plan-actions button .uic svg,
[data-row-remove] .uic svg,
[data-series-remove] .uic svg { width: 14px; height: 14px; }
.toolbar > button .uic svg { width: 15px; height: 15px; }
.back-link .uic svg { width: 15px; height: 15px; }

/* ============================================================
   35. Gemini composer + streaming insight
   ============================================================ */
.gemini-ask { margin: 4px 0 14px; }
.gemini-ask textarea {
  width: 100%;
  resize: none;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(244, 245, 251, 0.7);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s, box-shadow 0.18s;
}
[data-theme="dark"] .gemini-ask textarea { background: rgba(32, 33, 45, 0.6); }
.gemini-ask textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}
.gemini-ask-row { display: flex; gap: 8px; margin-top: 8px; }
.gemini-ask-row button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-xs);
  padding: 9px 15px;
  font-size: 12.5px;
  font-weight: 800;
}
.gemini-ask-row .primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.34);
}
.gemini-ask-row button[type="button"] {
  border: 1px solid var(--line);
  background: var(--glass-bg);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}
.gemini-ask-row .uic svg { width: 15px; height: 15px; }

.insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
#gemini-output .insight-actions button,
.gemini-panel-output .insight-actions button {
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 750;
  color: var(--accent);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s, transform 0.18s;
}
#gemini-output .insight-actions button:hover,
.gemini-panel-output .insight-actions button:hover {
  box-shadow: var(--shadow-float);
  transform: translateY(-1px);
}
#gemini-output .insight-actions [data-gemini-cancel],
#gemini-output .insight-actions [data-gemini-stop],
.gemini-panel-output .insight-actions [data-gemini-cancel],
.gemini-panel-output .insight-actions [data-gemini-stop] {
  color: var(--muted);
}
.gemini-panel-output .insight.busy,
.gemini-panel-output .insight.streaming,
#gemini-output .insight.busy,
#gemini-output .insight.streaming {
  border-color: rgba(79, 70, 229, 0.28);
}
.gemini-panel-output .insight.busy strong::after,
#gemini-output .insight.busy strong::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 8px;
  background: var(--accent);
  animation: dot-blink 1s ease-in-out infinite;
}
@keyframes dot-blink {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}

/* ============================================================
   v4 — Cohesive "full rework" polish
   One dominant primary action per screen, calmer page heads,
   and consistent card treatment across Today / Study / Progress.
   ============================================================ */

/* --- 1. One confident primary action everywhere (neutral surfaces) --- */
.primary,
#study-focus,
#result,
#rec-start,
#focus,
#first-focus,
#open-settings,
.recommend button.primary {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}
.primary:hover,
#study-focus:hover,
#result:hover,
#rec-start:hover,
#focus:hover,
#first-focus:hover,
#open-settings:hover,
.recommend button.primary:hover {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.36);
}
[data-theme="dark"] .primary,
[data-theme="dark"] #study-focus,
[data-theme="dark"] #result,
[data-theme="dark"] #rec-start,
[data-theme="dark"] #focus,
[data-theme="dark"] #first-focus {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* The Today hero sits on an indigo gradient: keep its button light-on-dark */
.hero button {
  background: #fff;
  color: #3f3aa8;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.hero button:hover {
  background: #fff;
  color: #3f3aa8;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18), 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* Assert primary status for screen-level actions */
#study-focus,
#result,
#print-week {
  --primary: 1;
}
#result {
  min-height: 38px;
  padding: 0 18px;
  font-weight: 800;
}
#study-focus {
  width: 100%;
  padding: 12px 16px;
}

/* --- 2. Calmer, more confident page heads --- */
.page-head h2 {
  font-size: clamp(26px, 2.6vw, 32px);
  letter-spacing: -0.05em;
}
.page-head > p,
.page-head .section-label {
  margin-bottom: 8px;
}
.page-head p:not(.section-label):not(.eyebrow) {
  color: var(--muted);
  margin-top: 6px;
  max-width: 46ch;
}
.page-head {
  margin-bottom: 32px;
}

/* --- 3. Consistent airy rhythm between sections --- */
main .page > article,
main .page > div,
main .page > section:not(.page-head) {
  margin-bottom: 28px;
}
.study-layout,
.study-deep,
.progress-col,
.two-col {
  gap: 22px;
}

/* --- 4. Secondary / ghost actions stay quiet so the primary reads --- */
.section-head button[data-route],
#refresh,
#print-week,
.hero-top button {
  color: var(--accent);
  font-weight: 780;
}
#refresh {
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-light);
  background: var(--accent-light);
  color: var(--accent);
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 800;
}
[data-theme="dark"] #refresh {
  color: #a5b4fc;
}
#refresh:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* --- 5. Shared frosted cards match Today's metrics --- */
.ring-card,
.history-card,
.card,
.chart-card,
.streak-card,
.exam-readiness,
.weekly-review,
.plan article,
.study-subjects article,
.attention {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-sm);
}

/* --- 6. Account + focus affordances in the header --- */
.actions #account-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  box-shadow: var(--shadow-card);
}
.actions #avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-style: normal;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}
.actions #account-trigger:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}
.actions #header-add .uic svg,
.actions #settings .uic svg {
  width: 16px;
  height: 16px;
}

/* --- 7. Study ring-card primary sits prominent under the ring --- */
.ring-card h3 { font-size: 18px; font-weight: 800; margin: 10px 0 4px; }
.ring-card p { color: var(--muted); font-size: 12.5px; }
