/* Home Butler — tuned for a 1280x800 frame read from ~3 m away. */
:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1b2027;
  --line: #262c35;
  --text: #eef1f4;
  --muted: #8b95a3;
  --accent: #f2b25c;      /* warm amber */
  --good: #7fcf9a;
  --urgent: #ff7b6b;
  --info: #7fb4ff;
  --accent-2: #ffd08a;
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #1c2536, transparent 70%), radial-gradient(900px 600px at 110% 110%, #1d1a2e, transparent 70%), #0b0d10;
  /* one colour per module, so cards are easy to tell apart from across the room */
  --c-weather: #6cb8ff;
  --c-commute: #ffb347;
  --c-menu: #6fdc8c;
  --c-shows: #c792ff;
  --c-reminders: #ff8fb1;
  --c-board: #ffd75e;
  --radius: 22px;
  --gap: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { background: var(--bg-grad); transition: background 2s; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 28px;
  line-height: 1.25;
  overflow: hidden;
  cursor: none;                 /* touch frame: hide the pointer */
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body.has-mouse { cursor: default; }

#app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 22px 30px 14px;
  transition: filter 1.5s ease, transform 2s ease;
  position: relative; z-index: 1;
}

/* ---------- header ---------- */
.top { display: flex; align-items: flex-end; gap: 28px; }
.time-block { display: flex; align-items: baseline; gap: 24px; }
.clock { font-size: 112px; font-weight: 300; letter-spacing: -3px; line-height: .9; font-variant-numeric: tabular-nums; }
.clock .ampm { font-size: 36px; letter-spacing: 0; margin-left: 6px; color: var(--muted); }
.date { font-size: 34px; color: var(--muted); white-space: nowrap; }
.banner { white-space: nowrap; background: var(--accent); color: #1a1205; padding: 6px 18px; border-radius: 999px; font-size: 26px; font-weight: 600; }
.status { margin-left: auto; max-width: 260px; font-size: 18px; color: var(--muted); text-align: right; }
.status .bad { color: var(--urgent); }

/* ---------- views ---------- */
.view { min-height: 0; overflow: hidden; }
.home { height: 100%; display: grid; grid-template-columns: 400px 1fr; gap: var(--gap); }
.side, .main-col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--mc, var(--line)); border-radius: var(--radius); padding: 20px 24px; }
.card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--mc, var(--muted)); }
.card .big { font-size: 36px; font-weight: 600; }
.card .sub { font-size: 24px; color: var(--muted); }
.card .line { margin-top: 6px; }
.stale { font-size: 18px; color: var(--muted); margin-top: 8px; }
.stale.old { color: var(--accent); }

/* weather */
.wx-now { display: flex; align-items: center; gap: 18px; }
.wx-icon { font-size: 76px; line-height: 1; }
.wx-temp { font-size: 84px; font-weight: 300; line-height: 1; }
.wx-advice { margin-top: 12px; font-size: 26px; color: var(--advice, var(--accent)); font-weight: 600; }

/* nudges */
.nudges { display: flex; flex-direction: column; gap: 16px; }
.nudge {
  display: grid; grid-template-columns: 76px 1fr; gap: 20px; align-items: center;
  background: var(--panel-2); border-radius: var(--radius); padding: 18px 26px 18px 20px;
  border-left: 8px solid var(--mc, var(--info));
}
.nudge.p-urgent { border-left-color: var(--urgent); box-shadow: 0 0 0 2px rgba(255,123,107,.35), 0 0 40px rgba(255,123,107,.18); }
.nudge.p-urgent .icon { background: rgba(255,123,107,.2); }
.nudge .icon { font-size: 44px; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--mc-soft, rgba(255,255,255,.06)); }
.nudge .text { font-size: 38px; font-weight: 600; line-height: 1.15; }
.nudge .detail { font-size: 25px; color: var(--muted); margin-top: 4px; }
.calm { display: flex; align-items: center; gap: 18px; font-size: 38px; color: var(--good); padding: 30px 26px; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); margin: 0; }
.calm::before { content: "✓"; font-size: 48px; }

.chips { display: flex; gap: var(--gap); flex-wrap: wrap; }
.chips .card { flex: 1 1 0; min-width: 0; }

/* lists & grids for full views */
.full { height: 100%; display: grid; gap: var(--gap); min-height: 0; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-week { grid-template-columns: 1.6fr 1fr; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
.list li:last-child { border-bottom: 0; }
.list .r { color: var(--muted); text-align: right; white-space: nowrap; }
.list .soon { color: var(--accent); }
.steps li { display: block; }
.steps .when { color: var(--accent); font-size: 22px; display: block; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week .day { background: var(--panel-2); border-radius: 16px; padding: 12px; font-size: 21px; min-height: 0; }
.week .day.today { outline: 3px solid var(--accent); background: var(--panel); }
.week .day.office::after { content: "Office"; display: block; margin-top: 8px; font-size: 16px; color: var(--info); }
.week .dname { font-size: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.week .meal { margin-top: 6px; }
.week .meal b { display: block; font-size: 15px; color: var(--muted); font-weight: 500; }
.grocery { columns: 3; column-gap: 32px; font-size: 22px; }
.grocery li { break-inside: avoid; padding: 5px 0; }
.scroll { overflow: auto; min-height: 0; }

/* ---------- tabs (touch + macro pad hints) ---------- */
.tabs { display: flex; gap: 10px; justify-content: center; opacity: .55; transition: opacity .3s; }
.tabs:hover, .tabs:focus-within { opacity: 1; }
.tabs button {
  font: inherit; font-size: 20px; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; min-height: 48px;
}
.tabs button.active { color: var(--text); border-color: var(--accent); background: rgba(255,255,255,.06); }
.tabs kbd { font: inherit; font-size: 15px; color: var(--accent); margin-right: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 24px; border-radius: 999px; font-size: 22px;
}

/* ---------- night mode (10pm–6am, or toggled) ---------- */
body.night #app { filter: brightness(.38) sepia(.35); }
body.night .tabs, body.night .chips, body.night .side .card:not(.wx) { display: none; }
body.night .home { grid-template-columns: 1fr; }
body.night .side { display: none; }
body.night .nudge:nth-child(n+2) { display: none; }
body.night .clock { font-size: 200px; }
body.night .top { justify-content: center; }
body.night .time-block { flex-direction: column; align-items: center; gap: 4px; }
body.night .status, body.night .deco, body.night .greeting { display: none; }

.card.wide .big { font-size: 40px; }

/* ---------- module colours ---------- */
.m-weather   { --mc: var(--c-weather);   --mc-soft: rgba(108,184,255,.16); }
.m-commute   { --mc: var(--c-commute);   --mc-soft: rgba(255,179,71,.16); }
.m-menu      { --mc: var(--c-menu);      --mc-soft: rgba(111,220,140,.16); }
.m-shows     { --mc: var(--c-shows);     --mc-soft: rgba(199,146,255,.16); }
.m-reminders { --mc: var(--c-reminders); --mc-soft: rgba(255,143,177,.16); }
.m-board { --mc: var(--c-board); --mc-soft: rgba(255,215,94,.16); }
.m-photos { --mc: #ffffff; }
/* Rotating photo under the weather: fills the rest of the left column. */
.card.photo { padding: 0; overflow: hidden; position: relative; flex: 1; min-height: 200px; border-top: 0; }
.card.photo img { display: block; width: 100%; height: 100%; object-fit: cover; animation: photoIn 1.2s ease-out; }
.card.photo .by { position: absolute; left: 12px; bottom: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 18px; }
@keyframes photoIn { from { opacity: 0; } to { opacity: 1; } }
body.night .card.photo { display: none; }

/* ---------- family board: sticky notes + ✓ button ---------- */
.nudge.with-done { grid-template-columns: 76px 1fr 84px; }
.nudge .done {
  width: 76px; height: 76px; border-radius: 50%; border: 2px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06); color: var(--text); font-size: 38px; cursor: pointer;
}
.nudge .done:active { background: rgba(255,255,255,.2); }
.nudge.sticky { background: #3a3220; border-left-color: var(--c-board); transform: rotate(-.4deg); }
.nudge.sticky .text { color: #fff4cc; }
.grocery.added li span:first-child { color: var(--c-board); }
/* Handwritten note: the drawing itself is the sticky (yellow paper, dark ink). */
.nudge.drawn .ink { display: block; height: 190px; width: auto; max-width: 100%; transform: rotate(-1.2deg);
  box-shadow: 0 6px 18px rgba(0,0,0,.45); border-radius: 14px; margin-bottom: 8px; }

/* ---------- greeting / countdown pill ---------- */
.greeting {
  white-space: nowrap; padding: 8px 22px; border-radius: 999px; font-size: 28px; font-weight: 700;
  color: #14100a; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 30px rgba(0,0,0,.3);
}

/* ---------- themes ----------
   Each sets the background, panel tints and the two accent colours. Seasons run by
   month; holidays come from config.json → theme.holidays. Preview with ?theme=name. */
body[data-theme="winter"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #1d3557, transparent 70%), radial-gradient(900px 600px at 110% 110%, #14264a, transparent 70%), #090e18;
  --panel: rgba(18,28,46,.85); --panel-2: rgba(24,38,62,.92); --line: #22324d; --accent: #9fd3ff; --accent-2: #e6f4ff;
}
body[data-theme="spring"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #3b2140, transparent 70%), radial-gradient(900px 600px at 110% 110%, #1b3a2a, transparent 70%), #0c110f;
  --panel: rgba(22,30,26,.85); --panel-2: rgba(30,42,36,.92); --line: #2a3a31; --accent: #ffb7d5; --accent-2: #a8f0b4;
}
body[data-theme="summer"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #0f4a4a, transparent 70%), radial-gradient(900px 600px at 110% 110%, #4a3a10, transparent 70%), #081214;
  --panel: rgba(14,32,36,.85); --panel-2: rgba(18,44,48,.92); --line: #1f3c40; --accent: #ffd166; --accent-2: #4dd6c8;
}
body[data-theme="autumn"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #4a2410, transparent 70%), radial-gradient(900px 600px at 110% 110%, #3a1a08, transparent 70%), #110a06;
  --panel: rgba(36,22,14,.85); --panel-2: rgba(48,30,18,.92); --line: #4a2e1c; --accent: #ff9f43; --accent-2: #ffd08a;
}
body[data-theme="christmas"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #0f4a2a, transparent 70%), radial-gradient(900px 600px at 110% 110%, #5a0f1c, transparent 70%), #07120c;
  --panel: rgba(12,36,24,.85); --panel-2: rgba(18,48,32,.92); --line: #1f4a33; --accent: #ff4d5e; --accent-2: #f5c84b; --advice: #f5c84b;
}
body[data-theme="newyear"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #2a2160, transparent 70%), radial-gradient(900px 600px at 110% 110%, #3d2a08, transparent 70%), #06061a;
  --panel: rgba(18,18,44,.85); --panel-2: rgba(26,26,60,.92); --line: #2c2c5a; --accent: #f5c84b; --accent-2: #c9b6ff;
}
body[data-theme="diwali"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #5a1250, transparent 70%), radial-gradient(900px 600px at 110% 110%, #6a3808, transparent 70%), #12051a;
  --panel: rgba(38,12,44,.85); --panel-2: rgba(52,18,58,.92); --line: #4e2356; --accent: #ffb020; --accent-2: #ff5fa2;
}
body[data-theme="pongal"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #4a3d05, transparent 70%), radial-gradient(900px 600px at 110% 110%, #1d4a1d, transparent 70%), #0e0d05;
  --panel: rgba(34,30,10,.85); --panel-2: rgba(46,40,14,.92); --line: #4a4018; --accent: #ffd23f; --accent-2: #7ed957;
}
body[data-theme="holi"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #4a1060, transparent 70%), radial-gradient(900px 600px at 110% 110%, #0a4a50, transparent 70%), #0e0a18;
  --panel: rgba(26,18,40,.82); --panel-2: rgba(34,24,52,.9); --line: #3a2a55; --accent: #ff5fa2; --accent-2: #4de2ff;
}
body[data-theme="halloween"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #3a0f4a, transparent 70%), radial-gradient(900px 600px at 110% 110%, #4a2206, transparent 70%), #0d0710;
  --panel: rgba(30,14,36,.85); --panel-2: rgba(40,20,48,.92); --line: #3e2448; --accent: #ff7a1a; --accent-2: #b77dff;
}
body[data-theme="canada"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #5a0a0a, transparent 70%), radial-gradient(900px 600px at 110% 110%, #2a0808, transparent 70%), #110707;
  --panel: rgba(36,14,14,.85); --panel-2: rgba(48,18,18,.92); --line: #4a2020; --accent: #ff4040; --accent-2: #ffffff; --advice: #ffffff;
}
body[data-theme="thanksgiving"] {
  --bg-grad: radial-gradient(1100px 700px at 15% -15%, #5a2a0a, transparent 70%), radial-gradient(900px 600px at 110% 110%, #3a2a08, transparent 70%), #110a06;
  --panel: rgba(36,22,14,.85); --panel-2: rgba(48,30,18,.92); --line: #4a2e1c; --accent: #ffb347; --accent-2: #e0703a;
}

/* ---------- decorations (behind everything, never clickable, off at night) ---------- */
.deco { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.deco i { position: absolute; font-style: normal; }
/* Move only for a minute (see playDecor in themes.js), then freeze: zero CPU while still. */
.deco.moving i { will-change: transform; }
.deco:not(.moving) *, .deco:not(.moving) *::before, .deco:not(.moving) *::after { animation-play-state: paused !important; }

.flake { top: -20px; width: var(--s); height: var(--s); border-radius: 50%; background: rgba(255,255,255,.75);
  animation: fall var(--d) linear var(--delay) infinite; }
.drop { top: -50px; font-size: var(--s); opacity: .5; animation: fallspin var(--d) linear var(--delay) infinite; }
.confetti { top: -20px; width: var(--s); height: calc(var(--s) * .45); border-radius: 2px; opacity: .8;
  animation: fallspin var(--d) linear var(--delay) infinite; }
.confetti:nth-child(4n+1) { background: #f5c84b; } .confetti:nth-child(4n+2) { background: #ff5fa2; }
.confetti:nth-child(4n+3) { background: #4de2ff; } .confetti:nth-child(4n)   { background: #ffffff; }
@keyframes fall     { from { transform: translate3d(0, -5vh, 0); } to { transform: translate3d(var(--drift), 108vh, 0); } }
@keyframes fallspin { from { transform: translate3d(0, -5vh, 0) rotate(0); } to { transform: translate3d(var(--drift), 108vh, 0) rotate(540deg); } }

.spark { width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, #fff 0, var(--accent) 45%, transparent 70%);
  box-shadow: 0 0 10px var(--accent); animation: twinkle var(--d) ease-in-out var(--delay) infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.3); } 50% { opacity: .9; transform: scale(1.3); } }

.blob { width: 520px; height: 520px; border-radius: 50%; animation: drift var(--d) ease-in-out var(--delay) infinite alternate; }
.blob.c0 { background: radial-gradient(circle, rgba(255,95,162,.30), transparent 65%); }
.blob.c1 { background: radial-gradient(circle, rgba(255,214,0,.25), transparent 65%); }
.blob.c2 { background: radial-gradient(circle, rgba(77,226,255,.25), transparent 65%); }
.blob.c3 { background: radial-gradient(circle, rgba(94,230,120,.25), transparent 65%); }
.blob.c4 { background: radial-gradient(circle, rgba(255,140,40,.28), transparent 65%); }
.blob.c5 { background: radial-gradient(circle, rgba(160,110,255,.28), transparent 65%); }
@keyframes drift { from { transform: translate3d(-60px, -30px, 0); } to { transform: translate3d(80px, 50px, 0); } }

.bat { font-size: 34px; opacity: .45; animation: flutter var(--d) ease-in-out var(--delay) infinite alternate; }
@keyframes flutter { from { transform: translate3d(-30px, 0, 0) scale(.9); } to { transform: translate3d(40px, -24px, 0) scale(1.05); } }

/* Christmas fairy lights along the top edge */
.lights { position: absolute; top: 0; left: 0; right: 0; height: 40px; display: flex; justify-content: space-between; padding: 0 14px;
  background: radial-gradient(120% 40px at 50% -10px, transparent 60%, rgba(255,255,255,.12) 62%, transparent 64%) 0 0 / 80px 40px repeat-x; }
.lights i { position: relative; width: 12px; height: 18px; border-radius: 50% 50% 45% 45%; margin-top: 10px;
  animation: bulb 3.2s ease-in-out infinite; }
.lights i:nth-child(even) { margin-top: 18px; }
.lights i:nth-child(4n+1) { background: #ff4d5e; color: #ff4d5e; }
.lights i:nth-child(4n+2) { background: #f5c84b; color: #f5c84b; animation-delay: -.8s; }
.lights i:nth-child(4n+3) { background: #5ee07a; color: #5ee07a; animation-delay: -1.6s; }
.lights i:nth-child(4n)   { background: #6cb8ff; color: #6cb8ff; animation-delay: -2.4s; }
@keyframes bulb { 0%, 100% { opacity: .45; box-shadow: none; } 50% { opacity: 1; box-shadow: 0 0 14px 3px currentColor; } }

/* Diwali diyas in the bottom corners */
.diyas { position: absolute; bottom: 10px; display: flex; gap: 18px; }
.diyas.left { left: 24px; } .diyas.right { right: 24px; }
.diyas i { position: relative; display: block; width: 46px; height: 20px; margin-top: 30px;
  background: linear-gradient(#d9772b, #8a3b12); border-radius: 4px 4px 23px 23px / 4px 4px 20px 20px;
  animation: flicker 2.6s ease-in-out infinite alternate; }
.diyas i::before { content: ''; position: absolute; left: 16px; top: -26px; width: 14px; height: 24px;
  background: radial-gradient(circle at 50% 70%, #fff6c2 0 25%, #ffc23a 45%, #ff7a00 75%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%; box-shadow: 0 0 22px 6px rgba(255,176,32,.55); }
.diyas i:nth-child(2) { animation-delay: -.9s; } .diyas i:nth-child(3) { animation-delay: -1.7s; }
@keyframes flicker { from { opacity: .75; transform: translateY(0) scale(1); } to { opacity: 1; transform: translateY(-2px) scale(1.04); } }

/* Pongal kolam dots, and a soft sun glow for summer/pongal */
.kolam { position: absolute; right: -80px; bottom: -80px; width: 420px; height: 420px; border-radius: 50%; opacity: .28;
  background: radial-gradient(circle, rgba(255,255,255,.7) 2px, transparent 3px) 0 0 / 26px 26px;
  -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%); mask: radial-gradient(circle, #000 35%, transparent 70%); }
.glow { position: absolute; top: -260px; right: -220px; width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,209,102,.22), transparent 62%); }

/* Marigold garland (toran) along the top for Diwali / Pongal */
.toran { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 6px; }
.toran i { position: relative; width: 18px; height: 18px; border-radius: 50%; margin-top: 4px;
  background: radial-gradient(circle at 35% 35%, #ffd54a, #ff9800 70%); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.toran i:nth-child(3n+2) { background: radial-gradient(circle at 35% 35%, #fff176, #ffb300 70%); }
.toran i:nth-child(6n) { width: 12px; height: 22px; border-radius: 50% 0; margin-top: 10px; background: #3fa34d; }
.toran i:nth-child(odd) { margin-top: 9px; }
