:root {
  color-scheme: dark;
  --bg: #06101d;
  --bg-soft: #0a1727;
  --panel: rgba(13, 29, 47, 0.82);
  --panel-strong: rgba(16, 36, 57, 0.96);
  --line: rgba(142, 174, 207, 0.15);
  --line-strong: rgba(142, 174, 207, 0.28);
  --text: #f4f8fc;
  --muted: #8fa5ba;
  --muted-2: #60778d;
  --accent: #4ed7ff;
  --accent-2: #7b7dff;
  --success: #35d39a;
  --warning: #ffbd4a;
  --danger: #ff5d72;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(32, 150, 194, 0.12), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(108, 84, 255, 0.13), transparent 28%),
    linear-gradient(180deg, #06101d 0%, #071321 48%, #050d18 100%);
  color: var(--text);
  overflow-x: hidden;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.ambient { position: fixed; pointer-events: none; filter: blur(70px); opacity: .16; border-radius: 999px; z-index: -1; }
.ambient-a { width: 360px; height: 360px; background: #0bc8ff; left: -180px; top: 35%; }
.ambient-b { width: 420px; height: 420px; background: #735cff; right: -230px; top: 18%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  background: rgba(5, 14, 25, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(78, 215, 255, .34); border-radius: 13px; background: rgba(78, 215, 255, .08); box-shadow: inset 0 0 22px rgba(78, 215, 255, .08); }
.brand-mark svg { width: 31px; }
.brand strong { display: block; font-size: 15px; letter-spacing: .1em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: .22em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; min-width: 92px; justify-content: center; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; }
.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 4px rgba(96,119,141,.12); }
.status-badge.online { color: #baf8df; border-color: rgba(53,211,154,.28); background: rgba(53,211,154,.08); }
.status-badge.online i { background: var(--success); box-shadow: 0 0 0 4px rgba(53,211,154,.12), 0 0 12px rgba(53,211,154,.65); }
.status-badge.connecting { color: #c9eefe; border-color: rgba(78,215,255,.26); }
.status-badge.connecting i { background: var(--accent); animation: blink 1s infinite; }

.shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 80px; }
.hero { display: grid; grid-template-columns: 1.35fr .65fr; align-items: end; gap: 40px; margin-bottom: 36px; }
.eyebrow, .card-kicker { margin: 0 0 10px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .19em; }
.hero h1 { margin: 0; max-width: 880px; font-size: clamp(34px, 4.3vw, 66px); line-height: 1.08; letter-spacing: -.045em; }
.hero h1 span { color: #9eeaff; text-shadow: 0 0 32px rgba(78,215,255,.18); }
.hero-copy { max-width: 760px; margin: 22px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.hero-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.hero-meta div { min-width: 0; padding: 17px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.hero-meta span { display: block; color: var(--muted); font-size: 10px; }
.hero-meta strong { display: block; margin-top: 7px; overflow: hidden; color: #e6f5ff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.notice { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; padding: 17px 20px; border: 1px solid; border-radius: 16px; }
.notice.warning { background: rgba(255,189,74,.08); border-color: rgba(255,189,74,.25); }
.notice.error { background: rgba(255,93,114,.08); border-color: rgba(255,93,114,.25); }
.notice-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.08); font-weight: 900; }
.notice strong { font-size: 14px; }
.notice p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.card { position: relative; min-width: 0; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17,37,59,.93), rgba(9,23,38,.86)); box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.card::after { content: ""; position: absolute; width: 190px; height: 190px; right: -100px; top: -110px; border-radius: 50%; background: radial-gradient(circle, rgba(78,215,255,.08), transparent 68%); pointer-events: none; }
.capture-card { grid-column: span 5; grid-row: span 2; }
.result-card { grid-column: span 4; }
.risk-card { grid-column: span 3; }
.probability-card { grid-column: span 7; }
.timeline-card, .system-card { grid-column: 1 / -1; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.card-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.mono-pill { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.035); color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }

.capture-visual { min-height: 275px; display: grid; place-items: center; align-content: center; gap: 28px; padding: 18px 0 12px; }
.pulse-ring { width: 156px; height: 156px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(78,215,255,.2); background: radial-gradient(circle, rgba(78,215,255,.12), rgba(78,215,255,.02) 58%, transparent 60%); box-shadow: 0 0 0 16px rgba(78,215,255,.025), 0 0 0 34px rgba(78,215,255,.012); transition: transform .1s ease, box-shadow .2s ease; }
.pulse-ring.listening { animation: ringPulse 1.8s ease-in-out infinite; }
.pulse-ring-inner { width: 86px; height: 86px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #23b7e8, #6158ec); box-shadow: 0 16px 42px rgba(42,157,220,.32); }
.pulse-ring svg { width: 43px; fill: none; stroke: white; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.level-wrap { width: min(360px, 88%); }
.level-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.04); }
.level-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--success), var(--accent), var(--warning)); box-shadow: 0 0 18px rgba(78,215,255,.45); transition: width 70ms linear; }
.level-labels { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }
.field { display: block; margin: 2px 0 16px; }
.field span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(2,12,22,.7); color: var(--text); }
.field input::placeholder { color: var(--muted-2); }
.capture-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 12px; transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button.primary { flex: 1 1 210px; color: #02111a; background: linear-gradient(135deg, #7fe8ff, #45c8f2); box-shadow: 0 12px 28px rgba(50,190,231,.18); }
.button.danger { flex: 1 1 170px; color: white; background: linear-gradient(135deg, #ff6377, #df3d57); }
.button.ghost { background: rgba(255,255,255,.035); border-color: var(--line); color: #c2d1df; }
.button.compact { min-height: 34px; padding: 0 12px; font-size: 10px; border-radius: 9px; }
.stop-square { width: 11px; height: 11px; border-radius: 2px; background: currentColor; }
.hint { min-height: 36px; margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.analysis-state { padding: 7px 10px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 10px; font-weight: 800; }
.analysis-state.live { color: #bff6e3; background: rgba(53,211,154,.08); border-color: rgba(53,211,154,.26); }
.analysis-state.silence { color: #ffe0a4; background: rgba(255,189,74,.08); border-color: rgba(255,189,74,.24); }
.primary-result { display: flex; align-items: center; gap: 24px; min-height: 170px; }
.emotion-orb { flex: 0 0 128px; width: 128px; height: 128px; display: grid; place-items: center; text-align: center; border-radius: 50%; border: 1px solid rgba(143,165,186,.18); background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.09), rgba(143,165,186,.04)); box-shadow: inset 0 0 28px rgba(255,255,255,.02), 0 0 35px rgba(0,0,0,.2); transition: background .35s ease, box-shadow .35s ease, border-color .35s ease; }
.emotion-orb span { display: block; font-size: 24px; font-weight: 900; letter-spacing: -.04em; }
.emotion-orb small { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.emotion-orb.positive { border-color: rgba(53,211,154,.38); background: radial-gradient(circle at 35% 30%, rgba(164,255,220,.2), rgba(53,211,154,.08)); box-shadow: 0 0 44px rgba(53,211,154,.16); }
.emotion-orb.alert { border-color: rgba(255,93,114,.4); background: radial-gradient(circle at 35% 30%, rgba(255,181,191,.2), rgba(255,93,114,.08)); box-shadow: 0 0 44px rgba(255,93,114,.17); }
.emotion-orb.attention { border-color: rgba(255,189,74,.4); background: radial-gradient(circle at 35% 30%, rgba(255,227,171,.18), rgba(255,189,74,.08)); box-shadow: 0 0 44px rgba(255,189,74,.14); }
.confidence-block { min-width: 0; flex: 1; }
.confidence-block > span { display: block; color: var(--muted); font-size: 11px; }
.confidence-block strong { display: block; margin: 7px 0 12px; font-size: 32px; letter-spacing: -.05em; }
.confidence-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.06); }
.confidence-track div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s ease; }
.result-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 4px; }
.result-meta div { min-width: 0; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.027); border: 1px solid rgba(255,255,255,.04); }
.result-meta span { display: block; color: var(--muted); font-size: 9px; }
.result-meta strong { display: block; margin-top: 5px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.risk-badge { padding: 7px 11px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 900; }
.risk-badge.normal { color: #8ff0c9; background: rgba(53,211,154,.08); border-color: rgba(53,211,154,.25); }
.risk-badge.caution { color: #ffd98a; background: rgba(255,189,74,.09); border-color: rgba(255,189,74,.26); }
.risk-badge.warning { color: #ff9aaa; background: rgba(255,93,114,.09); border-color: rgba(255,93,114,.27); }
.risk-score-wrap { text-align: center; }
.risk-gauge { position: relative; width: 190px; max-width: 100%; margin: 8px auto 0; }
.risk-gauge svg { width: 100%; overflow: visible; }
.gauge-bg, .gauge-progress { fill: none; stroke-width: 10; stroke-linecap: round; }
.gauge-bg { stroke: rgba(255,255,255,.07); }
.gauge-progress { stroke: var(--success); stroke-dasharray: 141.4; stroke-dashoffset: 141.4; transition: stroke-dashoffset .5s ease, stroke .3s ease; filter: drop-shadow(0 0 6px rgba(53,211,154,.35)); }
.risk-gauge > div { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: baseline; gap: 4px; }
.risk-gauge strong { font-size: 34px; letter-spacing: -.06em; }
.risk-gauge span { color: var(--muted); font-size: 10px; }
.risk-score-wrap > p { min-height: 42px; margin: 8px 0 13px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.disclaimer { padding: 11px 12px; border-radius: 11px; background: rgba(255,189,74,.055); color: #adbdcb; font-size: 9px; line-height: 1.55; text-align: left; }
.disclaimer strong { color: var(--warning); }

.probability-list { display: grid; gap: 13px; min-height: 205px; align-content: start; }
.probability-row { display: grid; grid-template-columns: 74px minmax(0,1fr) 45px; gap: 12px; align-items: center; }
.probability-label strong { display: block; font-size: 12px; }
.probability-label span { display: block; margin-top: 2px; color: var(--muted-2); font-size: 8px; text-transform: uppercase; }
.probability-track { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.055); }
.probability-track div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4ed7ff, #7777ff); transition: width .4s ease; }
.probability-value { text-align: right; color: #cce8f6; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.empty-state { place-items: center; color: var(--muted); text-align: center; font-size: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 9px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 15px; height: 3px; border-radius: 999px; }
.legend-risk { background: var(--accent); }
.legend-emotion { background: var(--warning); }
.chart-wrap { height: 250px; border-radius: 15px; background: rgba(2,12,22,.4); border: 1px solid rgba(255,255,255,.035); overflow: hidden; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }

.system-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.system-strip > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 9px; row-gap: 3px; align-items: center; padding: 14px; border-radius: 13px; background: rgba(255,255,255,.027); border: 1px solid rgba(255,255,255,.04); }
.system-dot { grid-row: 1 / span 2; width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); }
.system-dot.ok { background: var(--success); box-shadow: 0 0 10px rgba(53,211,154,.45); }
.system-dot.warn { background: var(--warning); box-shadow: 0 0 10px rgba(255,189,74,.4); }
.system-dot.error { background: var(--danger); box-shadow: 0 0 10px rgba(255,93,114,.45); }
.system-strip span:not(.system-dot) { color: var(--muted); font-size: 9px; }
.system-strip strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.diagnostics { margin: 16px 0 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.23); color: #a9c1d7; font: 10px/1.6 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; }

footer { padding: 20px 24px calc(28px + var(--safe-bottom)); border-top: 1px solid var(--line); color: var(--muted-2); text-align: center; font-size: 10px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(24px + var(--safe-bottom)); max-width: min(520px, calc(100% - 32px)); padding: 13px 17px; transform: translate(-50%, 20px); border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(8,21,35,.96); box-shadow: var(--shadow); color: #dbeaf5; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }
.toast.error { border-color: rgba(255,93,114,.35); color: #ffc5cd; }
.hidden { display: none !important; }

@keyframes blink { 50% { opacity: .35; } }
@keyframes ringPulse { 0%,100% { box-shadow: 0 0 0 16px rgba(78,215,255,.025), 0 0 0 34px rgba(78,215,255,.012); } 50% { box-shadow: 0 0 0 23px rgba(78,215,255,.035), 0 0 0 46px rgba(78,215,255,.012), 0 0 50px rgba(78,215,255,.12); } }

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero-meta { max-width: 620px; }
  .capture-card { grid-column: span 6; }
  .result-card { grid-column: span 6; }
  .risk-card { grid-column: span 5; }
  .probability-card { grid-column: span 7; }
}

@media (max-width: 820px) {
  .topbar { height: 66px; padding: 0 16px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 13px; }
  .status-badge { min-width: auto; }
  .status-badge span { display: none; }
  .shell { width: min(100% - 28px, 700px); padding: 34px 0 64px; }
  .hero { margin-bottom: 26px; }
  .hero h1 { font-size: clamp(33px, 10.5vw, 52px); }
  .hero-copy { font-size: 14px; }
  .hero-meta { grid-template-columns: repeat(3,1fr); gap: 7px; }
  .hero-meta div { padding: 13px 10px; }
  .dashboard-grid { display: block; }
  .card { margin-bottom: 14px; padding: 20px; }
  .capture-visual { min-height: 245px; }
  .system-strip { grid-template-columns: repeat(2,1fr); }
  .chart-wrap { height: 220px; }
}

@media (max-width: 520px) {
  .hero h1 { font-size: 29px; line-height: 1.12; }
  .top-actions .button { display: none; }
  .hero-meta { grid-template-columns: 1fr 1fr; }
  .hero-meta div:last-child { grid-column: 1 / -1; }
  .card-heading { margin-bottom: 18px; }
  .primary-result { gap: 17px; }
  .emotion-orb { flex-basis: 112px; width: 112px; height: 112px; }
  .emotion-orb span { font-size: 21px; }
  .confidence-block strong { font-size: 29px; }
  .result-meta { grid-template-columns: 1fr 1fr; }
  .result-meta div:last-child { grid-column: 1 / -1; }
  .probability-row { grid-template-columns: 66px minmax(0,1fr) 40px; gap: 8px; }
  .legend { display: none; }
  .system-strip { grid-template-columns: 1fr; }
  .capture-actions .button { width: 100%; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
