:root {
  --paper: #f2f6f7;
  --card: #fbfdfe;
  --ink: #1d2b32;
  --muted: #6d7b82;
  --sage: #a8c2c2;
  --sage-dark: #3f6f73;
  --apricot: #d98d7d;
  --line: #d7e1e4;
  --shadow: 0 16px 40px rgba(37, 68, 76, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 3%, rgba(139, 181, 191, .18), transparent 25rem),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

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

.app-shell {
  width: min(100%, 720px);
  min-height: 100svh;
  margin: auto;
  padding: env(safe-area-inset-top) 20px calc(96px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 2px 20px;
}

.eyebrow, .section-kicker {
  margin: 0 0 6px;
  color: var(--sage-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; letter-spacing: -.04em; }
h2 { letter-spacing: -.035em; }

.icon-button, .round-button, .close-button {
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.62);
  font-weight: 900;
  letter-spacing: 2px;
}

.page { display: none; animation: rise .28s ease both; }
.page.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.exam-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 172px;
  padding: 28px;
  border-radius: 30px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(33, 61, 70, .95), rgba(66, 111, 116, .9)),
    #3f6f73;
  box-shadow: 0 20px 42px rgba(45, 82, 92, .2);
}

.exam-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -76px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255,255,255,.04), 0 0 0 57px rgba(255,255,255,.035);
}

.pill {
  display: inline-block;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .14em;
}

.exam-card h2 { margin: 18px 0 8px; font-size: clamp(25px, 7vw, 36px); }
.exam-card p { margin: 0; color: rgba(255,255,255,.75); font-size: 13px; }

.round-button {
  z-index: 1;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--apricot);
  font-size: 24px;
  box-shadow: 0 9px 20px rgba(0,0,0,.12);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 30px 2px 14px;
}

.section-heading h2 { margin: 0; font-size: 21px; }
.text-button { border: 0; background: none; color: var(--sage-dark); font-size: 13px; cursor: pointer; }

.stack { display: grid; gap: 10px; }

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid rgba(222, 219, 210, .78);
  border-radius: 18px;
  background: rgba(255,253,248,.84);
}

.task-item.overdue { border-left: 4px solid var(--apricot); }

.check-button {
  width: 26px;
  height: 26px;
  border: 1.5px solid #aeb4aa;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.task-item.done .check-button { border-color: var(--sage-dark); background: var(--sage-dark); }
.task-item.done .check-button::after { content: "✓"; color: #fff; font-size: 15px; }
.task-item.done .task-title { color: #92958f; text-decoration: line-through; }
.task-title { display: block; margin-bottom: 5px; font-size: 15px; }
.task-meta { display: flex; gap: 7px; color: var(--muted); font-size: 11px; }

.delete-button {
  padding: 8px;
  border: 0;
  background: transparent;
  color: #aaa9a2;
  cursor: pointer;
}

.empty-state {
  padding: 28px 18px;
  border: 1px dashed #d0cec6;
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 20px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.stat-card strong { font-size: 28px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card.wide { grid-column: 1 / -1; }
.progress-copy { display: flex; justify-content: space-between; align-items: center; }
.progress-copy strong { font-size: 14px; }
.progress-track { height: 8px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #ebe9e1; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--sage-dark); transition: width .3s; }

.page-intro { color: var(--muted); font-size: 14px; line-height: 1.7; }

.plan-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 20px;
  padding: 5px;
  border-radius: 16px;
  background: #e9e6de;
}
.plan-mode-switch button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.plan-mode-switch button.active { color: var(--ink); background: var(--card); box-shadow: 0 5px 14px rgba(40,48,42,.08); }

.timeline-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 23px;
  border-radius: 25px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(166,195,202,.68), transparent 38%),
    linear-gradient(145deg, #294650, #47777c);
}
.timeline-overview h2 { margin-bottom: 7px; font-size: 23px; }
.timeline-overview p:not(.section-kicker) { margin: 0; color: rgba(255,255,255,.72); font-size: 12px; }
.timeline-overview .section-kicker { color: rgba(255,255,255,.7); }
.timeline-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border: 7px solid rgba(255,255,255,.17);
  border-top-color: var(--apricot);
  border-radius: 50%;
}
.timeline-ring strong { font-size: 17px; }
.timeline-ring span { margin-top: -10px; color: rgba(255,255,255,.65); font-size: 9px; }
.milestone-composer { margin-top: 14px; }
.milestone-composer textarea { min-height: 66px; }
.timeline-legend { display: flex; gap: 16px; margin: 19px 4px 8px; color: var(--muted); font-size: 10px; }
.timeline-legend span { display: flex; align-items: center; gap: 6px; }
.timeline-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--apricot); }
.timeline-legend .done-dot { background: var(--sage-dark); }
.milestone-timeline { position: relative; padding: 8px 0 10px 27px; }
.milestone-timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 23px;
  bottom: 37px;
  width: 2px;
  background: linear-gradient(var(--apricot), var(--sage-dark));
}
.timeline-endpoint { position: relative; display: flex; align-items: center; gap: 13px; min-height: 56px; }
.timeline-endpoint > span {
  position: absolute;
  z-index: 1;
  left: -24px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  color: #fff;
  background: var(--apricot);
  font-size: 9px;
}
.timeline-endpoint.finish > span { background: var(--sage-dark); }
.timeline-endpoint strong, .timeline-endpoint small { display: block; }
.timeline-endpoint small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.timeline-empty {
  margin: 7px 0 12px;
  padding: 17px;
  border: 1px dashed #c9c7bf;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255,255,255,.32);
  font-size: 12px;
  line-height: 1.65;
}
.milestone-item { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px; margin: 9px 0 14px; }
.milestone-check {
  position: absolute;
  z-index: 2;
  left: -25px;
  top: 18px;
  width: 20px;
  height: 20px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--apricot);
  cursor: pointer;
}
.milestone-item.done .milestone-check { background: var(--sage-dark); }
.milestone-item.done .milestone-check::after { content: "✓"; color: #fff; font-size: 10px; }
.milestone-card { padding: 17px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.milestone-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.milestone-phase { padding: 5px 8px; border-radius: 999px; color: var(--sage-dark); background: #e7ece4; font-size: 9px; font-weight: 700; }
.milestone-timing { color: var(--apricot); font-size: 10px; font-weight: 700; }
.milestone-card > strong { font-size: 15px; }
.milestone-card > p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.milestone-date { margin-top: 12px; color: #999b95; font-size: 9px; }
.milestone-item.done .milestone-card { opacity: .64; }
.milestone-item.done .milestone-card > strong { text-decoration: line-through; }
.milestone-item.overdue .milestone-card { border: 1px solid rgba(233,185,143,.8); }
.milestone-delete { align-self: start; margin-top: 8px; }

.composer {
  display: grid;
  gap: 10px;
  padding: 15px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: #fbfaf6;
}

input, select { min-height: 46px; padding: 0 13px; }
textarea { padding: 13px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--sage-dark); box-shadow: 0 0 0 3px rgba(91,114,93,.1); }
.composer-row { display: grid; grid-template-columns: 1.2fr .9fr auto; gap: 8px; }
.composer button, .primary-button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--sage-dark);
  font-weight: 700;
  cursor: pointer;
}

.filter-row {
  display: flex;
  gap: 7px;
  margin: 16px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}
.filter.active { border-color: var(--ink); color: #fff; background: var(--ink); }

.word-hero, .summary-intro {
  padding: 26px;
  border-radius: 28px;
  background: #e4e8de;
}
.word-hero h2, .summary-intro h2 { margin-bottom: 8px; font-size: 29px; }
.word-hero p, .summary-intro p { color: #5f675f; line-height: 1.65; font-size: 13px; }
.word-hero .primary-button { margin-top: 7px; background: var(--ink); }
.composer.compact { margin-top: 14px; }
.muted-count { color: var(--muted); font-size: 13px; font-weight: 500; }
.word-list { display: grid; gap: 10px; }
.word-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 17px;
  border-radius: 18px;
  background: var(--card);
}
.word-row strong { display: block; margin-bottom: 5px; font-size: 17px; }
.word-row p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mastery { display: flex; align-items: center; gap: 3px; }
.mastery i { width: 6px; height: 18px; border-radius: 4px; background: #e3e1da; }
.mastery i.on { background: var(--sage-dark); }

.vocab-intro {
  margin-bottom: 15px;
  padding: 25px;
  border-radius: 26px;
  background: linear-gradient(145deg, #dfeaec, #edf3f4);
}
.vocab-intro h2 { margin-bottom: 8px; font-size: 28px; }
.vocab-intro p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.language-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.language-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 285px;
  padding: 21px;
  overflow: hidden;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.english-card {
  color: #fff;
  background:
    radial-gradient(circle at 95% 5%, rgba(171,199,205,.72), transparent 38%),
    linear-gradient(145deg, #294650, #47777c);
}
.english-card .section-kicker, .english-card p { color: rgba(255,255,255,.72); }
.japanese-card { background: linear-gradient(145deg, #e4e7f0, #f0f1f6); }
.language-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.language-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255,255,255,.9);
  font-size: 17px;
  font-weight: 900;
}
.status-chip { padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status-chip.ready { color: #fff; background: rgba(255,255,255,.16); }
.status-chip.waiting { color: #8b6f5b; background: rgba(255,255,255,.72); }
.language-card h2 { margin-bottom: 8px; font-size: 23px; }
.language-card p { margin-bottom: 18px; font-size: 12px; line-height: 1.65; }
.language-enter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 13px 15px;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255,255,255,.9);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.language-enter.disabled { color: #a79484; background: rgba(255,255,255,.45); cursor: default; }
.vocab-preview {
  margin-top: 14px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgba(255,253,248,.62);
}
.vocab-preview h2 { margin-bottom: 7px; font-size: 18px; }
.vocab-preview p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.preview-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
.preview-tags span { padding: 7px 10px; border-radius: 999px; color: var(--sage-dark); background: #e3e9df; font-size: 10px; font-weight: 700; }

dialog.vocab-dialog {
  width: 100%;
  max-width: none;
  height: 100svh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: #f4f7f9;
}
.vocab-frame-shell { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.vocab-frame-header {
  z-index: 2;
  display: flex;
  align-items: center;
  grid-template-columns: 38px 1fr 38px;
  min-height: calc(68px + env(safe-area-inset-top));
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(250,248,242,.96);
}
.vocab-frame-header { display: grid; }
.frame-title { text-align: center; }
.frame-back-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #eeece5;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.vocab-frame-header .section-kicker { margin-bottom: 3px; }
.vocab-frame-header strong { font-size: 17px; }
.vocab-frame-shell iframe { width: 100%; height: 100%; border: 0; background: #f4f7f9; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.search-wrap input { border: 0; background: transparent; box-shadow: none; }
.new-note-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: 1px dashed #b8b9b1;
  border-radius: 20px;
  background: rgba(255,255,255,.3);
  text-align: left;
  cursor: pointer;
}
.new-note-card > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--apricot); font-size: 20px; }
.new-note-card strong, .new-note-card small { display: block; }
.new-note-card small { margin-top: 4px; color: var(--muted); }
.note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 14px; }
.note-card {
  min-height: 150px;
  padding: 18px;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}
.note-card:nth-child(3n+1) { background: #e8ede4; }
.note-card:nth-child(3n+2) { background: #f2e3d5; }
.note-card .tag { display: inline-block; margin-bottom: 25px; color: var(--sage-dark); font-size: 10px; font-weight: 700; }
.note-card strong { display: block; margin-bottom: 6px; }
.note-card p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.essay-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 25px;
  border-radius: 27px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(169,196,202,.78), transparent 42%),
    linear-gradient(145deg, #294650, #47777c);
}
.essay-hero .section-kicker { color: rgba(255,255,255,.7); }
.essay-hero h2 { margin-bottom: 7px; font-size: 25px; }
.essay-hero p:last-child { margin: 0; color: rgba(255,255,255,.73); font-size: 11px; line-height: 1.65; }
.essay-mark { display: grid; place-items: center; flex: 0 0 auto; width: 62px; height: 62px; border-radius: 19px; color: var(--ink); background: rgba(255,255,255,.88); font-family: serif; font-size: 29px; font-weight: 800; }
.essay-roadmap { display: grid; gap: 8px; margin-top: 14px; }
.essay-step { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.essay-step summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 15px; list-style: none; cursor: pointer; }
.essay-step summary::-webkit-details-marker { display: none; }
.essay-step summary > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; color: var(--sage-dark); background: #e7ece4; font-size: 10px; font-weight: 900; }
.essay-step summary strong, .essay-step summary small { display: block; }
.essay-step summary strong { font-size: 13px; }
.essay-step summary small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.essay-step summary b { color: var(--sage-dark); font-size: 18px; transition: transform .2s; }
.essay-step[open] summary b { transform: rotate(45deg); }
.essay-step-body { padding: 0 16px 16px 59px; color: #5f675f; font-size: 11px; line-height: 1.7; }
.essay-step-body p { margin-bottom: 10px; }
.essay-structure-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.essay-structure-grid span { padding: 10px 7px; border-radius: 11px; background: #f0eee7; font-size: 9px; }
.essay-structure-grid b { display: block; margin-bottom: 4px; color: var(--sage-dark); font-size: 13px; }
.essay-japanese { padding: 9px 10px; border-left: 3px solid var(--apricot); background: #f5ecea; color: #624f4d; }
.sentence-bank, .topic-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.sentence-bank span, .topic-cloud span { padding: 7px 9px; border-radius: 999px; color: var(--sage-dark); background: #e8ede5; font-size: 9px; }
.topic-cloud.warm span { color: #8a574e; background: #f2e3e0; }
.essay-files { margin-top: 18px; padding: 18px; border-radius: 20px; background: #eeeae2; }
.essay-files h2 { margin-bottom: 11px; font-size: 17px; }
.essay-files > div { display: grid; gap: 7px; }
.essay-files a { display: flex; justify-content: space-between; padding: 11px 12px; border-radius: 12px; color: var(--ink); background: var(--card); font-size: 10px; text-decoration: none; }
.essay-files a b { color: var(--sage-dark); font-size: 9px; }
.unified-note-heading { margin-top: 28px; }

.summary-intro { background: linear-gradient(145deg, #eadbcf, #f3e9df); }
.primary-button.full { width: 100%; margin: 14px 0; }
.summary-list { display: grid; gap: 12px; }
.summary-card {
  position: relative;
  padding: 21px;
  border-radius: 21px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.summary-card::before { content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 4px; border-radius: 9px; background: var(--apricot); }
.summary-card strong { font-size: 17px; }
.summary-card p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-line; }

.resource-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 16px;
  background: #e9e6de;
}
.resource-mode-switch button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.resource-mode-switch button.active { color: var(--ink); background: var(--card); box-shadow: 0 5px 14px rgba(40,48,42,.08); }
.resource-intro {
  padding: 25px;
  border-radius: 25px;
  background: linear-gradient(145deg, #dfeaec, #edf3f4);
}
.resource-intro h2 { margin-bottom: 8px; font-size: 25px; }
.resource-intro p:last-child { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.resource-section { margin-top: 25px; }
.resource-section.priority {
  padding: 17px;
  border: 1px solid rgba(233,185,143,.7);
  border-radius: 23px;
  background: rgba(245,229,215,.45);
}
.resource-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.resource-heading h2 { margin: 4px 0 0; font-size: 20px; }
.resource-heading small { color: var(--muted); font-size: 10px; }
.exam-badge { display: inline-block; padding: 5px 8px; border-radius: 999px; color: #8b5744; background: #f1c9a7; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.resource-list { display: grid; gap: 8px; }
.resource-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(222,219,210,.8);
  border-radius: 17px;
  color: var(--ink);
  background: var(--card);
  text-decoration: none;
}
.resource-logo { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; color: #fff; background: var(--sage-dark); font-size: 12px; font-weight: 900; }
.resource-card strong { display: block; margin-bottom: 4px; font-size: 14px; }
.resource-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.resource-card b { color: var(--sage-dark); }
.resource-list.compact .resource-card { padding: 13px; }
.resource-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.resource-grid a {
  display: flex;
  flex-direction: column;
  min-height: 84px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: var(--card);
  text-decoration: none;
}
.resource-grid strong { font-size: 14px; }
.resource-grid span { margin-top: auto; color: var(--muted); font-size: 10px; }

.application-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 23px;
  border-radius: 25px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(170,199,205,.72), transparent 40%),
    linear-gradient(145deg, #294650, #47777c);
}
.application-hero .section-kicker { color: rgba(255,255,255,.68); }
.application-hero h2 { margin-bottom: 7px; font-size: 24px; }
.application-hero p:last-child { margin: 0; color: rgba(255,255,255,.72); font-size: 11px; line-height: 1.55; }
.application-progress {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  border: 6px solid rgba(255,255,255,.18);
  border-top-color: var(--apricot);
  border-radius: 50%;
}
.application-progress strong { font-size: 17px; }
.application-progress span { margin-top: -10px; color: rgba(255,255,255,.65); font-size: 9px; }
.application-alert {
  margin: 13px 0;
  padding: 15px;
  border: 1px solid #e8c8ab;
  border-radius: 17px;
  background: #f6e8dc;
}
.application-alert strong { font-size: 13px; }
.application-alert p { margin: 6px 0 0; color: #806c60; font-size: 10px; line-height: 1.6; }
.application-filters { display: flex; gap: 7px; margin: 13px 0; overflow: auto; scrollbar-width: none; }
.application-filters button { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font-size: 10px; }
.application-filters button.active { border-color: var(--ink); color: #fff; background: var(--ink); }
.application-checklist { display: grid; gap: 8px; }
.application-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.application-check { width: 25px; height: 25px; margin-top: 2px; border: 1.5px solid #aeb4aa; border-radius: 50%; background: transparent; cursor: pointer; }
.application-item.done .application-check { border-color: var(--sage-dark); background: var(--sage-dark); }
.application-item.done .application-check::after { content: "✓"; color: #fff; font-size: 14px; }
.application-item.done summary strong { color: #8c918a; text-decoration: line-through; }
.application-item details { min-width: 0; }
.application-item summary { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 9px; list-style: none; cursor: pointer; }
.application-item summary::-webkit-details-marker { display: none; }
.document-number { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 8px; color: var(--sage-dark); background: #e8ede5; font-size: 10px; font-weight: 800; }
.application-item summary strong { display: block; font-size: 13px; line-height: 1.45; }
.application-item summary p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.document-group { padding: 4px 6px; border-radius: 7px; color: var(--sage-dark); background: #e7ece4; font-size: 8px; white-space: nowrap; }
.document-group.china { color: #8b5744; background: #f4dfce; }
.document-group.foreign { color: #625b88; background: #e9e5f4; }
.document-group.conditional { color: #846f46; background: #f2ead7; }
.document-detail { margin-top: 11px; padding: 11px; border-radius: 11px; color: #666d66; background: #f3f1eb; font-size: 10px; line-height: 1.65; }
.document-rules { margin-top: 20px; padding: 19px; border-radius: 19px; background: #e7ece4; }
.document-rules h2 { margin-bottom: 10px; font-size: 17px; }
.document-rules ul { margin: 0; padding-left: 18px; color: #5f675f; font-size: 10px; line-height: 1.8; }
.application-links { display: grid; gap: 8px; margin-top: 12px; }
.application-links a { display: flex; justify-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--card); font-size: 11px; text-decoration: none; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 720px);
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(222,219,210,.8);
  background: rgba(246,250,251,.93);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.bottom-nav button { display: grid; gap: 3px; place-items: center; border: 0; color: #989a94; background: none; cursor: pointer; }
.bottom-nav span { display: grid; place-items: center; width: 31px; height: 26px; border-radius: 12px; font-size: 17px; }
.bottom-nav small { font-size: 10px; }
.bottom-nav button.active { color: var(--sage-dark); font-weight: 800; }
.bottom-nav button.active span { background: #d9e8e9; }

dialog {
  width: min(calc(100% - 28px), 560px);
  max-height: calc(100svh - 28px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 30px 80px rgba(28, 36, 30, .25);
}
dialog::backdrop { background: rgba(30,35,31,.42); backdrop-filter: blur(3px); }
.dialog-card { display: grid; gap: 15px; padding: 24px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; }
.dialog-heading h2 { margin: 0; }
.close-button { width: 36px; height: 36px; border-radius: 50%; background: #eeece5; font-size: 21px; }
.dialog-card label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.review-card { min-height: 480px; }
.flashcard {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 235px;
  padding: 26px;
  border: 0;
  border-radius: 25px;
  background: linear-gradient(145deg, #e7ede3, #d6dfd2);
  cursor: pointer;
}
.flashcard strong { font-size: 34px; }
.flashcard span { color: var(--muted); font-size: 13px; }
.review-progress, .rate-label { color: var(--muted); text-align: center; font-size: 12px; }
.rating-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rating-row button { padding: 11px 3px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 11px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.settings-row b { color: var(--sage-dark); font-size: 20px; }
.file-row { position: relative; }
.file-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.settings-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.install-card { position: relative; text-align: center; }
.close-button.floating { position: absolute; right: 17px; top: 17px; }
.app-icon { display: grid; place-items: center; width: 88px; height: 88px; margin: 8px auto; border-radius: 23px; color: #fff; background: var(--sage-dark); font-size: 28px; font-weight: 800; letter-spacing: .1em; line-height: .9; box-shadow: 0 14px 30px rgba(60,80,63,.25); }
.install-card ol { padding-left: 26px; text-align: left; line-height: 2; }
.install-card > p { color: var(--muted); font-size: 12px; line-height: 1.6; }

#toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  padding: 11px 17px;
  border-radius: 999px;
  color: #fff;
  background: rgba(31,39,35,.92);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 390px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .composer-row { grid-template-columns: 1fr 1fr; }
  .composer-row button { grid-column: 1 / -1; }
  .note-grid { grid-template-columns: 1fr; }
  .exam-card { padding: 23px; }
  .language-grid { grid-template-columns: 1fr; }
  .language-card { min-height: 250px; }
}

@media (min-width: 721px) {
  .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
