:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.12);
  --hairline: rgba(60, 60, 67, 0.08);
  --sidebar-bg: #15202a;
  --sidebar-ink: #f5f7f8;
  --sidebar-muted: rgba(255, 255, 255, 0.56);
  --teal: #3f7418;
  --teal-dark: #2f5912;
  --teal-soft: #eef8e7;
  --growth: #83b83b;
  --growth-dark: #3f7418;
  --growth-soft: #eef8e7;
  --growth-glow: rgba(131, 184, 59, 0.22);
  --mint: #dbf1cc;
  --rose: #ffb3a7;
  --lavender: #c9c3ff;
  --sky: #b8e7f5;
  --gold: #c78b00;
  --gold-soft: #fff7df;
  --coral: #d9342b;
  --coral-soft: #ffebe8;
  --green: #3f7418;
  --green-soft: #eef8e7;
  --blue: #5f6b58;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 44px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.055);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.05), 0 20px 48px rgba(0, 0, 0, 0.1);
  --material: rgba(255, 255, 255, 0.72);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --transition: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 42%, #f2f2f7 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--transition);
}

.app-shell.sidebar-hidden {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 18px;
  border-right: none;
  background:
    linear-gradient(180deg, rgba(23, 34, 43, 0.98), rgba(17, 25, 34, 0.98)),
    var(--sidebar-bg);
  color: var(--sidebar-ink);
  overflow: hidden;
  transition:
    opacity var(--transition),
    padding var(--transition),
    transform var(--transition);
}

.app-shell.sidebar-hidden .sidebar {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  padding-left: 0;
  padding-right: 0;
  border-right: 0;
  transform: translateX(-12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(145deg, #a9d66b, var(--teal));
  color: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 12px 28px var(--growth-glow);
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  color: #fff;
}

.topbar h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand .eyebrow {
  color: var(--sidebar-muted);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 3px;
}

.nav-item {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-item[data-view="dashboard"]::before { content: "📊  "; }
.nav-item[data-view="diagnostic"]::before { content: "🎯  "; }
.nav-item[data-view="practice"]::before { content: "✏️  "; }
.nav-item[data-view="formulas"]::before { content: "🌱  "; }
.nav-item[data-view="written"]::before { content: "📝  "; }
.nav-item[data-view="errors"]::before { content: "🔧  "; }

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #a9d66b;
}

.sidebar-footer {
  margin-top: auto;
  color: var(--sidebar-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.sidebar-footer p {
  margin: 3px 0;
}

.main-panel {
  min-width: 0;
  padding: 24px 28px;
  background: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: none;
  margin: 0 auto 20px;
}

.topbar-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pane-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--material);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all var(--transition);
}

.pane-toggle:hover,
.pane-toggle:focus-visible {
  background: #fff;
  color: var(--ink);
  outline: none;
}

.app-shell.sidebar-hidden .pane-toggle {
  background: var(--teal-soft);
  color: var(--teal);
}

.pane-toggle-icon {
  display: grid;
  gap: 4px;
  width: 18px;
}

.pane-toggle-icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.content-area {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  transition: box-shadow var(--transition), transform var(--transition);
}

.student-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(131, 184, 59, 0.16);
  border-radius: var(--radius-lg);
  padding: 28px;
  background:
    radial-gradient(circle at 84% 12%, rgba(131, 184, 59, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 248, 231, 0.9));
  color: var(--ink);
  box-shadow: var(--shadow);
}

.parent-hero {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
  background:
    radial-gradient(circle at 88% 16%, rgba(131, 184, 59, 0.16), transparent 30%),
    var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.parent-hero h3 {
  max-width: 20ch;
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
}

.parent-hero p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.parent-priority {
  border-color: rgba(131, 184, 59, 0.16);
}

.parent-action-list {
  margin: 0;
  padding-left: 20px;
}

.parent-action-list li {
  margin: 9px 0;
  line-height: 1.45;
}

.parent-guidance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.parent-guidance > div {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.parent-guidance h4,
.parent-guidance p {
  margin: 0;
}

.parent-guidance p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.parent-reset-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  border: 1px solid rgba(217, 52, 43, 0.16);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 235, 232, 0.64);
}

.parent-reset-box p {
  margin: 5px 0 0;
  line-height: 1.42;
}

body[data-view="parent"] .grid.two {
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
}

.student-hero.compact {
  margin-bottom: 0;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
}

.hero-copy h3 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  max-width: 16ch;
  color: var(--ink);
}

.hero-copy p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.student-hero .eyebrow {
  color: var(--teal);
}

.student-hero .button-row .primary-button {
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.student-hero .button-row .primary-button:hover {
  background: var(--teal-dark);
  box-shadow: 0 10px 22px var(--growth-glow);
}

.student-hero .button-row .secondary-button {
  background: rgba(131, 184, 59, 0.1);
  color: var(--teal);
  border-color: rgba(131, 184, 59, 0.18);
}

.student-hero .button-row .secondary-button:hover {
  background: rgba(131, 184, 59, 0.16);
}

.garden-card {
  display: grid;
  grid-template-rows: 1fr auto;
  position: relative;
  min-height: 240px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 82% 18%, rgba(131, 184, 59, 0.22), transparent 30%),
    linear-gradient(180deg, #dff6ff 0%, #c8efff 42%, #daf1c9 64%, #b7dc83 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), var(--shadow-soft);
}

.garden-card.compact {
  min-height: 190px;
}

.garden-sky {
  position: relative;
  min-height: 170px;
}

.garden-sky::before {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: -18%;
  height: 52%;
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 255, 255, 0.45), transparent 24%),
    linear-gradient(180deg, rgba(219, 241, 204, 0.9), rgba(131, 184, 59, 0.68));
}

.garden-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.garden-caption span {
  color: var(--muted);
  font-size: 0.9rem;
}

.flower {
  position: absolute;
  display: block;
  z-index: 1;
  transform-origin: center bottom;
  animation: flower-pop 600ms ease both;
}

.flower::before,
.flower::after,
.flower span::before,
.flower span::after {
  content: "";
  position: absolute;
  width: 48%;
  height: 48%;
  border-radius: 50%;
  background: var(--rose);
}

.flower::before {
  left: 26%;
  top: 0;
}

.flower::after {
  right: 0;
  top: 26%;
  background: var(--lavender);
}

.flower span::before {
  left: 26%;
  bottom: 0;
  background: var(--gold);
}

.flower span::after {
  left: 0;
  top: 26%;
  background: var(--growth);
}

.flower span {
  position: absolute;
  inset: 0;
}

.flower span {
  background: radial-gradient(circle at center, #fff6d6 0 20%, transparent 21%);
  border-radius: 50%;
}

@keyframes flower-pop {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.3);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 0;
}

.panel-body {
  padding: 18px;
}

.panel h3,
.panel h4 {
  margin: 0;
}

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

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.badge-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.badge-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  border: 1px solid rgba(131, 184, 59, 0.18);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(238, 248, 231, 0.84));
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.badge-card:hover {
  transform: translateY(-2px);
  border-color: rgba(131, 184, 59, 0.32);
  box-shadow: 0 10px 24px var(--growth-glow);
}

.badge-card strong,
.badge-card span {
  display: block;
}

.badge-card strong {
  font-size: 0.95rem;
}

.badge-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.badge-medal {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #fff6c9 0 24%, transparent 25%),
    conic-gradient(from 0deg, var(--growth), #f4c95d, #bfe5f2, var(--mint), var(--growth));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.8), 0 2px 8px var(--growth-glow);
  animation: badge-glow 3s ease-in-out infinite;
}

@keyframes badge-glow {
  0%, 100% { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.8), 0 2px 8px var(--growth-glow); }
  50% { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9), 0 4px 16px rgba(131, 184, 59, 0.34); }
}

.daily-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.plan-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 200px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  transition: box-shadow var(--transition), transform var(--transition);
}

.plan-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-card h4,
.plan-card p {
  margin: 0;
}

.plan-card p {
  color: var(--muted);
  line-height: 1.4;
}

.study-reason {
  margin-top: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--teal-soft);
  color: var(--teal);
  letter-spacing: 0;
}

.status-pill.green {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(131, 184, 59, 0.16);
}

.status-pill.gold {
  background: var(--gold-soft);
  color: #8a6914;
}

.status-pill.red {
  background: var(--coral-soft);
  color: var(--coral);
}

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: 999px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.primary-button {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(63, 116, 24, 0.2);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--teal-dark);
  box-shadow: 0 12px 24px var(--growth-glow);
  transform: translateY(-1px);
  outline: none;
}

.secondary-button {
  background: rgba(131, 184, 59, 0.1);
  color: var(--teal);
  border-color: rgba(131, 184, 59, 0.16);
}

.secondary-button:hover {
  background: rgba(131, 184, 59, 0.16);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border-color: var(--line);
}

.ghost-button:hover {
  background: #fff;
  color: var(--ink);
}

.ghost-button.danger {
  color: var(--coral);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-list {
  display: grid;
  gap: 10px;
}

.skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
  align-items: center;
  gap: 12px;
}

.skill-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(60, 60, 67, 0.1);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.bar span.green {
  background: var(--growth);
}

.bar span.gold {
  background: var(--gold);
}

.bar span.red {
  background: var(--coral);
}

.session-card {
  display: grid;
  gap: 18px;
}

.practice-mode-card {
  height: 100%;
}

.practice-mode-card .panel-body {
  height: 100%;
  min-height: 230px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.practice-mode-card .primary-button {
  align-self: end;
  width: 100%;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-text {
  margin: 0;
  max-width: 76ch;
  font-size: clamp(1.18rem, 2.2vw, 1.55rem);
  line-height: 1.48;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.choice:hover,
.choice:focus-visible,
.choice.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 8px 22px rgba(131, 184, 59, 0.12);
  outline: none;
}

.choice.correct {
  border-color: rgba(131, 184, 59, 0.44);
  background: var(--green-soft);
}

.choice.incorrect {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.letter {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(60, 60, 67, 0.1);
  font-weight: 800;
}

.feedback {
  border: 1px solid rgba(131, 184, 59, 0.16);
  border-left: 4px solid var(--teal);
  padding: 12px 14px;
  max-width: 920px;
  background: rgba(238, 248, 231, 0.72);
  border-radius: var(--radius);
}

.feedback.celebrate {
  border-color: rgba(131, 184, 59, 0.22);
  border-left-color: var(--growth);
  background:
    linear-gradient(90deg, rgba(238, 248, 231, 0.92), rgba(255, 248, 220, 0.82));
}

.explanation-steps {
  margin: 10px 0 0;
  padding-left: 22px;
}

.explanation-steps li {
  margin: 8px 0;
  line-height: 1.45;
}

.unit-report {
  display: grid;
  gap: 10px;
}

.unit-report-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.74);
}

.unit-report-row span {
  display: block;
  margin-top: 3px;
}

.mock-report h4 {
  margin: 0 0 12px;
}

.mock-miss-list {
  display: grid;
  gap: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.empty-state {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row label {
  font-weight: 750;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--teal);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 4px rgba(131, 184, 59, 0.18);
}

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

.setup-panel {
  margin-bottom: 16px;
  border: 1px solid rgba(199, 139, 0, 0.18);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 247, 223, 0.72));
}

.setup-submit {
  align-self: end;
}

.note-list {
  margin: 0;
  padding-left: 20px;
}

.note-list li {
  margin: 8px 0;
}

.inline-code {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.progress-ring {
  display: grid;
  place-items: center;
  width: min(220px, 50vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 0 58%, transparent 59%),
    conic-gradient(var(--growth) 0%, #a9d66b var(--progress), rgba(60, 60, 67, 0.08) 0);
  margin: 0 auto;
  box-shadow: 0 12px 28px var(--growth-glow);
}

.formula-strip {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(238, 248, 231, 0.74));
}

.formula-mini-grid,
.formula-bank {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.formula-bank-details {
  border: 1px solid rgba(131, 184, 59, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
}

.formula-bank-details summary {
  cursor: pointer;
  padding: 14px;
  color: var(--teal);
  font-weight: 800;
}

.formula-bank-details .formula-bank {
  padding: 0 14px 14px;
}

.formula-mini,
.formula-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 13px;
  background: rgba(255, 255, 255, 0.78);
}

.formula-card {
  border-color: rgba(131, 184, 59, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 247, 223, 0.52));
}

.formula-card.reviewed {
  border-color: rgba(131, 184, 59, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 248, 231, 0.86));
}

.formula-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.formula-mini strong,
.formula-card strong {
  line-height: 1.25;
}

.formula-mini code,
.formula-card code {
  display: block;
  width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid rgba(131, 184, 59, 0.16);
  border-radius: 6px;
  padding: 8px;
  background: rgba(249, 251, 247, 0.9);
  color: #263221;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.96rem;
  line-height: 1.55;
}

.formula-hidden {
  display: grid;
  place-items: center;
  min-height: 78px;
  border: 1px dashed rgba(131, 184, 59, 0.3);
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    -45deg,
    rgba(238, 248, 231, 0.76),
    rgba(238, 248, 231, 0.76) 10px,
    rgba(255, 255, 255, 0.75) 10px,
    rgba(255, 255, 255, 0.75) 20px
  );
  color: var(--teal);
  font-weight: 800;
}

.compact-text {
  font-size: clamp(1rem, 2vw, 1.35rem) !important;
  line-height: 1.15 !important;
}

.written-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.writing-workspace {
  display: grid;
  gap: 12px;
}

.solution-card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.solution-card summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--teal);
}

.solution-card[open] summary {
  margin-bottom: 8px;
}

.solution-checklist {
  border: 1px dashed rgba(131, 184, 59, 0.28);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(249, 251, 247, 0.86);
}

.solution-checklist ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.solution-checklist li {
  margin: 6px 0;
}

.writing-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.writing-tools,
.writing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.writing-tool.is-active {
  border-color: rgba(131, 184, 59, 0.28);
  background: var(--teal-soft);
  color: var(--teal);
}

.touch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 750;
}

.touch-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.writing-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: clamp(560px, 68vh, 820px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgba(238, 248, 231, 0.58);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: crosshair;
  touch-action: none;
}

.writing-stage:focus-visible {
  outline: 3px solid rgba(131, 184, 59, 0.24);
  outline-offset: 3px;
}

.writing-pad {
  display: block;
  width: 100%;
  height: 980px;
  border: 0;
  background: #fffef9;
  box-shadow: 0 18px 42px rgba(31, 37, 40, 0.12);
  touch-action: none;
  transform-origin: 0 0;
  will-change: transform;
}

.written-gallery figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
}

.written-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f4f1e8;
}

.written-gallery figcaption {
  padding: 10px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.routine-list {
  margin: 0 0 16px;
  padding-left: 22px;
}

.routine-list li {
  margin: 10px 0;
  line-height: 1.45;
}

body[data-view="parent"] .nav-list,
body[data-view="parent"] #resetButton {
  display: none;
}

body[data-view="parent"] .sidebar {
  gap: 18px;
}

.progress-ring strong {
  font-size: 3rem;
}

@media (min-width: 981px) and (max-width: 1366px) and (orientation: landscape) {
  .app-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  body[data-view="written"] .app-shell {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .sidebar {
    gap: 16px;
    padding: 18px 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 0.8rem;
  }

  .brand h1,
  .topbar h2 {
    font-size: 0.95rem;
  }

  .eyebrow {
    font-size: 0.65rem;
  }

  .nav-list {
    gap: 3px;
  }

  .nav-item {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.88rem;
  }

  .sidebar-footer {
    font-size: 0.72rem;
  }

  .main-panel {
    padding: 16px 18px 20px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    max-width: none;
    margin-bottom: 14px;
    padding: 8px 0 10px;
    background: rgba(245, 245, 247, 0.76);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .ghost-button,
  .pane-toggle {
    min-height: 42px;
    padding: 7px 10px;
    font-size: 0.85rem;
  }

  .content-area {
    max-width: none;
  }

  .student-hero {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 230px);
    gap: 14px;
    margin-bottom: 10px;
    padding: 18px;
    border-radius: var(--radius);
  }

  .hero-copy {
    gap: 8px;
  }

  .hero-copy h3 {
    max-width: 22ch;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
  }

  .hero-copy p {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .garden-card {
    min-height: 195px;
  }

  .garden-sky {
    min-height: 130px;
  }

  .daily-plan-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .plan-card {
    min-height: 150px;
    padding: 14px;
  }

  .daily-plan .panel-body {
    padding-top: 10px;
  }

  .grid {
    gap: 12px;
  }

  .grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.82fr);
  }

  .grid.three {
    gap: 10px;
  }

  .formula-mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .panel {
    box-shadow: var(--shadow-soft);
  }

  .panel-header {
    padding: 14px 14px 0;
  }

  .panel-body {
    padding: 14px;
  }

  .metric-row {
    gap: 8px;
  }

  .metric {
    padding: 11px;
  }

  .metric strong {
    font-size: clamp(1.3rem, 2vw, 1.8rem);
  }

  body[data-view="written"] .content-area {
    max-width: none;
  }

  body[data-view="written"] .topbar {
    margin-bottom: 8px;
  }

  body[data-view="written"] .writing-toolbar {
    position: sticky;
    top: 60px;
    z-index: 15;
    box-shadow: var(--shadow-soft);
  }

  body[data-view="written"] .panel-header,
  body[data-view="written"] .panel-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  body[data-view="written"] .writing-stage {
    height: clamp(580px, 72vh, 740px);
  }

  body[data-view="written"] .writing-pad {
    height: 1200px;
  }
}

@media (min-width: 981px) and (max-width: 1120px) and (orientation: landscape) {
  .app-shell {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .brand h1 {
    font-size: 0.9rem;
  }

  .student-hero {
    grid-template-columns: 1fr;
  }

  .garden-card {
    min-height: 150px;
  }

  .garden-sky {
    min-height: 90px;
  }

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

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-hidden {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-hidden .sidebar {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px 14px;
    gap: 10px;
    border-right: 0;
    border-bottom: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }

  .brand {
    align-items: center;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.7);
  }

  .nav-item.active {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.18);
  }

  .sidebar-footer {
    display: none;
  }

  .main-panel {
    padding: 18px;
  }

  .grid.two,
  .grid.three,
  .metric-row,
  .form-grid,
  .student-hero,
  .formula-mini-grid,
  .parent-hero,
  .parent-guidance {
    grid-template-columns: 1fr;
  }

  .unit-report-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .writing-stage {
    height: clamp(540px, 68vh, 820px);
  }

  .writing-pad {
    height: 1080px;
  }
}

@media (min-width: 760px) and (max-width: 1100px) and (orientation: landscape) {
  .student-hero,
  .parent-hero {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  }

  .grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.82fr);
  }

  .grid.three,
  .formula-mini-grid,
  .metric-row,
  .form-grid,
  .parent-guidance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .writing-stage {
    height: clamp(520px, 64vh, 680px);
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-heading {
    align-items: flex-start;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button,
  .button-row button {
    flex: 1 1 auto;
  }

  .panel-header {
    flex-direction: column;
  }

  .plan-card {
    min-height: 0;
  }

  .writing-toolbar {
    align-items: stretch;
  }

  .parent-reset-box {
    align-items: stretch;
    flex-direction: column;
  }

  .writing-tools,
  .writing-actions,
  .touch-toggle {
    width: 100%;
  }

  .writing-stage {
    height: 460px;
  }

  .writing-pad {
    height: 860px;
  }
}
