/* Family panel, light day theme + night mode.
 * Target: old Chromium WebView (Android 10). No flex "gap", no aspect-ratio, no inset, no :has.
 * Grid uses grid-gap (old name) together with gap. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #e9eef5; }
body {
  font-family: Roboto, "HarmonyOS Sans", "Segoe UI", Arial, sans-serif;
  color: #1d2433;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
ul { list-style: none; }

#stage {
  position: absolute; left: 0; top: 0;
  width: 1280px; height: 800px;
  transform-origin: 0 0;
}

/* ---------- Icons (inline SVG injected by app.js) ---------- */
.ico, [data-ico] svg { display: inline-block; vertical-align: middle; }
.ico svg { width: 100%; height: 100%; display: block; }

/* ---------- Day layout ---------- */
#day {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  padding: 14px 14px 8px;
  display: flex; flex-direction: column;
}
.row { display: grid; grid-gap: 12px; gap: 12px; margin-bottom: 12px; }
.row-top { grid-template-columns: 440px 1fr 360px; height: 292px; }
.row-mid { grid-template-columns: 390px 1fr; height: 104px; }
.row-bot { grid-template-columns: 390px 1fr 1fr 1fr; flex: 1; min-height: 0; }

.card {
  position: relative; overflow: hidden;
  background: #f7f9fc;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(30, 50, 90, 0.08);
}

/* Photo frame */
.photo { background: #c9d6e6; }
.ph {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 1.2s ease;
}
.ph.show { opacity: 1; }
.ph-nav {
  position: absolute; top: 50%; margin-top: -18px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.ph-prev { left: 12px; }
.ph-next { right: 12px; }
.ph-nav:after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; margin: -5px 0 0 -3px;
  border-left: 2.5px solid #1d2433; border-bottom: 2.5px solid #1d2433;
  transform: rotate(45deg);
}
.ph-next:after { margin-left: -7px; transform: rotate(-135deg); }
.ph-dots { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; }
.ph-dots i {
  display: inline-block; width: 8px; height: 8px; margin: 0 3px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}
.ph-dots i.on { background: #fff; }

/* Clock */
.clock { text-align: center; background: linear-gradient(#f9fbfe, #eef3f9); }
.clock-time {
  font-size: 150px; font-weight: 700; line-height: 1; letter-spacing: -4px;
  margin-top: 22px; color: #1f2a3d;
  font-variant-numeric: tabular-nums;
}
.clock-pill {
  display: inline-block; position: relative; z-index: 1;
  margin-top: 14px; padding: 8px 22px;
  border-radius: 22px; background: rgba(225, 232, 242, 0.95);
  font-size: 20px; font-weight: 500;
}
.clock-pill .ico { width: 22px; height: 22px; margin: -3px 8px 0 0; }
.clock-hills { position: absolute; left: 0; right: 0; bottom: 0; height: 110px; }
.clock-hills svg { width: 100%; height: 100%; display: block; }

/* Month calendar */
.cal { padding: 12px 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; height: 34px; }
.cal-title { font-size: 21px; font-weight: 600; }
.cal-btn { width: 40px; height: 34px; position: relative; }
.cal-btn:after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -3px;
  border-left: 2.5px solid #1d2433; border-bottom: 2.5px solid #1d2433;
  transform: rotate(45deg);
}
.cal-next:after { margin-left: -8px; transform: rotate(-135deg); }
.cal-grid { display: table; width: 100%; table-layout: fixed; margin-top: 4px; }
.cal-r { display: table-row; }
.cal-c {
  display: table-cell; text-align: center; vertical-align: middle;
  height: 33px; font-size: 18px; position: relative;
}
.cal-wd { font-size: 15px; color: #4a5568; height: 26px; }
.cal-we { color: #d63a3a; }
.cal-c b {
  display: inline-block; min-width: 34px; height: 30px; line-height: 30px;
  border-radius: 9px; font-weight: 400;
}
.cal-c.vac b { background: #e1f3e4; }
.cal-c.today b { background: #2f6fe4; color: #fff; font-weight: 600; }
.cal-c.mark:after {
  content: ""; position: absolute; left: 50%; bottom: 0; margin-left: -2.5px;
  width: 5px; height: 5px; border-radius: 50%; background: #9b6bdc;
}

/* Date card */
.date { display: flex; align-items: center; padding: 0 16px 0 22px; background: #dbe8fb; }
.date-ico { width: 46px; height: 46px; margin-right: 16px; color: #2f6fe4; flex-shrink: 0; }
.date-ico svg { width: 100%; height: 100%; }
.date-wd { font-size: 29px; font-weight: 700; white-space: nowrap; }
.date-full { font-size: 22px; color: #2b3446; margin-top: 2px; white-space: nowrap; }
.date-hol {
  margin-left: auto; text-align: center; padding: 6px 10px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.6); border-radius: 14px; max-width: 112px;
}
.date-hol-k { font-size: 14px; color: #4a5568; }
.date-hol-v { font-size: 18px; font-weight: 600; line-height: 1.15; }

/* Weather */
.weather { display: flex; align-items: center; padding: 0 18px 0 22px; }
.w-now { display: flex; align-items: center; flex: 1; min-width: 0; }
.w-ico { width: 84px; height: 70px; margin-right: 14px; }
.w-ico svg, .w-day-ico svg { width: 100%; height: 100%; display: block; }
.w-temp { font-size: 62px; font-weight: 700; margin-right: 26px; min-width: 96px; }
.w-place { font-size: 19px; font-weight: 500; white-space: nowrap; }
.w-place .ico { width: 18px; height: 18px; margin: -3px 6px 0 0; }
.w-desc { font-size: 17px; color: #4a5568; margin-top: 3px; }
.w-wind { font-size: 15px; color: #6b7588; margin-top: 2px; }
.w-days { display: flex; height: 84px; }
.w-day {
  width: 118px; text-align: center; border-left: 1px solid #dde3ec;
  padding-top: 2px;
}
.w-day-name { font-size: 16px; font-weight: 600; }
.w-day-ico { width: 40px; height: 32px; margin: 2px auto 0; }
.w-day-t { font-size: 16px; }
.w-day-p { font-size: 13px; color: #3c6fb5; }

/* Today list */
.today-card { padding: 14px 16px; background: #f7f9fc; }
.today-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.today-card h2 .ico { width: 26px; height: 26px; margin: -4px 10px 0 2px; }
.today-card li {
  display: flex; align-items: center;
  height: 42px; padding: 0 8px; margin-bottom: 4px; border-radius: 12px;
  font-size: 19px;
}
.today-card li .t {
  width: 68px; text-align: center; margin-right: 12px; flex-shrink: 0;
  background: #dde8f7; border-radius: 10px; padding: 4px 0; font-size: 18px; font-weight: 500;
}
.today-card li .dot {
  width: 12px; height: 12px; border-radius: 50%; margin-right: 10px; flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.18);
}
.today-card li .w { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-card li.hot { background: #fbd9d9; }
.today-card li.hot .t { background: #f6b3b3; }
.today-card li.past { opacity: 0.45; }
.today-card .empty { color: #6b7588; font-size: 18px; padding: 8px; }

/* Event tiles */
.tile { padding: 16px 18px; }
.tile h3 { font-size: 23px; font-weight: 700; display: flex; align-items: center; }
.tile h3 .ico { width: 34px; height: 34px; margin-right: 12px; flex-shrink: 0; }
.tile .sub { font-size: 18px; margin-top: 6px; }
.tile .big { font-size: 60px; font-weight: 700; margin-top: 14px; letter-spacing: -1px; }
.tile .txt { font-size: 20px; margin-top: 14px; line-height: 1.3; }
.tile .who { font-size: 17px; margin-top: 6px; color: #4a5568; }
.tile .art { position: absolute; right: 14px; bottom: 12px; width: 82px; height: 82px; opacity: 0.9; }
.tile .art svg { width: 100%; height: 100%; }

.tile-red { background: #fde3e3; }
.tile-red h3 { color: #c62828; text-transform: uppercase; }
.tile-red .sub { color: #c62828; }
.tile-red .big { color: #7a1a1a; }
.tile-red.calm { background: #eef1f6; }
.tile-red.calm h3, .tile-red.calm .sub { color: #3a4458; }
.tile-red.calm .big { color: #3a4458; }
/* Red blink: opacity-only animation (cheap on an old GPU). */
.tile-red.alarm:before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  border-radius: 20px; border: 6px solid #e53935; background: rgba(229, 57, 53, 0.22);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { opacity: 0; } }

.tile-yellow { background: #fdf1c3; }
.tile-yellow h3 { color: #5a4300; }
.tile-violet { background: #ece2fb; }
.tile-violet h3 { color: #4a2a86; }
.tile-violet.today-bd { background: #dcc8fa; }
.tile .none { font-size: 18px; color: #6b7588; margin-top: 14px; }

/* Bottom nav */
.nav { display: flex; height: 58px; align-items: center; justify-content: space-around; }
.nav a {
  display: flex; align-items: center; height: 46px; padding: 0 20px; border-radius: 14px;
  font-size: 19px; color: #3a4458;
}
.nav a .ico { width: 28px; height: 28px; margin-right: 10px; }
.nav a.active { background: #dbe8fb; color: #1d4fb8; font-weight: 600; }
.nav a:not(.active) { opacity: 0.75; }

/* Connection / access problem: small red pill, top centre, above everything */
#net {
  position: absolute; left: 50%; top: 6px; z-index: 10;
  width: 520px; margin-left: -260px; text-align: center;
  padding: 6px 14px; border-radius: 14px;
  background: #c62828; color: #fff; font-size: 16px;
}
body.is-night #net { background: #3a0608; color: #b3141c; }

/* ---------- Night mode 21:00–07:00 ---------- */
#night {
  display: none;
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  background: #000; color: #b3141c;
  align-items: center; justify-content: center;
}
body.is-night { background: #000; }
body.is-night #day { display: none; }
body.is-night #night { display: flex; }
.n-dial { width: 660px; height: 660px; display: block; }
.n-side { margin-left: 70px; width: 300px; color: #8c1016; }
.n-date { font-size: 30px; margin-bottom: 16px; }
.n-cal .cal-c { height: 34px; font-size: 19px; }
.n-cal .cal-wd { font-size: 15px; height: 28px; }
.n-cal .cal-c.today b { background: #6e0b10; color: #000; }
.n-cal .cal-we { color: inherit; }
.n-cal .cal-wd { color: #6e0b10; }
.n-cal .cal-c.mark:after { background: #6e0b10; }
.n-cal .cal-c.vac b { background: none; }
