:root {
  --bg: #0a0a0c; --panel: #141418; --border: rgba(201,162,39,.35);
  --gold: #c9a227; --gold2: #e8c547; --text: #f5f5f4; --muted: #a8a29e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
#app { display: flex; flex-direction: column; min-height: 100%; max-width: 800px; margin: 0 auto; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #12121a, #0a0a0c); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand img { border-radius: 10px; }
.brand strong { display: block; font-size: 15px; }
.brand .sub { font-size: 11px; color: var(--muted); }
.modes { display: flex; gap: 6px; }
.modes button {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 10px; font-size: 11px; cursor: pointer;
}
.modes button.on { background: rgba(201,162,39,.15); color: var(--gold2); border-color: var(--gold); }
.icon-btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
}
#install-banner {
  display: none; margin: 8px 14px 0; padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(201,162,39,.45); background: rgba(201,162,39,.12);
  font-size: 13px; align-items: center; justify-content: space-between; gap: 8px;
}
#install-banner.show { display: flex; }
#install-banner button {
  border: none; background: linear-gradient(135deg, var(--gold), #8a7020); color: #111;
  font-weight: 700; padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
.feed { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg {
  border: 1px solid var(--border); background: var(--panel); border-radius: 14px; padding: 12px 14px;
  font-size: 14px; line-height: 1.5; word-break: break-word;
}
.msg.user { border-color: rgba(96,165,250,.35); background: #0f172a; }
.msg.sys { font-size: 12px; color: var(--muted); border-style: dashed; }
.msg .role { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); margin-bottom: 6px; }
.msg .body p { margin: 0 0 8px; }
.msg .body ul { margin: 6px 0; padding-left: 18px; }
.msg .body h3, .msg .body h4 { margin: 10px 0 6px; color: var(--gold2); font-size: 14px; }
.msg .body code { background: #0a0a0c; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.msg .body pre.code {
  background: #0a0a0c; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; overflow-x: auto; font-size: 12px; line-height: 1.4;
}
.cmd { border-top: 1px solid var(--border); padding: 10px 12px 16px; background: #0c0c10; }
.cmd-row { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  flex: 1; resize: none; min-height: 48px; max-height: 140px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); padding: 10px 12px; font: inherit;
}
.btn-run {
  width: 48px; height: 48px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, var(--gold), #8a7020); color: #111; font-weight: 700; cursor: pointer;
}
.btn-run:disabled { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font-size: 11px; border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 5px 10px; cursor: pointer;
}
.chip:hover { color: var(--gold2); border-color: var(--gold); }
.chip-voice { border-color: rgba(52,211,153,.4) !important; color: #34d399 !important; }
.hint { font-size: 11px; color: var(--muted); margin-top: 8px; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal.open { display: flex; }
.sheet {
  width: 100%; max-width: 800px; max-height: 88vh; overflow-y: auto;
  background: #121218; border-radius: 18px 18px 0 0; border: 1px solid var(--border); padding: 16px;
}
.sheet h3 { margin: 0 0 12px; color: var(--gold2); }
.sheet label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.sheet input {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font: inherit;
}
.sheet .row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.sheet .btn {
  flex: 1; min-width: 100px; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; font-weight: 600;
}
.sheet .btn.primary { background: linear-gradient(135deg, var(--gold), #8a7020); color: #111; border: none; }
@media (min-width: 768px) {
  .modal { align-items: center; }
  .sheet { border-radius: 18px; max-height: 80vh; }
}
