/* Paper Retro — Design Tokens
 * Warm editorial aesthetic. One source of truth for all screens & devices.
 */

:root {
  /* ─── Surfaces ─────────────────────────────────────────── */
  --paper-bg: #f5f0e6;
  --paper-bg-deep: #ebe4d3;
  --paper-surface: #fffaf0;
  --paper-surface-2: #faf3e2;

  /* ─── Ink (text) ───────────────────────────────────────── */
  --ink-1: #1a1510;
  --ink-2: #4a3a28;
  --ink-3: rgba(60, 40, 20, 0.6);
  --ink-4: rgba(60, 40, 20, 0.4);

  /* ─── Rule / divider ───────────────────────────────────── */
  --rule: rgba(120, 90, 50, 0.18);
  --rule-strong: rgba(120, 90, 50, 0.35);
  --rule-dashed: rgba(120, 90, 50, 0.3);

  /* ─── Accent (terracotta) ──────────────────────────────── */
  --accent: #b8743d;
  --accent-deep: #9a5d2e;
  --accent-soft: #e8c9a8;
  --accent-tint: rgba(184, 116, 61, 0.08);

  /* ─── Column tints (sticky notes) ──────────────────────── */
  --tint-wins-1: #fef3c7;
  --tint-wins-2: #fde9a8;
  --tint-stuck-1: #fce4d6;
  --tint-stuck-2: #f8d0bb;
  --tint-next-1: #e6f0d9;
  --tint-next-2: #d4e5bf;

  /* ─── State ────────────────────────────────────────────── */
  --ok: #4d7a3a;
  --warn: #b8743d;
  --danger: #a63f2a;

  /* ─── Radius ───────────────────────────────────────────── */
  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* ─── Shadow ───────────────────────────────────────────── */
  --sh-note: 0 2px 6px rgba(120,90,50,0.12), 0 1px 0 rgba(255,255,255,0.6) inset;
  --sh-note-hover: 0 6px 16px rgba(120,90,50,0.18), 0 1px 0 rgba(255,255,255,0.6) inset;
  --sh-card: 0 1px 2px rgba(80,50,20,0.06), 0 0 0 1px var(--rule);
  --sh-modal: 0 24px 60px rgba(60,40,20,0.22), 0 1px 0 rgba(255,255,255,0.6) inset;
  --sh-btn: 0 1px 0 rgba(120,90,50,0.15);

  /* ─── Type ─────────────────────────────────────────────── */
  --f-serif: "Instrument Serif", "Times New Roman", serif;
  --f-sans: Inter, -apple-system, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  /* ─── Space scale ──────────────────────────────────────── */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--f-sans);
  color: var(--ink-1);
  background: var(--paper-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ─── Paper grain ─── */
.paper-bg {
  background: var(--paper-bg);
  background-image: radial-gradient(rgba(120,90,50,0.08) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ─── Type utilities ─── */
.serif { font-family: var(--f-serif); font-weight: 400; letter-spacing: -0.015em; }
.italic { font-style: italic; }
.accent-ink { color: var(--accent); }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.tabular { font-variant-numeric: tabular-nums; }

/* ─── Buttons ─── */
.btn {
  font-family: inherit;
  border: 1px solid var(--rule-strong);
  background: var(--paper-surface);
  color: var(--ink-1);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all .12s;
  box-shadow: var(--sh-btn);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn:hover { background: var(--paper-surface-2); }
.btn-primary {
  background: var(--ink-1);
  color: var(--paper-bg);
  border-color: var(--ink-1);
}
.btn-primary:hover { background: #000; }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-deep);
}
.btn-accent:hover { background: var(--accent-deep); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(120,90,50,0.08); }

/* ─── Inputs ─── */
.input {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  background: var(--paper-surface);
  color: var(--ink-1);
  width: 100%;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* ─── Scrollbar (thin, warm) ─── */
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(120,90,50,0.2); border-radius: 99px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll { scrollbar-width: thin; scrollbar-color: rgba(120,90,50,0.2) transparent; }

/* ─── Focus ring ─── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ─── Animations ─── */
@keyframes live-pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.5 } }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: translateY(0) } }
.anim-fade { animation: fade-in .2s ease-out }
.anim-rise { animation: slide-up .25s ease-out }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout primitives ─── */
.page { width: 100%; min-height: 100vh; display: flex; flex-direction: column; }

/* ─── Avatar ─── */
.avatar {
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-border { border: 2px solid var(--paper-bg); }
.avatar-stack { display: inline-flex; }
.avatar-stack > * + * { margin-left: -8px; }
.avatar-rest {
  background: var(--paper-surface-2);
  border: 2px solid var(--paper-bg);
  color: var(--ink-2);
  font-weight: 500;
}

/* ─── Pills ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  background: rgba(120,90,50,0.08);
  color: var(--ink-2);
}
.pill-live { background: rgba(184,116,61,0.12); color: var(--accent-deep); border-color: rgba(184,116,61,0.35); }
.pill-done { background: rgba(77,122,58,0.12); color: var(--ok); border-color: rgba(77,122,58,0.3); }
.pill-accent { background: var(--accent); color: #fff; border-color: var(--accent-deep); }

/* ─── Live dot ─── */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(184,116,61,0.13);
  animation: live-pulse 2s ease-in-out infinite;
}

/* ─── Phase bar ─── */
.phase-bar {
  display: inline-flex;
  background: rgba(255,250,240,0.7);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.phase-btn {
  border: none;
  background: transparent;
  color: var(--ink-3);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.phase-btn[data-active="true"] {
  background: var(--ink-1);
  color: var(--paper-bg);
  font-weight: 500;
}
.phase-btn[data-past="true"] { color: var(--ink-2); }
.phase-btn[disabled] { cursor: default; }

/* ─── Timer ─── */
.timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: rgba(255,250,240,0.7);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-1);
}
.timer-bar {
  width: 40px; height: 3px;
  background: var(--rule);
  border-radius: 99px;
  overflow: hidden;
}
.timer-bar > div { height: 100%; background: var(--accent); transition: width 1s linear; }
.timer-compact { padding: 4px 8px 4px 10px; font-size: 12px; }
.timer-compact .timer-bar { width: 28px; }
.timer[data-low="true"] { color: var(--danger); }
.timer[data-low="true"] .timer-bar > div { background: var(--danger); }

/* ─── Sticky card ─── */
.sticky-card {
  background: var(--tint-wins-1);
  border-radius: 3px;
  padding: 14px 14px 11px;
  box-shadow: var(--sh-note);
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.sticky-card:hover { box-shadow: var(--sh-note-hover); transform: translateY(-1px); }
.sticky-card-body {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-1);
  white-space: pre-wrap;
}
.sticky-card-body.masked {
  color: rgba(60,40,20,0.45);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  min-height: 42px;
}
.sticky-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--rule-dashed);
  min-height: 22px;
}
.sticky-card-author {
  font-size: 10.5px;
  color: var(--ink-3);
  font-style: italic;
}
.vote-btn {
  border: 1px solid rgba(120,90,50,0.25);
  background: rgba(255,255,255,0.5);
  color: var(--ink-1);
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.vote-btn[data-voted="true"] {
  border-color: var(--accent-deep);
  background: var(--accent);
  color: #fff;
}
.vote-btn[disabled] { cursor: default; opacity: 0.85; }

/* ─── Composer ─── */
.composer {
  background: var(--tint-wins-1);
  border-radius: 3px;
  padding: 12px;
  box-shadow: 0 0 0 1.5px var(--accent), 0 6px 16px rgba(184,116,61,0.2), 0 1px 0 rgba(255,255,255,0.6) inset;
  transform: rotate(-0.4deg);
}
.composer textarea {
  resize: none;
  overflow: hidden;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  min-height: 42px;
}
.add-note-btn {
  width: 100%;
  border: 1px dashed var(--rule-strong);
  background: transparent;
  color: var(--ink-3);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all .12s;
}
.add-note-btn:hover { border-color: var(--accent); color: var(--ink-1); }

/* ─── Card group ─── */
.card-group {
  padding: 10px 10px 12px;
  background: rgba(120,90,50,0.06);
  border: 1.5px dashed var(--rule-strong);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

/* ─── Toggle ─── */
.toggle {
  width: 32px; height: 18px;
  border-radius: 99px;
  background: rgba(120,90,50,0.25);
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
  display: inline-block;
  cursor: pointer;
  border: none;
  padding: 0;
}
.toggle[data-checked="true"] { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: left .15s;
}
.toggle[data-checked="true"]::after { left: 16px; }

/* ─── Top bar & app shell ─── */
.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--rule);
  background: rgba(245,240,230,0.85);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.app-header {
  padding: 28px 32px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.app-body { flex: 1; overflow: auto; min-height: 0; }

/* ─── Board ─── */
.board-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  padding: 20px 32px 28px;
  overflow: auto;
  min-height: 0;
}
.board-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.board-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

/* ─── Dashboard retro card ─── */
.retro-card {
  background: var(--paper-surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--sh-card);
  transition: transform .12s, box-shadow .12s;
  display: block;
  color: inherit;
}
.retro-card:hover { transform: translateY(-2px); text-decoration: none; }
.retro-card.highlight { border-color: var(--accent); box-shadow: 0 4px 14px rgba(184,116,61,0.12); }
.retro-row {
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr 120px 110px 80px auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background .1s;
  color: inherit;
  text-decoration: none;
}
.retro-row:hover { background: var(--paper-surface-2); text-decoration: none; }
.retro-row:last-child { border-bottom: none; }

/* ─── Mobile tab switcher ─── */
.mobile-tabs {
  display: flex;
  padding: 10px 16px 0;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
}
.mobile-tab {
  border: 1px solid var(--rule);
  background: var(--paper-surface);
  color: var(--ink-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.mobile-tab[data-active="true"] {
  border-color: var(--ink-1);
  background: var(--ink-1);
  color: var(--paper-bg);
}

/* ─── Reactions ─── */
.reactions-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; min-height: 20px; }
.reaction-pill {
  border: 1px solid rgba(120,90,50,0.2);
  background: rgba(255,255,255,0.5);
  padding: 1px 7px 2px;
  border-radius: 99px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-1);
}
.reaction-pill[data-mine="true"] {
  border-color: var(--accent);
  background: rgba(184,116,61,0.15);
}

/* ─── Modal overlay ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,21,16,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--paper-surface);
  padding: 28px 30px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--sh-modal);
  min-width: 320px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .board-grid { grid-template-columns: 1fr; padding: 0 16px 20px; }
  .app-top { padding: 14px 20px; }
  .app-header { padding: 20px 20px 14px; }
  .retro-row { grid-template-columns: 1fr auto; }
  .retro-row .col-hide-phone { display: none; }
}
