/* Resona — Voice Emotion Intelligence. Dark, glassy, brand-gradient theme. */
:root {
  --bg: #070711;
  --bg-2: #0d0d1f;
  --panel: rgba(22, 22, 40, 0.62);
  --panel-line: rgba(140, 140, 200, 0.16);
  --text: #ecebff;
  --muted: #9a9ac4;
  --faint: #6f6f95;
  --violet: #a78bfa;
  --violet-2: #8b5cf6;
  --cyan: #22d3ee;
  --grad: linear-gradient(135deg, #a78bfa 0%, #22d3ee 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 20px;
  --shadow: 0 24px 60px -22px rgba(0, 0, 0, 0.7);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Space Grotesk', var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 700px at 15% -10%, #1a163a 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #0a2440 0%, transparent 50%), var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55;
  background:
    radial-gradient(40% 35% at 20% 20%, rgba(167, 139, 250, 0.22), transparent 70%),
    radial-gradient(45% 40% at 85% 70%, rgba(34, 211, 238, 0.16), transparent 70%);
  filter: blur(10px);
  animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(0,-3%,0) scale(1.06); } }

/* ───── top bar ───── */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 44px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark { display: grid; place-items: center; filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.4)); }
.brand__txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand__txt strong { font-family: var(--display); font-size: 22px; letter-spacing: 0.3px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand__txt span { font-size: 11.5px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500; background: var(--panel); border: 1px solid var(--panel-line); backdrop-filter: blur(8px); }
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 0 currentColor; }
.pill--idle .pill__dot { background: var(--faint); }
.pill--ready { color: var(--ok); } .pill--ready .pill__dot { background: var(--ok); animation: ping 2s infinite; }
.pill--working { color: var(--violet); } .pill--working .pill__dot { background: var(--violet); animation: ping 1s infinite; }
.pill--error { color: var(--bad); } .pill--error .pill__dot { background: var(--bad); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; } 70% { box-shadow: 0 0 0 6px transparent; opacity: 0.6; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ───── layout ───── */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 360px 1fr; gap: 22px;
  padding: 8px clamp(16px, 4vw, 44px) 8px;
  max-width: 1280px; margin: 0 auto; align-items: start;
}
.card {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.capture { padding: 22px; position: sticky; top: 14px; }
.stage { padding: 22px 22px 26px; }

/* ───── tabs ───── */
.tabs { display: flex; gap: 6px; padding: 5px; background: rgba(10,10,24,0.5); border-radius: 12px; margin-bottom: 22px; }
.tab { flex: 1; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: 600 13px var(--font); cursor: pointer; transition: 0.18s; }
.tab.is-active { background: rgba(167,139,250,0.16); color: var(--text); box-shadow: inset 0 0 0 1px rgba(167,139,250,0.3); }
.tabpane.is-hidden { display: none !important; }
.tabpane--center { display: flex; flex-direction: column; align-items: center; }

/* ───── recorder ───── */
.recorder { position: relative; width: 132px; height: 132px; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #2a2150, #14132b); display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(167,139,250,0.3), 0 18px 40px -16px rgba(139,92,246,0.6); transition: 0.2s; }
.recorder:hover { transform: translateY(-2px); }
.recorder__ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(167,139,250,0.4); opacity: 0; }
.recorder__icon { width: 30px; height: 30px; border-radius: 8px 8px 9px 9px; background: var(--grad);
  -webkit-mask: radial-gradient(circle at 50% 32%, #000 0 13px, transparent 14px) , linear-gradient(#000,#000); transition: 0.2s; }
.recorder__icon { width: 26px; height: 36px; border-radius: 13px; background: var(--grad); }
/* Live capture button: cyan accent + pulsing when active */
.recorder--live { box-shadow: 0 0 0 1px rgba(34,211,238,0.4), 0 18px 40px -16px rgba(34,211,238,0.55); }
.recorder--live .recorder__icon { background: linear-gradient(135deg, #22d3ee, #34d399); }
.recorder--live.is-recording { background: radial-gradient(circle at 50% 40%, #103040, #0a1e28); }
.recorder--live.is-recording .recorder__icon { width: 26px; height: 26px; border-radius: 6px; background: #22d3ee; box-shadow: 0 0 16px rgba(34,211,238,0.8); }
.recorder--live.is-recording .recorder__ring { border-color: rgba(34,211,238,0.55); animation: pulse 1.4s ease-out infinite; }
.recorder.is-recording { background: radial-gradient(circle at 50% 40%, #3a1430, #20101f); }
.recorder.is-recording .recorder__icon { width: 26px; height: 26px; border-radius: 6px; background: var(--bad); }
.recorder.is-recording .recorder__ring { animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

.level { width: 160px; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.07); margin: 18px 0 8px; overflow: hidden; }
.level__bar { display: block; height: 100%; width: 0%; background: var(--grad); transition: width 0.08s linear; }
.rec-time { font-family: var(--display); font-size: 20px; letter-spacing: 1px; color: var(--text); }
.hint { color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.5; margin: 10px 4px 0; }

/* ───── drop zone ───── */
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 18px;
  border: 1.5px dashed rgba(167,139,250,0.35); border-radius: 16px; cursor: pointer; transition: 0.18s; text-align: center; }
.drop.is-over, .drop:hover { border-color: var(--cyan); background: rgba(34,211,238,0.06); }
.drop__icon { font-size: 26px; color: var(--violet); }
.drop__title { font-weight: 600; }
.drop__sub { font-size: 12px; color: var(--muted); }

/* ───── controls ───── */
.controls { display: flex; gap: 12px; align-items: end; margin-top: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: 12px; color: var(--muted); }
.field select { padding: 11px 12px; border-radius: 11px; border: 1px solid var(--panel-line);
  background: rgba(10,10,24,0.6); color: var(--text); font: 500 14px var(--font); }
.btn { padding: 12px 18px; border-radius: 12px; border: 0; cursor: pointer; font: 600 14px var(--font); transition: 0.18s; }
.btn--primary { background: var(--grad); color: #0a0a1a; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--ghost { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--panel-line); }
.btn--ghost:hover { background: rgba(255,255,255,0.09); }
.btn--block { width: 100%; margin-top: 14px; }
.legal { font-size: 10.5px; color: var(--faint); text-align: center; margin: 16px 0 0; line-height: 1.5; }

/* ───── stage ───── */
.stage__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 4px; flex-wrap: wrap; }
.state { display: flex; flex-direction: column; padding: 10px 16px; border-radius: 14px; min-width: 220px;
  background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.3); transition: 0.5s; }
.state__label { font-family: var(--display); font-size: 19px; font-weight: 600; }
.state__sub { font-size: 12px; color: var(--muted); }
.state--calm { background: rgba(45,212,191,0.12); border-color: rgba(45,212,191,0.34); }
.state--confident { background: rgba(52,211,153,0.13); border-color: rgba(52,211,153,0.36); }
.state--excited { background: rgba(167,139,250,0.15); border-color: rgba(167,139,250,0.4); }
.state--focus { background: rgba(34,211,238,0.13); border-color: rgba(34,211,238,0.36); }
.state--stress { background: rgba(251,191,36,0.14); border-color: rgba(251,191,36,0.4); }
.state--reticent { background: rgba(148,163,184,0.13); border-color: rgba(148,163,184,0.34); }
.style { text-align: right; }
.style__k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); }
.style__v { font-family: var(--display); font-size: 16px; }

.stage__diamond { position: relative; display: grid; place-items: center; min-height: 360px; margin: 6px 0; }
.diamond-glow { position: absolute; width: 320px; height: 320px; border-radius: 50%; filter: blur(60px);
  background: radial-gradient(circle, rgba(167,139,250,0.5), transparent 70%); opacity: 0.5; transition: 0.6s; z-index: 0; }
nms-diamond { display: block; width: 100%; max-width: 560px; position: relative; z-index: 1; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--faint); font-size: 14px; z-index: 2; }
.empty.is-hidden { display: none; }

/* ───── gauges ───── */
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 6px 0 4px; }
.gauges.is-hidden { display: none; }
.gauge { display: flex; flex-direction: column; gap: 6px; }
.gauge__k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.gauge__track { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.gauge__track i { display: block; height: 100%; width: 0%; border-radius: 999px; background: var(--grad); transition: width 0.25s ease; }
.gauge[data-g="stress"] .gauge__track i { background: linear-gradient(135deg, #fbbf24, #fb7185); }

/* ───── player ───── */
.player { display: flex; align-items: center; gap: 14px; margin: 16px 0 4px; }
.player.is-hidden { display: none; }
.player__play { width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--grad); color: #0a0a1a; font-size: 15px; display: grid; place-items: center; transition: 0.15s; }
.player__play:hover { filter: brightness(1.08); }
.player__seek { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.1); outline: none; }
.player__seek::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--cyan); cursor: pointer; box-shadow: 0 0 10px rgba(34,211,238,0.7); }
.player__seek::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--cyan); cursor: pointer; }
.player__time { font-family: var(--display); font-size: 13px; color: var(--muted); min-width: 92px; text-align: right; }

/* ───── emotional history timeline ───── */
.timeline { margin-top: 16px; }
.timeline.is-hidden { display: none; }
.timeline__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.timeline__head > span:first-child { text-transform: uppercase; letter-spacing: 0.12em; }
.timeline__meta { font-family: var(--display); color: var(--cyan); }
.timeline__track { position: relative; overflow-x: auto; overflow-y: hidden; background: rgba(10,10,24,0.5); border: 1px solid var(--panel-line); border-radius: 12px; padding: 8px; }
.timeline__track::-webkit-scrollbar { height: 7px; }
.timeline__track::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.4); border-radius: 999px; }
.timeline__ribbon { position: relative; display: flex; height: 40px; align-items: stretch; border-radius: 8px; overflow: hidden; min-width: 100%; }
.tseg { flex: none; min-width: 2px; cursor: pointer; transition: filter 0.15s; box-shadow: inset -1px 0 rgba(0,0,0,0.25); display: flex; align-items: center; }
.tseg:hover { filter: brightness(1.18); }
.tseg--calm { background: #2dd4bf; } .tseg--confident { background: #34d399; } .tseg--excited { background: #a78bfa; }
.tseg--focus { background: #22d3ee; } .tseg--stress { background: #fbbf24; } .tseg--reticent { background: #94a3b8; }
.tseg__lbl { font-size: 9.5px; font-weight: 700; color: rgba(8,8,20,0.72); padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tseg.is-now { box-shadow: inset 0 0 0 2px #fff; animation: nowpulse 1.2s ease-in-out infinite; }
@keyframes nowpulse { 0%,100% { box-shadow: inset 0 0 0 2px #fff; } 50% { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); } }
.timeline__playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.9); pointer-events: none; z-index: 3; left: 0; }
.timeline__playhead.is-hidden { display: none; }
.timeline__legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 9px; font-size: 11px; color: var(--muted); }
.timeline__legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* ───── signal chips ───── */
.signals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; min-height: 30px; }
.signals.is-hidden { display: none; }
.sig { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  background: rgba(167,139,250,0.12); border: 1px solid rgba(167,139,250,0.26); font-size: 12.5px; }
.sig b { font-family: var(--display); color: var(--cyan); }

/* ───── report card ───── */
.report { position: relative; z-index: 1; max-width: 1280px; margin: 22px auto 0; padding: 24px clamp(18px,3vw,28px);
  /* sits below the grid */ width: calc(100% - 2 * clamp(16px,4vw,44px)); }
.report.is-hidden { display: none; }
.report__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.report__head h2 { font-family: var(--display); font-size: 18px; margin: 0; }
.report__meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-line); color: var(--muted); }
.chip:empty { display: none; }
.chip--solid { background: rgba(34,211,238,0.14); border-color: rgba(34,211,238,0.3); color: var(--text); }
.report__bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 22px; }
.rbar { display: flex; flex-direction: column; gap: 6px; }
.rbar__top { display: flex; justify-content: space-between; font-size: 12.5px; }
.rbar__top span:last-child { font-family: var(--display); color: var(--cyan); }
.rbar__track { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.rbar__track i { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.report__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag { padding: 5px 11px; border-radius: 8px; font-size: 11.5px; letter-spacing: 0.03em;
  background: rgba(167,139,250,0.1); border: 1px solid rgba(167,139,250,0.24); color: var(--violet); }

/* ───── toast + footer ───── */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,38,0.96); border: 1px solid var(--panel-line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: 0.3s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(251,113,133,0.5); }
.foot { position: relative; z-index: 1; text-align: center; color: var(--faint); font-size: 12px; padding: 30px 0 26px; }

/* ───── responsive ───── */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .capture { position: static; }
  .stage__head { justify-content: center; }
  .style { text-align: center; }
}
