/* ============================================================
   CLAYRUNE INTERACTIVE DEMO
   Dark "product" surface on the warm tobacco palette.
   Reuses :root tokens from styles.css.
   ============================================================ */

/* the hidden attribute must win over display:flex/block below */
[hidden]{ display:none !important; }

/* ---- demo stage (the dashboard sits in a bounded frame on the cream page) ---- */
.demo-stage{ padding:6px 0 64px; }
.demo-stage-head{ display:flex; align-items:baseline; gap:16px; flex-wrap:wrap; margin:0 0 18px; }
.demo-stage-head .ref{ font-family:var(--mono); font-size:11px; letter-spacing:.18em; text-transform:uppercase; color:var(--cobalt); }
.demo-stage-sub{ margin:0; font-size:13.5px; color:var(--ink-3); }
.demo-note{ margin:18px auto 0; max-width:980px; text-align:center; font-size:13px; color:var(--ink-3); }
.demo-note a{ color:var(--cobalt); border-bottom:1px solid rgba(185,91,54,.3); }

/* let the demo stage run wider than the standard 1280 content column */
.demo-stage .wrap{ max-width:1500px; }

.demo-frame{
  max-width:1400px; margin:0 auto;
  height:min(820px, 86vh);
  display:flex; flex-direction:column;
  background:
    radial-gradient(900px 600px at 100% -10%, rgba(196,152,73,.10), transparent 60%),
    var(--dk-bg);
  color:var(--dk-fg);
  border:1px solid var(--dk-border); border-radius:18px; overflow:hidden;
  box-shadow:0 40px 90px -30px rgba(25,21,18,.45), 0 8px 24px -12px rgba(25,21,18,.3);
}

/* the real demo app, iframe-isolated so its CSS/JS can't touch the page */
.demo-embed{ flex:1 1 auto; width:100%; min-height:0; border:0; display:block; background:var(--dk-bg); }

/* in-frame app titlebar */
.demo-bar{
  height:42px; flex:none; display:flex; align-items:center; gap:12px;
  padding:0 14px; border-bottom:1px solid var(--dk-border); background:rgba(0,0,0,.16);
}
.demo-bar-dots{ display:flex; gap:6px; }
.demo-bar-dots i{ width:11px; height:11px; border-radius:50%; background:var(--dk-border); }
.demo-bar-dots i:nth-child(1){ background:#C9624A; } .demo-bar-dots i:nth-child(2){ background:#D7B470; } .demo-bar-dots i:nth-child(3){ background:#5DA362; }
.demo-bar-brand{ display:flex; align-items:center; gap:7px; font-size:13px; color:var(--dk-fg-2); }
.demo-bar-brand img{ width:18px; height:18px; }
.demo-tag{
  font-family:var(--mono); font-size:9.5px; text-transform:uppercase; letter-spacing:.13em;
  color:var(--cyan); border:1px solid rgba(215,180,112,.35); border-radius:999px; padding:2px 7px;
}
.demo-sim{ margin-left:auto; font-family:var(--mono); font-size:11px; color:var(--sage); letter-spacing:.02em; }

/* ---- app shell (fills the frame) ---- */
.app{
  flex:1; min-height:0;
  display:grid;
  grid-template-columns:248px 1fr;
}

/* ---- sidebar ---- */
.side{
  border-right:1px solid var(--dk-border);
  background:rgba(0,0,0,.10);
  display:flex; flex-direction:column;
  min-height:0;
}
.side-h{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px 10px;
}
.side-h-ttl{ font-family:var(--mono); font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--dk-fg-2); }
.side-h-add{ color:var(--dk-fg-2); cursor:default; font-size:16px; line-height:1; }
.proj-list{ list-style:none; margin:0; padding:4px 10px; overflow-y:auto; flex:1; min-height:0; }
.proj{
  display:flex; align-items:center; gap:11px;
  padding:11px 12px; border-radius:11px; cursor:pointer;
  border:1px solid transparent;
  transition:background .15s, border-color .15s;
}
.proj:hover{ background:rgba(255,255,255,.04); }
.proj.is-active{ background:rgba(185,91,54,.16); border-color:rgba(185,91,54,.4); }
.proj-ic{
  width:30px; height:30px; flex:none; border-radius:9px;
  display:grid; place-items:center; font-size:14px;
  background:color-mix(in srgb, var(--c) 26%, transparent);
  color:var(--c); border:1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.proj-ic.sm{ width:24px; height:24px; border-radius:7px; font-size:12px; }
.proj-meta{ display:flex; flex-direction:column; line-height:1.25; min-width:0; }
.proj-meta b{ font-size:13.5px; color:var(--dk-fg); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.proj-meta small{ font-size:11px; color:var(--dk-fg-2); }
.dot{ width:8px; height:8px; border-radius:50%; margin-left:auto; flex:none; }
.dot-live{ background:var(--sage); box-shadow:0 0 0 4px rgba(93,163,98,.18); animation:pulse 1.6s infinite; }
.dot-idle{ background:var(--dk-fg-3); }
.side-f{ padding:14px; border-top:1px solid var(--dk-border); }
.side-cap{
  font-size:11.5px; line-height:1.5; color:var(--dk-fg-2);
  display:flex; gap:9px; align-items:flex-start;
}
.ci{ width:14px; height:14px; fill:currentColor; flex:none; }
.side-cap .ci{ color:var(--cyan); margin-top:2px; }

/* ---- console ---- */
.console{ display:flex; flex-direction:column; min-height:0; }
.con-top{
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 22px; border-bottom:1px solid var(--dk-border);
  background:rgba(0,0,0,.06);
}
.con-title{ display:flex; align-items:center; gap:9px; font-size:14.5px; }
.con-sub{ font-family:var(--mono); font-size:10.5px; color:var(--dk-fg-2); letter-spacing:.06em; text-transform:uppercase; }
.con-chips{ display:flex; gap:8px; }
.cchip{
  display:flex; align-items:center; gap:6px;
  font-size:11.5px; color:var(--dk-fg-2);
  border:1px solid var(--dk-border); border-radius:999px; padding:5px 11px;
  background:rgba(0,0,0,.10);
}
.cchip .ci{ width:12px; height:12px; color:var(--dk-fg-2); }

/* ---- transcript ---- */
.thread{
  flex:1; min-height:0; overflow-y:auto;
  padding:26px 22px 30px;
  display:flex; flex-direction:column; gap:20px;
  scroll-behavior:smooth;
}
.thread::-webkit-scrollbar{ width:9px; }
.thread::-webkit-scrollbar-thumb{ background:var(--dk-border); border-radius:9px; }

.msg{ display:flex; gap:13px; max-width:760px; animation:rise .35s ease both; }
@keyframes rise{ from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:none} }
.msg.user{ margin-left:auto; flex-direction:row-reverse; }
.ava{ width:34px; height:34px; flex:none; border-radius:10px; overflow:hidden;
  background:rgba(0,0,0,.2); border:1px solid var(--dk-border); display:grid; place-items:center; }
.ava img{ width:100%; height:100%; object-fit:cover; }
.msg.user .ava{ background:var(--cobalt); color:#fff; font-weight:600; font-size:13px; }

.bubble{
  background:var(--dk-surface); border:1px solid var(--dk-border);
  border-radius:14px; padding:13px 16px; font-size:14px; line-height:1.6;
}
.msg.user .bubble{ background:var(--cobalt); border-color:transparent; color:#fff; }
.bubble p{ margin:0 0 6px; }
.bubble p:last-child{ margin-bottom:0; }
.bubble .muted{ color:var(--dk-fg-2); font-size:13px; }
.msg.user .bubble .muted{ color:rgba(255,255,255,.8); }
.who{ font-size:11px; font-family:var(--mono); letter-spacing:.04em; color:var(--dk-fg-2); margin-bottom:5px; }
.who .role{ color:var(--cyan); }
.msg.user .who{ display:none; }

/* typing dots */
.typing{ display:inline-flex; gap:4px; padding:3px 0; }
.typing i{ width:6px; height:6px; border-radius:50%; background:var(--dk-fg-2); animation:blink 1.1s infinite both; }
.typing i:nth-child(2){ animation-delay:.18s; }
.typing i:nth-child(3){ animation-delay:.36s; }

/* plan card */
.plan{ margin-top:4px; border:1px solid var(--dk-border); border-radius:12px; overflow:hidden; background:rgba(0,0,0,.14); }
.plan-h{ padding:9px 14px; font-family:var(--mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase;
  color:var(--cyan); border-bottom:1px solid var(--dk-border); display:flex; align-items:center; gap:8px; }
.plan ol{ margin:0; padding:10px 14px 12px 32px; display:flex; flex-direction:column; gap:7px; }
.plan li{ font-size:13.5px; line-height:1.5; color:var(--dk-fg); }
.plan li.done{ color:var(--dk-fg-2); text-decoration:line-through; text-decoration-color:var(--dk-fg-3); }
.plan li.active{ color:#fff; }
.plan li.active::marker{ color:var(--cobalt); font-weight:700; }

/* approve bar */
.approve{ display:flex; align-items:center; gap:10px; margin-top:12px; flex-wrap:wrap; }
.approve .ap-q{ font-size:13px; color:var(--dk-fg-2); margin-right:2px; }
.btn-approve{
  background:var(--sage); color:#10240f; font-weight:600; border:none;
  padding:9px 16px; border-radius:9px; cursor:pointer; font-size:13.5px;
  display:inline-flex; align-items:center; gap:7px;
}
.btn-approve:hover{ filter:brightness(1.06); }
.btn-edit{
  background:transparent; color:var(--dk-fg); border:1px solid var(--dk-border);
  padding:9px 15px; border-radius:9px; cursor:pointer; font-size:13.5px;
}
.btn-edit:hover{ background:rgba(255,255,255,.05); }

/* working log (tool calls) */
.worklog{
  margin-top:10px; border:1px solid var(--dk-border); border-radius:12px;
  background:#241a11; padding:12px 14px; font-family:var(--mono); font-size:12.5px; line-height:1.85;
}
.wl-line{ display:flex; gap:10px; align-items:baseline; opacity:0; animation:rise .25s ease forwards; }
.wl-verb{ width:54px; flex:none; text-transform:uppercase; font-size:10.5px; letter-spacing:.06em; }
.wl-read{ color:#7Fb0c9; } .wl-edit{ color:var(--cobalt-soft); } .wl-run{ color:var(--cyan); }
.wl-add{ color:var(--sage); }
.wl-arg{ color:var(--dk-fg); }
.wl-meta{ color:var(--dk-fg-2); margin-left:auto; padding-left:14px; }
.wl-ok{ color:var(--sage); }

/* summary card */
.summary{ margin-top:10px; border:1px solid rgba(93,163,98,.4); border-radius:12px;
  background:rgba(93,163,98,.10); padding:13px 16px; }
.summary .s-h{ font-family:var(--mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase;
  color:var(--sage); margin-bottom:7px; display:flex; align-items:center; gap:8px; }
.summary p{ margin:0 0 6px; font-size:13.5px; line-height:1.55; }
.summary .files{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.fpill{ font-family:var(--mono); font-size:11px; color:var(--dk-fg); background:rgba(0,0,0,.22);
  border:1px solid var(--dk-border); border-radius:6px; padding:3px 8px; }
.fpill .pl{ color:var(--sage); } .fpill .mn{ color:var(--trading); }

/* ---- composer ---- */
.composer{ border-top:1px solid var(--dk-border); padding:14px 22px 16px; background:rgba(0,0,0,.10); }
.chips{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:11px; }
.chip{
  font-size:12.5px; color:var(--dk-fg); background:rgba(255,255,255,.04);
  border:1px solid var(--dk-border); border-radius:999px; padding:7px 13px; cursor:pointer;
  transition:background .14s, border-color .14s, transform .14s;
}
.chip:hover{ background:rgba(255,255,255,.08); }
.chip-primary{ border-color:rgba(215,180,112,.5); color:var(--cyan); background:rgba(215,180,112,.08); }
.chip.glow{ animation:chipglow 1.5s ease-in-out infinite; }
@keyframes chipglow{ 0%,100%{ box-shadow:0 0 0 0 rgba(215,180,112,.0) } 50%{ box-shadow:0 0 0 5px rgba(215,180,112,.18) } }
.chips.spent{ display:none; }

.input-row{ display:flex; gap:10px; align-items:center; }
#input{
  flex:1; background:#241a11; border:1px solid var(--dk-border); border-radius:11px;
  padding:13px 15px; color:var(--dk-fg); font-family:var(--sans); font-size:14px; outline:none;
}
#input::placeholder{ color:var(--dk-fg-3); }
#input:focus{ border-color:var(--cobalt); }
#input:disabled{ opacity:.5; }
.send{
  width:46px; height:46px; flex:none; border:none; border-radius:11px; cursor:pointer;
  background:var(--cobalt); color:#fff; display:grid; place-items:center;
  transition:filter .14s, transform .14s;
}
.send:hover{ filter:brightness(1.07); }
.send:disabled{ opacity:.45; cursor:default; }
.send .ci{ width:18px; height:18px; }
.composer-foot{ margin-top:9px; }
.composer-hint{ font-size:11.5px; color:var(--dk-fg-3); font-family:var(--mono); letter-spacing:.01em; }

/* ---- coach mark ---- */
.coach{
  position:fixed; z-index:40; max-width:240px;
  background:var(--cyan); color:#2a1d0c; font-size:12.5px; font-weight:600; line-height:1.4;
  padding:9px 12px; border-radius:10px;
  box-shadow:0 12px 30px rgba(0,0,0,.4);
  animation:coachpop .25s ease both;
}
@keyframes coachpop{ from{opacity:0; transform:scale(.92)} to{opacity:1; transform:none} }
.coach-arrow{ position:absolute; width:12px; height:12px; background:var(--cyan); transform:rotate(45deg); }

/* ---- finish ---- */
.finis{
  position:fixed; left:50%; bottom:26px; transform:translateX(-50%);
  z-index:45; width:min(560px, calc(100vw - 36px));
  display:flex; gap:15px; align-items:center;
  background:var(--paper-3); color:var(--ink); border-radius:16px;
  padding:16px 18px; box-shadow:0 24px 60px rgba(0,0,0,.45);
  animation:rise .4s ease both;
}
.finis img{ width:52px; height:52px; flex:none; }
.finis-body b{ font-size:15px; }
.finis-body p{ margin:3px 0 10px; font-size:13px; color:var(--ink-2); line-height:1.5; }
.finis-cta{ display:flex; gap:10px; flex-wrap:wrap; }
.finis .btn{ padding:9px 15px; font-size:13px; }
.btn-ghost{ background:transparent; border:1px solid var(--line); color:var(--ink-2); cursor:pointer; }
.btn-ghost:hover{ background:var(--paper-2); }

/* ============================================================
   RESPONSIVE — phones: sidebar collapses, console full width
   ============================================================ */
@media (max-width:820px){
  .app{ grid-template-columns:1fr; }
  .side{ display:none; }
  .con-chips{ display:none; }
  .thread{ padding:20px 15px 26px; }
  .msg{ max-width:100%; }
  .composer{ padding:12px 15px 14px; }
  .demo-frame{ height:min(620px, 80vh); border-radius:14px; }
  .demo-stage{ padding:4px 0 48px; }
}
@media (max-width:560px){
  .demo-sim{ display:none; }
}
@media (max-width:560px){
  .chips{ flex-direction:column; align-items:stretch; }
  .chip{ width:100%; text-align:left; font-size:12.5px; padding:9px 13px; }
  .wl-meta{ display:none; }
}
