/* ARC assistant — styling */
:root {
  --accent: #38e1ff;
  --accent-soft: rgba(56, 225, 255, 0.16);
  --ink: #eaf6ff;
  --muted: #7f93a8;
  --panel: rgba(9, 16, 26, 0.72);
  --line: rgba(140, 190, 220, 0.14);
}

body[data-mode="friday"] {
  --accent: #ffb347;
  --accent-soft: rgba(255, 179, 71, 0.16);
}

body[data-mode="edith"] {
  --accent: #ff4d6d;
  --accent-soft: rgba(255, 77, 109, 0.16);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 26%, rgba(56, 120, 170, 0.22), transparent 58%),
    radial-gradient(circle at 80% 100%, rgba(20, 60, 90, 0.35), transparent 55%),
    #04070c;
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 200, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 200, 255, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 36%, #000 0%, transparent 74%);
  mask-image: radial-gradient(circle at 50% 36%, #000 0%, transparent 74%);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 10px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: dotPulse 2.6s ease-in-out infinite;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; letter-spacing: 0.22em; }
.brand-text small { color: var(--muted); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }

.modes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.modes button {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.modes button:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.24); }

.modes button.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-soft);
}

/* ---------- stage ---------- */
.stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- reactor orb ---------- */
.reactor {
  position: relative;
  width: 132px;
  height: 132px;
  flex: none;
  margin-top: 2px;
}

.core-halo,
.ring {
  position: absolute;
  border-radius: 50%;
}

.core-halo {
  inset: -34%;
  background: radial-gradient(circle, var(--accent-soft), transparent 62%);
  filter: blur(16px);
  animation: breathe 5s ease-in-out infinite;
}

.ring { inset: 0; border: 1px solid var(--accent); }

.ring-1 {
  opacity: 0.4;
  border-style: dashed;
  animation: spin 26s linear infinite;
}

.ring-2 {
  inset: 15%;
  border-color: transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  opacity: 0.75;
  animation: spin 7s linear infinite;
}

.ring-3 {
  inset: 29%;
  opacity: 0.6;
  animation: breathe 3.6s ease-in-out infinite;
}

.core {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ffffff, var(--accent) 58%, transparent 78%);
  box-shadow: 0 0 26px var(--accent), 0 0 80px var(--accent-soft);
  animation: breathe 3.2s ease-in-out infinite;
}

body[data-state="listening"] .ring-2 { animation-duration: 2s; }
body[data-state="listening"] .ring-1 { animation-duration: 9s; }
body[data-state="listening"] .core { animation-duration: 1.1s; }

body[data-state="speaking"] .ring-2 { animation-duration: 3.2s; }
body[data-state="speaking"] .core { animation-duration: 0.62s; }

.status {
  margin: 6px 0 4px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- conversation ---------- */
.log {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 190, 220, 0.3) transparent;
}

.log::-webkit-scrollbar { width: 8px; }
.log::-webkit-scrollbar-thumb { background: rgba(140, 190, 220, 0.26); border-radius: 8px; }

.msg {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: start;
  animation: rise 0.26s ease both;
}

.msg .tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding-top: 11px;
  text-align: right;
}

.msg.ai .tag { color: var(--accent); }

.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  border-top-left-radius: 4px;
  font-size: 15px;
  overflow-wrap: anywhere;
  background: linear-gradient(180deg, var(--accent-soft), rgba(8, 14, 22, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.msg.user .bubble {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
}

.msg.system .bubble {
  background: rgba(255, 255, 255, 0.03);
  border-style: dashed;
  color: var(--muted);
  font-size: 13.5px;
}

.cmd-list {
  margin: 10px 0 2px;
  padding-left: 16px;
  display: grid;
  gap: 6px;
}

.cmd-list li { font-size: 13.5px; color: #b9c9d8; }
.cmd-list strong { color: var(--accent); margin-right: 6px; font-weight: 600; }

.link-chip {
  display: inline-block;
  margin-top: 9px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.link-chip:hover { background: var(--accent-soft); }

/* ---------- timers ---------- */
.timers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.timers:empty { display: none; }

.timer-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  font-size: 12.5px;
}

.t-name { color: #d6e7f4; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-left { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }

.t-x {
  border: 0;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #cfe0ee;
  font-size: 10px;
  line-height: 1;
}

.t-x:hover { background: var(--accent); color: #04070c; }

/* ---------- composer ---------- */
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 7px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.composer input {
  flex: 1;
  min-width: 0;
  padding: 9px 2px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.composer input::placeholder { color: #5d7186; }

.mic, .send {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.mic {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(255, 255, 255, 0.08);
}

.mic:hover { background: var(--accent); color: #04070c; }

.mic svg { display: block; }

.send {
  flex: none;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  background: var(--accent);
  color: #04070c;
}

.send:hover { filter: brightness(1.08); }

body[data-state="listening"] .mic {
  background: var(--accent);
  color: #04070c;
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: micPulse 1.4s ease-in-out infinite;
}

.hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
  color: #5d7186;
}

/* ---------- ai ---------- */
.ai-pill {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.ai-pill:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); }

.ai-pill.on {
  color: var(--accent);
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ai-pill.busy { animation: dotPulse 1s ease-in-out infinite; }

.ai-panel {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 6px;
  padding: 14px 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--accent);
  background: rgba(7, 13, 21, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  animation: rise 0.22s ease both;
}

.ai-panel[hidden] { display: none; }

.ai-panel h2 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.ai-panel p {
  margin: 0 0 11px;
  font-size: 13px;
  line-height: 1.5;
  color: #b9c9d8;
}

.ai-form { display: flex; flex-wrap: wrap; gap: 8px; }

.ai-form input {
  flex: 1;
  min-width: 190px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.ai-form input:focus { border-color: var(--accent); }

.ai-form button {
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #04070c;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-note { margin: 9px 0 0; font-size: 12px; color: var(--muted); }
.ai-note a { color: var(--accent); }

.ai-remove {
  margin-top: 9px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.ai-remove:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); }

.bubble.streaming { opacity: 0.86; }

/* ---------- things I build ---------- */
.built { display: grid; gap: 10px; margin-top: 8px; }

.built-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.built-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: 4px 10px;
}

.built-btn {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  text-decoration: none;
  cursor: pointer;
}

.built-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.built-frame {
  width: 100%;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.built-code {
  margin: 0;
  max-height: 300px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  color: #cfe9ff;
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre;
}

.built-note {
  margin: 10px 0 0;
  white-space: pre-line;
  font-size: 14px;
}

/* ---------- animation ---------- */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50% { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0.04); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 540px) {
  .reactor { width: 104px; height: 104px; }
  .topbar { padding: 12px 14px 6px; }
  .brand-text small { display: none; }
  .msg { grid-template-columns: 44px 1fr; gap: 8px; }
  .bubble { font-size: 14.5px; }
  .hint { display: none; }
  .send { padding: 11px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
