/* Phoni — voice client for Claude Code.
   Dark-only, minimal instrument UI. The mic is the hero; everything else is quiet. */
:root {
  --bg: #0b0e13;
  --surface: #12171f;
  --surface-2: #1a212b;
  --surface-3: #212b37;
  --line: #232c38;
  --line-soft: rgba(255, 255, 255, .06);
  --text: #e7ecf3;
  --muted: #8a97a6;
  --faint: #5c6672;
  --accent: #8b9cff;
  --accent-strong: #6b7cff;
  --accent-ink: #0a0e1c;
  --accent-dim: rgba(139, 156, 255, .14);
  --user: #cdd6ff;
  --live: #ff6b6b;
  --ok: #46d18a;
  --warn: #f5b544;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; } }

/* ---- login ---- */
.center { margin: auto; width: min(360px, 90vw); padding: 24px; text-align: center; }
.center .wordmark { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; color: var(--text); }
.center .greek { color: var(--accent); font-weight: 600; letter-spacing: .5px; margin-top: 2px; }
.center p { color: var(--muted); margin: 6px 0 0; }
.center input, .center button {
  width: 100%; padding: 14px 16px; margin-top: 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px;
}
.center input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.center button { background: var(--accent); color: var(--accent-ink); font-weight: 700; border: none; }
.center .err { color: var(--live); min-height: 20px; margin-top: 12px; font-size: 14px; }

/* ---- app shell ---- */
header {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 5;
  padding-top: max(11px, env(safe-area-inset-top));
}
.wordmark { font-weight: 800; letter-spacing: -.5px; }
.proj { color: var(--muted); font-size: 13px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none;
  box-shadow: 0 0 0 0 currentColor; }
.dot.busy { background: var(--warn); color: var(--warn); animation: ping 1.2s infinite; }
.dot.idle { background: var(--ok); color: var(--ok); }
.dot.off { background: var(--live); color: var(--live); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px transparent; } }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line); font-weight: 600; letter-spacing: .3px; }
.badge.bill { background: color-mix(in srgb, var(--live) 18%, transparent); color: var(--live); border-color: var(--live); }
.badge.free { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent); }

main { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth; }

/* ---- messages ---- */
.msg { max-width: 88%; padding: 11px 14px; border-radius: var(--r-lg); white-space: pre-wrap;
  word-break: break-word; font-size: 15px; }
.msg.user { align-self: flex-end; background: var(--accent-dim); color: var(--user);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-bottom-right-radius: 5px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line);
  border-bottom-left-radius: 5px; }
.msg.spoken { align-self: flex-start; display: flex; gap: 8px; align-items: flex-start;
  color: var(--muted); font-size: 14px; background: transparent; border: none; padding: 2px 4px; max-width: 92%; }
.msg.spoken .ico { color: var(--accent); width: 17px; height: 17px; margin-top: 2px; }
.msg.error { align-self: center; display: flex; gap: 8px; align-items: center; color: var(--live);
  background: color-mix(in srgb, var(--live) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--live) 35%, transparent);
  font-size: 14px; text-align: left; }
.msg.error .ico { width: 18px; height: 18px; flex: none; }
.msg.tool { align-self: flex-start; display: inline-flex; gap: 8px; align-items: center; font-size: 13px;
  color: var(--muted); font-family: ui-monospace, "SF Mono", monospace;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 11px; }
.msg.tool .ico { width: 15px; height: 15px; color: var(--accent); }
.msg.tool.done { opacity: .55; }
.msg.tool.done .ico { color: var(--ok); }
.msg.tool.fail { opacity: .8; }
.msg.tool.fail .ico { color: var(--live); }

/* ---- file activity panel ---- */
.files { margin: 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.files summary { display: flex; align-items: center; gap: 8px; padding: 11px 14px; color: var(--muted);
  cursor: pointer; user-select: none; font-size: 14px; list-style: none; }
.files summary::-webkit-details-marker { display: none; }
.files summary .ico { width: 16px; height: 16px; }
.files ul { list-style: none; margin: 0; padding: 0 14px 10px; font-family: ui-monospace, monospace; font-size: 13px; }
.files li { padding: 3px 0; color: var(--text); }
.files li .a { color: var(--accent); margin-right: 4px; }

/* ---- permission card ---- */
.perm { margin: 0 14px 8px; background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-dim); border-radius: var(--r-md); padding: 14px; display: none; }
.perm.show { display: block; animation: rise .18s ease; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.permlead { margin: 0 0 12px; display: flex; gap: 8px; align-items: flex-start; font-size: 15px; }
.permlead .ico { color: var(--accent); flex: none; margin-top: 1px; }
.perm .row { display: flex; gap: 10px; }
.perm button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px; border-radius: var(--r-md); border: none; font-weight: 700; }
.perm .ico { width: 18px; height: 18px; }
.perm .yes { background: var(--ok); color: #04210f; }
.perm .no { background: color-mix(in srgb, var(--live) 20%, transparent); color: var(--live);
  border: 1px solid color-mix(in srgb, var(--live) 45%, transparent); }

/* ---- queue ---- */
.queue { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 8px; }
.queue:empty { display: none; }
.qitem { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 7px 9px; font-size: 14px; }
.qitem .qt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.qitem button { display: inline-flex; background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px; color: var(--muted); }
.qitem button .ico { width: 16px; height: 16px; }

/* ---- input row ---- */
.inputrow { display: flex; gap: 8px; padding: 0 14px 10px; }
.inputrow input { flex: 1; padding: 13px 15px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 15px; }
.inputrow input::placeholder { color: var(--faint); }
.inputrow input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.inputrow button { display: inline-flex; align-items: center; justify-content: center; width: 48px;
  border-radius: var(--r-md); border: none; background: var(--accent); color: var(--accent-ink); }
.inputrow button .ico { width: 22px; height: 22px; stroke-width: 2; }

/* ---- controls ---- */
.controls { display: flex; gap: 8px; align-items: center; padding: 10px 14px;
  border-top: 1px solid var(--line-soft); background: var(--surface);
  flex-wrap: wrap; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 10px; min-width: 46px; color: var(--muted); font-size: 13px; font-weight: 600; }
.iconbtn .lbl { letter-spacing: .2px; }
.iconbtn.ghost { background: transparent; border-color: transparent; padding: 8px; min-width: 40px; }
.iconbtn.active { background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.iconbtn.stop { color: var(--live); border-color: color-mix(in srgb, var(--live) 30%, transparent); }
.iconbtn:active { transform: scale(.96); }

/* Mic is the hero: full-width primary control; the icon row sits below it. */
.mic { position: relative; flex: 1 1 100%; order: -1; min-height: 60px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink); font-weight: 800; font-size: 16px; letter-spacing: .2px;
  overflow: hidden; transition: transform .08s; }
.mic .ico { width: 22px; height: 22px; stroke-width: 2; }
.mic:active { transform: scale(.99); }
.mic:disabled { opacity: .4; }
.mic .micring { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; }
.mic.rec { background: linear-gradient(180deg, #ff8080, var(--live)); color: #2a0808; border-color: var(--live); }
.mic.rec .micring { opacity: 1; animation: ring 1.1s ease-out infinite; }
@keyframes ring { 0% { box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
  100% { box-shadow: inset 0 0 0 22px rgba(255,255,255,0); } }
.mic.hf { background: var(--surface-2); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mic.hf.on { background: var(--accent-dim); }
.mic.hf.on .micring { opacity: 1; animation: ring 1.8s ease-out infinite; }
.controls .iconbtn { flex: 1 1 0; white-space: nowrap; }

/* ---- modals / sheets ---- */
.modal { position: fixed; inset: 0; background: rgba(4, 6, 10, .66); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center; padding: 0; z-index: 20; }
.modal.show { display: flex; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  width: min(520px, 100%); max-height: 88vh; overflow-y: auto; padding: 18px 16px;
  padding-bottom: max(18px, env(safe-area-inset-bottom)); animation: sheetup .22s ease; }
@keyframes sheetup { from { transform: translateY(16px); opacity: .6; } }
@media (min-width: 560px) { .modal { align-items: center; } .sheet { border-radius: 20px; max-height: 82vh; } }
.sheet h2 { margin: 6px 0 12px; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.sheet h2 small { color: var(--faint); font-weight: 400; font-size: 12px; letter-spacing: 0; }
.sheet .item { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line);
  border-radius: var(--r-md); margin-bottom: 8px; background: var(--surface-2); }
.sheet .item .ico { color: var(--accent); flex: none; }
.sheet .item .it { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sheet .item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .item small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .item.back { background: transparent; border-style: dashed; color: var(--muted); }
.sheet .item.back .ico { color: var(--muted); }
.sheet .tabs { display: flex; gap: 6px; margin-bottom: 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; }
.sheet .tabs button { flex: 1; padding: 9px; border-radius: 9px; border: none;
  background: transparent; color: var(--muted); font-weight: 600; }
.sheet .tabs button.on { background: var(--accent-dim); color: var(--accent); }

/* ---- buttons (sheets) ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 600; }
.btn .ico { width: 18px; height: 18px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border: none; flex: 1; }
.btn.ghost { background: var(--surface-2); color: var(--muted); }
.btn.danger { color: var(--live); border-color: color-mix(in srgb, var(--live) 30%, transparent);
  background: color-mix(in srgb, var(--live) 8%, transparent); }
.btn:active { transform: scale(.98); }
.row2 { display: flex; gap: 8px; margin-top: 14px; }

/* ---- settings fields ---- */
.field { display: block; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.field select, .field input[type=range] { display: block; width: 100%; margin-top: 7px; padding: 11px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.field input[type=range] { padding: 8px 0; accent-color: var(--accent); }
.field.check { display: flex; gap: 10px; align-items: center; }
.field.check input { accent-color: var(--accent); width: 18px; height: 18px; }
.drow { display: flex; gap: 6px; margin-bottom: 6px; }
.drow input { flex: 1; min-width: 0; padding: 10px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); }
.drow button { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 0 12px; color: var(--muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.buildtag { text-align: center; color: var(--faint); font-size: 12px; margin: 12px 0 0; }
