:root {
  --forest-950: #102d27;
  --forest-900: #173f35;
  --forest-800: #205548;
  --forest-600: #3f7967;
  --mint-100: #dff0e8;
  --mint-50: #edf7f2;
  --cream: #f7f8f4;
  --paper: #fffefb;
  --ink: #1e2d29;
  --muted: #718079;
  --line: #dce4df;
  --orange: #d76d3d;
  --orange-pale: #fbebe3;
  --blue: #4b7391;
  --blue-pale: #e6eff6;
  --gold: #a67631;
  --gold-pale: #f6eedc;
  --shadow: 0 20px 55px rgba(22, 54, 45, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input { font: inherit; }
button { color: inherit; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(215, 109, 61, .35); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 34px 24px 24px; color: #fff; background: var(--forest-900); overflow: hidden; }
.sidebar::before { content: ""; position: absolute; width: 290px; height: 290px; right: -170px; top: -100px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 42px rgba(255,255,255,.025), 0 0 0 92px rgba(255,255,255,.02); pointer-events: none; }
.brand { position: relative; display: flex; align-items: center; gap: 12px; margin: 0 8px 52px; text-decoration: none; color: #fff; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; color: var(--forest-900); border-radius: 13px; background: #e8f2ec; }
.brand-mark svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-family: Georgia, "Noto Serif SC", serif; font-size: 22px; letter-spacing: .08em; }
.brand small { display: block; margin-top: 2px; color: rgba(255,255,255,.57); font-size: 10px; letter-spacing: .2em; }
.main-nav { display: grid; gap: 8px; position: relative; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 13px; padding: 13px 15px; color: rgba(255,255,255,.64); background: transparent; cursor: pointer; text-align: left; transition: .2s ease; }
.nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 3px 0 var(--orange); }
.semester-card { position: relative; margin-top: auto; padding: 17px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.055); }
.semester-card p { margin: 0 0 7px; color: rgba(255,255,255,.52); font-size: 11px; letter-spacing: .12em; }
.semester-card strong { display: block; font-size: 14px; font-weight: 650; }
.semester-card span { display: block; margin-top: 5px; color: rgba(255,255,255,.58); font-size: 11px; }
.semester-card .exemption-summary { align-items: center; gap: 5px; margin-top: 9px; color: #a8dfc4; font-size: 10px; }
.semester-card .exemption-summary:not([hidden]) { display: flex; }
.exemption-summary svg { width: 12px; height: 12px; }
.semester-card button { margin: 13px 0 0; padding: 0; border: 0; color: #f1b091; background: transparent; font-size: 11px; cursor: pointer; }

.main-content { min-width: 0; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(28px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(16px); }
.breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.breadcrumb span, .breadcrumb b { color: #98a39e; font-weight: 400; }
.breadcrumb strong { font-weight: 650; }
.clock-pill { display: flex; align-items: center; gap: 10px; min-width: 148px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.75); }
.clock-icon { width: 23px; height: 23px; color: var(--forest-600); }
.clock-pill strong { display: block; line-height: 1; font-size: 16px; letter-spacing: .04em; }
.clock-pill span:last-child { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.mobile-brand { display: none; }
.content-wrap { width: min(100%, 1500px); margin: 0 auto; padding: 44px clamp(28px, 4vw, 64px) 54px; }

.greeting-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-family: Georgia, "Noto Serif SC", "Songti SC", serif; font-size: clamp(27px, 3vw, 40px); font-weight: 600; letter-spacing: -.02em; }
.greeting-copy { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.today-button { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-size: 12px; cursor: pointer; transition: .2s ease; }
.today-button svg { width: 17px; height: 17px; fill: none; stroke: var(--forest-600); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.today-button:hover { border-color: #a9bdb4; transform: translateY(-1px); }

.reminder-card { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 18px; margin: 30px 0; padding: 22px 24px; overflow: hidden; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(110deg, var(--forest-900), #285b4d); box-shadow: var(--shadow); }
.reminder-card::after { content: ""; position: absolute; right: -45px; width: 185px; height: 185px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 30px rgba(255,255,255,.025); }
.reminder-card.is-urgent { background: linear-gradient(110deg, #923f27, #c36038); }
.reminder-card.is-live { background: linear-gradient(110deg, #214861, #39708a); }
.reminder-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; background: rgba(255,255,255,.13); font-size: 22px; }
.reminder-icon svg { width: 24px; height: 24px; }
.reminder-main { position: relative; z-index: 1; }
.reminder-kicker { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.65); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.reminder-kicker i { padding: 3px 7px; border-radius: 999px; color: #fff; background: rgba(255,255,255,.13); font-size: 8px; font-style: normal; letter-spacing: .06em; }
.reminder-card h2 { margin: 7px 0 4px; font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif; font-size: clamp(19px, 2vw, 26px); line-height: 1.35; font-weight: 650; letter-spacing: -.02em; }
.reminder-card p { margin: 0; color: rgba(255,255,255,.7); font-size: 11px; }
.next-meta { position: relative; z-index: 1; min-width: 88px; padding-left: 24px; border-left: 1px solid rgba(255,255,255,.16); text-align: right; }
.next-meta span { display: block; color: rgba(255,255,255,.55); font-size: 9px; }
.next-meta strong { display: block; margin-top: 3px; font-size: 22px; }
.progress-track { width: min(420px, 100%); height: 4px; margin-top: 12px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #fff; transition: width .6s ease; }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.section-title-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.section-title-stack .section-kicker { margin: 0; }
.section-head h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 23px; font-weight: 600; }
.week-switcher { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.week-switcher button { align-self: stretch; display: grid; place-items: center; width: 38px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.week-switcher button svg { width: 16px; height: 16px; }
.week-switcher button:disabled { opacity: .25; cursor: not-allowed; }
.week-switcher div { min-width: 106px; padding: 8px 0; text-align: center; }
.week-switcher strong { display: block; font-size: 12px; }
.week-switcher span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(126px, 1fr)); gap: 10px; }
.day-column { min-width: 0; min-height: 360px; padding: 14px 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.55); }
.day-column.is-today { border-color: #9dbaa9; background: var(--paper); box-shadow: 0 10px 30px rgba(22,54,45,.06); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; padding: 0 4px 12px; border-bottom: 1px solid var(--line); }
.day-name { color: var(--muted); font-size: 10px; font-weight: 700; }
.day-date { font-family: Georgia, serif; font-size: 19px; }
.day-column.is-today .day-name { color: var(--orange); }
.day-column.is-today .day-date::after { content: " TODAY"; font-family: Inter, sans-serif; color: var(--orange); font-size: 7px; letter-spacing: .08em; }
.course-stack { display: grid; gap: 8px; padding-top: 10px; }
.course-card { position: relative; min-width: 0; padding: 11px 10px 10px 13px; overflow: hidden; border: 1px solid transparent; border-radius: 12px; background: var(--mint-50); }
.course-card::before { content: ""; position: absolute; inset: 10px auto 10px 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--forest-600); }
.course-card[data-tone="core"] { background: var(--orange-pale); }
.course-card[data-tone="core"]::before { background: var(--orange); }
.course-card[data-tone="major"] { background: var(--blue-pale); }
.course-card[data-tone="major"]::before { background: var(--blue); }
.course-card[data-tone="literacy"] { background: var(--gold-pale); }
.course-card[data-tone="literacy"]::before { background: var(--gold); }
.course-time { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 700; }
.week-tag { padding: 2px 4px; border-radius: 4px; background: rgba(255,255,255,.55); white-space: nowrap; }
.course-card h3 { margin: 6px 0 8px; font-family: Georgia, "Noto Serif SC", serif; font-size: 12px; line-height: 1.5; font-weight: 600; }
.course-room, .course-teacher { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 8px; }
.course-room svg { width: 10px; height: 10px; flex: 0 0 auto; }
.course-teacher { margin-top: 5px; color: #50685f; font-weight: 650; }
.teacher-label { letter-spacing: .08em; }
.empty-day { display: grid; place-items: center; min-height: 190px; padding: 20px 6px; text-align: center; color: #a4aea9; }
.empty-day svg { width: 30px; height: 30px; margin: 0 auto; opacity: .48; stroke-width: 1.4; }
.empty-day p { margin: 7px 0 0; font-size: 10px; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 15px; padding-left: 4px; color: var(--muted); font-size: 9px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--forest-600); }
.legend-dot.core { background: var(--orange); }
.legend-dot.major { background: var(--blue); }
.legend-dot.literacy { background: var(--gold); }
.legend .legend-note { margin-left: auto; color: #a0aaa5; }
.mobile-day-tabs { display: none; }

.all-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.all-day { padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
.all-day-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 13px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.all-day-head h3 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 17px; }
.all-day-head span { color: var(--muted); font-size: 9px; }
.all-course { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 12px 0; }
.all-course + .all-course { border-top: 1px dashed var(--line); }
.all-course-time { color: var(--forest-600); font-size: 9px; font-weight: 750; line-height: 1.5; }
.all-course h4 { margin: 0; font-size: 12px; line-height: 1.5; }
.all-course p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.course-count { margin: 0; color: var(--muted); font-size: 11px; }

.map-section-head { align-items: center; }
.map-controls { display: flex; align-items: center; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.map-controls button { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 9px; color: var(--forest-600); background: transparent; cursor: pointer; }
.map-controls button:hover { background: var(--mint-50); }
.map-controls button:disabled { color: #aeb8b3; cursor: not-allowed; }
.map-controls svg { width: 16px; height: 16px; }
.map-controls span { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.map-viewer { height: min(68vh, 820px); min-height: 480px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #e8efcf; box-shadow: var(--shadow); cursor: grab; overscroll-behavior: contain; scrollbar-color: rgba(23,63,53,.35) transparent; }
.map-viewer.is-dragging { cursor: grabbing; user-select: none; }
.map-viewer:focus-visible { outline: 3px solid rgba(215,109,61,.35); outline-offset: 3px; }
.map-viewer img { display: block; width: 100%; max-width: none; height: auto; margin: 0 auto; user-select: none; -webkit-user-drag: none; transition: width .2s ease; }
.map-viewer.is-dragging img { transition: none; }
.map-help { display: flex; align-items: center; justify-content: center; margin: 11px 0 0; color: var(--muted); font-size: 9px; }

.mobile-nav { display: none; }
dialog { width: min(92vw, 460px); padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 90px rgba(7,30,24,.3); }
dialog::backdrop { background: rgba(10,34,28,.52); backdrop-filter: blur(4px); }
dialog form { padding: 26px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 24px; }
.close-dialog { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: var(--cream); cursor: pointer; }
.close-dialog svg { width: 17px; height: 17px; }
.dialog-copy { margin: 18px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.75; }
dialog label { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 700; }
dialog input { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 9px; }
.field-hint.is-error { color: #bd4b34; }
.setting-check { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 11px; margin-top: 22px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--cream); cursor: pointer; }
.setting-check input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.check-mark { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #b9c7c0; border-radius: 7px; color: transparent; background: #fff; font-size: 13px; transition: .2s ease; }
.check-mark svg { width: 14px; height: 14px; stroke-width: 2.5; }
.setting-check input:checked + .check-mark { border-color: var(--forest-900); color: #fff; background: var(--forest-900); }
.setting-check input:focus-visible + .check-mark { outline: 3px solid rgba(215, 109, 61, .35); outline-offset: 2px; }
.check-copy { min-width: 0; }
.check-copy strong { display: block; font-size: 11px; }
.check-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 400; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.dialog-actions button { padding: 10px 18px; border-radius: 11px; cursor: pointer; }
.button-secondary { border: 1px solid var(--line); background: #fff; }
.button-primary { border: 1px solid var(--forest-900); color: #fff; background: var(--forest-900); }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { padding-inline: 18px; }
  .week-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .day-column { min-height: 300px; }
  .all-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { position: sticky; top: 0; z-index: 20; height: 70px; padding: 0 20px; }
  .breadcrumb { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 9px; }
  .mobile-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--mint-50); }
  .mobile-brand .brand-mark svg { width: 24px; height: 24px; }
  .mobile-brand strong { font-family: Georgia, "Noto Serif SC", serif; font-size: 17px; }
  .clock-pill { min-width: 116px; padding: 8px 10px; }
  .clock-icon { width: 20px; height: 20px; }
  .clock-pill strong { font-size: 14px; }
  .content-wrap { padding: 30px 20px calc(100px + env(safe-area-inset-bottom)); }
  .greeting-row { align-items: flex-start; }
  .reminder-card { margin-block: 24px; }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .all-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-nav { position: fixed; z-index: 30; inset: auto 14px calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px; border: 1px solid rgba(255,255,255,.65); border-radius: 18px; background: rgba(20,55,46,.95); box-shadow: 0 15px 40px rgba(9,31,25,.28); backdrop-filter: blur(16px); }
  .mobile-nav button { display: grid; place-items: center; gap: 2px; padding: 6px 10px; border: 0; border-radius: 12px; color: rgba(255,255,255,.55); background: transparent; font-size: 9px; cursor: pointer; }
  .mobile-nav button svg { width: 18px; height: 18px; }
  .mobile-nav button.is-active { color: #fff; background: rgba(255,255,255,.12); }
}

@media (max-width: 620px) {
  .topbar { padding-inline: 16px; }
  .clock-pill { border: 0; padding-right: 0; background: transparent; min-width: auto; }
  .clock-icon, .clock-pill span:last-child { display: none; }
  .content-wrap { padding: 25px 16px calc(100px + env(safe-area-inset-bottom)); }
  .greeting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; column-gap: 5px; row-gap: 0; }
  .greeting-row > div { display: contents; }
  .eyebrow { flex: 0 0 100%; margin-bottom: 6px; }
  .section-title-stack { gap: 0px; }
  h1 { max-width: 290px; font-size: 28px; line-height: 1.22; }
  .greeting-row h1 { flex: 0 0 100%; max-width: none; }
  .greeting-copy { flex: 0 0 auto; max-width: none; margin-top: 4px; line-height: 1.35; white-space: nowrap; }
  .today-button { flex: 0 0 auto; gap: 4px; margin: 4px 0 0; padding: 0; border: 0; border-radius: 0; color: var(--forest-600); background: transparent; font-size: 10px; font-weight: 650; line-height: 1.35; }
  .today-button:hover { border-color: transparent; transform: none; }
  .today-button svg { width: 14px; height: 14px; }
  .reminder-card { grid-template-columns: auto minmax(0, 1fr); gap: 14px; margin-block: 14px; padding: 19px 17px; border-radius: 20px; }
  .reminder-icon { width: 43px; height: 43px; border-radius: 13px; }
  .next-meta { grid-column: 2; min-width: 0; padding: 0; border: 0; text-align: left; }
  .next-meta span, .next-meta strong { display: inline; font-size: 10px; }
  .next-meta strong { margin-left: 5px; }
  .reminder-card h2 { font-size: 19px; line-height: 1.35; }
  .section-head { align-items: center; }
  .week-switcher div { min-width: 92px; }
  .mobile-day-tabs { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 5px; margin: 0 0 12px; }
  .mobile-day-tabs button { display: grid; place-items: center; gap: 2px; min-width: 0; padding: 8px 2px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--paper); font-size: 8px; cursor: pointer; }
  .mobile-day-tabs strong { font-size: 12px; }
  .mobile-day-tabs button.is-active { border-color: var(--forest-900); color: #fff; background: var(--forest-900); }
  .week-grid { display: block; }
  .day-column { display: none; min-height: 275px; padding: 17px 14px; }
  .day-column.mobile-selected { display: block; }
  .day-head { padding-inline: 2px; }
  .day-name { font-size: 11px; }
  .course-card { padding: 13px 13px 12px 16px; }
  .course-card h3 { font-size: 14px; }
  .course-time, .course-room, .course-teacher { font-size: 9px; }
  .legend { gap: 10px; }
  .legend .legend-note { width: 100%; margin: 0; }
  .all-grid { grid-template-columns: 1fr; }
  .all-day { padding: 17px; }
  .all-course h4 { font-size: 13px; }
  .map-section-head { align-items: center; }
  .map-controls { flex: 0 0 auto; }
  .map-controls button { min-width: 31px; height: 30px; padding-inline: 6px; }
  .map-viewer { height: calc(100dvh - 260px); min-height: 430px; max-height: 680px; border-radius: 17px; }
  .map-help { margin-top: 9px; }
  dialog form { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
