/* ============================================================
   个人学习记录 · 学习时间管理 — 设计系统（鸿蒙 HarmonyOS 6 规范）
   多端自适应：手机（底部导航）→ 平板/PC（左侧导航）
   深浅色：跟随系统 + 手动切换
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 鸿蒙蓝（HarmonyOS 主色） */
  --primary: #0A59F7;
  --primary-dark: #0941C4;
  --primary-soft: #E8F0FF;
  --primary-grad: linear-gradient(135deg, #4D94FF 0%, #0A59F7 100%);

  /* 中性色 */
  --bg: #F1F3F5;
  --bg-soft: #F7F8FA;
  --card: #FFFFFF;
  --track: #E5E8EF;
  --text: #1A1C1E;
  --text-2: #5E6470;
  --text-3: #9AA1AD;
  --line: rgba(15, 23, 42, 0.08);

  /* 语义色（鸿蒙） */
  --danger: #F5222D;
  --danger-soft: #FDECEC;
  --success: #07C160;
  --warn: #FA8C16;

  /* 圆角体系（4 / 8 / 16 / 20 / 32） */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  /* 投影（中性灰、克制 10~15% 透明度） */
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 12px 28px rgba(10, 89, 247, 0.20);

  --nav-h: 64px;
  --side-w: 240px;
}

/* 深色模式 */
[data-theme="dark"] {
  --primary: #4D94FF;
  --primary-dark: #0A59F7;
  --primary-soft: rgba(77, 148, 255, 0.16);
  --primary-grad: linear-gradient(135deg, #4D94FF 0%, #0A59F7 100%);

  --bg: #0D0F14;
  --bg-soft: #14161C;
  --card: #1C1F26;
  --track: #2A2E37;
  --text: #F1F3F5;
  --text-2: #A8B0BD;
  --text-3: #6A7180;
  --line: rgba(255, 255, 255, 0.08);

  --danger: #FF5C5C;
  --danger-soft: rgba(255, 92, 92, 0.14);
  --success: #35D488;
  --warn: #FFA940;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow-glow: 0 12px 28px rgba(10, 89, 247, 0.34);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: "HarmonyOS Sans SC", "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; cursor: pointer; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; color: var(--text); }

/* ============================================================
   App 壳：多端自适应
   移动端：底部导航；平板/PC：左侧导航 + 宽内容
   ============================================================ */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + 24px); }

/* 桌面/平板：内容居中的「一多」容器 */
@media (min-width: 600px) {
  body { background: var(--bg); }
  .main { padding-bottom: 40px; }
}

/* ---------- 左侧导航（平板/PC） ---------- */
.side-nav { display: none; }
@media (min-width: 600px) {
  .side-nav {
    display: flex; flex-direction: column;
    width: var(--side-w); flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
    background: var(--card); border-right: 1px solid var(--line);
    padding: 24px 16px 16px;
  }
  .side-logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
  .side-logo img { width: 40px; height: 40px; border-radius: var(--radius-sm); }
  .side-logo span { font-weight: 800; font-size: 1.05rem; letter-spacing: .5px; }
  .side-links { display: flex; flex-direction: column; gap: 6px; flex: 1; }
  .side-links a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    font-size: .95rem; font-weight: 500; color: var(--text-2);
    transition: background .15s ease, color .15s ease;
  }
  .side-links a:hover { background: var(--bg-soft); }
  .side-links a .ni { font-size: 1.25rem; width: 26px; text-align: center; }
  .side-links a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
  .side-foot { padding: 12px 8px 0; border-top: 1px solid var(--line); }
  .side-foot .beian { padding: 8px 0 0; text-align: left; }
}

/* ---------- 内容宽度（平板/PC 分栏） ---------- */
@media (min-width: 600px) {
  .main > .topbar,
  .main > .hero,
  .main > .card,
  .main > .subject-grid,
  .main > .seg,
  .main > .child-tabs,
  .main > [style*="margin"] { max-width: 960px; margin-left: auto; margin-right: auto; }
}

/* ---------- 顶部栏 ---------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 8px; }
.topbar h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: .3px; }
.topbar .sub { font-size: .82rem; color: var(--text-3); margin-top: 2px; }
.topbar .right { display: flex; gap: 8px; align-items: center; }
.tb-left { min-width: 0; }
.tb-quote { flex: 0 1 44%; max-width: 200px; text-align: right; font-size: .72rem; line-height: 1.4;
  color: var(--text-3); font-style: italic; padding-top: 8px; }
@media (max-width: 380px) {
  .tb-quote { flex-basis: 38%; font-size: .68rem; }
}

/* 主题切换按钮 */
.theme-toggle { width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-size: 1.15rem; color: var(--text-2);
  background: var(--bg-soft); border: 1px solid var(--line); }
.theme-toggle:active { transform: scale(.92); }

/* ---------- 密码框 ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center; font-size: 1.05rem;
  color: var(--text-3); border-radius: var(--radius-sm); }
.pw-toggle:active { background: var(--bg); }
.pw-match { font-size: .76rem; margin-top: 6px; min-height: 1.1em; }
.pw-match.ok { color: var(--success); }
.pw-match.err { color: var(--danger); }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; margin: 12px 16px; }
.card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.card h3 .more { font-size: .8rem; color: var(--primary); font-weight: 500; }

/* ---------- 首页概览 hero ---------- */
.hero { margin: 8px 16px; padding: 24px 20px; border-radius: var(--radius); color: #fff;
  background: var(--primary-grad); box-shadow: var(--shadow-glow); }
.hero .row { display: flex; justify-content: space-between; align-items: flex-end; }
.hero .big { font-size: 2.1rem; font-weight: 800; letter-spacing: .5px; }
.hero .label { font-size: .78rem; opacity: .88; }
.hero .streak { text-align: right; font-size: .85rem; }
.hero .streak b { font-size: 1.3rem; }

/* ---------- 科目宫格（重复布局：宽屏多列） ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 16px; }
@media (min-width: 400px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 600px) { .subject-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 900px) { .subject-grid { grid-template-columns: repeat(5, 1fr); } }
.subject-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px 12px; text-align: center; transition: transform .12s ease; cursor: pointer;
  border: 1px solid var(--line); position: relative; overflow: hidden; }
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.subject-card:active { transform: scale(.96); }
.subject-card .icon { font-size: 1.7rem; }
.subject-card .name { font-weight: 600; margin-top: 4px; font-size: .95rem; }
.subject-card .today { font-size: .75rem; color: var(--text-3); margin-top: 2px; }
.subject-card .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }

/* ---------- 计时面板（进行中 · 专注全屏） ---------- */
.timer-sheet { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 80;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: max(22px, env(safe-area-inset-top) + 78px) 22px calc(28px + env(safe-area-inset-bottom));
  text-align: center; color: #fff;
  background: linear-gradient(165deg, #4D94FF 0%, #0A59F7 55%, #0941C4 100%); }
.timer-sheet::before { content: ''; position: absolute; top: -22%; left: 50%; transform: translateX(-50%);
  width: 125%; height: 62%; background: radial-gradient(ellipse at center, rgba(255,255,255,.30), rgba(255,255,255,0) 70%);
  pointer-events: none; }
.fs-card { position: relative; width: fit-content; min-width: min(300px, 100%); max-width: min(520px, calc(100% - 44px)); margin: 0 auto; padding: 32px 28px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--radius-xl); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 44px rgba(8, 20, 80, .30); }
.fs-icon { font-size: 3.2rem; line-height: 1; margin-bottom: 6px; }
.fs-name { font-size: 1.05rem; font-weight: 600; opacity: .92; margin-bottom: 14px; }
.fs-time { font-size: clamp(2.6rem, 11vw, 5.2rem); font-weight: 800; line-height: 1.05;
  font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; }
.fs-paused { display: inline-block; margin-top: 14px; padding: 6px 16px; border-radius: 999px;
  background: rgba(255,255,255,.22); font-size: .9rem; font-weight: 600; }
.fs-actions { position: relative; display: flex; gap: 16px; width: min(520px, calc(100% - 44px)); }
.fs-btn { height: 66px; border-radius: 999px; font-size: 1.15rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px; border: none; cursor: pointer;
  transition: transform .12s ease, filter .15s ease, box-shadow .15s ease; }
.fs-btn:active { transform: scale(.96); filter: brightness(.95); }
.fs-pause { flex: 1.15; background: #fff; color: #0A59F7; box-shadow: 0 12px 30px rgba(255,255,255,.32); }
.fs-stop { flex: 1; background: rgba(255,255,255,.10); color: #fff; border: 2px solid rgba(255,255,255,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.fs-hint { position: relative; font-size: .8rem; opacity: .82; }
.fs-quote { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); text-align: center; color: rgba(255,255,255,.95); pointer-events: none;
  text-shadow: 0 1px 8px rgba(8,24,80,.28); }
.fs-quote .q { display: block; font-size: .88rem; font-weight: 600; line-height: 1.55; }
.fs-quote .a { display: block; margin-top: 6px; font-size: .74rem; font-weight: 500; opacity: .82; }

/* ---------- 底部导航（仅移动端） ---------- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h); background: rgba(255,255,255,0.85); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line); display: flex; z-index: 50; padding-bottom: env(safe-area-inset-bottom); }
[data-theme="dark"] .bottom-nav { background: rgba(28, 31, 38, 0.85); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .68rem; color: var(--text-3); }
.bottom-nav a .ni { font-size: 1.25rem; padding: 3px 9px; border-radius: var(--radius-sm); transition: background .15s; }
.bottom-nav a.active { color: var(--primary); font-weight: 700; }
.bottom-nav a.active .ni { background: var(--primary-soft); }
@media (min-width: 600px) { .bottom-nav { display: none; } }

/* ---------- 备案号 ---------- */
.beian { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px;
  font-size: .72rem; line-height: 1.7; color: var(--text-3);
  padding: 16px 16px calc(16px + var(--nav-h)); }
.beian a { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); text-decoration: none; }
.beian a:hover { color: var(--primary); text-decoration: underline; }
.beian-icon { width: 14px; height: 14px; border-radius: 2px; flex: none; }
/* 移动端显示页面底部备案号，宽屏显示在侧边栏 */
.side-nav .beian { display: none; }
@media (min-width: 600px) {
  .main .beian { display: none; }
  .side-nav .beian { display: flex; padding: 8px 0 0; justify-content: flex-start; text-align: left; }
}

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff; border-radius: var(--radius-lg); padding: 13px 18px;
  font-size: .95rem; font-weight: 600; width: 100%; transition: opacity .15s, transform .12s, box-shadow .15s; }
.btn:hover { box-shadow: 0 6px 16px rgba(10, 89, 247, .24); }
.btn:active { opacity: .85; transform: scale(.985); }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 9px 18px; font-size: .85rem; width: auto; border-radius: var(--radius-lg); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; background: var(--bg-soft); outline: none; transition: border-color .15s, background .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--primary-soft); }
.field .row2 { display: flex; gap: 10px; }
.field .row2 > * { flex: 1; }

/* ---------- 标签 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; font-size: .82rem; background: var(--bg-soft);
  color: var(--text-2); border: 1.5px solid var(--line); cursor: pointer; user-select: none; transition: all .12s; }
.chip.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ---------- 分段控制 ---------- */
.seg { display: flex; background: var(--track); border-radius: var(--radius-sm); padding: 3px; margin: 12px 16px 0; }
.seg button { flex: 1; padding: 8px 0; border-radius: 6px; font-size: .85rem; color: var(--text-2); font-weight: 500; transition: .15s; }
.seg button.on { background: var(--card); color: var(--primary); font-weight: 700; box-shadow: var(--shadow-sm); }

/* ---------- 日期导航 ---------- */
.date-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 12px 0 0; }
.date-nav button { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--card); box-shadow: var(--shadow-sm); font-size: .9rem; color: var(--text-2); }
.date-nav .cur { font-weight: 700; font-size: .95rem; min-width: 150px; text-align: center; }

/* ---------- 列表 ---------- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .li-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: .92rem; }
.list-item .li-sub { font-size: .76rem; color: var(--text-3); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.list-item .li-right { text-align: right; font-weight: 700; font-size: .92rem; flex-shrink: 0; }
.list-item .li-right .sub { font-size: .72rem; color: var(--text-3); font-weight: 400; }
.mini-tag { font-size: .68rem; padding: 1px 7px; border-radius: 999px; color: #fff; white-space: nowrap; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; background: var(--primary-grad); }

/* ---------- 弹层 sheet ---------- */
.mask { position: fixed; inset: 0; background: rgba(20,22,35,.45); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; }
.mask.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 50%; transform: translate(-50%, 105%); bottom: 0; width: min(560px, 100%);
  background: var(--card); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 100; transition: transform .25s ease; max-height: 86vh; overflow-y: auto; }
.sheet.show { transform: translate(-50%, 0); }
.sheet h2 { font-size: 1.05rem; margin-bottom: 16px; }
.sheet .handle { width: 40px; height: 4px; background: var(--line); border-radius: 99px; margin: 0 auto 14px; }

/* ---------- toast ---------- */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: .88rem; z-index: 200; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 88%; text-align: center; }
.toast.show { opacity: 1; }

/* ---------- 图表容器 ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { max-width: 100%; }

/* ---------- 登录页 ---------- */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 8vh 24px 40px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .mark { width: 72px; height: 72px; border-radius: var(--radius); display: block; margin: 0 auto 6px; box-shadow: 0 8px 24px rgba(10, 89, 247, .22); }
.auth-logo h1 { font-size: 1.6rem; margin-top: 6px; }
.auth-logo p { color: var(--text-3); font-size: .85rem; margin-top: 4px; }
.auth-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; }
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid var(--line); }
.auth-tabs button { flex: 1; padding: 10px; font-size: 1rem; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.auth-tabs button.on { color: var(--primary); font-weight: 700; border-color: var(--primary); }
.role-pick { display: flex; gap: 10px; margin-bottom: 14px; }
.role-pick .rp { flex: 1; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; cursor: pointer; }
.role-pick .rp.on { border-color: var(--primary); background: var(--primary-soft); }
.role-pick .rp .t { font-weight: 700; font-size: .92rem; }
.role-pick .rp .d { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--text-3); padding: 36px 0; font-size: .88rem; }
.empty .e-icon { font-size: 2.4rem; margin-bottom: 8px; }

/* ---------- 家长端学生切换 ---------- */
.child-tabs { display: flex; gap: 8px; margin: 10px 16px 0; overflow-x: auto; }
.child-tabs .ct { padding: 8px 16px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm); font-size: .85rem; white-space: nowrap; cursor: pointer; border: 1.5px solid transparent; }
.child-tabs .ct.on { border-color: var(--primary); color: var(--primary); font-weight: 700; }

.text-center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.muted { color: var(--text-3); font-size: .8rem; }
