/* MyThinkingFellow — styles.css */
/* (c) 2026 Resonant Catalyst. All rights reserved. */
/* 3D Tubing Aesthetic — warm taupe, dimensional, premium */

:root {
  --bg: #2e2a26;
  --bg-warm: #332f2a;
  --bg-deep: #262320;
  --surface: #3e3934;
  --surface-lit: #4a4540;
  --surface-hover: #524c47;
  --border: rgba(190,170,140,0.14);
  --border-bright: rgba(190,170,140,0.28);
  --text: #d8cfc2;
  --text-dim: rgba(190,175,150,0.45);
  --text-bright: #ece4d6;
  --accent: #c4a870;
  --accent-glow: rgba(196,168,112,0.15);
  --accent-soft: rgba(196,168,112,0.06);
  --fellow: #c4a868;
  --fellow-dim: rgba(196,168,104,0.5);
  --danger: #c45a5a;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'DM Mono', monospace;

  /* 3D tubing */
  --tube-highlight: rgba(255,245,225,0.07);
  --tube-shadow: rgba(0,0,0,0.35);
  --tube-inset: rgba(0,0,0,0.2);
  --tube-rim: rgba(255,245,225,0.04);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Subtle textured background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(196,168,112,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(196,168,112,0.03) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 30%, var(--bg-warm) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ── Header — tube rail ── */
.header {
  flex-shrink: 0;
  padding: 18px 24px 14px;
  text-align: center;
  position: relative;
  background: linear-gradient(180deg, rgba(255,245,225,0.02) 0%, transparent 100%);
}
.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--tube-highlight), var(--tube-shadow));
  box-shadow:
    0 1px 2px var(--tube-shadow),
    inset 0 1px 0 var(--tube-highlight);
}
.header-title {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  font-style: italic;
  color: var(--accent);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.header-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ── Gate ── */
.gate {
  position: fixed;
  inset: 0;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
}
.gate::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(196,168,112,0.06) 0%, transparent 65%);
  pointer-events: none;
}
.gate.hidden { display: none; }
.gate-title {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  font-style: italic;
  color: var(--accent);
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  position: relative;
}
.gate-sub {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-dim);
  max-width: 360px;
  text-align: center;
  line-height: 1.55;
  position: relative;
}
.gate-input {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 24px;
  padding: 14px 22px;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-bright);
  outline: none;
  width: 300px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow:
    inset 0 2px 4px var(--tube-inset),
    0 1px 0 var(--tube-rim);
  position: relative;
}
.gate-input:focus {
  border-color: var(--accent);
  box-shadow:
    inset 0 2px 4px var(--tube-inset),
    0 0 0 3px var(--accent-soft),
    0 1px 0 var(--tube-rim);
}
.gate-btn {
  background: linear-gradient(180deg, #d4b880, #b49860);
  color: var(--bg-deep);
  border: none;
  border-radius: 24px;
  padding: 13px 36px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}
.gate-btn:hover { opacity: 0.9; }
.gate-btn:active { transform: scale(0.98); }

/* ── Messages ── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb {
  background: rgba(196,168,112,0.15);
  border-radius: 2px;
}

.msg {
  max-width: 85%;
  padding: 16px 20px;
  border-radius: 20px;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.01em;
  animation: msgIn 0.35s ease;
  position: relative;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User messages — recessed tube */
.msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, var(--surface-lit), var(--surface));
  border: 1px solid var(--border);
  color: var(--text-bright);
  border-bottom-right-radius: 6px;
  box-shadow:
    inset 0 1px 2px var(--tube-inset),
    0 2px 6px rgba(0,0,0,0.2);
}

/* Fellow messages — raised tube with glow */
.msg.fellow {
  align-self: flex-start;
  background: linear-gradient(145deg, rgba(196,168,112,0.1), rgba(196,168,112,0.04));
  border: 1px solid rgba(196,168,112,0.15);
  color: var(--text);
  border-bottom-left-radius: 6px;
  box-shadow:
    0 3px 10px rgba(0,0,0,0.25),
    0 0 20px rgba(196,168,112,0.04),
    inset 0 1px 0 rgba(255,245,225,0.05);
}
.msg.fellow strong {
  color: var(--text-bright);
  font-weight: 600;
}
.msg.fellow .fellow-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fellow-dim);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}

/* Thinking indicator */
.thinking {
  align-self: flex-start;
  padding: 14px 18px;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 400;
  background: rgba(196,168,112,0.03);
  border-radius: 20px;
  border: 1px solid rgba(196,168,112,0.06);
}
.thinking::after {
  content: '';
  animation: dots 1.5s steps(4,end) infinite;
}
@keyframes dots {
  0%  { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ── Reply zone — tube channel ── */
.reply-zone {
  flex-shrink: 0;
  padding: 14px 24px 22px;
  position: relative;
  background: linear-gradient(180deg, var(--bg-warm), var(--bg-deep));
}
.reply-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--tube-shadow), var(--tube-highlight));
  box-shadow:
    0 -1px 2px var(--tube-shadow),
    inset 0 -1px 0 var(--tube-highlight);
}
.reply-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.reply-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 13px 20px;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-bright);
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 160px;
  line-height: 1.55;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 2px 4px var(--tube-inset);
}
.reply-input:focus {
  border-color: var(--accent);
  box-shadow:
    inset 0 2px 4px var(--tube-inset),
    0 0 0 3px var(--accent-soft);
}
.reply-input::placeholder { color: var(--text-dim); }

/* Buttons — 3D tube caps */
.send-btn, .voice-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-bright);
  background: linear-gradient(145deg, var(--surface-lit), var(--surface));
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.25),
    inset 0 1px 0 var(--tube-highlight);
}
.send-btn:hover, .voice-btn:hover {
  background: linear-gradient(145deg, var(--surface-hover), var(--surface-lit));
  border-color: var(--accent);
  box-shadow:
    0 3px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 var(--tube-highlight),
    0 0 12px var(--accent-soft);
}
.send-btn:active, .voice-btn:active {
  transform: scale(0.95);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.3),
    inset 0 2px 4px var(--tube-inset);
}
.voice-btn.active {
  background: linear-gradient(145deg, #d4b880, #b49860);
  color: var(--bg-deep);
  border-color: var(--accent);
  box-shadow:
    0 2px 8px rgba(196,168,112,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  animation: voicePulse 2s ease infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(196,168,112,0.3), inset 0 1px 0 rgba(255,255,255,0.15); }
  50% { box-shadow: 0 2px 16px rgba(196,168,112,0.45), 0 0 24px rgba(196,168,112,0.15), inset 0 1px 0 rgba(255,255,255,0.15); }
}
.send-btn svg, .voice-btn svg { width: 22px; height: 22px; }

/* ── Voice status bar ── */
.voice-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  font-size: 0.75rem;
  color: var(--fellow-dim);
  font-style: italic;
}
.voice-bar.visible { display: flex; }
.voice-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(196,168,112,0.4);
  animation: voicePulse 1.5s ease infinite;
}

/* ── Beta badge ── */
.beta-badge {
  position: fixed;
  top: 8px;
  right: 12px;
  font-size: 0.6rem;
  font-family: var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.4;
  z-index: 2;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .messages { padding: 16px 16px; }
  .reply-zone { padding: 10px 16px 16px; }
  .msg { max-width: 92%; }
  .header { padding: 12px 16px 10px; }
}

/* ── Per-message Speaker Button ── */
.speak-btn {
  background: none;
  border: none;
  color: rgba(196,181,154,0.3);
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 6px;
  vertical-align: middle;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
}
.speak-btn:hover {
  color: var(--accent);
  filter: drop-shadow(0 0 4px rgba(196,168,112,0.3));
}

/* ── Onboarding Progressive Reveal ── */
.ob-beat {
  opacity: 0;
  transform: translateY(8px);
  animation: ob-in 0.5s ease forwards;
}

@keyframes ob-in {
  to { opacity: 1; transform: translateY(0); }
}

.ob-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.6rem;
  font-weight: 600;
  color: #c4b59a;
  margin-bottom: 1.2rem;
  line-height: 1.15;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.ob-line {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: rgba(255,255,255,0.88);
  margin-bottom: 0.55rem;
  line-height: 1.6;
}

.ob-detail {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  margin-bottom: 0.55rem;
  line-height: 1.6;
  padding-left: 0.5rem;
}

.ob-section {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(196,181,154,0.7);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  margin-bottom: 0.6rem;
}

.ob-fellow {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  font-style: italic;
  color: rgba(255,255,255,0.6);
  padding: 1.1rem 1.3rem;
  background: rgba(196,181,154,0.05);
  border-left: 3px solid rgba(196,181,154,0.3);
  border-radius: 0 4px 4px 0;
  margin-top: 0.5rem;
  line-height: 1.65;
  box-shadow: inset 2px 0 8px rgba(196,168,112,0.05);
}

.ob-cta {
  margin-top: 1.4rem;
}

.ob-cta-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(145deg, var(--surface-lit), var(--surface));
  color: #c4b59a;
  border: 1px solid rgba(196,181,154,0.3);
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.25),
    inset 0 1px 0 var(--tube-highlight);
}

.ob-cta-btn:hover {
  background: linear-gradient(145deg, var(--surface-hover), var(--surface-lit));
  border-color: rgba(196,181,154,0.45);
  box-shadow:
    0 3px 12px rgba(0,0,0,0.3),
    0 0 16px rgba(196,168,112,0.06),
    inset 0 1px 0 var(--tube-highlight);
}

/* ── Verification System ── */
.verify-bar {
  margin-top: 0.6rem;
  padding: 0.4rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.2rem;
  transition: opacity 1.5s ease;
}

.verify-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 0.35rem;
  margin-top: 0.3rem;
  flex-shrink: 0;
}

.verify-running {
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.03);
}
.verify-running .verify-dot {
  background: rgba(255,255,255,0.3);
  box-shadow: 0 0 4px rgba(255,255,255,0.15);
  animation: verify-pulse 1.2s ease-in-out infinite;
}

.verify-pass {
  color: rgba(130,190,130,0.7);
  background: rgba(130,190,130,0.05);
}
.verify-pass .verify-dot {
  background: rgba(130,190,130,0.7);
  box-shadow: 0 0 4px rgba(130,190,130,0.3);
}

.verify-info {
  color: rgba(180,180,220,0.7);
  background: rgba(180,180,220,0.05);
}
.verify-info .verify-dot {
  background: rgba(180,180,220,0.7);
  box-shadow: 0 0 4px rgba(180,180,220,0.3);
}

.verify-caution {
  color: rgba(220,190,100,0.85);
  background: rgba(220,190,100,0.06);
}
.verify-caution .verify-dot {
  background: rgba(220,190,100,0.85);
  box-shadow: 0 0 4px rgba(220,190,100,0.3);
}

.verify-critical {
  color: rgba(220,120,120,0.9);
  background: rgba(220,120,120,0.08);
}
.verify-critical .verify-dot {
  background: rgba(220,120,120,0.9);
  box-shadow: 0 0 4px rgba(220,120,120,0.3);
}

.verify-flags {
  width: 100%;
  margin-top: 0.3rem;
}

.verify-flag {
  padding: 0.25rem 0;
  font-size: 0.72rem;
  line-height: 1.4;
}

.verify-flag-icon {
  display: inline-block;
  width: 1.1em;
  text-align: center;
  font-weight: 600;
  margin-right: 0.3rem;
}

.verify-flag-critical .verify-flag-icon { color: rgba(220,120,120,0.9); }
.verify-flag-caution .verify-flag-icon { color: rgba(220,190,100,0.85); }
.verify-flag-info .verify-flag-icon { color: rgba(180,180,220,0.7); }

@keyframes verify-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
