@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --paper: #f3ecd8;
  --paper-line: #d8cca3;
  --margin: #c0453f;
  --ink: #2b2620;
  --ink-soft: #6b6252;
  --accent: #2b6a4f;
  --overdue: #b5322c;
  --today: #c07f1f;
  --week: #2b6a4f;
  --later: #5a6b7a;
  --card: #fbf8ee;
  --shadow: rgba(43, 38, 32, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

body {
  background-image:
    repeating-linear-gradient(
      var(--paper) 0px, var(--paper) 33px,
      var(--paper-line) 33px, var(--paper-line) 34px
    );
  background-attachment: local;
}

.page {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 40px 80px 76px;
  min-height: 100vh;
}

.page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 52px;
  width: 2px;
  background: var(--margin);
  opacity: 0.55;
}

header.top {
  margin-bottom: 34px;
}

.wordmark {
  font-family: 'Special Elite', 'IBM Plex Mono', monospace;
  font-size: 44px;
  letter-spacing: 2px;
  margin: 0;
  color: var(--ink);
}

.tagline {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.stamp {
  display: inline-block;
  margin-top: 14px;
  padding: 3px 10px;
  border: 2px solid var(--margin);
  color: var(--margin);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

/* --- paste view --- */

#pasteView textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-left: 4px solid var(--margin);
  padding: 16px 18px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
  box-shadow: 0 2px 10px var(--shadow);
}

#pasteView textarea::placeholder {
  color: var(--ink-soft);
  opacity: 0.8;
}

.hint {
  margin: 10px 0 22px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

button.primary {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fbf8ee;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 13px 24px;
  cursor: pointer;
  box-shadow: 0 3px 0 #1c4a37;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

button.primary:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #1c4a37;
}

button.primary:disabled {
  background: #8a8577;
  box-shadow: 0 3px 0 #6b6656;
  cursor: default;
}

button.ghost {
  appearance: none;
  border: 1px solid var(--paper-line);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  padding: 7px 12px;
  cursor: pointer;
}

button.ghost:hover { border-color: var(--ink-soft); color: var(--ink); }

.error {
  margin-top: 14px;
  color: var(--overdue);
  font-size: 13px;
}

/* --- plan view --- */

#planView { display: none; }

.plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-line {
  font-size: 13px;
  color: var(--ink-soft);
}

.progress-track {
  height: 6px;
  background: var(--paper-line);
  margin-top: 6px;
  width: 220px;
  max-width: 40vw;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s ease;
}

.group {
  margin-bottom: 30px;
}

.group-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--paper-line);
}

.group-title.overdue { color: var(--overdue); }
.group-title.today { color: var(--today); }
.group-title.week { color: var(--week); }
.group-title.later { color: var(--later); }

.item {
  display: flex;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--paper-line);
}

.item.done { opacity: 0.45; }
.item.done .item-title { text-decoration: line-through; }

.item input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.item-body { flex: 1; min-width: 0; }

.item-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.item-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.item-meta .due { font-weight: 600; }
.item-meta .due.overdue { color: var(--overdue); }
.item-meta .due.today { color: var(--today); }

.item-tip {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-style: italic;
}

.empty {
  color: var(--ink-soft);
  font-size: 13px;
  padding: 20px 0;
}

.plan-footer {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--paper-line);
}

.loading {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.loading.on { display: flex; }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--paper-line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #21201c;
    --paper-line: #35332c;
    --margin: #d9615c;
    --ink: #ece6d6;
    --ink-soft: #a49d8a;
    --accent: #4f9a76;
    --overdue: #e2685f;
    --today: #d99a3f;
    --week: #4f9a76;
    --later: #8b98a3;
    --card: #2a2822;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}
