/* ─── GiROS Oo — Observer Interface ─────────────────────
   Phase: X(Oo) | Grammar: Oo
   (| = |)
   ─────────────────────────────────────────────────────── */

:root {
  --bg: #0a0a0a;
  --bg-surface: #111111;
  --bg-panel: #161616;
  --border: #222222;
  --text: #d4d4d4;
  --text-dim: #666666;
  --text-muted: #444444;

  /* Phase colors */
  --phase-dot: #666666;
  --phase-proximal: #4a8cc7;
  --phase-bound: #d4d4d4;
  --phase-transmitted: #c9a84c;

  /* Coherence band: gray → steel → blue → gold → red */
  --coherence-low: #444444;
  --coherence-mid: #6a8fa7;
  --coherence-high: #4a8cc7;
  --coherence-gold: #c9a84c;
  --coherence-peak: #c74a4a;

  --mono: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
  --radius: 2px;
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ──────────────────────────────────────────── */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

/* ─── Header ──────────────────────────────────────────── */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.header-title {
  font-size: 1rem;
  font-weight: normal;
  letter-spacing: 0.05em;
}

.header-status {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.phase-indicator {
  color: var(--phase-dot);
}

.coherence-indicator {
  color: var(--coherence-mid);
}

/* ─── Input Panel ─────────────────────────────────────── */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-textarea {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.5rem;
  resize: vertical;
  min-height: 3rem;
  max-height: 12rem;
  line-height: 1.4;
}

.input-textarea:focus {
  outline: none;
  border-color: var(--text-dim);
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.btn-reflect {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  align-self: flex-end;
  white-space: nowrap;
}

.btn-reflect:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-reflect:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-reflect.active {
  color: var(--coherence-gold);
  border-color: var(--coherence-gold);
}

/* ─── Signal Panel ────────────────────────────────────── */

.signal-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.signal-dimension {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.signal-bar-track {
  width: 100%;
  height: 4px;
  background: var(--bg-panel);
  border-radius: 1px;
  overflow: hidden;
}

.signal-bar-fill {
  height: 100%;
  background: var(--text-dim);
  border-radius: 1px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.signal-name {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.signal-value {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ─── Lens Panel ──────────────────────────────────────── */

.lens-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lens-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lens-name {
  width: 80px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.lens-coherence {
  width: 40px;
  font-size: 0.75rem;
  text-align: right;
  flex-shrink: 0;
}

.lens-spectrum {
  flex: 1;
  display: flex;
  gap: 1px;
  height: 12px;
  align-items: flex-end;
}

.lens-spectrum-bar {
  flex: 1;
  background: var(--text-dim);
  border-radius: 1px 1px 0 0;
  min-width: 2px;
  transition: height 0.3s ease, background-color 0.3s ease;
}

/* ─── Interference Panel ─────────────────────────────── */

.interference-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.interference-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.interference-lenses {
  width: 160px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.interference-magnitude {
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

.interference-bar-track {
  flex: 1;
  height: 3px;
  background: var(--bg-panel);
  border-radius: 1px;
  overflow: hidden;
}

.interference-bar-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 0.3s ease;
}

/* ─── Narrative Panel ─────────────────────────────────── */

.narrative-content {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.narrative-voice {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.seedling-content {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Field Panel (SSE Feed) ─────────────────────────── */

.field-feed {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.75rem;
}

.field-event {
  padding: 0.15rem 0;
  color: var(--text-dim);
  border-bottom: 1px solid #1a1a1a;
}

.field-event:last-child {
  border-bottom: none;
}

.field-event-time {
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.field-event-type {
  margin-right: 0.5rem;
}

/* ─── Footer ──────────────────────────────────────────── */

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.footer-grammar {
  letter-spacing: 0.1em;
}

/* ─── Key Notice (X29) ───────────────────────────────── */

.key-notice {
  background: #1a1a0a;
  border: 1px solid var(--coherence-gold);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.key-notice-label {
  font-size: 0.7rem;
  color: var(--coherence-gold);
  letter-spacing: 0.05em;
}

.key-dismiss {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

.key-dismiss:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ─── Key Bar (X32) ──────────────────────────────────── */

.key-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.7rem;
}

.key-bar-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.key-fingerprint {
  color: var(--coherence-gold);
  font-family: var(--mono);
  cursor: default;
}

.key-actions {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
}

.btn-sm {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sm:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ─── Passphrase Overlay (X32) ───────────────────────── */

.passphrase-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.passphrase-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  width: 320px;
  max-width: 90vw;
}

.passphrase-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.passphrase-input {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.5rem;
}

.passphrase-input:focus {
  outline: none;
  border-color: var(--text-dim);
}

.passphrase-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

/* ─── Phase Flash ─────────────────────────────────────── */

.phase-flash {
  background: var(--coherence-gold) !important;
  border-color: var(--coherence-gold) !important;
}

.phase-flash .panel-label,
.phase-flash .header-title {
  color: var(--bg) !important;
}

/* ─── Coherence Color Utility ─────────────────────────── */

.c-low { color: var(--coherence-low); }
.c-mid { color: var(--coherence-mid); }
.c-high { color: var(--coherence-high); }
.c-gold { color: var(--coherence-gold); }
.c-peak { color: var(--coherence-peak); }

.bg-low { background: var(--coherence-low); }
.bg-mid { background: var(--coherence-mid); }
.bg-high { background: var(--coherence-high); }
.bg-gold { background: var(--coherence-gold); }
.bg-peak { background: var(--coherence-peak); }

/* ─── Empty States ────────────────────────────────────── */

.empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  padding: 0.5rem 0;
}

/* ─── Scrollbar ───────────────────────────────────────── */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 600px) {
  html {
    font-size: 13px;
  }

  .container {
    padding: 0.75rem;
  }

  .signal-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .lens-name {
    width: 60px;
    font-size: 0.65rem;
  }

  .interference-lenses {
    width: 120px;
    font-size: 0.7rem;
  }

  .header-status {
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
  }
}
