/* ProcrastiMate — design tokens + components. Mobile-first, one column. */
:root {
  --bg: #F6F2E9;
  --card: #FCFAF5;
  --ink: #1E3A33;
  --ink-2: #3D4B46;
  --muted: #6F7873;
  --line: #E6DFD0;
  --green: #1F4D40;
  --green-2: #2A6252;
  --ring: #7DBF93;
  --ring-bg: #E4E2DA;
  --danger: #B5453A;

  --s5: #CDE9D3;
  --s15: #CFE3F0;
  --s30: #DCD4F0;
  --s60: #F8E0C6;
  --s180: #F3CFCF;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(30, 58, 51, .05), 0 6px 20px rgba(30, 58, 51, .07);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Grandstander", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 600 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.dark { background: var(--green); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--green-2); }
[hidden] { display: none !important; }

.app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}
.view {
  padding: 28px 20px calc(110px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  animation: fade .3s ease;
  min-height: 100vh;
  min-height: 100dvh;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-outline { background: transparent; border: 2px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-xl { font-size: 22px; padding: 20px 24px; border-radius: 18px; width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 14px; border-radius: 10px; }

.input {
  width: 100%;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--green-2); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-h { margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--ink-2); }

/* ---------- home ---------- */
.brand { text-align: center; margin: 12px 0 26px; }
.logo {
  font: 800 clamp(40px, 11vw, 52px)/1 var(--display);
  color: var(--green);
  margin: 0;
  transform: rotate(-3deg);
  letter-spacing: -.5px;
}
.dice-wrap { position: relative; height: 80px; margin: 18px auto 10px; width: 160px; color: var(--green); }
.rays { position: absolute; inset: 0; color: #C9B98E; }
.dice { position: absolute; left: 44px; top: 4px; }
.app:not([aria-busy]) #v-home .dice { animation: wobble 3.2s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-5deg); } }
.tagline { margin: 0; color: var(--ink-2); font-size: 19px; font-weight: 600; }
.ask { text-align: center; font-size: 21px; font-weight: 700; margin: 8px 0 16px; }

.slots { display: flex; flex-direction: column; gap: 14px; }
.slot {
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
  transition: transform .1s, box-shadow .15s, filter .15s;
}
.slot:hover { box-shadow: 0 4px 14px rgba(30, 58, 51, .12); transform: translateY(-1px); }
.slot:active { transform: scale(.98); }
.slot-label { font-size: 22px; font-weight: 700; color: var(--ink); }
.slot-count { font-size: 12.5px; font-weight: 700; color: rgba(30, 58, 51, .55); letter-spacing: .02em; }
.slot.empty { filter: saturate(.35); opacity: .7; }
.s5 { background: var(--s5); }
.s15 { background: var(--s15); }
.s30 { background: var(--s30); }
.s60 { background: var(--s60); }
.s180 { background: var(--s180); }
.hint { text-align: center; color: var(--muted); margin-top: 18px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(246, 242, 233, .94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  color: #8A918D;
  text-decoration: none;
  font-weight: 700;
}
.tabbar svg { width: 26px; height: 26px; }
.tabbar a.on { color: var(--green); }

/* ---------- page headers ---------- */
.page-title { font: 800 32px/1.1 var(--display); color: var(--green); margin: 6px 0 4px; }
.page-sub { margin: 0 0 18px; color: var(--muted); }

/* ---------- jobs ---------- */
.add-job { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  opacity: .75;
}
.chip.on { border-color: var(--green); opacity: 1; }
.group { margin: 22px 0 6px; }
.group-h { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; }
.pill { border-radius: 999px; padding: 4px 12px; font-weight: 800; }
.group-n { color: var(--muted); font-weight: 700; }
.group-empty { color: var(--muted); margin: 4px 4px 0; font-size: 14px; font-weight: 600; }
.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.job {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 8px 10px 12px;
}
.job.editing { flex-wrap: wrap; padding: 10px; }
.job.editing .input:first-child { flex: 1 1 100%; }
.job.editing select { flex: 1; padding: 8px 10px; }
.job-icon { font-size: 22px; width: 28px; text-align: center; flex: none; }
.job-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.icon-btn {
  border: 0;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  flex: none;
}
.icon-btn:hover { background: #EFEADF; color: var(--ink); }

/* ---------- spin ---------- */
.view-dark { color: #fff; align-items: center; padding-bottom: 40px; }
.spin-h { text-align: center; font-size: 26px; font-weight: 700; margin: 30px 0 26px; line-height: 1.2; }
.spin-h span { font-size: 38px; font-weight: 800; }
.machine {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 10px;
  border-radius: 34px;
  background: #173D33;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .05), 0 18px 40px rgba(0, 0, 0, .25);
}
.lever {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 110px;
  margin-top: -55px;
  border-radius: 8px;
  background: linear-gradient(90deg, #6d7a74, #b7bfb9, #6d7a74);
}
.lever-l { left: -8px; }
.lever-r { right: -8px; }
.reel {
  position: relative;
  height: 504px; /* 7 rows */
  overflow: hidden;
  border-radius: 26px;
  background: linear-gradient(#cfd2cc, #f4f4f0 18%, #fff 50%, #f4f4f0 82%, #cfd2cc);
  perspective: 700px;
}
.reel::before, .reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 130px;
  z-index: 2;
  pointer-events: none;
}
.reel::before { top: 0; background: linear-gradient(rgba(10, 30, 24, .55), transparent); }
.reel::after { bottom: 0; background: linear-gradient(transparent, rgba(10, 30, 24, .55)); }
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.row {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  color: #26332F;
  font-size: 19px;
  font-weight: 700;
  border-bottom: 1px solid rgba(0, 0, 0, .06);
  backface-visibility: hidden;
}
.row-icon { font-size: 28px; width: 36px; text-align: center; }
.row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.hit { color: #0f2a22; }
.payline {
  position: absolute;
  left: -2px;
  right: -2px;
  top: 50%;
  height: 80px;
  margin-top: -40px;
  border-radius: 14px;
  z-index: 3;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 6px 18px rgba(0, 0, 0, .18), inset 0 0 0 999px rgba(255, 255, 255, .12);
}
.spin-status { font-size: 20px; margin: 32px 0 10px; color: rgba(255, 255, 255, .85); }
.dots { display: flex; gap: 10px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, .75); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- result / done ---------- */
#v-result, #v-done { align-items: center; overflow: hidden; position: relative; padding-bottom: 40px; }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.confetti i {
  position: absolute;
  width: 7px;
  height: 20px;
  border-radius: 4px;
  opacity: 0;
  animation: pop .7s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
@keyframes pop { from { opacity: 0; translate: 0 -30px; } to { opacity: .9; translate: 0 0; } }
#v-result > *:not(.confetti), #v-done > *:not(.confetti) { position: relative; z-index: 1; }
.result-h { font-size: 30px; font-weight: 700; margin: 54px 0 28px; text-align: center; }
.task-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  padding: 18px 20px 20px;
}
.task-card.big { padding: 30px 22px 30px; max-width: 340px; }
.task-icon { font-size: 92px; line-height: 1.1; }
.task-icon.sm { font-size: 52px; }
.task-title { font-size: 24px; font-weight: 800; margin-top: 8px; overflow-wrap: anywhere; }
.task-card.big .task-title { font-size: 34px; line-height: 1.15; margin-top: 14px; }
.task-mins { color: var(--ink-2); font-size: 19px; margin-top: 4px; }
.task-card.big .task-mins { font-size: 24px; }
.quote {
  margin: 30px 0;
  background: #F1ECDB;
  border-radius: 16px;
  padding: 18px 24px;
  text-align: center;
  font-size: 19px;
  color: var(--ink-2);
  max-width: 290px;
}
.fine { color: var(--ink-2); text-align: center; font-size: 17px; margin-top: 22px; }
.done-q { font-size: 19px; color: var(--ink-2); margin: 30px 0 14px; }
#done-remove { width: 100%; margin-top: 12px; }

/* ---------- focus ---------- */
#v-focus { align-items: center; padding-bottom: 40px; }
.focus-h { font-size: 28px; font-weight: 800; margin: 20px 0 2px; }
.focus-sub { margin: 0 0 16px; color: var(--ink-2); font-size: 19px; }
.ring-wrap { position: relative; width: min(290px, 78vw); aspect-ratio: 1; margin: 30px 0 26px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; }
.ring-bg { stroke: var(--ring-bg); }
.ring-fg { stroke: var(--ring); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.clock { font-size: clamp(46px, 14vw, 62px); font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.clock-sub { font-size: 20px; color: var(--ink-2); }
.lock-note {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #EEEBE3;
  border-radius: 18px;
  padding: 16px 22px;
  width: 100%;
  color: var(--ink-2);
  font-size: 16px;
}
.lock-note svg { color: #5E6C74; flex: none; }

/* ---------- progress ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-v { font-size: 30px; font-weight: 800; color: var(--green); line-height: 1.1; }
.stat-l { color: var(--muted); font-size: 14px; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; height: 140px; align-items: end; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-f { width: 100%; max-width: 18px; background: var(--ring); border-radius: 5px 5px 2px 2px; }
.bar.today .bar-f { background: var(--green); }
.bar-n { font-size: 11px; color: var(--muted); height: 16px; }
.bar-l { font-size: 11px; color: var(--muted); margin-top: 4px; }
.bar.today .bar-l { color: var(--green); font-weight: 800; }
.hbar { display: grid; grid-template-columns: 92px 1fr 30px; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.hbar-t { height: 14px; background: #EFEBE1; border-radius: 7px; overflow: hidden; }
.hbar-f { display: block; height: 100%; border-radius: 7px; filter: saturate(1.6) brightness(.93); }
.hbar-n { text-align: right; color: var(--muted); }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent li:last-child { border: 0; }
.rec-t { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.rec-t small { color: var(--muted); font-weight: 600; }

/* ---------- settings ---------- */
.account { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--s5);
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  flex: none;
}
.acct-name { font-size: 20px; font-weight: 800; }
.acct-meta { color: var(--muted); font-size: 14px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.toggle-row small { color: var(--muted); font-weight: 600; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--green); }
#sign-out { width: 100%; margin-bottom: 14px; }
.danger summary { cursor: pointer; color: var(--danger); font-weight: 800; }
.danger p { color: var(--ink-2); font-size: 14px; }
.danger .btn { margin-top: 10px; width: 100%; }

/* ---------- icon choice ---------- */
.add-row { display: flex; gap: 10px; }
.icon-pick {
  flex: none;
  width: 52px;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  position: relative;
}
.icon-pick:hover, .icon-pick:focus-visible { border-color: var(--green-2); }
.icon-pick.auto::after {
  content: "auto";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 5px;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .04em;
}
.icon-btn-plain { border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 8px; line-height: 1.2; }
.icon-btn-plain:hover { background: #EFEADF; }

.picker { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.picker-backdrop { position: absolute; inset: 0; background: rgba(20, 35, 30, .45); animation: fade .15s ease; }
.picker-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: min(78vh, 640px); /* fixed, so the sheet doesn't jump while searching */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  animation: rise .2s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 520px) {
  .picker { align-items: center; }
  .picker-panel { border-radius: 22px; }
}
.picker-head { display: flex; gap: 8px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.picker-x { flex: none; width: 44px; border: 0; background: #EEE9DC; border-radius: 12px; cursor: pointer; color: var(--muted); font-size: 16px; }
.picker-grid { overflow-y: auto; padding: 6px 14px 18px; overscroll-behavior: contain; }
.picker-g { margin: 14px 2px 6px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.picker-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
.picker-tile {
  aspect-ratio: 1;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 12px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.picker-tile:hover, .picker-tile:focus-visible { background: #fff; outline: none; }
.picker-tile.on { border-color: var(--green); background: #fff; }
.picker-auto { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.picker-auto .picker-tile { width: 52px; flex: none; background: #fff; }
.picker-auto small { color: var(--muted); font-weight: 600; }
.picker-none { color: var(--muted); text-align: center; margin: 30px 0; }
body.no-scroll { overflow: hidden; }

/* ---------- admin (testing) ---------- */
.adminbar {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 8px;
  background: #2B2118;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  z-index: 40;
  font-size: 13px;
  max-width: calc(100% - 20px);
}
.admin-badge { background: #F2A65A; color: #2B2118; font-weight: 800; letter-spacing: .08em; border-radius: 999px; padding: 3px 8px; font-size: 11px; }
.adminbar button { border: 0; background: rgba(255, 255, 255, .12); color: #fff; border-radius: 999px; padding: 6px 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.adminbar button:hover { background: rgba(255, 255, 255, .22); }
.adminbar .admin-exit { background: transparent; color: rgba(255, 255, 255, .6); }
.admin-actions { display: flex; gap: 6px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  max-width: calc(100% - 32px);
  width: max-content;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- auth ---------- */
.auth { justify-content: center; padding-bottom: 40px; }
.auth .brand { margin-bottom: 20px; }
.auth .logo { font-size: 46px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #EEE9DC; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 800; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.auth-h1 { font-size: 24px; margin: 0 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 800; margin-bottom: 6px; color: var(--ink-2); }
.field-labelrow { display: flex; justify-content: space-between; align-items: baseline; }
.link-btn { border: 0; background: none; color: var(--green-2); font-size: 13px; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.auth-btn { width: 100%; margin-top: 6px; font-size: 17px; }
.code-boxes { display: flex; gap: 8px; justify-content: center; margin: 8px 0 16px; }
.code-box {
  width: 46px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.code-box:focus { border-color: var(--green-2); }
.dev-note { background: #FFF6D8; border: 1px dashed #E0C56A; border-radius: 10px; padding: 10px; font-size: 14px; margin-bottom: 12px; text-align: center; }
.auth-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; font-size: 14px; }
.auth-actions .dot { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti i { opacity: .9; }
}
@media (min-width: 520px) {
  .view { padding-top: 40px; }
}
@media (max-height: 760px) {
  .reel { height: 360px; }
}
