:root {
  --teal: #0b5960;
  --teal-2: #16727a;
  --teal-soft: #dcebea;
  --coral: #df6b48;
  --coral-dark: #bf5437;
  --coral-soft: #fae4db;
  --cream: #f5f0e7;
  --paper: #fffdf8;
  --ink: #24373a;
  --muted: #68787a;
  --line: #e5ded2;
  --green: #2f8a63;
  --green-soft: #e1f2e8;
  --red: #c9564c;
  --shadow: 0 18px 50px rgba(36, 55, 58, .09);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(223, 107, 72, .09), transparent 28rem),
    linear-gradient(180deg, #faf7f0 0%, var(--cream) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-shell { width: min(100%, 780px); min-height: 100vh; margin: 0 auto; position: relative; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: rgba(250, 247, 240, .88);
  border-bottom: 1px solid rgba(229, 222, 210, .7);
  backdrop-filter: blur(16px);
}
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 11px; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px 14px 14px 5px; background: var(--teal); color: white; font-size: 22px; font-weight: 900; font-style: italic; box-shadow: 0 8px 18px rgba(11,89,96,.22); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.2px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.icon-button { width: 43px; height: 43px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); cursor: pointer; position: relative; }
.notification-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); right: 7px; top: 6px; }

main { padding: 0 18px 116px; }
.view { animation: fade-in .28s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.eyebrow { color: var(--coral-dark); font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(30px, 8vw, 48px); line-height: 1.06; letter-spacing: -.04em; }
h2 { letter-spacing: -.025em; }
p { line-height: 1.58; color: var(--muted); }

.onboarding-view { padding-top: 26px; }
.onboarding-hero { padding: 14px 4px 22px; }
.onboarding-hero h1 { margin: 9px 0 15px; }
.onboarding-hero p { font-size: 16px; max-width: 620px; }
.setup-card, .focus-card, .panel-card, .motivation-card, .install-card {
  border: 1px solid rgba(229, 222, 210, .9);
  background: rgba(255, 253, 248, .92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.setup-card { padding: 22px; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend, .field > span { font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.exam-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.exam-option { position: relative; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 14px; border: 1.5px solid var(--line); border-radius: 18px; cursor: pointer; transition: .2s ease; background: #fff; }
.exam-option input { position: absolute; opacity: 0; }
.exam-option:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.exam-icon { grid-row: 1 / span 2; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--teal); color: white; font-weight: 900; }
.exam-option strong { align-self: end; font-size: 16px; }
.exam-option small { color: var(--muted); font-size: 11px; }
.field { display: grid; margin-bottom: 17px; }
.field input, .field select { width: 100%; min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: white; color: var(--ink); outline: none; }
.field input:focus, .field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(11,89,96,.1); }
.primary-button, .secondary-button, .small-button, .text-button { border: 0; cursor: pointer; font-weight: 800; }
.primary-button { width: 100%; min-height: 54px; padding: 0 20px; border-radius: 16px; color: white; background: var(--coral); box-shadow: 0 10px 24px rgba(223, 107, 72, .24); }
.primary-button:hover { background: var(--coral-dark); }
.secondary-button { width: 100%; min-height: 48px; border-radius: 14px; color: var(--teal); background: var(--teal-soft); }
.small-button { padding: 9px 13px; border-radius: 12px; color: white; background: var(--teal); white-space: nowrap; }
.text-button { width: 100%; padding: 13px; background: transparent; color: var(--muted); }
.privacy-note { font-size: 11px; text-align: center; margin: 12px 0 0; }

.dashboard-view, .plan-view, .progress-view, .parent-view { padding-top: 26px; }
.welcome-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.welcome-row h1 { font-size: clamp(28px, 7vw, 40px); margin: 7px 0 9px; }
.welcome-row p { font-size: 14px; }
.streak-card { flex: 0 0 76px; display: grid; place-items: center; padding: 10px 8px; border-radius: 20px; background: var(--coral-soft); color: var(--coral-dark); }
.streak-card span { font-size: 22px; }
.streak-card strong { font-size: 24px; line-height: 1; }
.streak-card small { font-size: 10px; margin-top: 4px; }
.install-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 15px; margin: 14px 0; background: #fff5da; border-color: #ead7a8; }
.install-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: #f4cf6a; font-size: 22px; }
.install-card strong { font-size: 13px; }
.install-card p { margin: 3px 0 0; font-size: 11px; line-height: 1.4; }
.focus-card { padding: 20px; margin-top: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.section-heading h2 { font-size: 20px; margin: 5px 0 0; }
.section-heading.compact { margin-bottom: 18px; }
.section-heading.compact small { color: var(--muted); }
.progress-ring { --progress: 0%; width: 58px; height: 58px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--coral) var(--progress), var(--coral-soft) 0); position: relative; }
.progress-ring::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--paper); }
.progress-ring span { position: relative; z-index: 1; font-size: 12px; font-weight: 900; }
.task-list { display: grid; gap: 10px; margin: 18px 0; }
.task-item { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.task-check { width: 25px; height: 25px; border: 2px solid #aebaba; border-radius: 8px; background: white; cursor: pointer; color: white; font-weight: 900; }
.task-item.done .task-check { background: var(--green); border-color: var(--green); }
.task-item.done .task-title { text-decoration: line-through; color: #839091; }
.task-main { min-width: 0; }
.task-title { display: block; font-weight: 800; font-size: 14px; overflow-wrap: anywhere; }
.task-meta { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.subject-dot { width: 9px; height: 9px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--subject-color, var(--teal)); }
.task-time { color: var(--muted); font-weight: 800; font-size: 12px; }
.empty-state { text-align: center; padding: 26px 10px; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.stat-card { min-height: 144px; display: flex; flex-direction: column; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,248,.8); }
.stat-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; margin-bottom: 14px; }
.stat-icon.teal { background: var(--teal-soft); color: var(--teal); }
.stat-icon.coral { background: var(--coral-soft); color: var(--coral); }
.stat-card small { color: var(--muted); }
.stat-card strong { font-size: 22px; margin: 3px 0; }
.stat-card > span:last-child { font-size: 10px; color: var(--green); }
.motivation-card { padding: 22px; position: relative; overflow: hidden; background: var(--teal); color: white; border: 0; }
.quote-mark { position: absolute; right: 18px; top: -12px; font-family: Georgia, serif; font-size: 96px; color: rgba(255,255,255,.12); }
.motivation-card blockquote { margin: 0 0 12px; max-width: 86%; font-family: Georgia, serif; font-size: 19px; line-height: 1.45; }
.motivation-card small { color: rgba(255,255,255,.7); }

.page-heading h1 { font-size: clamp(30px, 8vw, 43px); margin: 8px 0 12px; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(43px, 1fr)); gap: 6px; margin: 20px 0; overflow-x: auto; }
.day-button { border: 1px solid var(--line); border-radius: 15px; padding: 10px 4px; background: var(--paper); color: var(--ink); cursor: pointer; }
.day-button small, .day-button strong { display: block; }
.day-button small { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.day-button.active { background: var(--teal); color: white; border-color: var(--teal); }
.day-button.active small { color: rgba(255,255,255,.7); }
.panel-card { padding: 20px; margin-bottom: 14px; }
.chart-card { min-height: 300px; }
.bar-chart { height: 190px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; align-items: end; padding-top: 24px; }
.bar-column { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 8px; align-items: end; text-align: center; }
.bar-track { height: 100%; display: flex; align-items: end; justify-content: center; border-radius: 10px; background: linear-gradient(180deg, rgba(220,235,234,.45), rgba(220,235,234,.8)); overflow: hidden; }
.bar-value { width: 100%; min-height: 4px; border-radius: 10px 10px 4px 4px; background: var(--teal); transition: height .35s ease; }
.bar-column.today .bar-value { background: var(--coral); }
.bar-column small { color: var(--muted); font-size: 10px; }
.subject-progress { display: grid; gap: 16px; margin-top: 18px; }
.subject-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; }
.subject-row strong, .subject-row span { font-size: 13px; }
.subject-row span { color: var(--muted); }
.progress-track { grid-column: 1/-1; height: 8px; border-radius: 999px; background: #ece8df; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--subject-color); }
.parent-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0 14px; }
.parent-summary article { padding: 15px 10px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); text-align: center; }
.parent-summary small, .parent-summary span { display: block; color: var(--muted); font-size: 9px; }
.parent-summary strong { display: block; margin: 5px 0; font-size: 19px; }
.advice-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; background: var(--coral-soft); border-color: #f0c7b8; }
.advice-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: white; color: var(--coral); font-size: 24px; }
.advice-card small { color: var(--coral-dark); font-weight: 800; }
.advice-card h2 { font-size: 18px; margin: 5px 0; }
.advice-card p { font-size: 13px; margin: 0; }
.plus-badge { padding: 6px 9px; border-radius: 999px; background: #392d58; color: white; font-size: 10px; font-weight: 800; }
.report-preview { padding: 14px; border-radius: 14px; background: #f5f2eb; font-size: 13px; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 780px); display: grid; grid-template-columns: repeat(4,1fr); padding: 8px 12px max(8px, env(safe-area-inset-bottom)); background: rgba(255,253,248,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
.nav-item { border: 0; background: transparent; color: var(--muted); display: grid; gap: 2px; place-items: center; padding: 5px; cursor: pointer; }
.nav-item span { font-size: 22px; line-height: 1; }
.nav-item small { font-size: 10px; font-weight: 800; }
.nav-item.active { color: var(--teal); }

dialog { width: min(calc(100% - 28px), 520px); border: 0; border-radius: 24px; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(22, 36, 39, .55); backdrop-filter: blur(4px); }
.dialog-card { padding: 22px; background: var(--paper); border-radius: 24px; box-shadow: var(--shadow); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; }
.close-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eeeae2; color: var(--ink); font-size: 23px; cursor: pointer; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 92px; transform: translate(-50%, 20px); width: max-content; max-width: calc(100% - 36px); padding: 12px 17px; border-radius: 999px; background: var(--ink); color: white; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  main { padding-inline: 30px; }
  .setup-card { padding: 28px; }
  .focus-card, .panel-card { padding: 25px; }
  .task-item { padding: 14px; }
}
@media (max-width: 380px) {
  .brand small { display: none; }
  .exam-grid { grid-template-columns: 1fr; }
  .welcome-row { display: grid; grid-template-columns: 1fr auto; }
  .parent-summary strong { font-size: 16px; }
}
@media (display-mode: standalone) {
  .install-card { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
