/* Same look as the almostaddi.com homepage: gradient, cream cards, ink outlines. */
:root {
  --ink: #1a0b2e;
  --cream: #fff7ee;
  --paper: #fffdf9;
  --muted: #6d6177;
  --line: #e7dccf;
  --pink: #e0245e;
  --sun: #ffcf4a;
  --mint: #5ee0b5;
  --sky: #7cc8ff;
  --red: #e5383b;
  --grad: linear-gradient(140deg, #d6246e 0%, #8e2bb8 55%, #4b1fa8 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font: 500 16px/1.45 "Bricolage Grotesque", system-ui, sans-serif;
  color: var(--ink);
  background: var(--grad) fixed;
  overflow-x: hidden;
}
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: float 16s ease-in-out infinite alternate;
}
.blob.a { width: 420px; height: 420px; background: #ff6a3d; top: -160px; right: -100px; opacity: .35; }
.blob.b { width: 460px; height: 460px; background: #2a1490; bottom: -180px; left: -160px; opacity: .6; animation-duration: 20s; }
@keyframes float { to { transform: translate(30px, -40px) scale(1.08); } }

#app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}
.loading { color: #fff; text-align: center; margin-top: 30vh; font-weight: 700; }

h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font: 800 clamp(2rem, 8vw, 3rem)/1 "Outfit", system-ui, sans-serif; color: #fff; }
h2 { font: 800 1.5rem/1.1 "Outfit", system-ui, sans-serif; }
h3 { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
p { margin: 0; }
.subhead { color: #fff; opacity: .8; font-weight: 700; margin-top: 6px; }
a { color: inherit; }

/* ───── Top bar ───── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0 22px;
  color: #fff;
}
.brand { font: 800 clamp(1.25rem, 5.2vw, 1.85rem) "Outfit", sans-serif; color: #fff; white-space: nowrap; flex: none; }
.brand a { text-decoration: none; border-radius: 8px; padding: 2px 3px; margin: 0 -3px; transition: background .15s, color .15s; }
.brand a:first-child { opacity: .75; font-weight: 700; }
.brand a:hover { background: var(--sun); color: var(--ink); opacity: 1; }
.who { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 10px; min-width: 0; font-weight: 700; font-size: .9rem; }

/* ───── Cards ───── */
.card {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 20px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.section-title { color: #fff; font: 800 1.1rem "Outfit", sans-serif; margin: 10px 0 -4px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-count { font: 700 .85rem "Bricolage Grotesque", system-ui, sans-serif; opacity: .8; }
.empty { color: var(--muted); text-align: center; padding: 8px 0; }
.empty.on-grad { color: rgba(255, 255, 255, .8); }

a.card.link { display: block; text-decoration: none; transition: transform .15s, box-shadow .15s; }
a.card.link:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }

/* ───── Chips & badges ───── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.chip.sun { background: var(--sun); }
.chip.mint { background: var(--mint); }
.chip.sky { background: var(--sky); }
.chip.pink { background: var(--pink); color: #fff; }
.chip.ink { background: var(--ink); color: var(--cream); }
.chip.ghost { border-color: transparent; background: rgba(26, 11, 46, .08); }

/* ───── Stats ───── */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat { padding: 14px 18px; }
.stat .label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font: 800 clamp(1.6rem, 6vw, 2.2rem)/1.1 "Outfit", sans-serif; }

/* ───── Tabs ───── */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 8px; margin: 0 -4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 8px 16px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 247, 238, .85);
  color: var(--ink);
  font: inherit; font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.tab.on { background: var(--ink); color: var(--cream); }
.tab .count { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--pink); color: #fff; font-size: .75rem; text-align: center; }

/* ───── Buttons ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font: inherit; font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn.primary { background: var(--pink); color: #fff; }
.btn.go { background: var(--mint); }
.btn.sky { background: var(--sky); }
.btn.dark { background: var(--ink); color: var(--cream); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 11px; }
.btn.plain { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; padding: 6px 8px; }
.btn.plain:hover, .btn.plain:active { transform: none; box-shadow: none; }
.btn.block { width: 100%; }
.topbar .btn.plain { color: #fff; }
.topbar .who { display: flex; flex-wrap: nowrap; gap: 2px; }
.topbar .who .btn { white-space: nowrap; }
@media (max-width: 360px) { .topbar { flex-wrap: wrap; row-gap: 4px; } }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ───── Forms ───── */
label.field, div.field { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .9rem; }
input[type=text], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit; font-weight: 500;
}
textarea { min-height: 80px; resize: vertical; }
input[type=file] { font: inherit; font-size: .9rem; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--pink); }
.form-error { color: var(--red); font-weight: 700; font-size: .9rem; min-height: 1em; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 500; }

/* ───── Auth ───── */
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth h1 { text-align: center; margin-bottom: 22px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; }
.seg button { padding: 9px; border: 0; background: #fff; font: inherit; font-weight: 800; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--cream); }

/* ───── Tasks / items ───── */
.item { display: flex; flex-direction: column; gap: 10px; }
.item .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.item .details { white-space: pre-wrap; color: var(--muted); }
.item .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.points { font: 800 1.2rem "Outfit", sans-serif; white-space: nowrap; }
.status { font-weight: 800; font-size: .9rem; }
.status.ok { color: #138a5e; }
.status.wait { color: #b26b00; }
.status.no { color: var(--red); }
.photo { display: block; max-width: 100%; max-height: 360px; border: 2px solid var(--ink); border-radius: 12px; object-fit: contain; background: #fff; }
.note { background: #fff; border: 2px dashed var(--line); border-radius: 12px; padding: 8px 12px; white-space: pre-wrap; }

/* ───── History ───── */
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log .delta { font-weight: 800; white-space: nowrap; }
.log .delta.plus { color: #138a5e; }
.log .delta.minus { color: var(--red); }

/* ───── Dialog ───── */
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}
dialog::backdrop { background: rgba(26, 11, 46, .55); backdrop-filter: blur(3px); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ───── Toasts ───── */
#toasts {
  position: fixed;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 700;
  animation: pop .2s ease;
}
.toast.err { background: #ffd1d1; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 520px) {
  .card { padding: 16px; box-shadow: 4px 4px 0 var(--ink); border-radius: 18px; }
  .stats { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* Inline number + unit pickers ("3 times every 1 week") */
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.inline input[type=number] { width: 72px; }
.inline select { width: auto; }
input[type=date] { padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-weight: 500; }
[hidden] { display: none !important; }
.card.vacation { background: #e6f4ff; gap: 12px; }

/* Something new on this tab */
.tab .dot { display: inline-block; width: 12px; height: 12px; margin-left: 6px; border-radius: 50%; background: var(--red); border: 2px solid var(--cream); box-shadow: 0 0 0 1px var(--ink); vertical-align: 1px; }
.log li.new .grow { font-weight: 800; }

/* Missed deadlines */
.chip.red { background: var(--red); color: #fff; vertical-align: 2px; }
.card.item.missed { background: #f3e9e6; }
.card.item.missed h3 { color: var(--muted); }

/* Points spent on rewards: the Reward tag's yellow, deepened enough to read on
   cream. Red is for points taken away. */
.log .delta.spend { color: #c99400; }
.check.on-grad { color: #fff; }

/* History: the list scrolls inside its card instead of stretching the page */
.card.scroll { max-height: min(62vh, 600px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
.card.scroll.short { max-height: 220px; }
.log li .chip { font-size: .7rem; padding: 0 8px; margin-right: 2px; }
select.filter { width: auto; max-width: 62%; padding: 6px 10px; font-weight: 700; font-size: .9rem; }
.chip.lilac { background: #d9c8ff; }
dialog .says { font-weight: 800; font-size: .9rem; margin-bottom: -8px; }

/* Toy-use session */
dialog.toy-session { width: min(560px, calc(100vw - 24px)); }
.toy-session h2 { margin: 0; }
.toy-left { display: flex; align-items: baseline; gap: 12px; }
.toy-left [data-left] { font: 800 2.6rem/1 "Outfit", sans-serif; font-variant-numeric: tabular-nums; }
.toy-session .toy-main { width: 100%; padding: 18px; font-size: 1.4rem; letter-spacing: .02em; }
.toy-box { padding: 14px; box-shadow: none; border-width: 2px; }
.toy-session .inline input[type=text] { flex: 1 1 180px; width: auto; }
.toy-devices { margin: 0; padding-left: 18px; }
.toy-log { font: 500 .8rem/1.4 ui-monospace, monospace; white-space: pre-wrap; max-height: 180px; overflow-y: auto; }
.toy-session .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); border: 2px solid var(--ink); vertical-align: -1px; margin-right: 6px; }
.toy-session .dot.on { background: var(--mint); }
.toy-session .dot.err { background: var(--red); }

/* Short number boxes (e.g. pauses allowed) */
input[type=number].narrow { width: 9.5em; }

/* Prize wheel */
.wheel-wrap { position: relative; width: min(100%, 460px); margin: 0 auto; }
.wheel { display: block; width: 100%; height: auto; overflow: visible; }
.wheel text { font-weight: 700; pointer-events: none; }
.wheel [data-action] { cursor: help; }
.wheel [data-spin] { transform-origin: 0 0; }
.slice-tip {
  position: fixed; z-index: 50; pointer-events: none;
  max-width: min(280px, calc(100vw - 16px));
  padding: 6px 10px;
  background: var(--ink); color: #fff;
  border-radius: 10px;
  font-size: .85rem; font-weight: 700; line-height: 1.3;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .25);
}
.slice-tip[hidden] { display: none; }
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 1;
  width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 24px solid var(--ink);
}
.spin-result { text-align: center; }
.spin-result:empty { display: none; }
.spin-result .note { text-align: left; }
.spin-result h2.plus { color: #138a5e; }
.spin-result h2.minus { color: var(--red); }
.spin-result .says { font-weight: 800; font-size: .9rem; text-align: left; margin-top: 8px; }
.spin-row { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spin-row [data-action=wheel-mute] { text-decoration: none; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
