:root {
  /* 跟随主站：深色为默认，浅色见 html[data-theme='light'] */
  --bg: #070c18;
  --bg-2: #0b1222;
  --panel: rgba(14, 21, 38, 0.82);
  --panel-2: rgba(18, 27, 48, 0.55);
  --line: rgba(120, 150, 200, 0.16);
  --line-2: rgba(120, 150, 200, 0.30);
  --text: #e9f0fb;
  --dim: #9db0cf;
  --faint: #6b7fa2;

  /* 暖色主调 */
  --accent: #ff9a4d;
  --accent-deep: #ff7a1a;
  --accent-soft: rgba(255, 154, 77, 0.14);
  --warm-glow: rgba(255, 154, 77, 0.15);

  --cyan: #35d6ff;
  --violet: #8b7bff;
  --red: #ef3b52;
  --ok: #34d399;
  --warn: #fbbf24;
  --r: 14px;
  --r-lg: 20px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* 浅色：与主站同一套 data-theme 切换，仅换配色 */
html[data-theme='light'] {
  --bg: #f4f7fc;
  --bg-2: #eef2f9;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-2: rgba(238, 242, 249, 0.72);
  --line: rgba(20, 40, 80, 0.12);
  --line-2: rgba(20, 40, 80, 0.22);
  --text: #16203a;
  --dim: #51607c;
  --faint: #8895ad;
  --accent: #ef7d1f;
  --accent-deep: #d9650c;
  --accent-soft: rgba(239, 125, 31, 0.12);
  --warm-glow: rgba(255, 154, 77, 0.08);
  --red: #d83a4e;
  --ok: #1f9d6b;
  --warn: #c97a12;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background:
    radial-gradient(900px 520px at 82% -8%, var(--warm-glow), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(53, 214, 255, 0.06), transparent 55%),
    radial-gradient(800px 500px at 100% 100%, rgba(139, 123, 255, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* ── 暖光场景（装饰层） ── */
.hw-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.hw-scene__warmth {
  position: absolute; inset: 0;
  background:
    radial-gradient(620px 460px at 80% 6%, rgba(255, 176, 92, 0.14), transparent 62%),
    radial-gradient(420px 360px at 12% 18%, rgba(255, 154, 77, 0.07), transparent 60%);
}
.hw-lamp {
  position: absolute; top: -14px; right: 10px; width: 240px; height: auto;
  filter: drop-shadow(0 8px 26px rgba(255, 154, 77, 0.18));
}
.hw-lamp__cone { mix-blend-mode: screen; filter: blur(7px); transform-origin: 98px 112px; animation: hwLampFlicker 5s ease-in-out infinite; }
@keyframes hwLampFlicker { 0%, 100% { opacity: .82; } 50% { opacity: 1; } }

.hw-mote {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255, 200, 130, 0.85); box-shadow: 0 0 8px rgba(255, 180, 100, 0.85);
  animation: hwFloat 7s linear infinite;
}
@keyframes hwFloat {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: .9; }
  88% { opacity: .6; }
  100% { transform: translateY(130px); opacity: 0; }
}

.hw-desk {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: flex-end; gap: 14px; padding: 0 26px;
  font-size: 26px; opacity: .5; filter: saturate(.9);
}
.hw-decor { transform: translateY(0); }

/* ── 顶栏 ── */
.hw-top {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(7, 11, 20, 0.7);
  border-bottom: 1px solid var(--line);
}
html[data-theme='light'] .hw-top { background: rgba(244, 247, 252, 0.78); }
.hw-top__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.hw-top__brand { font-weight: 700; letter-spacing: .02em; }
.hw-top__brand b { color: var(--accent); }
.hw-top__right { display: flex; align-items: center; gap: 12px; }
.hw-top__back { font-size: 13px; color: var(--dim); border: 1px solid var(--line-2); padding: 7px 14px; border-radius: 99px; transition: .18s; }
.hw-top__back:hover { color: var(--accent); border-color: var(--accent); }

.hw-clock {
  font-size: 13px; color: var(--dim);
  border: 1px solid var(--line-2); padding: 6px 12px; border-radius: 99px;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.hw-theme {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--accent);
  font-size: 16px; display: grid; place-items: center; transition: .18s;
}
.hw-theme:hover { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ── 作业栏头 ── */
.hw-bar { padding: 40px 0 90px; }
.hw-bar__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.hw-bar__head h1 { font-size: clamp(26px, 4vw, 38px); margin: 0; }
.hw-bar__sub { color: var(--dim); font-size: 14px; margin: 6px 0 0; }
.hw-bar__sub b { color: var(--accent); }
.hw-warm-text { color: var(--accent); }

/* ── 统计小卡 ── */
.hw-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.hw-stat {
  flex: 1 1 150px; min-width: 140px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 2px;
  position: relative; overflow: hidden;
}
.hw-stat::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
}
.hw-stat__num { font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.hw-stat__label { font-size: 12.5px; color: var(--dim); }
.hw-stat--soon .hw-stat__num { color: var(--warn); }
.hw-stat--past .hw-stat__num { color: var(--red); }
.hw-stat--file .hw-stat__num { color: var(--ok); }
.hw-stat--preview .hw-stat__num { color: var(--accent); }

/* ── 卡片网格 ── */
.hw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.hw-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative; overflow: hidden;
  transition: .2s;
}
.hw-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 30px rgba(255, 122, 26, 0.12); }
.hw-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), #ffd083); opacity: .8;
}
.hw-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hw-card__title { margin: 0; font-size: 18px; }
.hw-card__subj {
  display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent);
  border: 1px solid var(--line-2); padding: 2px 9px; border-radius: 99px;
}
.hw-card__due { font-size: 12.5px; color: var(--dim); white-space: nowrap; }
.hw-card__due.is-soon { color: var(--warn); }
.hw-card__due.is-past { color: var(--red); text-decoration: line-through; }
.hw-card__desc { margin: 0; color: var(--dim); font-size: 14px; white-space: pre-wrap; word-break: break-word; }

/* ── 预览区 ── */
.hw-preview { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); overflow: hidden; }
.hw-preview__label { font-size: 11px; letter-spacing: .1em; color: var(--faint); padding: 8px 12px; border-bottom: 1px solid var(--line); text-transform: uppercase; }
.hw-preview img { display: block; max-width: 100%; max-height: 280px; margin: 0 auto; }
.hw-preview iframe { width: 100%; height: 260px; border: 0; background: #fff; }
.hw-preview pre {
  margin: 0; padding: 12px; max-height: 220px; overflow: auto;
  font-size: 12.5px; white-space: pre-wrap; word-break: break-word; color: var(--text);
  font-family: ui-monospace, Consolas, "Liberation Mono", monospace;
}
.hw-preview__note { padding: 12px; font-size: 13px; color: var(--dim); }

/* ── 卡片底部操作 ── */
.hw-card__foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; align-items: center; }

/* ── 按钮 ── */
.hw-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); cursor: pointer; transition: .18s;
}
.hw-btn:hover { border-color: var(--accent); color: var(--accent); }
.hw-btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #2a1402; border-color: transparent; font-weight: 700; }
.hw-btn--primary:hover { color: #2a1402; filter: brightness(1.06); box-shadow: 0 8px 22px rgba(255, 122, 26, 0.28); }
.hw-btn--dl { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.4); color: var(--ok); }
.hw-btn--dl:hover { color: var(--ok); border-color: var(--ok); }
.hw-btn--del { margin-left: auto; background: rgba(239, 59, 82, 0.1); border-color: rgba(239, 59, 82, 0.4); color: var(--red); }
.hw-btn--del:hover { border-color: var(--red); color: var(--red); }

/* ── 空状态 ── */
.hw-empty { text-align: center; color: var(--faint); padding: 60px 20px; border: 1px dashed var(--line-2); border-radius: var(--r); margin-top: 8px; }

/* ── 弹层 ── */
.hw-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.hw-modal[hidden] { display: none; }
.hw-modal__backdrop { position: absolute; inset: 0; background: rgba(3, 6, 13, 0.72); backdrop-filter: blur(4px); }
.hw-modal__panel {
  position: relative; width: min(560px, 100%); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 26px;
}
.hw-modal__panel h2 { margin: 0 0 18px; font-size: 22px; }
.hw-modal__panel h2::before { content: "🛋 "; }
.hw-modal__close { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--dim); font-size: 24px; cursor: pointer; line-height: 1; }
.hw-modal__close:hover { color: var(--text); }
.hw-modal__panel label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 14px; }
.hw-modal__panel input[type=text], .hw-modal__panel input[type=date], .hw-modal__panel textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: rgba(6, 11, 22, 0.7); color: var(--text);
  font: inherit; font-size: 14px; outline: none;
}
html[data-theme='light'] .hw-modal__panel input[type=text],
html[data-theme='light'] .hw-modal__panel input[type=date],
html[data-theme='light'] .hw-modal__panel textarea { background: rgba(255, 255, 255, 0.8); }
.hw-modal__panel input:focus, .hw-modal__panel textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hw-modal__panel textarea { resize: vertical; }
.hw-modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.hw-warn { color: var(--warn); font-size: 13px; min-height: 18px; margin: -6px 0 10px; }

@media (max-width: 520px) {
  .hw-grid { grid-template-columns: 1fr; }
  .hw-lamp { width: 170px; }
  .hw-clock { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hw-lamp__cone, .hw-mote { animation: none; }
  .hw-card { transition: none; }
}
