:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f0f4fa;
  --ink: #1f2a44;
  --ink-soft: #5a6b8c;
  --line: #e3e9f2;
  --brand: #4c6ef5;
  --brand-soft: #eaf0ff;
  --green: #2f9e44;
  --green-soft: #e6f6ea;
  --orange: #f08c00;
  --orange-soft: #fff3e0;
  --red: #e03131;
  --red-soft: #ffe9e9;
  --purple: #7048e8;
  --purple-soft: #f1ecff;
  --yellow: #f1c40f;
  --shadow: 0 4px 16px rgba(31, 42, 68, .08);
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 8px; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
b { color: var(--ink); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: .15s;
}
.btn:hover { filter: brightness(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #3b5bdb; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-warn { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-block { width: 100%; padding: 12px; font-size: 17px; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 登录（语文意美） ---------- */
.login-view {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, #eaf2ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #fdf3e0 0%, transparent 55%),
    linear-gradient(135deg, #f3f6fc 0%, #fbf7ef 100%);
}
.login-deco { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; pointer-events: none; }
.login-deco-ink { width: 460px; height: 460px; left: -120px; top: -120px; background: radial-gradient(circle, #b9c8ff 0%, transparent 70%); }
.login-deco-bamboo { width: 380px; height: 380px; right: -100px; bottom: -120px; background: radial-gradient(circle, #ffe2b0 0%, transparent 70%); }
.login-card {
  position: relative; z-index: 2;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(6px);
  padding: 38px 36px 28px;
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(40,60,130,.16);
  border: 1px solid rgba(255,255,255,.7);
  width: 384px; max-width: 92vw;
  text-align: center;
  overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: linear-gradient(90deg, #4c6ef5, #f2b705, #4c6ef5);
}
.login-seal {
  position: absolute; top: 16px; right: 16px;
  width: 46px; height: 46px; border-radius: 10px;
  background: #e03131; color: #fff; font-size: 24px; line-height: 46px;
  font-family: 'Kaiti SC','STKaiti','KaiTi','Songti SC',serif; font-weight: 700;
  box-shadow: 0 4px 12px rgba(224,49,49,.35); transform: rotate(-5deg);
}
.login-logo { font-size: 54px; filter: drop-shadow(0 6px 10px rgba(76,110,245,.25)); }
.login-title { font-size: 27px; margin-top: 6px; letter-spacing: 1px; color: var(--ink); }
.login-sub { color: var(--ink-soft); margin: 4px 0 6px; font-size: 14px; }
.login-poem { color: #b08900; font-size: 13px; margin: 0 0 20px; font-family: 'Kaiti SC','STKaiti','KaiTi',serif; letter-spacing: .5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form label { font-size: 14px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px; }
.login-form input {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 15px; background: #fff;
}
.login-form input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.login-error { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 10px; }
.login-quick { margin-top: 16px; display: flex; gap: 10px; justify-content: center; }
.login-quick .btn { flex: 1; }

/* ---------- 主框架 ---------- */
.topbar {
  height: 60px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 46;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo { font-size: 24px; }
.topbar-name { font-size: 19px; font-weight: 700; }
.role-tag { font-size: 12px; padding: 3px 9px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); }
.role-tag.teacher { background: var(--purple-soft); color: var(--purple); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-username { color: var(--ink-soft); font-size: 14px; }

.main-view { display: flex; flex-direction: column; min-height: 100vh; }
.side-nav {
  width: 210px; background: var(--panel); border-right: 1px solid var(--line);
  padding: 14px 10px; position: fixed; top: 60px; bottom: 0; left: 0; overflow-y: auto;
}
.side-nav .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; color: var(--ink-soft);
  font-size: 15px; margin-bottom: 4px; cursor: pointer; user-select: none;
}
.side-nav .nav-item:hover { background: var(--panel-2); }
.side-nav .nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-nav .nav-emoji { font-size: 18px; }

.content { margin-left: 210px; padding: 22px; flex: 1; }

/* ---------- 通用卡片/网格 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 22px; }
.page-sub { color: var(--ink-soft); font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { margin-left: 0; padding: 14px; }
  .topbar { padding: 0 12px; }
  .topbar-name { display: none; }
  .topbar .nav-toggle { display: inline-flex; }
  .side-nav {
    transform: translateX(-100%); transition: transform .25s ease;
    width: 80vw; max-width: 280px;
    z-index: 45; box-shadow: 2px 0 16px rgba(20,28,48,.18);
  }
  .side-nav.open { transform: translateX(0); }
  .nav-overlay { display: none; position: fixed; inset: 0; background: rgba(20,28,48,.4); z-index: 44; }
  .nav-overlay.show { display: block; }
  .topbar-username { display: none; }
  .page-title { font-size: 19px; }
  .login-card { padding: 30px 22px 22px; }
  .table-wrap { overflow-x: auto; }
  .batch-bar { position: static; }
}

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-title .tag { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--panel-2); color: var(--ink-soft); font-weight: 500; }
.stat { text-align: center; }
.stat .num { font-size: 30px; font-weight: 800; color: var(--brand); }
.stat .num.green { color: var(--green); }
.stat .num.orange { color: var(--orange); }
.stat .num.purple { color: var(--purple); }
.stat .label { font-size: 13px; color: var(--ink-soft); }

/* ---------- 任务卡 ---------- */
.task-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; position: relative; }
.task-card.done { border-color: var(--green); background: linear-gradient(180deg, #fff, #f6fff8); }
.task-card.rejected { border-color: var(--red); }
.task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-name { font-size: 17px; font-weight: 700; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 20px; background: var(--panel-2); color: var(--ink-soft); }
.chip.daily { background: var(--brand-soft); color: var(--brand); }
.chip.weekly { background: var(--purple-soft); color: var(--purple); }
.chip.diff-1 { background: var(--green-soft); color: var(--green); }
.chip.diff-2 { background: var(--orange-soft); color: var(--orange); }
.chip.diff-3 { background: var(--red-soft); color: var(--red); }
.task-points { font-size: 15px; font-weight: 700; color: var(--orange); white-space: nowrap; }
.task-desc { font-size: 13px; color: var(--ink-soft); }
.task-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.status-badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.status-badge.todo { background: var(--panel-2); color: var(--ink-soft); }
.status-badge.submitted { background: var(--orange-soft); color: var(--orange); }
.status-badge.graded { background: var(--green-soft); color: var(--green); }
.status-badge.rejected { background: var(--red-soft); color: var(--red); }
.done-flag { position: absolute; top: 10px; right: 10px; font-size: 22px; }

/* ---------- 农场 ---------- */
.farm-land { background: linear-gradient(180deg, #cfe8ff 0%, #e9f7e0 100%); border-radius: var(--radius); padding: 12px; position: relative; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); }
.farm-land.locked { background: var(--panel-2); color: var(--ink-soft); }
.crop-emoji { font-size: 54px; line-height: 1; transition: transform .4s; }
.crop-emoji.watering { animation: sway 1.2s ease-in-out infinite; }
@keyframes sway { 0%,100%{transform:rotate(-3deg);} 50%{transform:rotate(3deg);} }
.crop-name { font-size: 13px; font-weight: 600; margin-top: 6px; }
.crop-state { font-size: 12px; padding: 2px 8px; border-radius: 20px; margin-top: 4px; }
.crop-state.normal { background: var(--green-soft); color: var(--green); }
.crop-state.thirsty { background: var(--orange-soft); color: var(--orange); }
.crop-state.dead { background: var(--red-soft); color: var(--red); }
.crop-state.mature { background: var(--yellow); color: #6b5300; }
.water-bar { width: 80%; height: 7px; background: var(--panel-2); border-radius: 10px; margin-top: 8px; overflow: hidden; }
.water-bar > span { display: block; height: 100%; background: #4dabf7; transition: width .5s; }
.progress-text { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.land-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.shop-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.shop-emoji { font-size: 30px; }
.shop-info { flex: 1; }
.shop-name { font-weight: 700; font-size: 15px; }
.shop-desc { font-size: 12px; color: var(--ink-soft); }
.shop-price { color: var(--orange); font-weight: 700; }

/* ---------- 榜单/表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--ink-soft); font-weight: 600; background: var(--panel-2); }
.table tr:hover td { background: #fafcff; }
.rank { font-weight: 800; color: var(--brand); width: 36px; }
.rank.top1 { color: #f1a33c; } .rank.top2 { color: #9aa7bd; } .rank.top3 { color: #cd7f32; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.mini-bar { height: 8px; border-radius: 6px; background: var(--brand); min-width: 4px; }

/* ---------- 公告 ---------- */
.notice { border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 10px 10px 0; padding: 12px 14px; margin-bottom: 12px; }
.notice.teacher { border-color: var(--purple); background: var(--purple-soft); }
.notice .n-head { font-size: 14px; font-weight: 700; display: flex; justify-content: space-between; }
.notice .n-date { font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.notice .n-body { font-size: 14px; margin-top: 4px; }

/* ---------- 日历 ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; background: var(--panel); position: relative; }
.cal-cell .d { font-size: 14px; font-weight: 700; }
.cal-cell.full { background: var(--green-soft); border-color: var(--green); }
.cal-cell.partial { background: var(--orange-soft); border-color: var(--orange); }
.cal-cell.miss { background: var(--red-soft); border-color: var(--red); }
.cal-cell.future { color: var(--ink-soft); background: var(--panel-2); }
.cal-cell.today { outline: 2px solid var(--brand); }

/* ---------- 表单/弹窗 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; font-family: inherit; background: var(--panel-2);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); font-size: 13px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: var(--panel-2); color: var(--ink-soft); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }

.modal-root { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(20,28,48,.45); }
.modal-box { position: relative; background: var(--panel); border-radius: 16px; width: 560px; max-width: 94vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 17px; position: sticky; top: 0; background: var(--panel); }
.modal-close { border: none; background: transparent; font-size: 18px; color: var(--ink-soft); }
.modal-body { padding: 20px; }

.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 30px; z-index: 80; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toastIn .2s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.stars { color: var(--yellow); font-size: 18px; letter-spacing: 2px; }
.preview-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }
.upload-box { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-soft); cursor: pointer; }
.upload-box:hover { border-color: var(--brand); color: var(--brand); }
.medal { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; padding: 10px 4px; border-radius: 12px; background: var(--panel-2); font-size: 12px; }
.medal .m-emoji { font-size: 30px; }
.medal.locked { opacity: .4; }
.section-sub { font-size: 14px; color: var(--ink-soft); margin: -4px 0 14px; }
.empty { text-align: center; color: var(--ink-soft); padding: 30px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ---------- 互访农场（美化） ---------- */
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 8px; line-height: 1.2; }
.visit-tip { background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.visit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.visit-card2 { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--panel); box-shadow: var(--shadow); }
.visit-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.visit-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; flex: 0 0 auto; }
.visit-info { flex: 1; min-width: 0; }
.visit-name { font-weight: 700; font-size: 16px; }
.mini-farm { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-land { border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; background: linear-gradient(180deg, #eaf4ff 0%, #eef9e8 100%); position: relative; }
.mini-land.empty { background: var(--panel-2); color: var(--ink-soft); }
.mini-land.thirsty { background: linear-gradient(180deg, #fff0e0 0%, #ffe9d6 100%); }
.mini-land.dead { background: linear-gradient(180deg, #ffe3e3 0%, #ffd6d6 100%); }
.mini-land.weedy { background: linear-gradient(180deg, #e9e1ff 0%, #efe9ff 100%); }
.mini-land.mature { background: linear-gradient(180deg, #fff7d6 0%, #fff3bf 100%); }
.mini-emoji { font-size: 26px; line-height: 1; }
.mini-name { font-size: 11px; font-weight: 600; margin-top: 3px; }
.mini-state { font-size: 10px; color: var(--ink-soft); margin-top: 2px; }
.mini-sab { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }

/* ---------- 打卡详情 ---------- */
.rec-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--panel); margin-bottom: 12px; }
.rec-card.status-submitted { border-left: 4px solid var(--orange); }
.rec-card.status-graded { border-left: 4px solid var(--green); }
.rec-card.status-rejected { border-left: 4px solid var(--red); }
.rec-top { display: flex; align-items: center; justify-content: space-between; }
.rec-task { font-weight: 700; font-size: 16px; }
.rec-meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.rec-content { font-size: 14px; margin-top: 8px; white-space: pre-wrap; background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px; }
.rec-comment { font-size: 13px; margin-top: 8px; background: var(--green-soft); border-radius: var(--radius-sm); padding: 8px 10px; color: #2b6b3a; }
.rec-comment.warn { background: var(--red-soft); color: var(--red); }
.rec-media-wrap { margin-top: 8px; }
.rec-media { max-width: 180px; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* ---------- 移动端导航抽屉 ---------- */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-right: 4px; flex: 0 0 auto;
  border: none; background: transparent; font-size: 22px; color: var(--brand); border-radius: 10px;
}
.nav-toggle:hover { background: var(--brand-soft); }
.nav-overlay { display: none; }

/* ---------- 教师批量批改工具条 ---------- */
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 12px; position: sticky; top: 60px; z-index: 10;
}
.batch-bar select { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 14px; background: var(--panel-2); max-width: 46vw; }
.batch-bar .spacer { flex: 1 1 auto; }
.row-check { width: 17px; height: 17px; cursor: pointer; }
#check-all { width: 17px; height: 17px; cursor: pointer; }

