/* 所有页面共用：格子纸、纸、胶带、底栏、占位页 */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--f-body);
  color: var(--c-ink);
  background: var(--c-grid-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
img { display: block; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }

/* 格子纸 */
.grid-paper {
  background-color: var(--c-grid-bg);
  background-image:
    linear-gradient(var(--c-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}
/* 页面主体：格子纸 + 左边粉色页边线；底下留出底栏的高度 */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) var(--page-x) calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
  overflow-x: hidden;
}
.page::before {
  content: ""; position: absolute; left: 30px; top: 0; bottom: 0; width: 1px;
  background: var(--c-margin-line); pointer-events: none;
}

/* 白纸：带一点阴影 */
.paper {
  background: var(--c-paper);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 6px 14px rgba(var(--c-shadow), .12), 0 1px 2px rgba(var(--c-shadow), .12);
}
/* 横线本 */
.lined {
  background-color: var(--c-paper);
  background-image: repeating-linear-gradient(transparent 0 25px, var(--c-line-blue) 25px 26px);
}

/* 胶带：放在 position: relative 的东西里，用 style 定位置和角度 */
.tape {
  position: absolute; height: 20px; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--tape-blue-a) 0 6px, var(--tape-blue-b) 6px 12px);
  box-shadow: 0 1px 1px rgba(var(--c-shadow), .08);
}
.tape.pink { background: repeating-linear-gradient(135deg, var(--tape-pink-a) 0 5px, var(--tape-pink-b) 5px 10px); }

.script { font-family: var(--f-script); color: var(--c-accent); font-weight: 400; }
.mono { font-family: var(--f-mono); }
.mute { color: var(--c-ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 底栏：五张纸签，选中的那张高一点、奶蓝色、贴一截胶带 */
.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 10px env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; align-items: end;
}
.tabbar a {
  height: 58px; position: relative;
  background: var(--c-paper); border-radius: var(--r-tab) var(--r-tab) 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; color: var(--c-ink-2);
  box-shadow: 0 -3px 10px rgba(var(--c-shadow), .08);
  transition: height .2s ease;
}
.tabbar a svg { stroke: var(--c-ink-2); }
.tabbar a[aria-current="page"] {
  height: 70px; background: var(--c-paper-blue); color: var(--c-ink); font-weight: 600;
  box-shadow: 0 -3px 10px rgba(var(--c-shadow), .12);
}
.tabbar a[aria-current="page"] svg { stroke: var(--c-ink); }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; left: 50%; top: -8px; width: 34px; height: 14px; margin-left: -17px;
  transform: rotate(-4deg);
  background: repeating-linear-gradient(90deg, var(--tape-blue-a) 0 6px, var(--tape-blue-b) 6px 12px);
}

[hidden] { display: none !important; }
button:disabled { cursor: default; }
.icon-btn:disabled { opacity: .3; }

/* 还没做的页 */
.todo-page { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 60vh; }
.todo-page .paper { padding: 28px 32px; transform: rotate(-1deg); position: relative; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
