:root {
  --bg: #07070c;
  --panel: #101018;
  --panel-2: #15151f;
  --line: rgba(0, 240, 255, 0.22);
  --line-soft: rgba(255, 255, 255, 0.07);
  --cyan: #00f0ff;
  --magenta: #ff2bd6;
  --red: #ff3b4d;
  --text: #d7e6ea;
  --dim: #7b8a93;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ---------- 背景：网格 + 扫描线 ---------- */
.grid-bg {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 40%, transparent 90%);
}
.scanline {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.12) 2px 4px
  );
  opacity: 0.5;
}
.scanline::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 120px;
  background: linear-gradient(to bottom, transparent, rgba(0, 240, 255, 0.06), transparent);
  /* 用 transform 代替 top 动画，走 GPU 合成，避免每帧触发布局 */
  animation: sweep 9s linear infinite;
  will-change: transform;
}
@keyframes sweep {
  from { transform: translateY(-120px); }
  to   { transform: translateY(100vh); }
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 16, 0.88);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-glitch {
  font-size: 26px; font-weight: 700; letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7), 0 0 24px rgba(0, 240, 255, 0.35);
}
.brand-sub { color: var(--dim); font-size: 12px; letter-spacing: 1px; }
.clock-box { text-align: right; }
.date { color: var(--dim); font-size: 12px; letter-spacing: 2px; }
.clock {
  font-size: 22px; color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  font-variant-numeric: tabular-nums;
}
.controls { display: flex; align-items: center; gap: 10px; }

/* ---------- 按钮 ---------- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: box-shadow 0.2s, background 0.2s, color 0.2s;
}
.icon-btn:hover {
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}
.text-btn span { font-size: 13px; font-family: var(--mono); }
.ic {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
#soundBtn .ic-off { display: none; }
#soundBtn.muted { color: var(--dim); border-color: var(--line-soft); }
#soundBtn.muted .ic-on { display: none; }
#soundBtn.muted .ic-off { display: block; }

/* ---------- 布局 ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- 面板 ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.08), inset 0 0 40px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column;
  min-height: 420px;
}
.panel-title {
  font-size: 15px; letter-spacing: 3px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.accent { color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }
.accent.magenta { color: var(--magenta); text-shadow: 0 0 8px var(--magenta); }
.panel-tag { margin-left: auto; font-size: 11px; color: var(--dim); letter-spacing: 2px; }
.save-status {
  font-size: 11px; color: var(--cyan); letter-spacing: 1px;
  opacity: 0; transition: opacity 0.3s;
}
.save-status.show { opacity: 1; }

/* ---------- 待办表单 ---------- */
.task-form { display: flex; gap: 10px; margin-bottom: 16px; }
.task-form input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
}
.task-form input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}
#taskTitle { flex: 1; min-width: 0; }
#taskTime { width: 110px; color-scheme: dark; }
.add-btn { flex-shrink: 0; }

/* ---------- 任务列表 ---------- */
.task-list { list-style: none; overflow-y: auto; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s, border-color 0.2s;
}
.task-item:hover { border-color: var(--line); }
.task-item.done { opacity: 0.38; }
.task-item.done .task-title { text-decoration: line-through; }

.task-check {
  appearance: none;
  width: 18px; height: 18px; flex-shrink: 0;
  border: 1px solid var(--cyan);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  display: grid; place-content: center;
}
.task-check:checked { background: var(--cyan); box-shadow: 0 0 8px rgba(0, 240, 255, 0.6); }
.task-check:checked::after {
  content: ""; width: 9px; height: 5px;
  border-left: 2px solid #041015; border-bottom: 2px solid #041015;
  transform: rotate(-45deg) translateY(-1px);
}

.task-info { flex: 1; min-width: 0; }
.task-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.task-meta .ic { width: 13px; height: 13px; color: var(--cyan); }
.task-item.overdue .task-meta { color: var(--red); }
.task-item.overdue .task-meta .ic { color: var(--red); }
.task-item.overdue { border-color: rgba(255, 59, 77, 0.4); }

.del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--dim); padding: 6px; border-radius: 4px;
  transition: color 0.2s, box-shadow 0.2s;
}
.del-btn:hover { color: var(--red); box-shadow: 0 0 10px rgba(255, 59, 77, 0.35); }
.empty-tip { color: var(--dim); font-size: 13px; text-align: center; padding: 24px 0; }

/* ---------- 日记 ---------- */
.diary-title {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--magenta);
  text-shadow: 0 0 6px rgba(255, 43, 214, 0.35);
  font-family: var(--mono);
  font-size: 17px;
  padding: 10px 14px;
  margin-bottom: 12px;
  outline: none;
}
.diary-title:focus { border-color: var(--magenta); box-shadow: 0 0 10px rgba(255, 43, 214, 0.3); }
.diary-body {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.9;
  padding: 14px;
  outline: none;
  min-height: 260px;
  overflow-y: auto;
}
.diary-body:focus { border-color: var(--magenta); box-shadow: 0 0 10px rgba(255, 43, 214, 0.25); }
.diary-body:empty::before {
  content: attr(data-placeholder);
  color: var(--dim);
  pointer-events: none;
}

/* 日记工具栏 */
.diary-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.diary-toolbar .icon-btn { padding: 6px 10px; }
.diary-toolbar .text-btn span { font-size: 12px; }

/* 大小滑块 */
.size-ctl {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  border: 1px solid rgba(255, 43, 214, 0.4);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--magenta);
}
.size-ctl input[type="range"] {
  width: 110px;
  accent-color: var(--magenta);
}

/* 日记内媒体 */
.media-wrap {
  display: inline-block;
  max-width: 100%;
  margin: 8px 0;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: bottom;
}
.media-wrap img, .media-wrap video {
  width: 100%;
  display: block;
  border-radius: 4px;
}
.media-wrap audio { width: 100%; min-width: 220px; display: block; }
.media-wrap.selected {
  border-color: var(--magenta);
  box-shadow: 0 0 12px rgba(255, 43, 214, 0.45);
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 4, 8, 0.75);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
}
.modal {
  width: min(90vw, 360px);
  background: var(--panel);
  border: 1px solid var(--cyan);
  border-radius: 10px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.35);
  animation: pop 0.25s ease-out;
}
@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-bell { color: var(--cyan); display: flex; justify-content: center; margin-bottom: 10px; }
.modal-bell .ic { width: 34px; height: 34px; filter: drop-shadow(0 0 8px var(--cyan)); animation: ring 1s ease-in-out infinite; }
@keyframes ring {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(8deg); }
  80% { transform: rotate(-6deg); }
}
.modal-label { font-size: 12px; letter-spacing: 3px; color: var(--dim); margin-bottom: 6px; }
.modal-task { font-size: 18px; color: var(--text); margin-bottom: 20px; word-break: break-all; }
.modal-snooze {
  display: flex; gap: 10px; justify-content: center;
  margin-bottom: 16px;
}
.modal-snooze select {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  color-scheme: dark;
}
.modal-snooze select:focus { border-color: var(--cyan); }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.btn {
  font-family: var(--mono); font-size: 14px; letter-spacing: 1px;
  padding: 9px 22px; border-radius: 4px; cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
}
.btn.primary {
  background: var(--cyan); color: #041015; border: 1px solid var(--cyan);
  font-weight: 700;
}
.btn.primary:hover { box-shadow: 0 0 16px rgba(0, 240, 255, 0.7); }
.btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line-soft);
}
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---------- 提示条 ---------- */
.autoplay-hint {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 60;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 8px 20px; border-radius: 4px;
  font-size: 13px; letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
}
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 60;
  background: rgba(255, 59, 77, 0.12);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 8px 20px; border-radius: 4px;
  font-size: 13px;
}
.toast.info {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--cyan);
  color: var(--cyan);
}
.hidden { display: none !important; }

@media (max-width: 780px) {
  .topbar { padding: 12px 16px; }
  .layout { padding: 16px; }
  .brand-glitch { font-size: 20px; }
  /* 移动端关闭实时模糊，减少合成开销 */
  .topbar { backdrop-filter: none; background: rgba(10, 10, 16, 0.96); }
  .modal-overlay { backdrop-filter: none; }
}
