:root {
  --teal: #0F4C5C;
  --teal-dark: #0A2A33;
  --teal-2: #2A9D8F;
  --orange: #E36414;
  --cream: #F7F3EA;
  --paper: #FBF9F3;
  --white: #FFFFFF;
  --ink: #17211F;
  --muted: #6B7774;
  --line: #DDE5E1;
  --soft: #F1F5F2;
  --red: #B23A48;
  --amber: #C98A16;
  --shadow: 0 16px 40px rgba(10, 42, 51, .10);
  --radius: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #E7ECE8;
  font-size: 14px;
  line-height: 1.55;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }

#app {
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  position: relative;
  box-shadow: 0 0 0 1px rgba(10, 42, 51, .05), 0 30px 80px rgba(10, 42, 51, .12);
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(247, 243, 234, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(221, 229, 225, .7);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--teal);
  color: #F5EFE2;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; letter-spacing: -.2px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
  flex: none;
}
.brand-text { min-width: 0; }
.brand-title { font-weight: 800; font-size: 15px; color: var(--teal-dark); letter-spacing: .03em; }
.brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); color: var(--teal); display: grid; place-items: center;
  flex: none;
}
.icon-btn:active { transform: scale(.96); }

.view { padding: 14px 16px calc(102px + env(safe-area-inset-bottom, 0px)); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.hero {
  position: relative;
  background: linear-gradient(135deg, #0F4C5C 0%, #0A2A33 78%);
  color: #F6F1E4;
  border-radius: 24px;
  padding: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(10, 42, 51, .18);
}
.hero::after {
  content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%;
  right: -100px; top: -120px; border: 1px solid rgba(42, 157, 143, .45);
  box-shadow: 0 0 0 24px rgba(42,157,143,.06), 0 0 0 48px rgba(42,157,143,.04);
  pointer-events: none;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; position: relative; z-index: 1; }
.hero-top > div:first-child { min-width: 0; }
.hero-date { font-size: 12px; color: #B9D8D1; letter-spacing: .08em; text-transform: uppercase; }
.hero-title { font-size: 25px; font-weight: 800; line-height: 1.18; margin: 6px 0 4px; letter-spacing: -.02em; }
.hero-sub { font-size: 12px; color: #CFE2DC; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14);
  color: #E9F2EE; padding: 5px 9px; border-radius: 999px; font-size: 11px;
}
.progress-ring {
  width: 74px; height: 74px; border-radius: 50%;
  background: conic-gradient(#F2C46D var(--p, 0%), rgba(255,255,255,.14) 0);
  display: grid; place-items: center; flex: none;
  position: relative;
}
.progress-ring::before {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #0E3A45;
}
.ring-inner { position: relative; z-index: 1; text-align: center; line-height: 1.1; }
.ring-num { font-size: 18px; font-weight: 800; color: #F6F1E4; }
.ring-label { font-size: 9px; color: #B9D8D1; margin-top: 2px; }

.section { margin-top: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 9px; }
.section-title { font-size: 15px; font-weight: 800; color: var(--teal-dark); letter-spacing: .01em; }
.section-link { font-size: 11px; color: var(--orange); background: none; border: 0; padding: 0; }

.card {
  background: var(--white);
  border: 1px solid rgba(221, 229, 225, .85);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: 0 8px 24px rgba(10, 42, 51, .045);
}
.card + .card { margin-top: 10px; }
.card.flat { box-shadow: none; background: var(--paper); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-title { font-weight: 800; font-size: 14px; color: var(--teal-dark); }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-body { font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--soft); color: var(--teal);
  white-space: nowrap;
}
.tag.orange { background: #FCEBDA; color: #A64A0B; }
.tag.green { background: #E1F2EC; color: #1B6F5F; }
.tag.red { background: #F8E2E4; color: #8E2C38; }
.tag.gray { background: #EFF1EF; color: #61706C; }

.now-card {
  background: linear-gradient(135deg, #FFF6E7, #FCE9D5);
  border: 1px solid #F3D3AE;
  border-radius: 20px;
  padding: 14px 15px;
  display: flex; align-items: center; gap: 13px;
}
.now-time {
  width: 52px; height: 52px; border-radius: 16px; background: var(--teal);
  color: #F6F1E4; display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: 13px; line-height: 1.05; text-align: center;
}
.now-label { font-size: 10px; font-weight: 800; color: var(--orange); letter-spacing: .12em; }
.now-title { font-size: 15px; font-weight: 800; color: var(--teal-dark); margin: 2px 0 2px; }
.now-meta { font-size: 11px; color: #6D5C49; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.quick {
  border: 1px solid var(--line); background: var(--white); border-radius: 14px;
  padding: 10px 8px; text-align: center; color: var(--teal-dark);
  min-width: 0; overflow: hidden;
}
.quick b { display: block; font-size: 12px; }
.quick span { font-size: 10px; color: var(--muted); }
.quick:active { transform: scale(.98); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 15px;
  padding: 11px 12px;
}
.stat-num { font-size: 20px; font-weight: 800; color: var(--teal-dark); line-height: 1.15; }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 2px; }
.stat.orange .stat-num { color: var(--orange); }

.timeline { position: relative; margin-left: 2px; }
.timeline::before {
  content: ""; position: absolute; left: 47px; top: 8px; bottom: 10px;
  width: 1px; background: var(--line);
}
.tl-item { display: flex; gap: 10px; position: relative; padding: 5px 0; }
.tl-time { width: 42px; flex: none; font-size: 10px; color: var(--muted); text-align: right; padding-top: 3px; font-variant-numeric: tabular-nums; }
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%; background: var(--white);
  border: 2px solid var(--line); margin-top: 5px; flex: none; z-index: 1;
}
.tl-item.study .tl-dot { border-color: var(--teal-2); }
.tl-item.class .tl-dot { border-color: var(--orange); }
.tl-item.meal .tl-dot { border-color: #C9A227; }
.tl-item.exercise .tl-dot { border-color: #6A8F3A; }
.tl-item.sleep .tl-dot { border-color: #7C6AA8; }
.tl-body { flex: 1; min-width: 0; padding: 2px 0 6px; border-bottom: 1px dashed rgba(221,229,225,.65); }
.tl-item:last-child .tl-body { border-bottom: 0; }
.tl-title { font-size: 12px; font-weight: 700; color: var(--ink); }
.tl-detail { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.tl-check {
  width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--white); display: grid; place-items: center; flex: none;
  font-size: 12px; color: transparent; margin-top: 2px;
}
.tl-check.on { background: var(--teal-2); border-color: var(--teal-2); color: #fff; }
.tl-item.done .tl-title { color: var(--muted); text-decoration: line-through; }

.meal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meal-card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 11px; min-width: 0; }
.meal-card.wide { grid-column: span 2; }
.meal-label { font-size: 10px; font-weight: 800; color: var(--orange); letter-spacing: .08em; }
.meal-text { font-size: 11.5px; margin: 3px 0; line-height: 1.45; overflow-wrap: anywhere; }
.meal-meta { font-size: 10px; color: var(--muted); }
.meal-supp { margin-top: 5px; font-size: 9.5px; color: #1B6F5F; background: #E1F2EC; display: inline-block; padding: 2px 6px; border-radius: 6px; }

.supp-list { display: flex; flex-direction: column; gap: 6px; }
.supp-item { display: flex; gap: 9px; align-items: baseline; font-size: 11.5px; }
.supp-time { font-size: 10px; color: var(--orange); font-weight: 800; width: 38px; flex: none; }

.task-list { display: flex; flex-direction: column; gap: 7px; }
.task-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 11px;
}
.task-check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line);
  flex: none; display: grid; place-items: center; margin-top: 1px; background: #fff;
  color: transparent; font-size: 11px;
}
.task-check.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.task-title { font-size: 12px; font-weight: 700; }
.task-detail { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.btn {
  border: 1px solid var(--line); background: var(--white); color: var(--teal-dark);
  border-radius: 12px; padding: 9px 13px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #F7F3EA; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 9px; }
.btn-danger { color: var(--red); border-color: #EBC9CD; background: #FFF7F7; }

.week-pills { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.week-pills::-webkit-scrollbar { display: none; }
.week-pill {
  flex: none; border: 1px solid var(--line); background: var(--white); color: var(--muted);
  border-radius: 999px; padding: 6px 11px; font-size: 11px; font-weight: 700;
}
.week-pill.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.week-pill.today { box-shadow: 0 0 0 2px rgba(227,100,20,.18); }

.kv { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(221,229,225,.8); }
.kv:last-child { border-bottom: 0; }
.kv-k { width: 66px; flex: none; font-size: 10.5px; color: var(--muted); }
.kv-v { flex: 1; font-size: 11.5px; }
.kv-v b { color: var(--teal-dark); }

.word-card {
  background: linear-gradient(160deg, #FFFFFF, #F4F8F5);
  border: 1px solid var(--line); border-radius: 24px; padding: 22px 18px 16px;
  text-align: center; box-shadow: var(--shadow);
}
.word-main { font-size: 40px; font-weight: 800; color: var(--teal-dark); letter-spacing: -.03em; line-height: 1.1; word-break: break-word; }
.phonetic { color: var(--teal-2); font-size: 14px; margin-top: 4px; font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }
.meaning { margin-top: 14px; font-size: 15px; color: var(--ink); min-height: 24px; }
.meaning.hidden-meaning { color: transparent; background: #E9EFEB; border-radius: 8px; user-select: none; }
.word-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 16px; }
.word-actions .btn { padding: 10px 6px; }
.word-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 10px; }
.bar { height: 7px; border-radius: 999px; background: #E7EEE9; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal-2), #6DC3B5); transition: width .25s ease; }
.search {
  width: 100%; border: 1px solid var(--line); background: var(--white); border-radius: 13px;
  padding: 10px 12px; outline: none; color: var(--ink); font-size: 13px;
}
.search:focus { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(42,157,143,.12); }

.work-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 13px; }
.work-title { font-weight: 800; font-size: 13px; color: var(--teal-dark); }
.work-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.upload-zone {
  border: 1.5px dashed #B9CCC5; border-radius: 16px; padding: 18px 14px;
  text-align: center; background: #F4F8F5; margin-top: 10px;
}
.upload-zone b { display: block; color: var(--teal); font-size: 13px; }
.upload-zone span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 3px; }
.work-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.work-item:last-child { border-bottom: 0; }
.work-ico { width: 34px; height: 34px; border-radius: 10px; background: #E1F2EC; color: #1B6F5F; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.work-name { font-size: 11.5px; font-weight: 700; }
.work-sub { font-size: 10px; color: var(--muted); }

.settings { display: flex; flex-direction: column; gap: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-main { flex: 1; min-width: 0; }
.setting-title { font-size: 12px; font-weight: 700; }
.setting-sub { font-size: 10px; color: var(--muted); margin-top: 1px; }
.switch { width: 44px; height: 26px; border-radius: 999px; background: #D8E2DD; border: 0; position: relative; flex: none; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.switch.on { background: var(--teal-2); }
.switch.on::after { left: 21px; }

.notice {
  background: #FFF6E7; border: 1px solid #F3D3AE; color: #6D4A20;
  border-radius: 14px; padding: 11px 12px; font-size: 11px; line-height: 1.55;
}
.notice b { color: #A64A0B; }
.empty { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 12px; }

.tabbar {
  position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
  background: rgba(251, 249, 243, .94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(221,229,225,.9);
}
.tab {
  border: 0; background: transparent; color: #8A9691;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; font-size: 9.5px; font-weight: 700;
}
.tab-ico {
  width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: transparent; color: #8A9691;
}
.tab.active { color: var(--teal-dark); }
.tab.active .tab-ico { background: var(--teal); color: #F7F3EA; }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-mask { position: absolute; inset: 0; background: rgba(10, 42, 51, .45); backdrop-filter: blur(2px); }
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  background: var(--paper); border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -20px 60px rgba(10,42,51,.22);
}
.sheet-handle { width: 38px; height: 4px; border-radius: 999px; background: #CBD7D1; margin: 4px auto 12px; }
.sheet-title { font-size: 18px; font-weight: 800; color: var(--teal-dark); margin-bottom: 3px; }
.sheet-sub { font-size: 11px; color: var(--muted); margin-bottom: 12px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-row label { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 11px;
  padding: 9px 10px; outline: none; color: var(--ink); font-size: 12px;
}
.textarea { min-height: 62px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(42,157,143,.12); }
.seg { display: flex; background: #E9EFEB; border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 7px 4px; font-size: 11px; color: var(--muted); font-weight: 700; }
.seg button.on { background: #fff; color: var(--teal-dark); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-actions .btn { flex: 1; padding: 11px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: rgba(10,42,51,.94); color: #F7F3EA; padding: 9px 14px;
  border-radius: 999px; font-size: 12px; z-index: 80; white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}

@media (min-width: 700px) {
  body { padding: 18px 0; }
  #app { border-radius: 28px; min-height: calc(100dvh - 36px); overflow: hidden; }
  .tabbar { bottom: 18px; border-radius: 0 0 28px 28px; }
  .sheet-panel { bottom: 18px; border-radius: 24px; }
}
