:root {
  --bg: #f5f0e8;
  --card: #fffdf9;
  --ink: #1b2422;
  --muted: #5b6763;
  --line: #e4dccf;
  --accent: #0f766e;
  --accent-ink: #f5f0e8;
  --accent-soft: #d8ece8;
  --warn: #a15c07;
  --agent-bubble: #eef4f2;
  --user-bubble: #0f766e;
  --user-ink: #ffffff;
  --shadow: 0 1px 2px rgba(27, 36, 34, .06), 0 8px 24px rgba(27, 36, 34, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111615;
    --card: #19201e;
    --ink: #e6ece9;
    --muted: #98a5a0;
    --line: #2a3431;
    --accent: #3fb5a6;
    --accent-ink: #0d1413;
    --accent-soft: #1d3632;
    --warn: #e0a449;
    --agent-bubble: #222b29;
    --user-bubble: #2c8f83;
    --user-ink: #ffffff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 Inter, "IBM Plex Sans Arabic", system-ui, sans-serif;
}
[lang="ar"], [dir="rtl"] { font-family: "IBM Plex Sans Arabic", Inter, sans-serif; }
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
button, input { font: inherit; color: inherit; }

.top {
  max-width: 1180px; margin: 0 auto; padding: 20px 16px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); position: relative; flex: none;
}
.mark::after {
  content: ""; position: absolute; left: 8px; right: 8px; top: 14px; height: 10px;
  border: 2.5px solid var(--accent-ink); border-bottom: 0; border-radius: 12px 12px 0 0;
}
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 13px; }
.repo { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 14px; }
.repo:hover { text-decoration: underline; }

.layout {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px 24px;
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.side { display: grid; gap: 16px; }
.lede { color: var(--muted); margin: 10px 0 18px; max-width: 62ch; }
.small { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 500;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled { cursor: not-allowed; opacity: .6; }
.hint { color: var(--muted); font-size: 13px; }

.stage { display: grid; justify-items: center; gap: 10px; padding: 26px 0 18px; }
.orb {
  width: 132px; height: 132px; border-radius: 50%; border: 0; cursor: pointer; position: relative;
  background: radial-gradient(circle at 35% 30%, #37a99b, var(--accent) 60%, #0b4f49);
  color: #fff; font-weight: 600; font-size: 16px; box-shadow: 0 10px 30px rgba(15, 118, 110, .35);
  transition: transform .15s ease;
}
.orb:hover { transform: scale(1.03); }
.orb:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.orb-ring { position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.orb.live .orb-ring { animation: pulse 1.8s ease-out infinite; }
.orb.speaking { background: radial-gradient(circle at 35% 30%, #e7b35a, #b7791f 60%, #7a4f10); box-shadow: 0 10px 30px rgba(183, 121, 31, .35); }
.orb.speaking .orb-ring { border-color: #b7791f; }
@keyframes pulse { 0% { transform: scale(.95); opacity: .7; } 100% { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .orb.live .orb-ring { animation: none; opacity: .5; } }
.status { color: var(--muted); font-size: 14px; min-height: 22px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 14px; font-weight: 500; padding: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { opacity: .5; cursor: default; text-decoration: none; }

.transcript {
  border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px;
  max-height: 420px; overflow-y: auto; min-height: 120px;
}
.empty { color: var(--muted); font-size: 14px; margin: 0; list-style: none; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.agent { background: var(--agent-bubble); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.user { background: var(--user-bubble); color: var(--user-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.system { align-self: center; background: none; color: var(--muted); font-size: 13px; padding: 2px; }

.composer[hidden] { display: none; }
.composer { display: flex; gap: 8px; margin-top: 14px; }
.composer input {
  flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg);
}
.composer input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.composer button {
  border: 0; border-radius: 999px; padding: 10px 18px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer;
}

.owners { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.owner { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.owner-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.owner-name { font-weight: 600; }
.owner-creds { font: 500 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.owner-try { color: var(--muted); font-size: 13px; margin-top: 2px; }

.actions, .records { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 320px; overflow-y: auto; }
.action { border-left: 3px solid var(--accent); padding: 4px 0 4px 10px; font-size: 13px; }
.action.error { border-left-color: var(--warn); }
.action-name { font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.action-io { color: var(--muted); overflow-wrap: anywhere; }
.record { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.record b { display: block; font-size: 13px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 8px 16px 32px; color: var(--muted); font-size: 12.5px; }
