/* Target: Android WebView 106. Plain hex colours and simple selectors only. */
:root {
  --bg: #0b0e14;
  --card: #141922;
  --card-hi: #1b2230;
  --line: #232b38;
  --text: #eef1f6;
  --dim: #98a2b3;
  --faint: #5f6a7b;
  --green: #34d399;
  --amber: #f5b041;
  --red: #f87171;
  --blue: #60a5fa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 1280px;
  height: 800px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: none; }
.hidden { display: none !important; }

.frame { position: relative; width: 1280px; height: 800px; padding: 22px 32px 28px; }

/* Header */
.top { display: flex; justify-content: space-between; align-items: flex-start; height: 112px; }
.clock { font-size: 72px; font-weight: 700; line-height: 0.95; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.date { margin-top: 10px; font-size: 22px; color: var(--dim); }
.weather { display: flex; align-items: flex-start; padding-top: 18px; }
.wx-block { margin-right: 28px; padding: 6px 28px 0 0; border-right: 1px solid var(--line); text-align: right; }
.wx-label { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); }
.wx-range { margin-top: 6px; font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-range span { color: var(--dim); font-weight: 500; }
.wx-sub { margin-top: 8px; font-size: 15px; color: var(--dim); }
.wx-now { text-align: right; }
.temp { font-size: 46px; font-weight: 700; line-height: 1; }
.cond { margin-top: 6px; font-size: 17px; color: var(--dim); }
.cond-extra { margin-top: 4px; font-size: 14px; color: var(--faint); }
.cond-extra.rain { color: var(--blue); }

/* Layout */
.grid { display: flex; gap: 22px; height: 638px; }
.col { display: flex; flex-direction: column; gap: 18px; }
.col.left { width: 686px; }
.col.right { width: 508px; }
.row { display: flex; gap: 18px; }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 24px; overflow: hidden; }
.card-head { display: flex; align-items: baseline; }
.card-head .meta { margin-left: auto; }
.card-head .meta + .meta { margin-left: 18px; }
.label { font-size: 14px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--dim); }
.meta { font-size: 13px; font-weight: 500; color: var(--faint); white-space: nowrap; }

/* Glucose */
.glucose { height: 330px; }
.g-banner { margin-top: 10px; padding: 6px 12px; border-radius: 8px; background: #3a2a10; color: var(--amber); font-size: 14px; font-weight: 700; }
.g-row { display: flex; align-items: center; height: 140px; }
.g-value { font-size: 120px; font-weight: 700; letter-spacing: -4px; line-height: 1; font-variant-numeric: tabular-nums; }
.g-side { margin-left: 10px; align-self: flex-end; padding-bottom: 22px; }
.g-unit { font-size: 20px; font-weight: 700; color: var(--dim); letter-spacing: -0.5px; }
.g-delta { margin-top: 4px; font-size: 18px; color: var(--dim); font-variant-numeric: tabular-nums; }
.g-arrow { width: 60px; height: 60px; margin-left: 26px; }
.g-arrow svg { width: 60px; height: 60px; display: block; }
.g-right { margin-left: 20px; }
.pill { display: inline-block; padding: 6px 16px; border-radius: 999px; font-size: 16px; font-weight: 700; color: #0b0e14; background: var(--green); }
.pill:empty { display: none; }
.g-predict { margin-top: 10px; font-size: 15px; color: var(--dim); }
.spark-wrap { position: relative; }
.spark { display: block; width: 632px; height: 110px; overflow: visible; }
.spark-window { position: absolute; right: 0; top: 104px; padding: 2px 8px; border-radius: 6px; background: var(--card-hi); font-size: 12px; font-weight: 700; color: var(--dim); }
.glucose.stale .g-value, .glucose.stale .g-side { color: var(--faint); }

/* Lights */
.lights { height: 128px; padding-top: 16px; padding-bottom: 16px; }
.chip-btn { margin-left: 16px; padding: 4px 12px; border-radius: 999px; background: var(--card-hi); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--dim); }
.tiles { display: flex; gap: 14px; margin-top: 12px; }
.tile { flex: 1; min-width: 0; height: 60px; display: flex; align-items: center; padding: 0 16px; border-radius: 14px; background: var(--card-hi); border: 1px solid var(--line); }
.tile i { flex: none; width: 30px; height: 30px; border-radius: 15px; margin-right: 14px; border: 2px solid var(--faint); }
.tile b { display: block; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { display: block; margin-top: 2px; font-size: 13px; color: var(--dim); }
.tile.on { background: #33291a; border-color: #5c4521; }
.tile.on i { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 18px #f5b04166; }
.tile.on span { color: var(--amber); }
.tile.busy { opacity: 0.6; }
.tile.offline b, .tile.offline span { color: var(--faint); }

/* Bottom row: reminders */
.bottom { flex: 1; min-height: 0; }
.reminders { flex: 1; min-width: 0; padding-top: 16px; padding-bottom: 12px; }
.r-list { margin-top: 8px; }
.r-item { display: flex; align-items: center; height: 30px; font-size: 17px; }
.r-item i { flex: none; width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--faint); margin-right: 12px; }
.r-item b { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-item span { margin-left: 12px; font-size: 13px; font-weight: 700; color: var(--dim); }
.r-item span.soon { color: var(--amber); }
.r-empty { margin-top: 10px; font-size: 16px; color: var(--faint); }

/* Agenda */
.agenda { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.allday { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.allday:empty { display: none; }
.chip { display: flex; align-items: center; max-width: 100%; padding: 6px 12px; border-radius: 10px; background: var(--card-hi); font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip i { flex: none; width: 8px; height: 8px; border-radius: 4px; margin-right: 8px; }
.events { flex: 1; min-height: 0; margin-top: 10px; overflow: hidden; }
.ev { display: flex; align-items: stretch; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ev.now { background: var(--card-hi); border-radius: 12px; border-bottom-color: transparent; }
.ev-time { flex: none; width: 84px; padding-top: 2px; }
.ev-time b { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-time span { display: block; margin-top: 3px; font-size: 13px; color: var(--dim); }
.ev-bar { flex: none; width: 4px; border-radius: 2px; margin-right: 14px; }
.ev-body { min-width: 0; flex: 1; }
.ev-tag { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; margin-bottom: 2px; }
.ev-title { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-sub { margin-top: 2px; font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-travel { display: flex; align-items: center; margin-top: 5px; font-size: 13px; color: var(--dim); }
.ev-travel.late { color: var(--amber); }
.badge { display: inline-block; min-width: 26px; margin-left: 5px; padding: 1px 5px; border-radius: 5px; font-size: 12px; font-weight: 700; text-align: center; }
.day-break { margin: 12px 0 2px 12px; font-size: 13px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); }
.agenda-empty { padding: 20px 12px; font-size: 18px; color: var(--faint); }
.legend { display: flex; gap: 20px; padding-top: 10px; font-size: 13px; color: var(--dim); }
.legend span { display: flex; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; }
.legend .err { color: var(--amber); }

/* Spotify */
.spotify { height: 84px; display: flex; align-items: center; padding: 12px 14px; }
.sp-art { flex: none; width: 58px; height: 58px; border-radius: 8px; background: var(--card-hi); object-fit: cover; }
.sp-text { flex: 1; min-width: 0; margin-left: 14px; }
.sp-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-artist { margin-top: 3px; font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-controls { display: flex; align-items: center; margin-left: 8px; }
.sp-btn { width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; border-radius: 25px; }
.sp-btn svg { width: 24px; height: 24px; fill: var(--dim); }
.sp-main { background: var(--card-hi); }
.sp-main svg { fill: var(--text); }

/* Training */
.training { height: 84px; padding-top: 14px; padding-bottom: 12px; }
.t-row { margin-top: 8px; font-size: 15px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-row b { color: var(--text); }

.status { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 12px; color: var(--amber); }

/* Overlays */
.overlay { position: fixed; left: 0; top: 0; width: 1280px; height: 800px; }

.photos { z-index: 10; background: #000; }
.ph-img { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; object-fit: contain; opacity: 0; transition: opacity 1.2s ease; }
.ph-img.show { opacity: 1; }
.ph-chip { position: absolute; right: 24px; bottom: 22px; padding: 10px 16px; border-radius: 14px; background: #000000b3; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ph-chip span { margin-left: 14px; }

.night { z-index: 20; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.n-clock { font-size: 180px; font-weight: 300; letter-spacing: -4px; color: #5a4a3c; font-variant-numeric: tabular-nums; line-height: 1; }
.n-glucose { margin-top: 24px; font-size: 64px; font-weight: 700; font-variant-numeric: tabular-nums; }
.n-glucose span { font-size: 26px; font-weight: 500; margin-left: 10px; color: #4a4038; }
.n-hint { position: absolute; bottom: 26px; font-size: 13px; color: #2a2622; }

.sheet { z-index: 30; background: #000000cc; display: flex; align-items: center; justify-content: center; }
.sheet-panel { position: relative; width: 820px; height: 640px; padding: 30px 36px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.sheet-close { position: absolute; right: 18px; top: 14px; width: 52px; height: 52px; font-size: 38px; line-height: 1; color: var(--dim); }
.sheet-time { font-size: 15px; font-weight: 700; letter-spacing: 1px; color: var(--dim); }
.sheet-title { margin-top: 6px; padding-right: 50px; font-size: 30px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-loc { margin-top: 6px; font-size: 17px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modes { display: flex; gap: 10px; margin-top: 22px; }
.mode { flex: 1; height: 56px; border-radius: 14px; background: var(--card-hi); border: 1px solid var(--line); font-size: 17px; font-weight: 700; color: var(--dim); }
.mode.active { background: #1d3557; border-color: var(--blue); color: var(--text); }
.mode span { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--dim); }
.sheet-summary { margin-top: 22px; font-size: 26px; font-weight: 700; }
.sheet-summary span { font-size: 17px; font-weight: 500; color: var(--dim); margin-left: 12px; }
.steps { margin-top: 14px; height: 300px; overflow: hidden; }
.step { display: flex; align-items: center; min-height: 54px; border-bottom: 1px solid var(--line); font-size: 17px; }
.step-icon { flex: none; width: 64px; }
.step-icon .badge { margin-left: 0; font-size: 15px; padding: 3px 8px; }
.step-walk { font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--faint); }
.step b { font-weight: 700; }
.step-sub { margin-top: 2px; font-size: 14px; color: var(--dim); }

.alert { z-index: 40; background: #7f1d1d; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.alert.urgent { animation: pulse 1.6s ease-in-out infinite; }
.alert.soon { background: #7c2d12; }
.al-label { font-size: 34px; font-weight: 700; letter-spacing: 6px; text-transform: uppercase; color: #fecaca; }
.al-value { display: flex; align-items: center; margin-top: 10px; font-size: 260px; font-weight: 700; letter-spacing: -8px; line-height: 1; font-variant-numeric: tabular-nums; }
.al-arrow { width: 150px; height: 150px; margin-left: 30px; }
.al-arrow svg { width: 150px; height: 150px; display: block; }
.al-sub { margin-top: 16px; font-size: 26px; color: #fecaca; }
.al-hint { position: absolute; bottom: 28px; font-size: 16px; color: #fca5a5; }
@keyframes pulse { 0% { background: #7f1d1d; } 50% { background: #b91c1c; } 100% { background: #7f1d1d; } }
