/* J.A.R.V.I.S. PWA — Stark Industries mobile aesthetic */

:root {
  --bg:        #04080f;
  --bg-2:      #0a0f1a;
  --line:      rgba(0, 240, 255, 0.20);
  --line-hot:  rgba(0, 240, 255, 0.55);
  --cyan:      #00f0ff;
  --cyan-dim:  #4dd6ff;
  --amber:     #ff8c00;
  --red:       #ff3a3a;
  --green:     #44ff88;
  --yellow:    #ffd23f;
  --text:      #cfe9ff;
  --text-dim:  rgba(207, 233, 255, 0.55);
  --font-ui:   'Orbitron', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0,240,255,0.06), transparent 60%),
    radial-gradient(800px 400px at 50% 110%, rgba(255,140,0,0.04), transparent 60%),
    var(--bg);
}

.screen { width: 100%; height: 100%; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ── Frame corners ────────────────────────────────────────────────────── */
.corner {
  position: fixed; width: 24px; height: 24px;
  border: 1px solid var(--cyan);
  opacity: 0.6;
  pointer-events: none;
  z-index: 50;
}
.corner.tl { top: 10px;    left: 10px;  border-right: none; border-bottom: none; }
.corner.tr { top: 10px;    right: 10px; border-left:  none; border-bottom: none; }
.corner.bl { bottom: 10px; left: 10px;  border-right: none; border-top:    none; }
.corner.br { bottom: 10px; right: 10px; border-left:  none; border-top:    none; }

/* ── Brand ────────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-sm { gap: 8px; }
.logo-hex {
  width: 22px; height: 22px;
  background: var(--cyan);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  filter: drop-shadow(0 0 6px var(--cyan));
}
.logo-hex.small { width: 16px; height: 16px; }
.brand-name {
  font-weight: 900; letter-spacing: 4px; color: var(--cyan);
  font-size: 16px;
}

/* ── Login screen ─────────────────────────────────────────────────────── */
#login-screen {
  align-items: center; justify-content: center;
  padding: 32px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  padding: 28px 24px 22px;
  backdrop-filter: blur(8px);
}
.login-card .brand { justify-content: center; margin-bottom: 4px; }
.login-card .brand-name { font-size: 20px; }
.subtitle {
  text-align: center; color: var(--text-dim);
  letter-spacing: 4px; font-size: 11px; margin: 0 0 20px;
}
#login-form { display: flex; flex-direction: column; gap: 8px; }
#login-form label {
  font-size: 10px; letter-spacing: 3px; color: var(--text-dim);
  margin-top: 6px;
}
#login-form input {
  background: rgba(0,240,255,0.04);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono); font-size: 14px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 150ms ease;
}
#login-form input:focus {
  border-color: var(--cyan);
}
#login-btn {
  margin-top: 18px;
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-ui); font-weight: 700; letter-spacing: 4px;
  font-size: 13px;
  padding: 12px;
  cursor: pointer;
  transition: all 160ms ease;
}
#login-btn:hover, #login-btn:active {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
}
.error {
  color: var(--red);
  font-size: 11px;
  letter-spacing: 1px;
  font-family: var(--font-mono);
  min-height: 1em;
  margin-top: 8px;
  text-align: center;
}

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.status-block {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px;
}
.led { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.led-up   { background: var(--green); box-shadow: 0 0 8px var(--green); }
.led-down { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  width: 32px; height: 32px;
  font-size: 14px;
  cursor: pointer;
  transition: all 140ms;
}
.ghost-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ── Conversation log ─────────────────────────────────────────────────── */
.conversation {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.empty-hint {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.empty-hint p { margin: 4px 0; }
.empty-hint .muted { font-size: 11px; opacity: 0.7; }

.bubble {
  max-width: 86%;
  padding: 10px 14px;
  font-family: var(--font-mono); font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--line);
  position: relative;
}
.bubble .timestamp {
  display: block;
  font-size: 9px; letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-top: 4px;
}
.bubble.user {
  align-self: flex-end;
  background: rgba(0, 240, 255, 0.08);
  border-color: var(--cyan-dim);
  color: var(--cyan-dim);
}
.bubble.jarvis {
  align-self: flex-start;
  background: rgba(255, 140, 0, 0.04);
  border-color: rgba(255, 140, 0, 0.4);
  color: var(--text);
}
.bubble.system {
  align-self: center;
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1.5px;
}
.bubble.error {
  border-color: var(--red);
  color: var(--red);
}
.bubble.streaming::after {
  content: ' ▍';
  color: var(--cyan);
  animation: blink 0.8s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Composer ─────────────────────────────────────────────────────────── */
.composer {
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: rgba(4, 8, 15, 0.95);
  flex: none;
  /* iOS safe area */
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
#msg-input {
  flex: 1;
  background: rgba(0,240,255,0.04);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  border-radius: 0;
}
#msg-input:focus { border-color: var(--cyan); }
.primary-btn {
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 0 18px;
  cursor: pointer;
  transition: all 150ms;
  flex: none;
}
.primary-btn:hover, .primary-btn:active {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}
.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Toast ────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  top: 60px;
  left: 50%; transform: translateX(-50%);
  background: rgba(10, 15, 26, 0.95);
  border: 1px solid var(--cyan);
  padding: 8px 16px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 2px; color: var(--cyan);
  opacity: 0; pointer-events: none;
  transition: opacity 220ms;
  z-index: 60;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── Scrollbar (mobile usually hides this anyway) ─────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.25); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
