:root {
  --bg: #0b1220;
  --surface: rgba(18, 30, 57, 0.78);
  --surface-strong: rgba(8, 13, 26, 0.95);
  --surface-alt: rgba(255, 255, 255, 0.08);
  --surface-soft: rgba(255, 255, 255, 0.05);
  --text: #edf2ff;
  --muted: #9fb2d2;
  --primary: #7c5cff;
  --primary-soft: rgba(124, 92, 255, 0.16);
  --accent: #3de2c4;
  --danger: #ff5c83;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
  --radius: 28px;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background: radial-gradient(circle at top left, rgba(124, 92, 255, 0.28), transparent 24%),
    radial-gradient(circle at bottom right, rgba(61, 226, 196, 0.18), transparent 22%),
    linear-gradient(180deg, #07101f 0%, #0b1226 100%);
  color: var(--text);
}

body.theme-light {
  --bg: #f1f5ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 1);
  --surface-alt: rgba(255, 255, 255, 0.8);
  --surface-soft: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #475569;
  --primary: #5b5cff;
  --primary-soft: rgba(91, 92, 255, 0.14);
  --accent: #16a34a;
  --danger: #dc2626;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  background: radial-gradient(circle at top left, rgba(91, 92, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.12), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

body.theme-dark {
  --bg: #0b1220;
  --surface: rgba(18, 30, 57, 0.78);
  --surface-strong: rgba(8, 13, 26, 0.95);
  --surface-alt: rgba(255, 255, 255, 0.08);
  --surface-soft: rgba(255, 255, 255, 0.05);
  --text: #edf2ff;
  --muted: #9fb2d2;
  --primary: #7c5cff;
  --primary-soft: rgba(124, 92, 255, 0.16);
  --accent: #3de2c4;
  --danger: #ff5c83;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
  background: radial-gradient(circle at top left, rgba(124, 92, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(61, 226, 196, 0.12), transparent 22%),
    linear-gradient(180deg, #07101f 0%, #0b1226 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body,
button,
input,
textarea {
  font: 100% Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hidden {
  display: none !important;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.75);
  z-index: 999;
  padding: 24px;
}

.popup-card {
  width: min(440px, 100%);
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.35);
  padding: 32px;
  color: var(--text);
}

.popup-header h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.popup-card p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.popup-actions {
  display: flex;
  justify-content: flex-end;
}

.popup-actions .button {
  min-width: 120px;
}

button,
input,
textarea {
  border: none;
  outline: none;
}

/* Accessible focus styles */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 8px;
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  margin: 0 0 12px;
  color: var(--accent);
}

.topnav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  overflow-x: auto;
}

.topnav a,
.topnav button.dropdown-label {
  min-width: 0;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.topnav a:hover,
.topnav button.dropdown-label:hover {
  color: var(--primary);
}

  .nav-dropdown {
    position: relative;
  }

  .dropdown-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
  }

  .dropdown-menu {
    pointer-events: none;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin-top: 12px;
    padding: 14px 0;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: opacity 180ms ease, transform 180ms ease;
    transform: translateY(10px);
    z-index: 10;
  }

  .dropdown-menu a,
  .dropdown-menu button {
    display: block;
    width: 100%;
    padding: 10px 18px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
  }

  .dropdown-menu a:hover,
  .dropdown-menu button:hover {
    background: rgba(124, 92, 255, 0.08);
    color: var(--primary);
  }

  .nav-dropdown:hover .dropdown-menu,
  .nav-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .ad-banner {
    display: grid;
    place-items: center;
    padding: 28px 0;
  }

  .ad-card {
    width: min(100%, 1040px);
    padding: 30px 32px;
    border-radius: 32px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
    display: grid;
    gap: 16px;
    text-align: center;
  }

  .ad-card h3 {
    margin: 0;
    font-size: clamp(1.6rem, 2vw, 2rem);
  }

  .ad-card p {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.8;
  }

  .ad-card .button {
    width: auto;
    justify-self: center;
  }

  .ad-inset {
    padding: 18px 20px;
    border-radius: 24px;
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    color: var(--text);
    margin-bottom: 20px;
  }

  .ad-inset p {
    margin: 0;
    line-height: 1.7;
  }

  .faq-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .faq-item h4 {
    margin-top: 0;
  }

  .faq-item p {
    margin: 0;
    color: var(--muted);
  }

.theme-toggle {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 40px;
}

.hero-copy h2 {
  margin: 0;
  font-size: clamp(2.8rem, 4vw, 4.6rem);
  line-height: 1.02;
}

.hero-text {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 30px;
}

/* Infinite categories marquee */
.category-marquee {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  margin: 18px 0 8px;
}

.marquee-track {
  display: flex;
  gap: 18px;
  align-items: center;
  white-space: nowrap;
  min-width: 200%;
  animation: marquee 18s linear infinite;
}

.category {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.marquee-track:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.calc-helper,
.graph-helper,
.timer-status,
.stopwatch-meta,
.todo-status {
  margin-bottom: 18px;
  padding: 18px 22px;
  border-radius: 24px;
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}

.calc-helper p,
.graph-helper p,
.timer-status,
.stopwatch-meta,
.todo-status {
  margin: 0;
  line-height: 1.7;
}

.graph-samples,
.scientific-examples,
.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.graph-example,
.function-example,
.preset-btn {
  font-size: 0.92rem;
}

.hero-panel {
  padding: 28px;
  border-radius: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.hero-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.panel-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.mini-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.mini-status strong {
  font-size: 1.1rem;
  color: var(--text);
}

.dashboard-card {
  display: grid;
  gap: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.small-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
}

.small-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.preview-window {
  border-radius: 30px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 28px;
}

.preview-header {
  height: 16px;
  width: 110px;
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 20px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.preview-block {
  min-height: 130px;
  border-radius: 24px;
  background: var(--surface-alt);
}

.section {
  margin-bottom: 42px;
}

.section-header {
  max-width: 720px;
  margin-bottom: 28px;
}

.section-header h2 {
  margin: 0;
  font-size: clamp(2rem, 2.6vw, 3rem);
}

.feature-grid,
.showcase-grid,
.testimonial-grid,
.faq-grid,
.overview-grid,
.clock-grid,
.theme-grid {
  display: grid;
  gap: 18px;
}

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.showcase-card,
.testimonial-card,
.faq-item,
.overview-card,
.clock-card,
.theme-card {
  padding: 28px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.feature-card h3,
.showcase-card h3,
.faq-item h4 {
  margin-top: 0;
}

.feature-card p,
.showcase-card p,
.faq-item p,
.testimonial-card,
.clock-card span,
.overview-card span {
  color: var(--muted);
}

.dashboard-section .dashboard-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 24px;
  border-radius: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.dashboard-main {
  min-width: 0;
}

.dashboard-shell,
.dashboard-main,
.sidebar,
.hero-copy,
.hero-actions,
.feature-grid,
.showcase-grid,
.testimonial-grid,
.faq-grid,
.overview-grid,
.notes-grid,
.theme-grid {
  max-width: 100%;
}

.sidebar-brand {
  font-size: 1rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav button {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  border: 1px solid transparent;
}

.sidebar-nav button:hover,
.sidebar-nav button.active {
  background: rgba(124, 92, 255, 0.14);
  border-color: rgba(124,92,255,0.2);
}

.dashboard-main {
  display: grid;
  gap: 22px;
}

.dashboard-panel {
  padding: 24px;
  border-radius: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: none;
}

.dashboard-panel.active {
  display: block;
}

.calculator-display {
  display: grid;
  gap: 10px;
  padding: 26px 24px;
  margin-bottom: 22px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.calc-history {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-screen {
  width: 100%;
  padding: 18px 22px;
  border-radius: 24px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 700;
  text-align: right;
  box-shadow: inset 0 0 0 1px var(--border);
}

.calculator-grid,
.scientific-grid {
  display: grid;
  gap: 12px;
}

.calculator-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scientific-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.calc-btn {
  min-height: 68px;
  border-radius: 22px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 150ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.calc-btn:hover {
  transform: translateY(-1px);
  background: var(--surface-alt);
}

.calc-btn.secondary {
  background: var(--surface-soft);
  color: var(--text);
}

.calc-btn.secondary:hover {
  background: var(--surface-alt);
}

.calc-btn[data-action="equals"] {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 18px 35px rgba(124, 92, 255, 0.24);
}

.calc-btn[data-action="clear"] {
  color: var(--danger);
}

.calc-btn[data-action="delete"] {
  color: var(--text);
}

.calc-btn[data-value="+"] ,
.calc-btn[data-value="-"] ,
.calc-btn[data-value="*"] ,
.calc-btn[data-value="/"] {
  background: rgba(124, 92, 255, 0.14);
  color: white;
}

.calc-btn[data-value="+"]:hover,
.calc-btn[data-value="-"]:hover,
.calc-btn[data-value="*"]:hover,
.calc-btn[data-value="/"]:hover {
  background: rgba(124, 92, 255, 0.22);
}

.scientific-grid .calc-btn {
  min-height: 56px;
  padding: 0 12px;
  font-size: 0.98rem;
  background: var(--surface-soft);
  color: var(--text);
}

.scientific-grid .calc-btn:hover {
  background: var(--surface-alt);
}

.calc-btn.tertiary {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.calc-btn.tertiary:hover {
  background: var(--surface-alt);
}

.button.tertiary {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.status-pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.14);
  color: var(--primary);
  font-weight: 700;
}

.overview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-card strong {
  display: block;
  margin-top: 12px;
  font-size: 2rem;
}

.graph-card {
  display: grid;
  gap: 18px;
}

.graph-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.graph-actions input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.todo-input-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-bottom: 24px;
}

#todoInput {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 24px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.todo-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.todo-item.completed {
  opacity: 0.7;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-text {
  margin: 0;
  flex: 1;
}

.todo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

.todo-status {
  border-radius: 20px;
}

.graph-canvas {
  position: relative;
  min-height: 280px;
  border-radius: 32px;
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

.graph-canvas canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 24px;
}

.graph-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.graph-title {
  font-size: 0.95rem;
}

.scientific-info {
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 24px;
  padding: 24px;
  border: 1px solid var(--border);
}

.scientific-info code {
  display: inline-block;
  color: var(--text);
  background: var(--surface-alt);
  padding: 8px 12px;
  border-radius: 14px;
}

.scientific-list {
  margin: 14px 0 0;
  padding-left: 20px;
}

.scientific-list li {
  margin-bottom: 8px;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.timer-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.timer-grid input {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.stopwatch-display {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 22px;
  color: var(--text);
}

.stopwatch-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.stopwatch-meta span {
  font-size: 0.95rem;
  color: var(--muted);
}

.lap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.lap-list li {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--text);
}

.clock-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.clock-card {
  padding: 24px;
}

.clock-card strong {
  display: block;
  margin-top: 14px;
  font-size: 2rem;
}

.note-tools {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.note-card {
  word-break: break-word;
}

#noteInput {
  width: 100%;
  border-radius: 24px;
  padding: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.note-card {
  padding: 20px;
  border-radius: 24px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.theme-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.theme-card {
  padding: 24px;
  text-align: left;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  border: 1px solid transparent;
}

.theme-card.active,
.theme-card:hover {
  border-color: var(--primary);
  background: rgba(124,92,255,0.14);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 18px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: 1px solid transparent;
}

.button.secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.button.tertiary {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.button.tertiary:hover {
  background: var(--surface-alt);
}

.theme-toggle {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.showcase-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.testimonial-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.testimonial-card {
  display: grid;
  gap: 16px;
  font-style: italic;
}

.testimonial-card cite {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.faq-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 24px;
  border-radius: 28px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.footer-copy {
  color: var(--muted);
  margin-top: 12px;
}

@media (max-width: 1120px) {
  .hero,
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .showcase-grid,
  .testimonial-grid,
  .faq-grid,
  .clock-grid,
  .overview-grid,
  .notes-grid,
  .theme-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    top: auto;
    width: 100%;
  }

  .sidebar-nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .hero-actions,
  .topnav {
    justify-content: center;
  }

  .section-header {
    text-align: center;
  }
}

@media (max-width: 940px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-card,
  .overview-grid,
  .preview-grid,
  .graph-actions,
  .todo-input-group,
  .note-tools,
  .timer-grid {
    grid-template-columns: 1fr;
  }

  .topnav {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    padding-bottom: 0;
  }

  .topnav a,
  .topnav button.dropdown-label,
  .theme-toggle {
    width: 100%;
  }

  .nav-dropdown {
    width: 100%;
  }

  .dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    margin-top: 0;
    border-radius: 20px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 18px 16px 36px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-copy h2 {
    font-size: clamp(2rem, 5vw, 2.8rem);
  }

  .hero-panel,
  .dashboard-panel,
  .sidebar,
  .hero-panel,
  .calculator-display {
    padding: 20px;
  }

  .hero-actions {
    flex-direction: column;
    gap: 14px;
  }

  .button,
  .theme-toggle {
    min-width: auto;
    width: 100%;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .graph-actions,
  .todo-input-group,
  .note-tools,
  .timer-grid {
    grid-template-columns: 1fr;
  }

  .graph-actions input,
  .graph-actions button,
  .todo-input-group input,
  .timer-grid input {
    width: 100%;
  }

  .dashboard-section .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: 100%;
    top: auto;
  }
}

@media (max-width: 620px) {
  .hero {
    gap: 18px;
  }

  .hero-panel,
  .dashboard-panel,
  .feature-card,
  .showcase-card,
  .testimonial-card,
  .faq-item,
  .overview-card,
  .clock-card,
  .note-card,
  .theme-card {
    padding: 20px;
  }

  .calculator-grid,
  .scientific-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calc-btn {
    min-height: 60px;
  }

  .calculator-grid button[data-action="equals"] {
    grid-column: span 3;
  }

  .theme-toggle {
    padding: 14px 18px;
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding: 14px 14px 28px;
  }

  .topbar {
    padding: 16px 16px;
  }

  .topnav {
    gap: 12px;
  }

  .hero-copy h2 {
    font-size: 2rem;
  }

  .calculator-grid,
  .scientific-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calculator-grid button[data-action="equals"] {
    grid-column: span 2;
  }

  .graph-actions,
  .todo-input-group,
  .note-tools {
    gap: 10px;
  }

  .button,
  .theme-toggle,
  .graph-actions button,
  .scientific-grid .calc-btn,
  .calc-btn {
    width: 100%;
  }

  .topnav a,
  .topnav button.dropdown-label,
  .theme-toggle {
    padding: 14px 16px;
  }

  .nav-dropdown {
    width: 100%;
  }

  .footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}
