/* The one theme every page shares: a soft meadow with white cards. Change colours here only. */
:root {
  --bg: linear-gradient(180deg, #e8f4ff 0%, #f4f9ec 55%, #e4f2d6 100%) fixed;
  --card: #ffffff;
  --ink: #2a2433;
  --mute: #6f6880;
  --line: #e7e2ee;
  --brand: #6b4fd8;      /* buttons, links, active tab */
  --brand-soft: #efeaff;
  --nice: #1f9d55;
  --nice-soft: #e3f6ea;
  --naughty: #e0533d;
  --naughty-soft: #fde9e5;
  --gold: #f0a500;       /* points */
  --gold-soft: #fff4d6;
  --spikes: #7a5236;     /* the hedgehog */
  --radius: 16px;
  --shadow: 0 6px 20px #2a243314;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
a { color: var(--brand); }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.muted { color: var(--mute); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hidden { display: none !important; }

button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 10px 16px; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; touch-action: manipulation;
}
button:disabled { opacity: .45; cursor: default; }
button.ghost, .btn.ghost { background: var(--brand-soft); color: var(--brand); }
button.nice { background: var(--nice); }
button.naughty { background: var(--naughty); }
button.small { padding: 6px 12px; min-height: 34px; font-size: .875rem; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; max-width: 100%; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { min-height: 0; width: 20px; height: 20px; }
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: .85rem; }
.pill.nice { background: var(--nice-soft); color: var(--nice); }
.pill.naughty { background: var(--naughty-soft); color: var(--naughty); }
.pill.gold { background: var(--gold-soft); color: #9a6a00; }
.pill.wait { background: var(--brand-soft); color: var(--brand); }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); flex: none; display: inline-grid; place-items: center; font-weight: 800; color: var(--brand); }
.dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--naughty); color: #fff; font-size: .75rem; font-weight: 800; }

/* Lists of things (chores, rewards, history) */
ul.items { list-style: none; margin: 0; padding: 0; }
ul.items li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
ul.items li:first-child { border-top: 0; }
ul.items .what { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
ul.items li.off { opacity: .55; }
.empty { color: var(--mute); font-style: italic; padding: 8px 0; }

/* Header */
header.top { background: #ffffffd9; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .bar { max-width: 980px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
header.top .title { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1 1 auto; }
header.top nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; color: var(--ink); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
header.top nav a.on { background: var(--brand-soft); color: var(--brand); }
header.top .logo { height: 22px; }
@media (max-width: 700px) {
  header.top nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  header.top nav a { padding: 6px 10px; white-space: nowrap; }
}

/* Dialog */
dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px #0004; }
dialog::backdrop { background: #2a243366; }
dialog form { display: grid; gap: 12px; }
dialog .row { justify-content: flex-end; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--naughty); }

/* Sparkle burst */
.spark { position: fixed; pointer-events: none; z-index: 60; font-size: 22px; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .875rem; font-weight: 700; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* Wheel */
.wheel { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 12px auto; }
.wheel svg { width: 100%; height: 100%; display: block; }
.wheel .pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 24px solid var(--ink); z-index: 2; }

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