/* Family Hub — TV-first dark theme. Type scales with viewport so the same
   templates read at 3 m on the TV and stay sane on tablets/phones. */
:root {
  --bg: #101418; --panel: #1a2129; --panel2: #232c37;
  --text: #e8edf2; --dim: #8fa1b3; --accent: #5ec26a; --warn: #e2b93b;
  --danger: #e06c5b; --radius: 0.6rem;
}
* { box-sizing: border-box; }
html { font-size: clamp(14px, 1.4vw, 22px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, sans-serif; line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; color: var(--dim);
     text-transform: uppercase; letter-spacing: 0.06em; }

.topbar { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--panel2); }
.topbar .spacer { flex: 1; }
.topbar a { color: var(--dim); margin-left: 1rem; }

.grid { display: grid; gap: 1rem; padding: 1rem 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.tv .grid { grid-template-columns: 1.3fr 1fr 1fr; height: calc(100vh - 4rem); }
@media (max-width: 900px) { .tv .grid { grid-template-columns: 1fr; height: auto; } }

.panel { background: var(--panel); border-radius: var(--radius); padding: 1rem;
  overflow-y: auto; }

/* events */
.day { margin-bottom: 0.8rem; }
.day .dayname { color: var(--dim); font-size: 0.85rem; }
.day.today .dayname { color: var(--accent); font-weight: 700; }
.event { display: flex; gap: 0.6rem; padding: 0.35rem 0.5rem; margin: 0.2rem 0;
  background: var(--panel2); border-radius: 0.4rem; align-items: baseline; }
.event .time { color: var(--dim); font-variant-numeric: tabular-nums;
  min-width: 3.2rem; font-size: 0.85rem; }
.event .cat { margin-left: auto; }
.badge { font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 1rem;
  background: var(--panel2); color: var(--dim); }
.badge.stale { background: #4a3d1e; color: var(--warn); }

/* chore board */
.kidcol { margin-bottom: 1rem; }
.kidhead { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.kidhead .avatar { font-size: 1.6rem; }
.kidhead .pts { margin-left: auto; color: var(--warn); font-weight: 700; }
.chore { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem;
  margin: 0.25rem 0; background: var(--panel2); border-radius: 0.4rem; }
.chore.done { opacity: 0.55; text-decoration: line-through; }
.chore.overdue { outline: 1px solid var(--danger); }
.chore .pts { margin-left: auto; color: var(--warn); font-size: 0.85rem; white-space: nowrap; }
.chore button { font-size: 1rem; }

/* projects */
.tile { background: var(--panel2); border-radius: 0.4rem; padding: 0.6rem 0.8rem;
  margin: 0.4rem 0; }
.tile .status { float: right; }
.status.active { color: var(--accent); } .status.waiting { color: var(--warn); }
.status.done { color: var(--dim); }
.tile .latest { color: var(--dim); font-size: 0.85rem; margin-top: 0.2rem; }
.hedge-stats { display: flex; gap: 1rem; margin-top: 0.3rem; font-size: 0.9rem; }
.hedge-stats b { color: var(--accent); }

/* forms & buttons */
button, .btn { background: var(--accent); color: #08210d; border: 0;
  border-radius: 0.4rem; padding: 0.45rem 0.9rem; font-weight: 700; cursor: pointer;
  font-size: 0.95rem; }
button.secondary { background: var(--panel2); color: var(--text); }
button.danger { background: var(--danger); color: #2a0d08; }
input, select { background: var(--panel2); color: var(--text);
  border: 1px solid #33404e; border-radius: 0.4rem; padding: 0.45rem 0.6rem;
  font-size: 1rem; }
form.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  margin: 0.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
td, th { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--panel2); text-align: left; }
.dim { color: var(--dim); } .small { font-size: 0.85rem; }
.token { font-family: ui-monospace, monospace; background: var(--panel2);
  padding: 0.2rem 0.4rem; border-radius: 0.3rem; word-break: break-all; }

/* auth pages */
.center { display: grid; place-items: center; min-height: 100vh; }
.card { background: var(--panel); border-radius: var(--radius); padding: 2rem;
  min-width: 20rem; }
.error { color: var(--danger); }

/* kid mode */
.kidmode .chore { font-size: 1.3rem; padding: 0.8rem; }
.kidmode .chore button { font-size: 1.3rem; padding: 0.6rem 1.2rem; }
.kidmode h1 { font-size: 2.2rem; }
.bigpts { font-size: 3rem; color: var(--warn); font-weight: 800; }

/* celebration */
@keyframes pop { 0% {transform: scale(1);} 30% {transform: scale(1.04);} 100% {transform: scale(1);} }
body.celebrate .panel { animation: pop 0.6s ease; }
body.celebrate::after { content: "🎉"; position: fixed; inset: auto 1rem 1rem auto;
  font-size: 4rem; animation: pop 0.6s ease; }

/* night dimming for the TV (22:00–07:00 via JS class) */
body.night { filter: brightness(0.55); }

/* phones */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; row-gap: 0.2rem; padding: 0.6rem 0.8rem; }
  .topbar h1 { font-size: 1.25rem; white-space: nowrap; }
  .grid { padding: 0.6rem 0.8rem; gap: 0.7rem; }
  .panel { padding: 0.8rem; }
}
