: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); }

/* ── 卡片网格（B 站式多栏缩略图） ── */
.hw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.hw-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
  transition: .2s;
}
.hw-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 32px rgba(255, 122, 26, 0.14); }

/* 缩略图区（固定比例，小图） */
.hw-card__thumb {
  position: relative; aspect-ratio: 16 / 10;
  background: var(--panel-2); overflow: hidden; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.hw-card__thumb--img { background-size: cover; background-position: center; }
.hw-card__thumb--text { padding: 14px; cursor: default; }
.hw-thumb__text { font-size: 12px; color: var(--dim); line-height: 1.55; overflow: hidden; max-height: 100%;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
.hw-thumb__ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: var(--faint); }
.hw-spin { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: hwSpin .8s linear infinite; }
@keyframes hwSpin { to { transform: rotate(360deg); } }
/* 文档/表格/PPT 缩略图：把内容缩印进小框 */
.hw-thumb__page { position: absolute; top: 0; left: 0; width: 480px; transform: scale(.5); transform-origin: top left; }
.hw-thumb__doc, .hw-thumb__xls { background: #fff; color: #1a1a1a; height: 100%; overflow: hidden; font-size: 14px; }
.hw-thumb__doc { padding: 18px 22px; }
.hw-thumb__doc img { max-width: 100%; }
.hw-thumb__doc table { border-collapse: collapse; width: 100%; }
.hw-thumb__doc td, .hw-thumb__doc th { border: 1px solid #bbb; padding: 5px 8px; }
.hw-thumb__xls table { border-collapse: collapse; font-size: 14px; }
.hw-thumb__xls td, .hw-thumb__xls th { border: 1px solid #bbb; padding: 5px 8px; white-space: nowrap; }
.hw-thumb__page .px-slide { margin: 0; border-radius: 0; box-shadow: none; }

/* 类型角标 */
.hw-card__badge {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 7px; color: #fff;
  background: rgba(10, 14, 24, 0.55); backdrop-filter: blur(3px);
}
.hw-badge--img { background: #35d6ff; color: #04222b; }
.hw-badge--pdf { background: #ef3b52; }
.hw-badge--doc { background: #2f6bff; }
.hw-badge--xls { background: #1f9d6b; }
.hw-badge--ppt { background: #ef7d1f; }
.hw-badge--txt { background: #8b7bff; }
.hw-badge--file { background: #6b7fa2; }

/* 卡片正文 */
.hw-card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.hw-card__title { margin: 0; font-size: 15px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hw-card__desc { margin: 0; color: var(--dim); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hw-card__foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── 灯箱预览 ── */
.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%; 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-preview__loading { padding: 16px; font-size: 13px; color: var(--dim); }

/* ── 灯箱（点开看大图） ── */
.hw-viewer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.hw-viewer[hidden] { display: none; }
.hw-viewer__backdrop { position: absolute; inset: 0; background: rgba(3, 6, 13, 0.82); backdrop-filter: blur(6px); }
.hw-viewer__panel {
  position: relative; width: min(960px, 100%); max-height: 92vh;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.hw-viewer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.hw-viewer__title { margin: 0; font-size: 17px; line-height: 1.3; padding-right: 12px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.hw-viewer__close { background: none; border: 0; color: var(--dim); font-size: 26px; cursor: pointer; line-height: 1; padding: 0 4px; }
.hw-viewer__close:hover { color: var(--text); }
.hw-viewer__body { padding: 16px; overflow: auto; background: var(--panel-2); }
.hw-viewer__frame { width: 100%; height: 72vh; border: 0; background: #fff; border-radius: 8px; }
.hw-viewer__pre { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.6; margin: 0;
  font-family: ui-monospace, Consolas, "Liberation Mono", monospace; }

/* ── 离线办公预览（Word / Excel / PPT 本地渲染，用于灯箱大图） ── */
.hw-doc { padding: 16px 20px; max-height: 70vh; overflow: auto; font-size: 15px; color: #1a1a1a; background: #fff; border-radius: 8px; }
.hw-doc img { max-width: 100%; height: auto; }
.hw-doc table { border-collapse: collapse; width: 100%; }
.hw-doc td, .hw-doc th { border: 1px solid #ccc; padding: 6px 9px; }
.hw-xls { padding: 12px; background: #fff; border-radius: 8px; }
.hw-xls__title { margin: 12px 0 6px; font-size: 14px; color: #1f6f4a; }
.hw-xls__scroll { overflow: auto; max-height: 64vh; border: 1px solid #ddd; border-radius: 8px; }
.hw-xls__scroll table { border-collapse: collapse; font-size: 13px; }
.hw-xls__scroll td, .hw-xls__scroll th { border: 1px solid #ccc; padding: 5px 9px; white-space: nowrap; }
.hw-pptx { overflow: auto; max-height: 72vh; background: #f3f3f5; padding: 10px; border-radius: 8px; }
.hw-pptx img { max-width: 100%; display: block; }

/* ── 自研 PPTX 渲染器输出样式 ── */
.px-slide {
  position: relative; margin: 0 auto 14px; border-radius: 8px; overflow: hidden;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .22); color: #000; background: #fff;
}
.px-slide--thumb { margin: 0; border-radius: 0; box-shadow: none; }
.px-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.px-sp, .px-picbox, .px-gf { position: absolute; overflow: hidden; }
.px-shape { width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.px-tx { display: flex; flex-direction: column; width: 100%; }
.px-tx p { margin: 0 0 3px; line-height: 1.25; }
.px-pic { max-width: 100%; height: 100%; object-fit: contain; display: block; }
.px-tbl { width: 100%; border-collapse: collapse; font-size: 12pt; }
.px-tbl td { border: 1px solid #999; padding: 4px 8px; vertical-align: top; }
.px-no { position: absolute; right: 10px; bottom: 8px; font-size: 12px; color: #888; }
.px-note { padding: 8px; font-size: 11px; color: #888; }

/* ── 按钮 ── */
.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; }
}
