/* ===== 蜡笔小新风 · 样式 =====
   想换配色，只改 :root 里的变量，全站跟着变。 */

:root {
  --shin-yellow: #ffd93b;
  --shin-red: #ff5a4e;
  --shin-green: #7ac143;
  --shin-blue: #6ec1e4;
  --ink: #2b2b2b;
  --paper: #fffdf5;
  --paper-2: #fff6d8;

  --crayon: 3px solid var(--ink);
  --radius: 18px 22px 16px 20px;

  --font-fun: "Comic Sans MS", "Segoe Print", "Bradley Hand", "微软雅黑", "Microsoft YaHei", sans-serif;
  --font-cn: "微软雅黑", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font-cn);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 217, 59, 0.35) 0 22px, transparent 23px),
    radial-gradient(circle at 88% 12%, rgba(110, 193, 228, 0.28) 0 30px, transparent 31px),
    radial-gradient(circle at 78% 82%, rgba(122, 193, 67, 0.22) 0 26px, transparent 27px),
    repeating-linear-gradient(0deg, rgba(43, 43, 43, 0.04) 0 1px, transparent 1px 28px);
  padding: 28px 18px 48px;
}

.page { width: 100%; max-width: 760px; margin: 0 auto; }

/* ---------- 顶部标题区 ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--shin-yellow);
  border: var(--crayon);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: 6px 6px 0 rgba(43, 43, 43, 0.85);
  transform: rotate(-0.6deg);
}

.hero__doodle { flex: 0 0 auto; line-height: 0; animation: nod 3.2s ease-in-out infinite; }

@keyframes nod {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(-3deg); }
}

.hero__text { min-width: 0; }

.hero h1 {
  margin: 0 0 6px;
  font-family: var(--font-fun);
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #fff, 3px 3px 0 rgba(43, 43, 43, 0.18);
}

.hero__sub { margin: 0; font-size: 15px; color: #4a4a4a; }

/* ---------- 提示横幅（出错/警告时出现） ---------- */
.banner {
  margin-top: 16px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  background: var(--shin-red);
  border: var(--crayon);
  border-radius: 14px;
  box-shadow: 4px 4px 0 rgba(43, 43, 43, 0.85);
}

/* ---------- 主面板 ---------- */
.panel {
  margin-top: 22px;
  background: var(--paper-2);
  border: var(--crayon);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 6px 6px 0 rgba(43, 43, 43, 0.85);
  transform: rotate(0.25deg);
}

/* ---------- 添加表单 ---------- */
.add { display: block; }

.add__title {
  width: 100%;
  font-family: var(--font-cn);
  font-size: 17px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  border: var(--crayon);
  border-radius: 14px;
  box-shadow: 3px 3px 0 rgba(43, 43, 43, 0.75);
  outline: none;
}

.add__title:focus { background: #fffef2; box-shadow: 3px 3px 0 var(--shin-green); }

.add__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 4px; }

.field__label { font-size: 12px; color: #666; padding-left: 4px; }

.field__input {
  font-family: var(--font-cn);
  font-size: 15px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: var(--crayon);
  border-radius: 12px;
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.7);
  outline: none;
}

.field__input:focus { box-shadow: 2px 2px 0 var(--shin-blue); }

.btn {
  font-family: var(--font-fun);
  font-size: 16px;
  padding: 9px 20px;
  color: var(--ink);
  background: #fff;
  border: var(--crayon);
  border-radius: 999px;
  box-shadow: 3px 3px 0 rgba(43, 43, 43, 0.85);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(43, 43, 43, 0.85); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(43, 43, 43, 0.85); }

.btn--go { background: var(--shin-red); color: #fff; }

.add__hint { margin: 10px 0 0; font-size: 12px; color: #777; }

/* ---------- 清单 ---------- */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
  padding-bottom: 8px;
  border-bottom: 3px dashed rgba(43, 43, 43, 0.25);
}

.list-head__title { font-family: var(--font-fun); font-size: 19px; letter-spacing: 0.5px; }

.count {
  font-size: 13px;
  padding: 3px 10px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

/* ---------- 备份区 ---------- */
.backup {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 3px dashed rgba(43, 43, 43, 0.2);
}

.btn--sm {
  font-family: var(--font-cn);
  font-size: 13px;
  padding: 6px 12px;
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.8);
}

.backup__hint { font-size: 12px; color: #7a7a7a; }

/* ---------- 共享区 ---------- */
.sync {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 3px dashed rgba(43, 43, 43, 0.2);
}

.sync__label { font-weight: 800; font-size: 14px; }

.sync__code {
  flex: 1 1 200px;
  min-width: 150px;
  font-family: var(--font-cn);
  font-size: 13px;
  padding: 6px 10px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
}

.sync__status { font-size: 12px; color: #7a7a7a; }
.sync__status--ok { color: #4b8b2b; font-weight: 700; }
.sync__status--warn { color: #d8352a; font-weight: 700; }

/* ---------- 筛选标签 ---------- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.filter {
  font-family: var(--font-cn);
  font-size: 14px;
  padding: 6px 14px;
  color: #555;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.75);
  cursor: pointer;
}

.filter.is-active {
  color: #fff;
  background: var(--shin-green);
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.9);
}

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: var(--crayon);
  border-radius: 14px 18px 14px 16px;
  box-shadow: 3px 3px 0 rgba(43, 43, 43, 0.8);
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from { transform: scale(0.96) rotate(-0.4deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

.task__title { margin: 0; font-size: 16px; line-height: 1.35; word-break: break-word; }

.task__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

/* 勾选框 */
.task__check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: #fff;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.75);
  cursor: pointer;
}

.task__check--done { background: var(--shin-green); }

/* 右边：时间药丸 + 工具按钮 */
.task__tail {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task__tools { display: flex; gap: 4px; }

.task__tool {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.7);
  cursor: pointer;
}

.task__tool:active { transform: translate(2px, 2px); box-shadow: none; }
.task__tool--danger:hover { background: #ffe3e0; }

/* 已完成的卡片 */
.task--done {
  background: #f4f4ef;
  opacity: 0.85;
  animation: none;
}

.task--done .task__title {
  text-decoration: line-through;
  color: #8a8a8a;
}

.task--done .task__countdown { color: #6f9c4a; }
.task--done .task__due { color: #8a8a8a; background: #eee; }

/* 编辑态 */
.task--editing {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  animation: none;
  background: #fffef2;
}

.task__edit-title {
  width: 100%;
  font-family: var(--font-cn);
  font-size: 16px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  outline: none;
}

.task__edit-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.task__edit-date,
.task__edit-time {
  font-family: var(--font-cn);
  font-size: 14px;
  padding: 6px 8px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  outline: none;
}

.task__edit-save,
.task__edit-cancel { padding: 6px 16px; font-size: 14px; }

.task__countdown {
  margin: 0;
  font-family: var(--font-fun);
  font-size: 13px;
  color: #6b6b6b;
  letter-spacing: 0.3px;
}

.task__countdown--overdue { color: #d8352a; font-weight: bold; }

.task--overdue {
  background: #fff1ef;
  border-color: #d8352a;
  box-shadow: 3px 3px 0 rgba(216, 53, 42, 0.85);
  animation: none;
}

.task__due--overdue { background: #ffdcd7; color: #d8352a; border-color: #d8352a; }

/* ---------- 分组小标题 ---------- */
.group-head {
  list-style: none;
  margin: 16px 0 2px;
  padding-left: 4px;
  font-family: var(--font-fun);
  font-size: 14px;
  color: #555;
  letter-spacing: 0.5px;
}

.group-head:first-child { margin-top: 0; }

.group-head--overdue { color: #d8352a; }

.task__due {
  margin: 0;
  flex: 0 0 auto;
  font-size: 13px;
  color: #555;
  padding: 4px 10px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 999px;
  white-space: nowrap;
}

.empty {
  margin: 0;
  padding: 26px 18px;
  text-align: center;
  font-size: 15px;
  color: #777;
  border: 3px dashed rgba(43, 43, 43, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

/* ---------- 底部 ---------- */
.foot { margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.chip {
  font-family: var(--font-fun);
  font-size: 18px;
  letter-spacing: 1px;
  padding: 6px 14px;
  background: #fff;
  border: var(--crayon);
  border-radius: 999px;
  box-shadow: 3px 3px 0 rgba(43, 43, 43, 0.8);
}

.chip--save { font-size: 14px; font-family: var(--font-cn); background: #eafbe4; }

.chip--sound {
  font-size: 14px;
  font-family: var(--font-cn);
  background: #e7f4fd;
  cursor: pointer;
}

.chip--sound:active { transform: translate(2px, 2px); box-shadow: none; }
.chip--warn { background: #ffe3e0; }

.foot__note { font-size: 13px; color: #666; }

/* ---------- 到点提醒（浮在最上面的小卡片） ---------- */
.alerts {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
  pointer-events: none;
}

.alert {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--shin-yellow);
  border: 3px solid #d8352a;
  border-radius: 14px 18px 14px 16px;
  box-shadow: 4px 4px 0 rgba(216, 53, 42, 0.8);
  animation: dropIn 0.22s ease-out;
}

.alert--late { background: #ffe9e6; }

@keyframes dropIn {
  from { transform: translateY(-14px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.alert__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}

.alert__btn {
  flex: 0 0 auto;
  font-family: var(--font-fun);
  font-size: 14px;
  padding: 6px 14px;
  color: #fff;
  background: var(--shin-red);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 rgba(43, 43, 43, 0.85);
  cursor: pointer;
}

.alert__btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- 窄屏 ---------- */
@media (max-width: 520px) {
  body { padding: 16px 12px 36px; }
  .hero { padding: 14px 16px; gap: 12px; }
  .hero__doodle svg { width: 76px; height: 76px; }
  .hero h1 { font-size: 26px; }
  .panel { padding: 16px; }
  .add__row { gap: 8px; }
  .btn { width: 100%; }
  .task { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ==========================================================
   第 7 步 · 蜡笔质感打磨
   这一节是对上面基础样式的"精修"，全部是视觉层的东西：
   想撤销某条效果，直接删掉对应那几行即可。
   ========================================================== */

/* 1. 纸张颗粒：让整页像画在纸上，而不是屏幕里 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page { position: relative; z-index: 1; }

/* 2. 顶部横幅：右上角加一颗手绘太阳 */
.hero { position: relative; overflow: hidden; }

.hero::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -34px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  border: 3px dashed rgba(43, 43, 43, 0.22);
}

.hero h1 { letter-spacing: 2px; }

/* 3. 卡片：每张歪一点点，鼠标放上去会轻轻抬起 */
.task {
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.task:nth-of-type(4n + 1) { transform: rotate(-0.4deg); }
.task:nth-of-type(4n + 2) { transform: rotate(0.35deg); }
.task:nth-of-type(4n + 3) { transform: rotate(-0.15deg); }
.task:nth-of-type(4n)     { transform: rotate(0.25deg); }

.task:hover {
  transform: translateY(-2px) rotate(0deg);
  box-shadow: 5px 6px 0 rgba(43, 43, 43, 0.85);
}

/* 4. 勾选框：点上时"盖章" */
.task__check { transition: transform 0.12s ease, background 0.12s ease; }
.task__check:hover { transform: scale(1.12) rotate(-5deg); }
.task__check--done { animation: stampIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes stampIn {
  0%   { transform: scale(0.5) rotate(-25deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* 5. 完成时：整张卡片"啪"地落位 */
.task--done { animation: doneIn 0.3s ease-out; }

@keyframes doneIn {
  from { transform: rotate(-1.4deg) scale(0.97); }
  to   { transform: rotate(0deg) scale(1); }
}

/* 6. 分组标题：下面加一道手画横线 */
.group-head::after {
  content: "";
  display: block;
  width: 46%;
  height: 3px;
  margin-top: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(43, 43, 43, 0.35), rgba(43, 43, 43, 0.08));
}

.group-head--overdue::after { background: linear-gradient(90deg, rgba(216, 53, 42, 0.6), rgba(216, 53, 42, 0.15)); }
.group-head--done::after    { background: linear-gradient(90deg, rgba(122, 193, 67, 0.75), rgba(122, 193, 67, 0.2)); }

/* 7. 空状态：小人轻轻上下浮 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.55);
}

.empty__art { animation: floaty 3.4s ease-in-out infinite; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-6px) rotate(2deg); }
}

.empty__text { margin: 0; font-size: 15px; color: #6b6b6b; }

/* 8. 时间药丸：也歪一点点，像手贴的标签 */
.task__due { transform: rotate(-0.7deg); }

/* 9. 提醒卡片：出现时摇一下；"干得漂亮"用绿色 */
.alert { animation: dropIn 0.22s ease-out, wiggle 0.5s ease-in-out 0.2s 1; }

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-0.9deg); }
  75%      { transform: rotate(0.9deg); }
}

.alert--good {
  background: #eafbe4;
  border-color: #4b8b2b;
  box-shadow: 4px 4px 0 rgba(75, 139, 43, 0.75);
}

.toast { animation: toastIn 0.25s ease-out; }

@keyframes toastIn {
  from { transform: translateY(-10px) scale(0.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* 10. 添加按钮：撒上一层小圆点，像蜡笔点出来的 */
.btn--go {
  background-color: var(--shin-red);
  background-image: radial-gradient(rgba(255, 255, 255, 0.45) 1.5px, transparent 1.6px);
  background-size: 8px 8px;
}

/* 11. 输入框提示文字淡一点 */
.add__title::placeholder { color: #b8b1a0; }

/* 12. 键盘操作也有清楚的焦点框（不用鼠标也能用） */
button:focus-visible,
input:focus-visible {
  outline: 3px dashed var(--shin-blue);
  outline-offset: 2px;
}

/* 13. 滚动条也换成蜡笔风 */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: #fff6d8; }
::-webkit-scrollbar-thumb {
  background: var(--shin-yellow);
  border: 3px solid #fff6d8;
  border-radius: 8px;
}
