:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --emerald: 160 84% 39%;
  --amber: 38 92% 50%;
  --red: 0 84% 60%;
  --purple: 262 83% 58%;
  --blue: 221 83% 53%;
  --radius: 0.5rem;
  color-scheme: light;
}

.dark {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --border: 240 3.7% 10%;
  --input: 240 3.7% 10%;
  --ring: 240 4.9% 83.9%;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, hsl(var(--emerald) / 0.08), transparent 28rem),
    radial-gradient(circle at top right, hsl(var(--purple) / 0.08), transparent 26rem),
    hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 1.5rem 1rem 0;
  pointer-events: none;
  transition: transform 0.45s ease, opacity 0.45s ease, padding 0.45s ease;
}

.site-header.compact {
  padding-top: 1rem;
}

.floating-nav {
  width: min(56rem, 100%);
  display: flex;
  align-items: center;
  border: 1px solid hsl(var(--border) / 0.55);
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  background: hsl(var(--background) / 0.62);
  box-shadow: 0 18px 45px hsl(0 0% 0% / 0.25);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  transition: all 0.35s ease;
}

.compact .floating-nav {
  padding-block: 0.5rem;
  background: hsl(var(--background) / 0.82);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.brand,
.nav-actions {
  flex: 1;
  display: flex;
  align-items: center;
}

.nav-actions {
  justify-content: flex-end;
  gap: 0.75rem;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, #10b981, #22d3ee, #8b5cf6);
  box-shadow: 0 0 0 2px hsl(var(--foreground) / 0.1);
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.desktop-nav a {
  position: relative;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: hsl(var(--foreground));
}

.desktop-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -0.35rem;
  height: 2px;
  border-radius: 99px;
  background: hsl(var(--emerald));
  transition: right 0.25s ease;
}

.desktop-nav a:hover::after,
.desktop-nav a.active::after {
  right: 0;
}

.new-link b {
  position: absolute;
  top: -0.9rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  background: hsl(var(--emerald));
  color: black;
  font-size: 0.55rem;
  line-height: 1;
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 7rem 1.5rem 2rem;
  background: hsl(var(--background) / 0.96);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  animation: fadeDown 0.2s ease;
}

.mobile-menu a {
  color: hsl(var(--muted-foreground));
  font-size: 1.55rem;
  font-weight: 600;
}

.mobile-menu span {
  margin-left: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  background: hsl(var(--emerald));
  color: black;
  font-size: 0.65rem;
}

.desktop-only {
  display: inline-flex;
}

.mobile-only {
  display: none;
}

.app-shell {
  min-height: 100vh;
  padding: 6rem 1rem 2rem;
}

.container {
  width: min(72rem, 100%);
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 1.5rem;
}

.loading-screen,
.empty-state,
.simple-page {
  min-height: 55vh;
  display: grid;
  place-items: center;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

.simple-page-card {
  width: min(46rem, 100%);
  border: 1px solid hsl(var(--border));
  border-radius: 1.5rem;
  background: hsl(var(--card) / 0.72);
  padding: 2rem;
  box-shadow: 0 20px 60px hsl(0 0% 0% / 0.18);
}

.page-controls,
.control-left,
.control-right,
.row,
.chip-row,
.modal-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-controls {
  justify-content: space-between;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  padding: 0.42rem 1rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  font-size: 0.875rem;
  font-weight: 650;
}

.target-pill,
.count-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--emerald) / 0.25);
  background: hsl(var(--emerald) / 0.1);
  color: hsl(var(--emerald));
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill.warn {
  border-color: hsl(var(--amber) / 0.25);
  background: hsl(var(--amber) / 0.1);
  color: hsl(var(--amber));
}

.status-pill.muted {
  border-color: hsl(var(--border));
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

.button,
.outline-button,
.ghost-button,
.signin-button,
.icon-button {
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.button {
  border-color: hsl(var(--emerald));
  background: hsl(var(--emerald));
  color: white;
}

.button:hover,
.outline-button:hover,
.signin-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.outline-button {
  border-color: hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.ghost-button {
  background: transparent;
  color: hsl(var(--muted-foreground));
}

.ghost-button:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.signin-button {
  border-color: white;
  background: white;
  color: black;
  border-radius: 999px;
  padding-inline: 1rem;
}

.icon-button {
  width: 2.25rem;
  padding: 0;
  border-color: hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
}

.danger-button {
  color: hsl(var(--red));
  border-color: hsl(var(--red) / 0.35);
  background: hsl(var(--red) / 0.08);
}

.card,
.accordion,
.progress-panel,
.stat-card,
.subject-card,
.weak-panel,
.selector-card,
.modal-card {
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  background: hsl(var(--card) / 0.82);
}

.progress-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
}

.progress-panel {
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.progress-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring .ring-bg {
  stroke: hsl(var(--muted));
}

.progress-ring .ring-fg {
  stroke: hsl(var(--emerald));
  transition: stroke-dashoffset 0.8s ease;
}

.progress-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.progress-center strong {
  font-size: 2rem;
}

.complete-label {
  margin-top: 0.65rem;
  color: hsl(var(--emerald));
  font-size: 0.9rem;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-card {
  padding: 0.85rem;
}

.stat-label {
  color: hsl(var(--muted-foreground));
  font-size: 0.7rem;
}

.stat-value {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.streak-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.85rem;
  background: hsl(var(--card));
  padding: 0.7rem 1rem;
}

.streak-bar .pace {
  margin-left: auto;
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
}

.countdown {
  display: grid;
  justify-items: center;
  gap: 0.85rem;
}

.countdown-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
}

.time-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.time-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.time-box {
  width: 5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  background: hsl(var(--background) / 0.55);
  font-size: 1.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.time-box.last {
  border-color: hsl(var(--emerald) / 0.42);
  box-shadow: 0 0 20px hsl(var(--emerald) / 0.13);
}

.time-label {
  margin-top: 0.25rem;
  display: block;
  color: hsl(var(--muted-foreground));
  text-align: center;
  font-size: 0.63rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.time-separator {
  margin-bottom: 1.2rem;
  color: hsl(var(--muted-foreground) / 0.45);
  font-size: 1.2rem;
  font-weight: 800;
}

.date-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
}

.date-row input[type="date"] {
  height: 2rem;
  color: hsl(var(--foreground));
  color-scheme: dark;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background));
  padding-inline: 0.65rem;
}

.light .date-row input[type="date"] {
  color-scheme: light;
}

.accordion {
  overflow: hidden;
}

.accordion-trigger,
.subject-trigger,
.unit-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  text-align: left;
}

.accordion-trigger {
  padding: 0.9rem 1rem;
  font-weight: 700;
}

.accordion-body {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.25);
}

.paper {
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
}

.paper:last-child {
  border-bottom: 0;
}

.paper h4 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
}

.paper-meta,
.section-chips {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  color: hsl(var(--muted-foreground));
  font-size: 0.74rem;
}

.section-chips {
  margin-top: 0.65rem;
}

.section-chips span {
  border: 1px solid hsl(var(--border));
  border-radius: 0.45rem;
  background: hsl(var(--background));
  padding: 0.3rem 0.55rem;
}

.section-chips b {
  color: hsl(var(--emerald));
}

.search-wrap {
  position: relative;
}

.search-wrap input,
.field,
.modal-card textarea,
.modal-card select,
.modal-card input,
.note-input {
  width: 100%;
  border: 1px solid hsl(var(--input));
  border-radius: 0.75rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 0.72rem 0.9rem;
  outline: none;
}

.search-wrap input {
  padding-left: 2.35rem;
  padding-right: 2.35rem;
}

.search-wrap input:focus,
.field:focus,
.modal-card textarea:focus,
.modal-card select:focus,
.modal-card input:focus,
.note-input:focus {
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.25);
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
}

.clear-search {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.subject-group {
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 0.85rem;
  background: hsl(var(--card));
}

.subject-trigger {
  border-left: 3px solid transparent;
  padding: 0.95rem 1rem;
}

.subject-trigger.open {
  border-left-color: hsl(var(--emerald));
  background: hsl(var(--emerald) / 0.045);
}

.subject-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 800;
}

.chevron {
  display: inline-block;
  transition: transform 0.18s ease;
}

.open .chevron,
.unit-trigger.open .chevron,
.accordion-trigger.open .chevron {
  transform: rotate(180deg);
}

.subject-content {
  border-top: 1px solid hsl(var(--border));
}

.unit-trigger {
  padding: 0.72rem 1.5rem;
  background: hsl(var(--muted) / 0.35);
  color: hsl(var(--muted-foreground));
  font-size: 0.84rem;
}

.unit-title {
  flex: 1;
}

.chapter-list {
  background: hsl(var(--background));
}

.chapter-row,
.detail-row,
.weak-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid hsl(var(--border) / 0.55);
  padding: 0.72rem 1rem;
}

.chapter-row {
  padding-left: 2rem;
}

.check {
  width: 1.15rem;
  height: 1.15rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid hsl(var(--muted-foreground) / 0.32);
  border-radius: 0.25rem;
  background: transparent;
  color: white;
  padding: 0;
}

.check.done {
  border-color: hsl(var(--emerald));
  background: hsl(var(--emerald));
}

.chapter-name {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
}

.done-text {
  color: hsl(var(--muted-foreground));
  text-decoration: line-through;
}

.topic-count {
  color: hsl(var(--muted-foreground) / 0.65);
  font-size: 0.68rem;
}

.star-button,
.weak-button,
.note-button {
  border: 0;
  background: transparent;
  color: hsl(var(--muted-foreground) / 0.55);
  padding: 0.1rem;
}

.star-button.active,
.note-button.active {
  color: #fbbf24;
}

.weak-button.active {
  color: #f87171;
}

.filter-pill,
.subtype-pill {
  border: 0;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  padding: 0.42rem 0.8rem;
  font-size: 0.76rem;
  font-weight: 650;
}

.filter-pill.active,
.subtype-pill.active {
  background: hsl(var(--emerald));
  color: white;
}

.subject-card {
  overflow: hidden;
}

.subject-card-header {
  border-left: 3px solid hsl(var(--emerald));
  background: hsl(var(--emerald) / 0.045);
  padding: 0.9rem 1rem;
}

.subject-card-header h3 {
  margin: 0;
  flex: 1;
  font-size: 1rem;
}

.mini-progress {
  height: 0.48rem;
  overflow: hidden;
  border-radius: 999px;
  background: hsl(var(--muted));
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: hsl(var(--emerald));
  transition: width 0.5s ease;
}

.detail-row {
  align-items: flex-start;
  transition: background 0.18s ease;
}

.detail-row:hover {
  background: hsl(var(--accent) / 0.35);
}

.detail-row.completed {
  background: hsl(var(--emerald) / 0.05);
}

.chapter-meta {
  min-width: 0;
  flex: 1;
}

.chapter-meta p {
  margin: 0;
}

.unit-subtitle {
  margin-top: 0.15rem !important;
  color: hsl(var(--muted-foreground) / 0.7);
  font-size: 0.68rem;
}

.difficulty {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.22rem 1.25rem 0.22rem 0.55rem;
  background: hsl(var(--emerald) / 0.12);
  color: hsl(var(--emerald));
  font-size: 0.62rem;
  font-weight: 750;
}

.difficulty.medium {
  background: hsl(var(--amber) / 0.12);
  color: hsl(var(--amber));
}

.difficulty.hard {
  background: hsl(var(--red) / 0.12);
  color: hsl(var(--red));
}

.note-area {
  width: 100%;
  margin-top: 0.6rem;
}

.note-input {
  min-height: 4rem;
  resize: vertical;
  font-size: 0.78rem;
}

.weak-panel {
  overflow: hidden;
}

.weak-header {
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.8rem 1rem;
}

.weak-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

.weak-row {
  justify-content: space-between;
}

.weak-row p {
  margin: 0;
}

.weak-row small {
  color: hsl(var(--muted-foreground));
}

.selector-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.selector-hero h1,
.simple-page-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.05em;
}

.selector-hero p,
.simple-page-card p {
  color: hsl(var(--muted-foreground));
}

.selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.selector-card {
  position: relative;
  min-height: 12.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.selector-card:hover,
.selector-card.selected {
  transform: translateY(-2px);
  border-color: hsl(var(--emerald) / 0.55);
  background: hsl(var(--emerald) / 0.045);
}

.selector-icon {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, hsl(var(--emerald) / 0.16), hsl(var(--purple) / 0.14));
  color: hsl(var(--emerald));
  font-size: 1.25rem;
}

.selector-card h3 {
  margin: 0;
}

.selector-card p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
  line-height: 1.5;
}

.selector-card footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.custom-card {
  background:
    linear-gradient(135deg, hsl(var(--emerald) / 0.08), hsl(var(--purple) / 0.06)),
    hsl(var(--card));
}

.onboarding-card {
  width: min(35rem, 100%);
  margin: 0 auto;
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  background: hsl(var(--card));
  padding: 1.5rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-stack label {
  display: grid;
  gap: 0.35rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
  font-weight: 600;
}

.level-grid,
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.range-row {
  display: grid;
  gap: 0.35rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: hsl(0 0% 0% / 0.55);
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  position: relative;
  width: min(32rem, 100%);
  padding: 1.4rem;
  box-shadow: 0 24px 80px hsl(0 0% 0% / 0.35);
  animation: modalIn 0.18s ease;
}

.modal-card.wide {
  width: min(48rem, 100%);
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-title h3 {
  margin: 0;
}

.modal-title p {
  margin: 0.1rem 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
}

.tab-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  border-radius: 0.75rem;
  background: hsl(var(--muted));
  padding: 0.25rem;
}

.tab-row button {
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: hsl(var(--muted-foreground));
  padding: 0.5rem;
  font-weight: 650;
}

.tab-row button.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 4px 10px hsl(0 0% 0% / 0.12);
}

.builder-subject {
  border: 1px solid hsl(var(--border));
  border-radius: 0.8rem;
  padding: 0.75rem;
}

.builder-chapter {
  margin-top: 0.6rem;
  padding-left: 0.7rem;
  border-left: 2px solid hsl(var(--emerald) / 0.45);
}

.topics-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  padding: 0.25rem 0.55rem;
  font-size: 0.68rem;
}

.toast-root {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  display: grid;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  min-width: min(22rem, calc(100vw - 2rem));
  border: 1px solid hsl(var(--border));
  border-radius: 0.85rem;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow: 0 18px 50px hsl(0 0% 0% / 0.2);
  padding: 0.75rem 0.9rem;
  pointer-events: auto;
  animation: toastIn 0.2s ease;
}

.toast strong {
  display: block;
  margin-bottom: 0.15rem;
}

.toast span {
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
}

.confetti-root {
  position: fixed;
  inset: 0;
  z-index: 180;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 0.45rem;
  height: 0.8rem;
  border-radius: 0.15rem;
  animation: confetti 1.8s ease-out forwards;
}

.hidden {
  display: none !important;
}

.muted {
  color: hsl(var(--muted-foreground));
}

.error {
  color: hsl(var(--red));
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(0.7rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes confetti {
  0% {
    opacity: 1;
    transform: translateY(-10vh) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(105vh) rotate(680deg);
  }
}

@media (max-width: 900px) {
  .desktop-nav,
  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .floating-nav {
    padding-inline: 1rem;
  }

  .progress-grid,
  .selector-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-controls {
    align-items: flex-start;
  }

  .control-right {
    width: 100%;
  }

  .time-box {
    width: 3.8rem;
    height: 3.8rem;
    font-size: 1.35rem;
  }

  .topic-count,
  .difficulty {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-inline: 0.85rem;
  }

  .stats-grid,
  .level-grid,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .chapter-row {
    padding-left: 1rem;
  }

  .streak-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .streak-bar .pace {
    margin-left: 0;
  }
}
