:root {
  --bg: #05070a;
  --fg: #e8f6ff;
  --muted: #8a9cab;
  --accent: #7ef9ff;
  --warm: #ffd37e;
  --clash: #ff9e5e;
  --urgent: #ff7e7e;
  --panel: rgba(232, 246, 255, 0.05);
  --line: rgba(232, 246, 255, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  background: rgba(5, 7, 10, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.15rem; }
.mini-face { display: inline-flex; gap: 4px; padding: 5px 6px; border-radius: 8px; background: #0d1a20; }
.mini-face i { width: 7px; height: 11px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: blink 5s infinite; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
.who { color: var(--muted); font-size: 0.9rem; }
.who .settings { color: var(--accent); text-decoration: none; }

main, .center { max-width: 34rem; margin: 0 auto; padding: 0.8rem 0.9rem 3rem; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 0.9rem;
}
.card.center { margin-top: 18vh; text-align: center; }
.card.center h1 { margin: 0 0 0.3rem; }
.card.center p { color: var(--muted); }
#gbutton { display: flex; justify-content: center; margin: 1.2rem 0 0.4rem; }
.error { color: var(--urgent); }
h2 { margin: 0 0 0.6rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.status { color: var(--warm); font-size: 0.9rem; margin: 0.2rem 0.3rem 0.8rem; }

/* Chat */
.tabs { display: flex; gap: 0.3rem; background: rgba(0, 0, 0, 0.3); border-radius: 999px; padding: 0.25rem; margin-bottom: 0.8rem; }
.tab { flex: 1; border: 0; border-radius: 999px; padding: 0.5rem; background: none; color: var(--muted); font: inherit; font-weight: 600; }
.tab.active { background: var(--accent); color: #032326; }
.thread { display: flex; flex-direction: column; gap: 0.45rem; max-height: 46vh; overflow-y: auto; margin-bottom: 0.8rem; }
.hint { color: var(--muted); margin: 0.2rem 0; font-size: 0.92rem; }
.bubble { max-width: 85%; padding: 0.55rem 0.8rem; border-radius: 1rem; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: #1d3a40; border-bottom-right-radius: 0.3rem; }
.bubble.me.say { background: #3a3220; }
.bubble.dave { align-self: flex-start; background: rgba(232, 246, 255, 0.08); border-bottom-left-radius: 0.3rem; }
.bubble.pending { color: var(--muted); font-style: italic; }
#compose { display: flex; gap: 0.5rem; }
#compose input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--fg);
  font: inherit;
}
#compose button { border: 0; border-radius: 999px; padding: 0 1.1rem; background: var(--accent); color: #032326; font: inherit; font-weight: 700; }

/* Events */
ul { list-style: none; margin: 0; padding: 0; }
.events .day { color: var(--muted); font-size: 0.85rem; margin: 0.7rem 0 0.2rem; }
.events .day:first-child { margin-top: 0; }
.event { display: grid; grid-template-columns: 4.2rem 0.7rem 1fr auto; gap: 0.5rem; align-items: baseline; padding: 0.45rem 0.5rem; border-left: 3px solid transparent; border-radius: 0.5rem; }
.event .time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; align-self: center; }
.event.now { background: rgba(126, 249, 255, 0.08); border-left-color: var(--accent); }
.event.clash { border-left-color: var(--clash); }
.event .tag { color: var(--clash); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; }
.empty { color: var(--muted); font-style: italic; }

/* To do */
.item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.55rem 0; border-top: 1px solid var(--line); transition: opacity 0.4s; }
.item:first-child { border-top: 0; }
.tick { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--muted); background: none; margin-top: 0.1rem; }
.item.soon .tick { border-color: var(--warm); }
.item.urgent .tick { border-color: var(--urgent); }
.item .text { display: flex; flex-direction: column; }
.item .meta { color: var(--muted); font-size: 0.85rem; }
.item.urgent .meta { color: var(--urgent); }
.item.done { opacity: 0.35; }
.item.done .title { text-decoration: line-through; }
.item.done .tick { background: var(--accent); border-color: var(--accent); }

/* Weather */
.weather .now { display: flex; align-items: center; gap: 0.7rem; }
.weather .icon { font-size: 2.2rem; }
.weather .temp { font-size: 2.4rem; font-weight: 700; }
.weather .detail { display: flex; flex-direction: column; color: var(--muted); font-size: 0.9rem; }
.weather .detail b { color: var(--fg); }
.weather .rain { margin: 0.7rem 0 0; color: var(--warm); }
.weather .rain.raining, .weather .rain.approaching { color: var(--urgent); font-weight: 600; }
.weather .forecast { color: var(--muted); font-size: 0.9rem; margin: 0.6rem 0 0; }
.radar { position: relative; aspect-ratio: 1; margin-top: 0.9rem; border-radius: 0.8rem; overflow: hidden; }
.radar img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.radar .home { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #ff3dbb; box-shadow: 0 0 0 4px rgba(255, 61, 187, 0.35); }
.radar .credit { position: absolute; left: 0.4rem; bottom: 0.3rem; font-size: 0.65rem; color: #333; background: rgba(255, 255, 255, 0.7); padding: 0 0.3rem; border-radius: 0.3rem; }

/* Where is it? */
.where-item { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.where-item:first-child { border-top: 0; }
.where-item .meta { color: var(--muted); font-size: 0.85rem; }
.where-item form { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.where-item input {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--fg);
  font: inherit;
}
.where-item button { border: 0; border-radius: 999px; padding: 0.5rem 1rem; background: var(--accent); color: #032326; font: inherit; font-weight: 700; }
.where-item .saved { color: #7effa8; }
