/* Jarvis HUD — dark base + electric cyan / arc-reactor blue, single red accent.
   No gold. Animated, responsive, installable. */

:root {
  --bg: #04070e;
  --bg2: #070d18;
  --panel: rgba(10, 20, 36, 0.55);
  --panel-edge: rgba(0, 224, 255, 0.28);
  --cyan: #00e6ff;
  --arc: #39c2ff;
  --blue: #1e7bff;
  --red: #ff2d4b;
  --text: #d7ecf6;
  --muted: #6f8aa3;
  --grid-line: rgba(57, 194, 255, 0.06);
  --glow: 0 0 18px rgba(0, 224, 255, 0.35);
  --font: "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(30, 123, 255, 0.10), transparent 60%),
    radial-gradient(900px 700px at 10% 110%, rgba(0, 230, 255, 0.08), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 38px 100%,
    var(--bg);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ============ Boot intro ============ */
#intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, #06101f 0%, #02050b 70%);
  opacity: 1; transition: opacity 0.6s ease 0.2s;
}
body.booted #intro { opacity: 0; pointer-events: none; }

.intro-scan {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  filter: drop-shadow(0 0 6px var(--cyan));
  animation: scan 2.6s ease-in-out infinite;
}
@keyframes scan { 0% { top: 12%; } 50% { top: 88%; } 100% { top: 12%; } }

.wordmark { width: min(78vw, 560px); height: auto; overflow: visible; }
.wordmark .zero circle { fill: none; stroke: var(--cyan); stroke-width: 6; }
.wordmark .zero .zero-inner { stroke: var(--arc); stroke-width: 3; opacity: 0.8; }
.wordmark .seven-stroke { fill: none; stroke: var(--cyan); stroke-width: 16; stroke-linecap: round; stroke-linejoin: round; }
.wordmark .pistol { fill: var(--arc); stroke: var(--cyan); stroke-width: 2; }
.wordmark .trigger { stroke: var(--bg); stroke-width: 4; stroke-linecap: round; }

/* draw-on + fly-across choreography */
.wordmark .zero circle, .wordmark .seven-stroke, .wordmark .pistol {
  stroke-dasharray: 1200; stroke-dashoffset: 1200;
  animation: draw 1.1s ease forwards;
}
.wordmark .zero:nth-of-type(2) circle { animation-delay: 0.12s; }
.wordmark .seven { animation: fly 1.0s cubic-bezier(.2,.8,.2,1) 0.5s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fly {
  0% { transform: translateX(-420px) skewX(-12deg); opacity: 0; }
  60% { transform: translateX(18px) skewX(0); opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}

.muzzle { opacity: 0; transform-origin: 468px 124px; }
.muzzle polygon { fill: var(--red); }
.muzzle { animation: fire 0.5s ease 1.5s 1; }
@keyframes fire {
  0% { opacity: 0; transform: scale(0.2); }
  30% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 0; transform: scale(1.6); }
}

.intro-tag {
  margin-top: 28px; font-family: var(--mono); letter-spacing: 0.5em;
  font-size: 13px; color: var(--arc); opacity: 0;
  animation: fadeUp 0.8s ease 1.7s forwards;
  text-shadow: var(--glow);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 0.9; transform: none; } }

/* ============ HUD ============ */
#hud {
  max-width: 1180px; margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px 28px;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
body.booted #hud { opacity: 1; transform: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px 18px; border-bottom: 1px solid var(--panel-edge);
  margin-bottom: 22px;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark {
  font-family: var(--mono); font-weight: 700; font-size: 22px; color: var(--cyan);
  text-shadow: var(--glow); letter-spacing: 2px;
}
.brand-name { font-size: 15px; letter-spacing: 0.5em; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.date { color: var(--muted); font-size: 13px; }
.clock { font-family: var(--mono); font-size: 20px; color: var(--text); text-shadow: var(--glow); }
.conn {
  width: 9px; height: 9px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 10px var(--red); display: inline-block;
}
.conn.ok { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

/* grid */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.tile-wide { grid-column: 1 / -1; }

.tile {
  position: relative; background: var(--panel);
  border: 1px solid var(--panel-edge); border-radius: 14px;
  padding: 16px 18px 18px; backdrop-filter: blur(6px);
  box-shadow: inset 0 0 30px rgba(0, 120, 200, 0.05);
  transition: border-color 0.3s ease, transform 0.3s ease;
  overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent 70%);
  opacity: 0.6;
}
.tile:hover { border-color: var(--cyan); transform: translateY(-2px); }

.tile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tile-head h2 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--arc);
}
.corner { width: 14px; height: 14px; border-top: 2px solid var(--cyan); border-right: 2px solid var(--cyan); opacity: 0.6; }
.count {
  font-family: var(--mono); font-size: 13px; color: var(--bg); background: var(--cyan);
  border-radius: 6px; padding: 1px 8px; box-shadow: var(--glow);
}

/* lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  display: flex; gap: 10px; align-items: baseline; font-size: 14px;
  padding: 7px 10px; border-left: 2px solid var(--blue);
  background: rgba(30, 123, 255, 0.06); border-radius: 0 8px 8px 0;
}
.list li .when { font-family: var(--mono); color: var(--cyan); min-width: 64px; font-size: 13px; }
.list li .scope { margin-left: auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.list li.empty { color: var(--muted); border-color: var(--muted); background: transparent; font-style: italic; }

/* brief */
.brief { display: grid; gap: 10px; }
.brief-weather { font-size: 16px; color: var(--text); }
.brief-fact { font-size: 14px; color: var(--text); padding-left: 14px; border-left: 2px solid var(--cyan); }
.brief-quote { font-size: 14px; color: var(--muted); font-style: italic; }

/* streaks */
.streaks { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.streak {
  text-align: center; padding: 12px 6px; border-radius: 12px;
  border: 1px solid rgba(0, 224, 255, 0.18); background: rgba(0, 224, 255, 0.04);
}
.streak.today { border-color: var(--cyan); box-shadow: var(--glow); }
.streak .num { font-family: var(--mono); font-size: 26px; color: var(--cyan); display: block; }
.streak .lbl { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.streak .ring { font-size: 11px; color: var(--red); }

/* capture */
.capture { display: flex; gap: 10px; }
.capture input {
  flex: 1; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--panel-edge);
  border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: 15px; font-family: var(--font);
}
.capture input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }
.capture button, .ghost {
  border: 1px solid var(--cyan); background: rgba(0, 224, 255, 0.1); color: var(--cyan);
  border-radius: 10px; padding: 0 18px; font-size: 14px; cursor: pointer;
  font-family: var(--mono); letter-spacing: 0.08em; transition: background 0.2s ease;
}
.capture button:hover, .ghost:hover { background: rgba(0, 224, 255, 0.22); }
.capture button:disabled { opacity: 0.5; cursor: wait; }
.capture-reply { min-height: 0; margin-top: 12px; color: var(--cyan); font-size: 14px; }
.capture-reply:not(:empty) { padding: 10px 12px; border-left: 2px solid var(--cyan); background: rgba(0,224,255,0.06); border-radius: 0 8px 8px 0; }
.feed { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed li { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.feed .src { font-family: var(--mono); color: var(--arc); text-transform: uppercase; min-width: 64px; }

/* status bar */
.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--panel-edge);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.statusbar #status::before { content: "● "; color: var(--cyan); }

/* settings dialog */
dialog#settings {
  border: 1px solid var(--cyan); background: var(--bg2); color: var(--text);
  border-radius: 14px; padding: 0; box-shadow: 0 0 40px rgba(0,224,255,0.25); max-width: 420px; width: 90%;
}
dialog#settings::backdrop { background: rgba(2, 5, 11, 0.7); backdrop-filter: blur(3px); }
.settings-form { padding: 20px; display: grid; gap: 14px; }
.settings-form h3 { margin: 0; color: var(--arc); letter-spacing: 0.2em; font-size: 14px; text-transform: uppercase; }
.settings-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.settings-form input {
  background: rgba(0,0,0,0.4); border: 1px solid var(--panel-edge); border-radius: 8px;
  padding: 10px; color: var(--text); font-size: 14px;
}
.settings-form .hint { font-size: 12px; color: var(--muted); margin: 0; }
.settings-form menu { display: flex; gap: 10px; justify-content: flex-end; margin: 0; padding: 0; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  #hud { padding-left: 14px; padding-right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark *, .muzzle, .intro-scan { animation: none !important; }
  .wordmark .zero circle, .wordmark .seven-stroke, .wordmark .pistol { stroke-dashoffset: 0; }
}
