/* Nebula OS sim — chrome aligned to firmware ui.cpp / SPEC.md
   Screen 410×502 · C_BG #000 · C_CARD #14161A · C_ACCENT #00E5C0
   Control: grab pill, slider cards 88px / track 12 / knob 28 / empty 0x3A3D45
   Tiles 114×76 r16 · Launcher pad 24 · tiles 174×118 · press 0x2A2D33
*/

:root {
  --bg: #050508;
  --amoled: #000000;
  --card: #14161a;
  --card-press: #2a2d33;
  --track-empty: #3a3d45;
  --text: #ffffff;
  --dim: #8a8a8e;
  --accent: #00e5c0;
  --warn: #ff9f0a;
  --danger: #ff453a;
  --violet: #7c6cff;
  --screen-w: 410px;
  --screen-h: 502px;
  --bezel-r: 62px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(0, 229, 192, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 35% at 85% 95%, rgba(124, 108, 255, 0.1), transparent 50%),
    var(--bg);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  color: var(--accent);
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 18px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.hero { text-align: center; max-width: 440px; }
.hero-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 15%, #a8fff0 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.hero-blurb {
  color: var(--dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

.watch-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.watch-bezel {
  width: calc(var(--screen-w) + 28px);
  height: calc(var(--screen-h) + 28px);
  padding: 14px;
  border-radius: calc(var(--bezel-r) + 10px);
  background: linear-gradient(145deg, #2a2a30 0%, #0c0c10 40%, #1a1a20 100%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 24px 60px rgba(0,0,0,0.65),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.watch-screen {
  position: relative;
  width: var(--screen-w);
  height: var(--screen-h);
  border-radius: var(--bezel-r);
  background: var(--amoled);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.brightness-veil {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  z-index: 40;
  border-radius: inherit;
  transition: opacity 0.15s;
}

.screen-stack { position: absolute; inset: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--amoled);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 1;
}
.screen.active {
  display: flex;
  opacity: 1;
  transform: none;
  z-index: 2;
}
.screen.slide-up-in { animation: slideUpIn 0.28s ease both; }
.screen.slide-down-in { animation: slideDownIn 0.28s ease both; }
@keyframes slideUpIn {
  from { transform: translateY(100%); opacity: 1; }
  to { transform: none; opacity: 1; }
}
@keyframes slideDownIn {
  from { transform: translateY(-100%); opacity: 1; }
  to { transform: none; opacity: 1; }
}

/* —— Home / watchface —— */
.screen-home { padding: 0; }
.home-chrome {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;
  pointer-events: none;
  z-index: 5;
}
.home-batt {
  position: absolute;
  top: 36px;
  right: 40px;
  font-size: 15px;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: 0.02em;
}
.home-wifi {
  position: absolute;
  top: 36px;
  left: 40px;
  color: var(--dim);
  display: flex;
  align-items: center;
}
.home-wifi.off { opacity: 0.25; }

.face { flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.face[hidden] { display: none !important; }

.home-clock {
  margin-top: 108px;
  text-align: center;
  z-index: 3;
}
.home-time {
  font-size: 56px;
  font-weight: 610;
  letter-spacing: 0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.home-date {
  margin-top: 6px;
  font-size: 15px;
  color: var(--dim);
  font-weight: 500;
}

.nova-stage {
  flex: 1;
  width: 100%;
  position: relative;
  margin-top: 8px;
  min-height: 160px;
}
.nova {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 120px;
  height: 140px;
  margin-left: -60px;
  margin-top: -70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  touch-action: none;
  z-index: 4;
  transition: filter 0.2s;
}
.nova:active { cursor: grabbing; }
.nova.react .nova-glow { opacity: 0.95; transform: scale(1.15); }
.nova.react .mouth { d: path("M52 74 Q60 86 68 74"); }
.nova-glow {
  position: absolute;
  width: 100px; height: 100px;
  top: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,124,255,0.45), transparent 70%);
  opacity: 0.7;
  animation: pulse 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0.85; }
}
.nova-svg { position: relative; z-index: 1; filter: drop-shadow(0 8px 16px rgba(80,60,180,0.35)); }
.nova .eye { transform-origin: center; animation: blink 5s infinite; }
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  94%, 96% { transform: scaleY(0.1); }
}
.nova .sp { animation: twinkle 2.4s ease-in-out infinite; }
.nova .s2 { animation-delay: 0.6s; }
.nova .s3 { animation-delay: 1.2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.nova-label {
  margin-top: 2px;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-hint {
  position: absolute;
  bottom: 28px;
  left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  opacity: 0.55;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 3;
}
.home-hint.hidden { opacity: 0; transition: opacity 0.4s; }

/* Time-first face */
.face-time { justify-content: center; padding-top: 40px; }
.timeface-time {
  font-size: 72px;
  font-weight: 620;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
}
.timeface-date {
  text-align: center;
  margin-top: 10px;
  color: var(--dim);
  font-size: 16px;
}
.timeface-sec {
  text-align: center;
  margin-top: 6px;
  font-size: 22px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.timeface-nova {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%) scale(0.62);
  transform-origin: bottom center;
}

/* —— Shared chrome —— */
.grab {
  display: flex;
  justify-content: center;
  padding-top: 14px;
  padding-bottom: 6px;
  flex-shrink: 0;
}
.grab-pill {
  width: 44px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.28);
}

.app-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 6px 12px 0 0;
  flex-shrink: 0;
  position: relative;
}
.back-hit {
  width: 78px;
  height: 64px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.chev {
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
  margin-top: -4px;
}
.app-title {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
}
.app-body {
  flex: 1;
  padding: 4px 24px 28px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.app-body.scroll { overflow-y: auto; overscroll-behavior: contain; }

/* —— Control —— */
.screen-cc { padding: 0 24px 32px; }
.cc-batt {
  text-align: center;
  font-size: 34px;
  font-weight: 620;
  margin: 4px 0 12px;
  font-variant-numeric: tabular-nums;
}
.slider-card {
  background: var(--card);
  border-radius: 16px;
  height: 88px;
  padding: 12px 16px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.slider-ico { color: var(--dim); display: flex; }
.slider-val {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sheet-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
.sheet-slider:focus { outline: none; }
.sheet-slider::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct, 62%), var(--track-empty) var(--pct, 62%), var(--track-empty) 100%);
}
.sheet-slider::-moz-range-track {
  height: 12px;
  border-radius: 99px;
  background: var(--track-empty);
}
.sheet-slider::-moz-range-progress {
  height: 12px;
  border-radius: 99px;
  background: var(--accent);
}
.sheet-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -8px;
  box-shadow: 0 2px 8px rgba(0,229,192,0.35);
  border: 0;
}
.sheet-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}

.cc-tiles {
  display: grid;
  grid-template-columns: repeat(3, 114px);
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
}
.cc-tile {
  width: 114px;
  height: 76px;
  border-radius: 16px;
  border: 0;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.cc-tile:active { background: var(--card-press); }
.cc-tile.on {
  background: #1a2a28;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0,229,192,0.25);
}

/* —— Launcher —— */
.screen-launcher { padding: 0 0 20px; }
.launcher-title {
  text-align: center;
  font-size: 18px;
  color: var(--dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.launcher-grid {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: 174px 174px;
  gap: 14px;
  justify-content: center;
  align-content: start;
}
.app-tile {
  width: 174px;
  height: 118px;
  border-radius: 16px;
  border: 0;
  background: var(--card);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.app-tile:active { background: var(--card-press); }
.app-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  background: #1c1f26;
  color: var(--accent);
}
.ico-talk { background: linear-gradient(135deg, #5a4fd4, #8b7cff); color: #fff; }
.ico-faces { font-size: 22px; }
.app-name { font-size: 14px; font-weight: 560; }

/* —— Faces —— */
.faces-body { gap: 12px; padding-top: 8px; }
.face-card {
  width: 100%;
  height: 88px;
  border-radius: 16px;
  border: 0;
  background: var(--card);
  color: var(--text);
  text-align: left;
  padding: 16px 18px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.face-card.on { background: #1a2a28; box-shadow: inset 0 0 0 1px rgba(0,229,192,0.22); }
.face-card:active { background: var(--card-press); }
.face-card-top { display: flex; justify-content: space-between; align-items: center; }
.face-card-name { font-size: 18px; font-weight: 600; }
.face-on { color: var(--accent); font-size: 12px; font-weight: 600; text-transform: lowercase; }
.face-card-sub { font-size: 12px; color: var(--dim); }
.faces-note { text-align: center; color: var(--dim); font-size: 12px; margin-top: auto; padding-bottom: 8px; }

/* —— Settings rows —— */
.set-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  width: 100%;
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  color: inherit;
  font-family: inherit;
  text-align: left;
}
.set-row:last-child { border-bottom: 0; }
.set-row.link { cursor: pointer; }
.set-row.link:active { background: var(--card-press); }
.dim { color: var(--dim); font-size: 13px; }
.accent { color: var(--accent); font-size: 13px; font-weight: 600; }

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: var(--track-empty);
  border-radius: 99px;
  transition: 0.2s;
  cursor: pointer;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }

/* —— Talk —— */
.talk-body { gap: 12px; }
.talk-nova { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.talk-orb {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c4b5ff, #5a4fd4 60%, #2a2460);
  box-shadow: 0 0 24px rgba(124,108,255,0.45);
  animation: pulse 2.2s ease-in-out infinite;
}
.talk-status { font-size: 13px; color: var(--dim); }
.talk-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}
.bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.35;
  background: var(--card);
}
.bubble.bot { align-self: flex-start; }
.bubble.me { align-self: flex-end; background: #1a2a28; color: var(--accent); }
.talk-actions, .timer-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn {
  border: 0;
  border-radius: 16px;
  height: 48px;
  min-width: 110px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--accent); color: #00352c; }
.btn.primary:active { filter: brightness(0.92); }
.btn.ghost { background: var(--card); color: var(--text); }
.btn.ghost:active { background: var(--card-press); }

/* —— Activity / weather / timer —— */
.activity-body { align-items: center; gap: 16px; }
.ring-wrap { margin-top: 8px; }
.stat-rows { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.stat { font-size: 15px; display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.teal { background: var(--accent); }
.dot.violet { background: var(--violet); }
.dot.amber { background: var(--warn); }

.weather-body { align-items: center; text-align: center; gap: 6px; padding-top: 24px; }
.wx-temp { font-size: 72px; font-weight: 620; line-height: 1; letter-spacing: -0.02em; }
.wx-cond { font-size: 18px; margin-top: 4px; }
.wx-loc { color: var(--dim); font-size: 14px; margin-bottom: 16px; }
.wx-row { display: flex; gap: 10px; width: 100%; }
.wx-chip {
  flex: 1;
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.timer-body { align-items: center; gap: 18px; padding-top: 20px; }
.timer-display {
  font-size: 52px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.timer-presets { display: flex; gap: 8px; }
.chip {
  border: 0;
  background: var(--card);
  color: var(--text);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.chip.on { background: #1a2a28; color: var(--accent); }
.lap-list {
  list-style: none;
  width: 100%;
  max-height: 120px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.lap-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Torch */
.screen-torch, .screen-torch .app-header { background: #f5f5f0; color: #111; }
.screen-torch .chev, .screen-torch .app-title { color: #111; }
.torch-body {
  flex: 1;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 14px;
  cursor: pointer;
}

.wifi-note { font-size: 12px; color: var(--dim); line-height: 1.4; margin-top: 8px; }

.note-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 14px;
}
.dim-card { color: var(--dim); }

/* Calc */
.calc-body { gap: 10px; padding-bottom: 20px; }
.calc-display {
  background: var(--card);
  border-radius: 14px;
  padding: 16px 14px;
  text-align: right;
  font-size: 32px;
  font-variant-numeric: tabular-nums;
  font-weight: 560;
  min-height: 56px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.calc-grid button {
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 18px;
  font-weight: 560;
  font-family: inherit;
  cursor: pointer;
}
.calc-grid button:active { background: var(--card-press); }
.calc-grid .op { color: var(--accent); }
.calc-grid .eq { background: #1a2a28; }
.calc-grid .zero { grid-column: span 2; }

.stage-meta {
  font-size: 0.78rem;
  color: var(--dim);
  letter-spacing: 0.02em;
}

.gestures {
  width: 100%;
  max-width: 440px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 18px 20px;
}
.gestures h2 { font-size: 0.95rem; margin-bottom: 10px; }
.gestures ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.gestures li { font-size: 0.82rem; color: var(--dim); line-height: 1.4; }
.gestures strong { color: var(--text); }
.gestures em { color: var(--accent); font-style: normal; }

.foot {
  font-size: 0.75rem;
  color: var(--dim);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .page { padding: 28px 12px 40px; }
  .watch-bezel {
    transform: scale(0.92);
    transform-origin: top center;
    margin-bottom: -20px;
  }
}

/* —— patches for class hooks present in markup —— */
.face-companion { width: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.timeface-clock { text-align: center; }
.screen-app { /* app shell; layout via .app-header / .app-body */ }
.rings { display: block; }
.about { opacity: 0.95; }
.dark-on-light .chev,
.dark-on-light .app-title { color: #111; }
.screen.slide-from-top { animation: slideDownIn 0.28s ease both; }
.screen.slide-from-bottom { animation: slideUpIn 0.28s ease both; }
