/* Family Wall: landscape-first wall iPad calendar. All sizes are in rem; root font scales with the screen
   (16px at 1180x820, ~18.5px at 1366x1024). No hover-dependent UI. */
:root {
  --bg: #070b14; --panel: #0d1424; --panel2: #121b30; --line: rgba(160,185,235,.13);
  --text: #e8edf7; --text2: #9fadc9; --text3: #66748f;
  --c-luke: #43d68a; --c-mary: #f58bc1; --c-duke: #4da3ff; --c-personal: #3ccfcf; --c-family: #b79bff; --c-northreach: #ffa24d; --c-holiday: #f2c94c;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: min(1.356vw, 1.951vh); -webkit-text-size-adjust: 100%; background: var(--bg); }
@media (orientation: portrait) { html { font-size: min(1.951vw, 1.356vh); } }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: radial-gradient(120% 90% at 0% 0%, #0e1830 0%, var(--bg) 60%);
  color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
body.night { filter: brightness(.55) saturate(.85); } /* dim overnight */
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---- layout ---- */
.wall { position: fixed; inset: 0; display: grid; grid-template-columns: 31% 1fr; gap: .8rem;
  padding: calc(.9rem + var(--safe-t)) 1rem calc(.9rem + var(--safe-b)); }
.side { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 1.2rem; padding: 1.1rem 1.2rem .6rem; }
.month { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 1.2rem; padding: .9rem 1rem .6rem; }
@media (orientation: portrait) {
  .wall { grid-template-columns: 1fr; grid-template-rows: 38% 1fr; }
  .side { padding: .9rem 1.2rem .5rem; }
}

/* ---- clock + agenda ---- */
.clockbox { flex: none; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.clock { font-size: 4.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.clock .ap { font-size: 1.6rem; font-weight: 600; color: var(--text2); margin-left: .35rem; letter-spacing: 0; }
.date { margin-top: .35rem; font-size: 1.55rem; font-weight: 500; color: var(--text2); }
@media (orientation: portrait) { .clockbox { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; } .clock { font-size: 3.6rem; } .date { margin: 0; font-size: 1.7rem; text-align: right; } }

.agenda-wrap { flex: 1; min-height: 0; position: relative; margin-top: .3rem; }
.agenda-wrap::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2rem; background: linear-gradient(transparent, var(--panel)); pointer-events: none; }
.agenda { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2rem; scrollbar-width: none; }
.agenda::-webkit-scrollbar { display: none; }
.dayhead { display: flex; align-items: baseline; justify-content: space-between; margin: .85rem 0 .35rem; font-size: 1.05rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text2); }
.dayhead.today { font-size: 1.2rem; color: #ffd166; }
.dayhead small { font-size: .9rem; letter-spacing: 0; font-weight: 500; color: var(--text3); text-transform: none; }
.back-btn { margin: .6rem 0 0; padding: .55rem 1rem; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 1rem; font-weight: 600; color: var(--text); }
.ev { display: flex; gap: .75rem; padding: .5rem 0 .5rem .1rem; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev .bar { flex: none; width: .3rem; border-radius: .2rem; background: var(--cc, var(--c-personal)); }
.ev .t { flex: none; width: 5.3rem; font-size: 1.1rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.3; }
.ev .t small { display: block; font-size: .85rem; font-weight: 500; color: var(--text3); }
.ev .b { min-width: 0; flex: 1; }
.ev .ti { font-size: 1.4rem; font-weight: 600; line-height: 1.22; display: flex; align-items: center; gap: .45rem; }
.ev .ti span.tx { min-width: 0; overflow-wrap: anywhere; }
.ev .lo { margin-top: .12rem; font-size: .95rem; color: var(--text3); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.past { opacity: .42; }
.ev.now { background: linear-gradient(90deg, rgba(255,209,102,.16), transparent 80%); border-radius: .5rem; }
.empty { margin: .4rem 0 .2rem; font-size: 1.15rem; color: var(--text3); }
.side-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .4rem; font-size: .85rem; color: var(--text3); }
.status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.warn { color: #ffb454; }
.lock-btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .7rem; border-radius: .6rem; color: var(--text3); font-size: .85rem; }
.lock-btn.armed { background: #5b1f2a; color: #ffd0d6; }

/* sport icons (no badges) */
.ev-icon, .chip-icon { display: inline-flex; flex: none; align-items: center; justify-content: center; font-style: normal; line-height: 1; }
.ev-icon { width: 1.35rem; height: 1.35rem; font-size: 1.25rem; }
.ev-icon svg, .chip-icon svg { width: 100%; height: 100%; display: block; }
.chip-icon { width: 1rem; height: 1rem; font-size: .92rem; }

/* ---- month ---- */
.month-head { flex: none; display: flex; align-items: center; gap: .8rem; padding-bottom: .55rem; }
.m-title { flex: 1; margin: 0; font-size: 2.3rem; font-weight: 700; letter-spacing: -.01em; }
.nav-btn { width: 3.6rem; height: 3.6rem; border-radius: 1rem; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text); }
.nav-btn:active, .today-btn:active, .back-btn:active { background: #1d2a4a; }
.today-btn { height: 3.6rem; padding: 0 1.4rem; border-radius: 1rem; background: var(--panel2); border: 1px solid var(--line); font-size: 1.15rem; font-weight: 700; }
.today-btn[disabled] { opacity: .35; }
.dow { flex: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; padding-bottom: .3rem; font-size: .95rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); text-align: center; }
.grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; }
.cell { min-width: 0; min-height: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; gap: .12rem; padding: .3rem .25rem .2rem; border-radius: .6rem; background: var(--panel2); border: 1px solid transparent; position: relative; }
.cell.we { background: #101a30; }
.cell.other { opacity: .38; }
.cell.today { border-color: #ffd166; box-shadow: inset 0 0 0 1px rgba(255,209,102,.5); background: #1a2038; }
.cell.sel { border-color: #6ea0ff; }
.cell .n { flex: none; align-self: flex-start; min-width: 1.7rem; height: 1.7rem; padding: 0 .3rem; display: grid; place-items: center; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; border-radius: 999px; line-height: 1; }
.cell.today .n { background: #ffd166; color: #1b1405; }
.chips { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .14rem; overflow: hidden; }
.chip { flex: none; display: flex; align-items: center; gap: .25rem; min-height: 1.5rem; padding: .12rem .25rem .12rem .22rem; border-radius: .3rem; font-size: .9rem; font-weight: 600; line-height: 1.12; overflow: hidden;
  background: color-mix(in srgb, var(--cc) 24%, transparent); border-left: .22rem solid var(--cc); color: #f1f4fb; }
.chip .tx { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.more { flex: none; height: 1.2rem; line-height: 1.2rem; font-size: .82rem; font-weight: 700; color: var(--text2); padding-left: .3rem; }
.legend { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.3rem; padding: .5rem 0 .2rem; font-size: .95rem; color: var(--text2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: .8rem; height: .8rem; border-radius: .25rem; background: var(--cc); display: inline-block; }
.slide-l { animation: sl .28s ease-out; } .slide-r { animation: sr .28s ease-out; }
@keyframes sl { from { opacity: 0; transform: translateX(2rem); } to { opacity: 1; transform: none; } }
@keyframes sr { from { opacity: 0; transform: translateX(-2rem); } to { opacity: 1; transform: none; } }

/* category colors */
.c-luke { --cc: var(--c-luke); } .c-mary { --cc: var(--c-mary); } .c-duke { --cc: var(--c-duke); } .c-personal { --cc: var(--c-personal); }
.c-family { --cc: var(--c-family); } .c-northreach { --cc: var(--c-northreach); } .c-holiday { --cc: var(--c-holiday); }

/* ---- lock + loading ---- */
.lock { position: fixed; inset: 0; display: grid; place-items: center; padding: 2rem; }
.lock-inner { width: min(28rem, 100%); text-align: center; }
.lock-title { font-size: 2.6rem; margin: 0 0 .3rem; }
.lock-sub { color: var(--text2); font-size: 1.2rem; margin: 0 0 1.4rem; }
.pass-input { width: 100%; font-size: 1.5rem; padding: .9rem 1rem; border-radius: .9rem; border: 1px solid var(--line); background: var(--panel2); color: var(--text); text-align: center; -webkit-user-select: text; user-select: text; }
.lock-error { min-height: 1.4rem; color: #ff8a8a; font-size: 1.05rem; margin: .6rem 0; }
.primary-btn { width: 100%; font-size: 1.4rem; font-weight: 700; padding: .9rem; border-radius: .9rem; background: #3b6cff; color: #fff; }
.primary-btn[disabled] { opacity: .5; }
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1rem; background: rgba(7,11,20,.86); font-size: 1.3rem; color: var(--text2); z-index: 5; }
.spinner { width: 3rem; height: 3rem; border-radius: 50%; border: .3rem solid var(--line); border-top-color: #6ea0ff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .slide-l, .slide-r, .spinner { animation: none; } }
