/* ════════════════════════════════════════════════════════════════════════
   aedelgard-chat.css — THE SINGLE SHARED CHAT DESIGN.
   Source of truth for both faces of the same mind:
     • web   → aedelgard/public/app.html        (broker, key bar, anchor menu)
     • body  → aedelgard-body/tower/.../chat.html (localhost, dreams moon)
   Each face links THIS sheet and adds only its own chrome on top.
   The body VENDORS a copy at build time (must stay offline-self-contained —
   never fetched remotely, or it leaks a request + breaks operator-blindness).
   Change a bubble colour here once; both faces update. Do not fork this.
   ════════════════════════════════════════════════════════════════════════ */

/* ── base: reset, tokens, body ── */
  *{box-sizing:border-box;margin:0;padding:0}
  :root{--amber:#e8b878;--ink:#cdc4b5;--bg:#0a0908;--panel:#100e0b;--line:rgba(245,235,220,.08)}
  html,body{height:100%}
  body{background:var(--bg);color:var(--ink);font-family:'Schibsted Grotesk',sans-serif;-webkit-font-smoothing:antialiased;display:flex;flex-direction:column;height:100vh;overflow:hidden}


  /* ── chat ── */
  .scroll{flex:1;overflow-y:auto;padding:26px 0 12px}
  .thread{max-width:780px;margin:0 auto;padding:0 22px}
  .msg{margin:0 0 22px;display:flex;gap:13px;align-items:flex-start}
  .av{width:27px;height:27px;border-radius:7px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-family:'JetBrains Mono',monospace;font-size:11px;margin-top:2px}
  .msg.user .av{background:#1d1813;color:#b3aa9b}
  .msg.assistant .av{background:rgba(232,184,120,.12)}
  .body{flex:1;min-width:0;font-size:15.5px;line-height:1.72;color:#e4ddd0;overflow-wrap:anywhere}
  .msg.user .body{color:#cdc4b5}
  .body p{margin:0 0 11px}.body p:last-child{margin-bottom:0}
  .body pre{background:#0d0c0a;border:1px solid var(--line);border-radius:9px;padding:14px 15px;overflow-x:auto;margin:11px 0;font-family:'JetBrains Mono',monospace;font-size:13px;line-height:1.6;color:#d6cdbd}
  .body code{font-family:'JetBrains Mono',monospace;font-size:.9em;background:#181410;padding:1.5px 5px;border-radius:4px;color:var(--amber)}
  .body pre code{background:none;padding:0;color:inherit}
  .body ul,.body ol{margin:8px 0 11px;padding-left:22px}.body li{margin:3px 0}
  .body h1,.body h2,.body h3{color:#f1ece2;margin:16px 0 8px;line-height:1.3}
  .body h1{font-size:21px}.body h2{font-size:18px}.body h3{font-size:16px}
  .body a{color:var(--amber)}
  .body strong{color:#f1ece2}
  .cursor{display:inline-block;width:8px;height:16px;background:var(--amber);vertical-align:text-bottom;animation:blink 1s steps(1) infinite}
  @keyframes blink{50%{opacity:0}}

  /* ── composer ── */
  .composer{border-top:1px solid var(--line);background:#0d0c0a;padding:14px 18px 18px;flex-shrink:0}
  .cwrap{max-width:780px;margin:0 auto;display:flex;gap:10px;align-items:flex-end;background:#161310;border:1px solid var(--line);border-radius:13px;padding:8px 8px 8px 16px}
  .cwrap textarea{flex:1;min-width:0;background:transparent;border:none;outline:none;resize:none;color:#ece4d6;font-family:'Schibsted Grotesk',sans-serif;font-size:15.5px;line-height:1.5;max-height:180px;padding:8px 0}
  .send{flex-shrink:0;width:38px;height:38px;border:none;border-radius:9px;background:var(--amber);color:#211c14;cursor:pointer;font-size:17px;display:flex;align-items:center;justify-content:center;transition:.15s}
  .send:disabled{background:#3a342b;color:#6b6353;cursor:not-allowed}
  .hint{max-width:780px;margin:9px auto 0;font-family:'JetBrains Mono',monospace;font-size:10.5px;color:#5f594c;text-align:center}

  .empty{max-width:560px;margin:8vh auto 0;text-align:center;padding:0 24px}
  .empty h1{font-size:25px;font-weight:600;color:#f1ece2;letter-spacing:-0.02em}
  .empty p{font-size:15.5px;line-height:1.6;color:#9a9082;margin-top:12px}
  /* ── stage: chat + cache panel ── */
  .stage{flex:1;display:flex;min-height:0;overflow:hidden}
  .chatcol{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0}
  .chatcol .scroll{flex:1;overflow-y:auto;padding:26px 0 12px}
  .cachepanel{flex:0 0 268px;width:268px;background:#0c0b09;border-left:1px solid var(--line);position:relative;transition:flex-basis .28s ease,width .28s ease}
  .cachepanel.folded{flex-basis:0;width:0}
  .panel-toggle{position:absolute;left:-13px;top:18px;z-index:5;width:26px;height:26px;border-radius:50%;border:1px solid var(--line);background:#161310;color:var(--amber);cursor:pointer;font-size:13px;line-height:1;display:flex;align-items:center;justify-content:center}
  .cachepanel.folded .panel-toggle{left:-26px}
  .panel-inner{padding:20px 18px;height:100%;overflow-y:auto;box-sizing:border-box;opacity:1;transition:opacity .2s}
  .cachepanel.folded .panel-inner{opacity:0;pointer-events:none}
  .panel-head{font-family:'JetBrains Mono',monospace;font-size:11px;letter-spacing:.12em;color:#cba968;display:flex;align-items:center;gap:8px;margin-bottom:18px}
  .live-dot{width:7px;height:7px;border-radius:50%;background:#3a342b;transition:background .3s,box-shadow .3s}
  .live-dot.on{background:#9fd29a;box-shadow:0 0 8px rgba(159,210,154,.8)}
  .metric{display:flex;justify-content:space-between;align-items:baseline;padding:9px 0;border-bottom:1px solid rgba(203,169,104,.1)}
  .mlabel{font-size:12.5px;color:#8a8170}
  .mval{font-family:'JetBrains Mono',monospace;font-size:14px;color:#ece4d6}
  .mval.ok{color:#9fd29a}
  .ctx-wrap{margin-top:22px}
  .ctx-head{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#8a8170;margin-bottom:8px}
  .ctx-rail{position:relative;height:200px;border:1px solid var(--line);border-radius:9px;background:#100e0b;overflow:hidden;display:flex;flex-direction:column-reverse}
  .ctx-fill{width:100%;height:0;background:linear-gradient(180deg,#e8b878,#b07d3c);transition:height .5s cubic-bezier(.2,.8,.2,1)}
  .chk{position:absolute;left:0;right:0;height:0;border-top:2px dashed #f1d9a8;pointer-events:none}
  .chk::after{content:'◆';position:absolute;right:4px;top:-9px;color:#f1d9a8;font-size:11px}
  .ctx-legend{font-size:11px;color:#6f6757;margin-top:8px;display:flex;justify-content:space-between}
  .chk-key{color:#f1d9a8}
  .panel-note{font-size:11px;line-height:1.55;color:#6f6757;margin-top:18px}
  @media(max-width:820px){.cachepanel{position:fixed;right:0;top:0;bottom:0;z-index:40;box-shadow:-12px 0 40px rgba(0,0,0,.5)}}


  /* ── The crown: shining crystal, dead-centre at the very top peak, ever-present ── */
  /* bounded lane: fixed height, clear bottom border, never bleeds into the page (mobile too) */
  .ae-crown{position:relative;width:100%;height:66px;display:flex;justify-content:center;align-items:center;background:#0d0c0a;border-bottom:1px solid var(--line);pointer-events:none;overflow:hidden;flex-shrink:0}
  .ae-crown .ae-crown-stage{perspective:420px;width:46px;height:40px;display:flex;align-items:center;justify-content:center;position:relative}
  .ae-crown .ae-crown-halo{position:absolute;left:50%;top:50%;width:61px;height:61px;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle,rgba(250,232,190,.26),rgba(232,184,120,.07) 50%,transparent 70%);filter:blur(5px);animation:ae-breathe 5s ease-in-out infinite}
  .ae-crown .ae-floater{animation:gem-float 7s ease-in-out infinite;transform-style:preserve-3d}
  .ae-crown .ae-gem{position:relative;width:28px;height:28px;transform-style:preserve-3d;animation:gem-spin 16s linear infinite}
  .ae-crown .ae-face{position:absolute;left:50%;top:50%;width:24px;height:24px;margin:-12px 0 0 -12px;background:linear-gradient(135deg,rgba(245,206,140,.42),rgba(203,169,104,.08));border:1px solid rgba(245,206,140,.7);clip-path:polygon(50% 0,100% 100%,0 100%)}
  .ae-crown .ae-f1{transform:rotateY(0deg)   translateZ(8px) rotateX(38deg)}
  .ae-crown .ae-f2{transform:rotateY(90deg)  translateZ(8px) rotateX(38deg)}
  .ae-crown .ae-f3{transform:rotateY(180deg) translateZ(8px) rotateX(38deg)}
  .ae-crown .ae-f4{transform:rotateY(270deg) translateZ(8px) rotateX(38deg)}
  .ae-crown .ae-f5{transform:rotateY(0deg)   translateZ(8px) rotateX(38deg) scaleY(-1) translateY(-24px)}
  .ae-crown .ae-f6{transform:rotateY(90deg)  translateZ(8px) rotateX(38deg) scaleY(-1) translateY(-24px)}
  .ae-crown .ae-f7{transform:rotateY(180deg) translateZ(8px) rotateX(38deg) scaleY(-1) translateY(-24px)}
  .ae-crown .ae-f8{transform:rotateY(270deg) translateZ(8px) rotateX(38deg) scaleY(-1) translateY(-24px)}
  .ae-crown .ae-core{position:absolute;left:50%;top:50%;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;background:radial-gradient(circle,rgba(250,232,190,1),rgba(232,184,120,.4) 55%,transparent 74%);filter:blur(1.5px);animation:ae-breathe 5s ease-in-out infinite}
  /* the anchor now wears the real logo mark, not the inline gem */
  .ae-anchor .ae-logo{width:56px;height:56px;flex-shrink:0;filter:drop-shadow(0 0 12px rgba(232,184,120,.35))}

  /* crown animations (crown markup lives in this shared sheet) */
  @keyframes gem-spin{from{transform:rotateX(-18deg) rotateY(0deg)}to{transform:rotateX(-18deg) rotateY(360deg)}}
  @keyframes gem-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-7px)}}
  @keyframes ae-breathe{0%,100%{opacity:.5}50%{opacity:1}}
