/* ────────────────────────────────────────────────────────────────────────
   The Echo Chamber — a fun test interface for the echo2 agent.
   Built on top of the `blocks init --type embed --agent echo2` scaffold.
   ──────────────────────────────────────────────────────────────────────── */

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

:root {
  --void-1: #0f0c29;
  --void-2: #302b63;
  --void-3: #24243e;
  --ink: #f4ecd8;
  --ink-dim: rgba(244, 236, 216, 0.65);
  --ink-faint: rgba(244, 236, 216, 0.25);
  --glow: #ffb74d;
  --glow-hot: #ff8a65;
  --accent: #80deea;
  --danger: #ef9a9a;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow-glow: 0 0 32px rgba(255, 183, 77, 0.35);
  --shadow-soft: 0 6px 24px rgba(0, 0, 0, 0.4);
}

html, body {
  min-height: 100%;
  height: 100%;
}

body {
  font-family: "Helvetica Neue", Helvetica, system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  background: radial-gradient(ellipse at top, var(--void-2), var(--void-1) 50%, var(--void-3));
  color: var(--ink);
  padding: 2rem 1rem;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

/* ───── layout ───── */

.chamber {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.chamber__hero {
  text-align: center;
  padding-top: 2rem;
}

.chamber__badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(128, 222, 234, 0.4);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1.2rem;
  backdrop-filter: blur(6px);
}

.chamber__title {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(135deg, var(--glow), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(255, 183, 77, 0.2);
  margin-bottom: 0.8rem;
}

.chamber__subtitle {
  color: var(--ink-dim);
  font-size: 1.05rem;
  line-height: 1.5;
}

/* ───── auth bar ───── */

.chamber__auth {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.chamber__error {
  color: var(--danger);
  font-size: 0.9rem;
  font-style: italic;
}

/* ───── shared buttons ───── */

.chamber__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  color: var(--ink);
}
.chamber__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chamber__btn:not(:disabled):hover { transform: translateY(-1px); }

.chamber__btn--primary {
  background: linear-gradient(135deg, var(--glow), var(--glow-hot));
  color: #1a1a1a;
  box-shadow: var(--shadow-glow);
}
.chamber__btn--primary:not(:disabled):hover {
  box-shadow: 0 0 40px rgba(255, 138, 101, 0.55);
}

.chamber__btn--ghost {
  background: transparent;
  border: 1px solid var(--ink-faint);
  color: var(--ink-dim);
}
.chamber__btn--ghost:hover { color: var(--ink); }

.chamber__btn--shout {
  background: linear-gradient(135deg, var(--accent), #4fc3f7);
  color: #0a1a2a;
  box-shadow: 0 0 24px rgba(128, 222, 234, 0.35);
  align-self: flex-end;
  font-size: 1rem;
  padding: 0.8rem 1.8rem;
}
.chamber__btn--shout:not(:disabled):hover {
  box-shadow: 0 0 40px rgba(128, 222, 234, 0.55);
}

.chamber__btn-emoji { filter: grayscale(0); font-size: 1.05em; }

/* ───── echo input card ───── */

.echo-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: var(--shadow-soft);
}

.echo-card__label {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.echo-card textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, "Menlo", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.echo-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(128, 222, 234, 0.18);
}

.echo-card__hint {
  color: var(--ink-dim);
  font-size: 0.85rem;
  font-style: italic;
}
.echo-card__hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ───── status / ripple ───── */

.echo-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius);
  min-height: 4rem;
  transition: border-color 0.3s ease;
}

.echo-status.is-active {
  border-color: rgba(255, 183, 77, 0.35);
  box-shadow: 0 0 24px rgba(255, 183, 77, 0.12);
}

.echo-status__ripple {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.echo-status__ripple span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--glow);
  opacity: 0;
  transform: scale(0.5);
}
.echo-status.is-active .echo-status__ripple span {
  animation: ripple 1.6s cubic-bezier(0.2, 0.6, 0.2, 1) infinite;
}
.echo-status.is-active .echo-status__ripple span:nth-child(2) { animation-delay: 0.4s; }
.echo-status.is-active .echo-status__ripple span:nth-child(3) { animation-delay: 0.8s; }

@keyframes ripple {
  0%   { transform: scale(0.4); opacity: 0.85; }
  100% { transform: scale(1.6); opacity: 0; }
}

.echo-status__messages {
  font-size: 0.95rem;
  color: var(--ink-dim);
  font-style: italic;
  transition: color 0.3s ease;
}
.echo-status.is-active .echo-status__messages { color: var(--ink); font-style: normal; }
.echo-status.is-done .echo-status__messages { color: var(--accent); font-style: normal; }

/* ───── echo output ───── */

.echo-output {
  background: linear-gradient(180deg, rgba(255, 183, 77, 0.08), rgba(255, 138, 101, 0.04));
  border: 1px solid rgba(255, 183, 77, 0.35);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: 0 0 40px rgba(255, 183, 77, 0.12);
  animation: echoIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes echoIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.echo-output__label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--glow);
}

.echo-output pre.output {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, "Menlo", monospace;
  font-size: 1.05rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* ───── footer ───── */

.chamber__footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding-top: 1.5rem;
}
.chamber__footer a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-faint);
}
.chamber__footer a:hover { color: var(--accent); }
.chamber__footer code {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
