:root {
  --bg: #0f1226;
  --bg-soft: #171a35;
  --card: #1e2245;
  --card-2: #262a55;
  --accent: #6c8cff;
  --accent-2: #37e0b0;
  --danger: #ff5d73;
  --warn: #ffcf5c;
  --text: #eef1ff;
  --muted: #9aa0c7;
  --border: #333a6e;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Malgun Gothic", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #23295c 0%, transparent 60%),
              radial-gradient(1000px 500px at -10% 10%, #1a2f57 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 40px) clamp(14px, 4vw, 28px) 80px;
}
header.hero {
  text-align: center;
  margin-bottom: clamp(18px, 4vw, 32px);
}
.hero h1 {
  font-size: clamp(1.5rem, 5vw, 2.3rem);
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}
.hero .badge {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(55,224,176,.1);
  border: 1px solid rgba(55,224,176,.3);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.hero p { color: var(--muted); margin: 0; font-size: clamp(.85rem, 2.5vw, 1rem); }

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 26px);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h2 {
  font-size: 1.05rem;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .step {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
}
.card .hint { color: var(--muted); font-size: .82rem; margin: 0 0 14px 34px; }

textarea, select {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}
textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea#question { min-height: 78px; }

.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.row.between { justify-content: space-between; align-items: center; }

button {
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, background .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-rec { background: var(--danger); color: #fff; flex: 1 1 200px; justify-content: center; }
.btn-rec.recording { animation: pulse 1.3s infinite; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.btn-pick { background: var(--card-2); color: var(--text); border: 1px solid var(--border); font-size: .82rem; padding: 8px 12px; }
.btn-pick:hover { border-color: var(--accent); }

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,93,115,.5); }
  50% { box-shadow: 0 0 0 12px rgba(255,93,115,0); }
}

.status {
  font-size: .85rem;
  color: var(--muted);
  margin-top: 10px;
  min-height: 20px;
}
.status .dot { display:inline-block; width:9px; height:9px; border-radius:50%; background: var(--muted); margin-right:7px; vertical-align: middle; }
.status.live .dot { background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.transcript-box {
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  min-height: 90px;
  font-size: 1.02rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.transcript-box:empty::before { content: "여기에 인식된 답변이 표시됩니다…"; color: var(--muted); }
.transcript-box .interim { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Custom saved questions */
textarea#modelAnswer { min-height: 110px; }
.chip-custom {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.chip-custom:hover { border-color: var(--accent); }
.chip-custom button {
  border: none;
  border-radius: 0;
  background: var(--card-2);
  color: var(--text);
  font-size: .82rem;
  padding: 8px 12px;
}
.chip-custom .chip-x {
  padding: 8px 10px;
  color: var(--muted);
  border-left: 1px solid var(--border);
}
.chip-custom .chip-x:hover { color: var(--danger); }

/* Feedback */
.fb-scorewrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.ring {
  --pct: 0;
  width: 96px; height: 96px; flex: 0 0 96px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-2) calc(var(--pct)*1%), #2a2f5e 0);
  display: grid; place-items: center;
  position: relative;
}
.ring::before { content:""; position:absolute; inset:8px; border-radius:50%; background: var(--card); }
.ring span { position: relative; font-size: 1.5rem; font-weight: 800; }
.ring small { position: relative; display:block; font-size:.6rem; color: var(--muted); text-align:center; margin-top:-2px;}
.level-tag { font-weight: 700; font-size: 1.1rem; }
.level-tag small { display:block; font-weight:400; color: var(--muted); font-size:.78rem; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin: 16px 0; }
.metric {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}
.metric .v { font-size: 1.35rem; font-weight: 700; }
.metric .l { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.fb-list { list-style: none; padding: 0; margin: 8px 0 0; }
.fb-list li {
  padding: 11px 14px 11px 44px;
  border-radius: 10px;
  margin-bottom: 8px;
  position: relative;
  font-size: .92rem;
  background: var(--card-2);
  border: 1px solid var(--border);
}
.fb-list li::before {
  position: absolute; left: 14px; top: 10px; font-size: 1rem;
}
.fb-list li.good::before { content: "✅"; }
.fb-list li.warn::before { content: "💡"; }
.fb-list li.info::before { content: "ℹ️"; }

/* History */
.hist-list { list-style: none; padding: 0; margin: 8px 0 0; }
.hist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 8px;
}
.hist-item .q { font-size: .88rem; word-break: break-word; }
.hist-item .meta { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.hist-item .left { flex: 1 1 220px; min-width: 0; }
.hist-score { font-weight: 700; color: var(--accent-2); white-space: nowrap; }
.hist-actions { display: flex; gap: 6px; }

.hidden { display: none !important; }

.unsupported {
  background: rgba(255,93,115,.12);
  border: 1px solid rgba(255,93,115,.4);
  color: #ffd7dd;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: .9rem;
  margin-bottom: 18px;
}
footer { text-align:center; color: var(--muted); font-size:.78rem; margin-top: 30px; }
footer code { background: var(--bg-soft); padding: 2px 6px; border-radius: 6px; }

a.link { color: var(--accent); }
