/* Agent Soul — companion inner-world dashboard */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root{
  --bg:#0a0a0f; --surface:#111118; --border:#1a1a25;
  --text:#c8c8d8; --text-dim:#6a6a80; --text-bright:#e8e8f4;
  --accent:#788cc8; --accent-warm:#f0a03c; --accent-glow:#96a0dc;
  --mono:'Menlo','Cascadia Code','Consolas',monospace;
  --sans:'Inter','Segoe UI','Helvetica Neue',sans-serif;
}
html{font-size:15px;background:var(--bg);color:var(--text)}
body{font-family:var(--sans);min-height:100dvh;overflow-x:hidden}

/* --- Auth gate --- */
#auth-gate{display:flex;flex-direction:column;align-items:center;justify-content:center;
  min-height:100dvh;gap:1.4rem;text-align:center;padding:2rem}
#auth-gate h1{font-size:1.1rem;font-weight:400;letter-spacing:.08em;color:var(--text-dim)}
#auth-gate button{background:none;border:1px solid var(--border);color:var(--accent);
  padding:.7rem 2rem;border-radius:2rem;cursor:pointer;font-size:.95rem;
  transition:border-color .3s,color .3s}
#auth-gate button:hover{border-color:var(--accent);color:var(--text-bright)}
#auth-gate .auth-err{color:var(--accent-warm);font-size:.82rem;max-width:28rem}

/* --- Dashboard layout --- */
#app{display:none;max-width:64rem;margin:0 auto;padding:1.6rem 1.2rem 4rem}
#app.visible{display:block}

.soul-header{display:flex;align-items:center;gap:1.4rem;margin-bottom:2rem}
.soul-header .meta{display:flex;flex-direction:column;gap:.2rem}
.soul-header .meta h1{font-size:1rem;font-weight:500;color:var(--text-bright);letter-spacing:.04em}
.soul-header .meta .conn{font-family:var(--mono);font-size:.72rem;color:var(--text-dim)}
.conn .dot{display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:4px;vertical-align:middle}
.conn .dot.local{background:#5c8}
.conn .dot.cloud{background:var(--accent)}
.conn .dot.off{background:#844}

/* --- Grid --- */
.grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
@media(max-width:640px){.grid{grid-template-columns:1fr}}
.card{background:var(--surface);border:1px solid var(--border);border-radius:.6rem;padding:1rem 1.1rem}
.card.full{grid-column:1/-1}
.card h2{font-size:.72rem;text-transform:uppercase;letter-spacing:.1em;color:var(--text-dim);margin-bottom:.7rem}

/* --- Affect bars --- */
.affect-bars{display:flex;flex-direction:column;gap:.45rem}
.affect-row{display:flex;align-items:center;gap:.6rem}
.affect-row label{width:4.5rem;font-family:var(--mono);font-size:.72rem;color:var(--text-dim);text-align:right}
.affect-row .bar{flex:1;height:6px;background:var(--border);border-radius:3px;overflow:hidden}
.affect-row .bar .fill{height:100%;border-radius:3px;transition:width .6s ease}
.fill.energy{background:var(--accent-warm)}
.fill.valence{background:var(--accent)}
.fill.arousal{background:#b07dd8}

/* --- Self-model --- */
.self-model p{font-size:.88rem;line-height:1.5;color:var(--text);margin-bottom:.4rem}
.self-model .strategy{color:var(--accent);font-family:var(--mono);font-size:.82rem}
.self-model .question{color:var(--accent-warm);font-style:italic;font-size:.85rem}

/* --- Turns --- */
.turns{display:flex;flex-direction:column;gap:.5rem;max-height:22rem;overflow-y:auto}
.turn{font-size:.82rem;line-height:1.45;padding:.45rem .6rem;border-radius:.4rem}
.turn.user{background:rgba(120,140,200,.08);border-left:2px solid var(--accent)}
.turn.assistant{background:rgba(160,130,210,.06);border-left:2px solid #9878b0}
.turn .role{font-family:var(--mono);font-size:.68rem;color:var(--text-dim);margin-bottom:.15rem}

/* --- Strategy trajectory --- */
.trajectory{display:flex;flex-direction:column;gap:.4rem;max-height:14rem;overflow-y:auto}
.traj-item{font-family:var(--mono);font-size:.75rem;color:var(--text-dim);
  padding:.3rem .5rem;border-left:2px solid var(--border);transition:border-color .3s}
.traj-item:first-child{border-color:var(--accent);color:var(--text)}
.traj-item .ts{font-size:.65rem;color:var(--text-dim);opacity:.6}

/* --- Diary --- */
.diary{display:flex;flex-direction:column;gap:.5rem;max-height:14rem;overflow-y:auto}
.diary-entry{font-size:.82rem;line-height:1.45;padding:.4rem .6rem;
  border-left:2px solid var(--accent-warm);color:var(--text)}
.diary-entry .tone{font-family:var(--mono);font-size:.68rem;color:var(--accent-warm);margin-bottom:.15rem}

/* --- Maturity --- */
.maturity{text-align:center;padding:1rem 0}
.maturity .score{font-size:2.4rem;font-weight:300;color:var(--accent-glow)}
.maturity .label{font-family:var(--mono);font-size:.72rem;color:var(--text-dim);margin-top:.25rem}

/* --- Avatar --- */
.av-root{position:relative;width:120px;height:120px;border-radius:50%;overflow:visible;flex-shrink:0;
  background:rgba(60,60,100,.08)}
.av-field{position:absolute;inset:0;border-radius:50%;filter:blur(22px);
  background:radial-gradient(ellipse 55% 55% at 42% 38%,rgba(120,140,200,.55),transparent),
    radial-gradient(ellipse 55% 55% at 55% 47%,rgba(160,130,210,.35),transparent);
  animation:av-breathe 7s ease-in-out infinite}
.av-core{position:absolute;width:28%;height:28%;top:50%;left:50%;transform:translate(-50%,-50%);
  border-radius:50%;filter:blur(18px);opacity:.5;
  background:radial-gradient(circle,rgba(150,160,220,.6),transparent 70%);
  animation:av-pulse 8s ease-in-out infinite}
.av-halo{position:absolute;inset:-6px;border-radius:50%;border:1px solid rgba(180,200,240,.25);
  opacity:.3;animation:av-breathe 7s ease-in-out infinite reverse}
@keyframes av-breathe{
  0%{transform:scale(1) translate(0,0)}
  33%{transform:scale(1.04) translate(6px,-3.6px)}
  66%{transform:scale(.97) translate(-3px,2.4px)}
  100%{transform:scale(1) translate(0,0)}
}
@keyframes av-pulse{0%,100%{opacity:1}50%{opacity:.72}}

/* chat input */
.chat-card .turns{max-height:320px;overflow-y:auto;margin-bottom:.75rem}
.chat-input{display:flex;gap:.5rem}
.chat-input input{flex:1;background:var(--surface);border:1px solid var(--border);border-radius:8px;
  padding:.6rem .8rem;color:var(--text);font:inherit;outline:none;transition:border-color .2s}
.chat-input input:focus{border-color:var(--accent)}
.chat-input input::placeholder{color:rgba(255,255,255,.25)}
.chat-input button{background:var(--accent);border:none;border-radius:8px;padding:.6rem 1rem;
  color:#0a0a0f;font-size:1.1rem;cursor:pointer;transition:opacity .2s}
.chat-input button:hover{opacity:.85}
.chat-input button:disabled{opacity:.4;cursor:default}
.turn.user .role{color:var(--accent)}
.turn.assistant .role{color:rgba(180,140,220,.7)}

/* scrollbar */
::-webkit-scrollbar{width:4px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}
