/* PixselChat Live – shared design system. No external fonts or scripts (privacy, works offline). */

:root {
  /* PixselChat brand: black, Live blue, Lounge magenta, Helvetica Neue */
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --bg-2: #07090c;
  --surface: #0e1116;
  --surface-2: #151a21;
  --surface-3: #1d242d;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --line-3: rgba(255, 255, 255, 0.25);
  --chip-on-text: #cfe4f7;
  --text: #ffffff;
  --text-2: #c3ccd6;
  --muted: #8691a0;
  --accent: #357ab4;          /* PixselChat Live blue */
  --accent-rgb: 53, 122, 180;
  --accent-2: #4b94d1;
  --accent-text: #8cc0ec;     /* blue that reads well as text on black */
  --accent-soft: rgba(53, 122, 180, 0.18);
  --magenta: #982a5b;         /* PixselChat Lounge magenta: live, recording, stop */
  --magenta-rgb: 152, 42, 91;
  --magenta-2: #c13a78;
  --magenta-text: #f08cbb;
  --magenta-soft: rgba(193, 58, 120, 0.16);
  --violet: #8b7bff;
  --green: #2ed47a;
  --green-soft: rgba(46, 212, 122, 0.14);
  --amber: #ffb547;
  --amber-soft: rgba(255, 181, 71, 0.14);
  --red: #ef4b6b;
  --radius: 10px;             /* the brand cards use small, crisp corners */
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --font: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --gradient-live: linear-gradient(135deg, var(--magenta) 0%, var(--magenta-2) 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(var(--accent-rgb), .45); }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(var(--bg-rgb), 0.78);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; letter-spacing: 0; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-side { padding-left: 12px; border-left: 1px solid var(--line-2); font-size: 12px; line-height: 1.3; color: var(--muted); font-weight: 500; }
.brand-side b { display: block; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
/* Spanish equivalent next to English labels on the speaker side */
.alt { color: var(--muted); font-weight: 400; margin-left: .45em; font-size: .92em; }
.alt::before { content: "· "; }
.btn .alt, .segmented .alt, .nav .alt { color: inherit; opacity: .7; }
.btn.xl .alt { display: block; margin: 2px 0 0; font-size: 12px; opacity: .85; }
.btn.xl .alt::before { content: ""; }
.btn.xl { flex-direction: column; gap: 0; line-height: 1.15; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  text-decoration: none; color: var(--text-2); padding: 7px 12px; border-radius: 6px; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-3); color: var(--text); }
.topbar .spacer { flex: 1; }

/* ------------------------------------------------------------------ layout */
.page { max-width: 1440px; margin: 0 auto; padding: 24px 28px 64px; }
.grid-console { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .grid-console { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ cards */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); }
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 680; }

/* ------------------------------------------------------------------ pills & chips */
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok { color: var(--green); background: var(--green-soft); border-color: transparent; }
.pill.ok .dot { background: var(--green); }
.pill.warn { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.pill.warn .dot { background: var(--amber); }
.pill.live { color: #fff; background: var(--magenta-2); border-color: transparent; letter-spacing: 0.06em; }
.pill.live .dot { background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.pill.bad { color: var(--red); background: rgba(239, 75, 107, .14); border-color: transparent; }
.pill.bad .dot { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s;
}
.chip:hover { border-color: var(--line-3); color: var(--text); }
.chip.on { background: var(--accent-soft); color: var(--chip-on-text); border-color: rgba(var(--accent-rgb), .7); font-weight: 600; }
.chip.on::before { content: "✓ "; }
.chip:disabled { opacity: .5; cursor: default; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--gradient); border-color: transparent; color: #fff; box-shadow: 0 10px 30px -12px rgba(var(--accent-rgb), .8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: rgba(var(--magenta-rgb), .8); color: var(--magenta-text); }
.btn.danger:hover { background: var(--magenta-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.xl { height: 56px; padding: 0 28px; font-size: 16px; border-radius: 14px; }
.btn.icon { width: 36px; padding: 0; height: 36px; }

/* ------------------------------------------------------------------ forms */
label.field { display: flex; flex-direction: column; gap: 7px; }
label.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: rgba(var(--accent-rgb), .6); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .12); }
.input:disabled { opacity: .6; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d879c' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.hint { font-size: 12.5px; color: var(--muted); }
.form-grid { display: grid; gap: 16px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 11px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.segmented button.on { background: var(--surface-3); color: var(--text); }

/* ------------------------------------------------------------------ misc */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.stat .v { font-size: 20px; font-weight: 680; letter-spacing: -0.02em; }
.stat .l { font-size: 12px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; opacity: .6; margin-bottom: 8px; }

/* toasts */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; padding: 11px 16px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .6); font-size: 14px; max-width: 560px; animation: toastIn .25s ease-out;
}
.toast.error { border-color: rgba(239, 75, 107, .55); }
.toast.ok { border-color: rgba(46, 212, 122, .45); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(3, 5, 10, .7); backdrop-filter: blur(6px); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: min(480px, 100%); padding: 24px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
@keyframes fade { from { opacity: 0; } }

.hidden { display: none !important; }

/* ------------------------------------------------------------------ clone-a-voice dialog */
.clone-dlg { width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.clone-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.clone-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.clone-body { overflow: auto; padding: 8px 24px 8px; }
.clone-step { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.clone-step:last-child { border-bottom: 0; }
.clone-step h3 { margin: 0; font-size: 15px; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.clone-foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--bg-2); }
.clone-status { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.segmented button svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }
.rec-stage { display: flex; align-items: center; gap: 20px; padding: 16px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.rec-big { width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--text); background: transparent; display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .1s; }
.rec-big:active { transform: scale(.96); }
.rec-core { width: 52px; height: 52px; border-radius: 50%; background: var(--magenta-2); transition: all .2s; }
.rec-big.on .rec-core { width: 26px; height: 26px; border-radius: 6px; }
.rec-big.on { border-color: var(--magenta-2); animation: recGlow 1.6s infinite; }
@keyframes recGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--magenta-rgb), .6); } 50% { box-shadow: 0 0 0 10px rgba(var(--magenta-rgb), 0); } }
.rec-time { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.meter.wide { width: 100%; max-width: 360px; margin-top: 10px; }
.read-me { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; color: var(--text); line-height: 1.6; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop.big { padding: 30px 20px; }
.drop:hover, .drop.over { border-color: rgba(var(--accent-rgb), .6); background: var(--accent-soft); color: var(--text); }
.drop b { color: var(--text); display: block; margin-bottom: 2px; }
.drop-icon svg { width: 30px; height: 30px; color: var(--text-2); margin-bottom: 6px; }
.clone-done { text-align: center; padding: 40px 20px 30px; }
.clone-done h3 { font-size: 20px; margin: 10px 0 4px; }
.done-icon { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.done-icon svg { width: 30px; height: 30px; }
.meter { width: 120px; height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--green), #b6f36a 70%, var(--amber)); transition: width .06s linear; }
@media (max-width: 640px) { .clone-step { flex-direction: column; } .clone-step .row { flex-direction: column; align-items: stretch; } }

/* PixselChat Live: brand fine-tuning */
.brand-logo { height: 50px; }
label.field > span.hint { font-weight: 400; color: var(--muted); }
.segmented button { white-space: nowrap; }
.card-head h2 { white-space: nowrap; }

/* ------------------------------------------------------------------ light colour mode */
:root[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-rgb: 244, 246, 249;
  --bg-2: #eceff3;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e6eaef;
  --line: rgba(10, 20, 35, 0.09);
  --line-2: rgba(10, 20, 35, 0.16);
  --line-3: rgba(10, 20, 35, 0.3);
  --text: #0b0f14;
  --text-2: #364150;
  --muted: #5f6a78;
  --accent-text: #23639b;
  --accent-soft: rgba(53, 122, 180, 0.12);
  --chip-on-text: #1d5687;
  --magenta-text: #982a5b;
  --magenta-soft: rgba(193, 58, 120, 0.1);
  --green: #12804a;
  --green-soft: rgba(18, 128, 74, 0.1);
  --amber: #a05c00;
  --amber-soft: rgba(214, 140, 20, 0.14);
  --red: #c8243f;
  --shadow: 0 1px 2px rgba(10, 20, 35, 0.05), 0 16px 40px -24px rgba(10, 20, 35, 0.25);
  color-scheme: light;
}
/* video areas stay dark in both modes, so subtitles and controls read well */
:root[data-theme="light"] .player,
:root[data-theme="light"] .screen {
  --bg-rgb: 0, 0, 0;
  --surface-3: #1d242d;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --text-2: #c3ccd6;
  --muted: #8691a0;
  color-scheme: dark;
  color: var(--text);
}
:root[data-theme="light"] .toast { box-shadow: 0 16px 36px -12px rgba(10, 20, 35, .3); }

/* the light/dark switch */
.theme-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; min-width: 34px; padding: 0 9px; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent; color: var(--text-2);
  cursor: pointer; font-size: 13px; font-weight: 500; flex: none;
}
.theme-btn:hover { border-color: var(--line-3); color: var(--text); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .alt { margin-left: .35em; }
/* show what you switch TO: a sun in dark mode, a moon in light mode */
.theme-btn .i-moon, .theme-btn .t-dark { display: none; }
:root[data-theme="light"] .theme-btn .i-sun, :root[data-theme="light"] .theme-btn .t-light { display: none; }
:root[data-theme="light"] .theme-btn .i-moon, :root[data-theme="light"] .theme-btn .t-dark { display: inline; }
:root[data-theme="light"] .theme-btn .i-moon { display: block; }
@media (max-width: 720px) { .theme-btn.with-text span { display: none !important; } }
