/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #1a56db;
  --blue-light:#dbeafe;
  --blue-mid:  #3b82f6;
  --navy:      #0f172a;
  --sky:       #e0f2fe;
  --green:     #10b981;
  --yellow:    #f59e0b;
  --orange:    #f97316;
  --red:       #ef4444;
  --purple:    #8b5cf6;
  --gray-50:   #f8fafc;
  --gray-100:  #f1f5f9;
  --gray-200:  #e2e8f0;
  --gray-300:  #cbd5e1;
  --gray-400:  #94a3b8;
  --gray-500:  #64748b;
  --gray-600:  #475569;
  --gray-700:  #334155;
  --gray-800:  #1e293b;
  --gray-900:  #0f172a;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.12);
}

html, body {
  height: 100%;
  font-family: -apple-system, 'Malgun Gothic', 'Apple SD Gothic Neo', BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 15px;
  line-height: 1.6;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ===== APP HEADER ===== */
.app-header {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.logo-mark {
  font-size: 28px;
  background: rgba(255,255,255,.15);
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.logo-sub { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 1px; }
.header-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ===== HOME ===== */
.home-main { flex: 1; padding: 28px 20px 40px; max-width: 760px; margin: 0 auto; width: 100%; }
.home-intro { margin-bottom: 28px; }
.home-intro h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.home-intro p  { font-size: 14px; color: var(--gray-500); margin-top: 4px; }

.script-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.script-card-item {
  background: #fff;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.script-card-item:hover {
  border-color: var(--blue-mid);
  box-shadow: 0 4px 20px rgba(59,130,246,.15);
  transform: translateY(-2px);
}
.script-card-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
}
.script-card-item.c-blue::before   { background: var(--blue); }
.script-card-item.c-green::before  { background: var(--green); }
.script-card-item.c-orange::before { background: var(--orange); }
.script-card-item.c-purple::before { background: var(--purple); }
.script-card-item.c-red::before    { background: var(--red); }
.script-card-item.c-yellow::before { background: var(--yellow); }

.scard-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.scard-icon { font-size: 28px; }
.scard-diff {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px;
  background: var(--gray-100); color: var(--gray-600);
}
.scard-diff.hard { background: #fee2e2; color: #b91c1c; }
.scard-diff.medium { background: #fef3c7; color: #92400e; }

.scard-title { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.scard-category { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; }
.scard-meta { display: flex; gap: 12px; font-size: 12px; color: var(--gray-400); }
.scard-meta span { display: flex; align-items: center; gap: 4px; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #1648c0; }
.btn-primary.sm { padding: 7px 14px; font-size: 13px; }

.btn-icon {
  background: none;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--blue); color: var(--blue); }

.btn-stop {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: none;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(220,38,38,.35);
  transition: all .15s;
  letter-spacing: .5px;
}
.btn-stop:hover { transform: scale(1.03); box-shadow: 0 6px 28px rgba(220,38,38,.45); }

.btn-restore {
  background: none;
  border: 1.5px solid var(--orange);
  color: var(--orange);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-restore:hover { background: var(--orange); color: #fff; }

.btn-retry {
  background: none;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-retry:hover { background: var(--blue); color: #fff; }

/* ===== TAGS ===== */
.tag {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-right: 6px;
}
.tag.outline {
  background: none;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}

/* ===== PREP SCREEN ===== */
/* ===== LANGUAGE TABS ===== */
.lang-tabs {
  display: flex;
  background: var(--navy);
  padding: 0 20px;
  gap: 2px;
  flex-shrink: 0;
}
.lang-tab {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all .15s;
}
.lang-tab:hover { color: rgba(255,255,255,.8); }
.lang-tab.active { color: #fff; border-bottom-color: #3b82f6; }

.prep-topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.prep-timer-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  padding: 6px 16px;
  border-radius: 20px;
}
.prep-timer-label { font-size: 12px; color: var(--gray-500); }
.prep-countdown {
  font-size: 20px;
  font-weight: 800;
  color: var(--blue);
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.prep-countdown.urgent { color: var(--red); animation: pulse .6s infinite; }

.prep-body { flex: 1; padding: 24px 20px 40px; max-width: 720px; margin: 0 auto; width: 100%; overflow-y: auto; }
.prep-meta { margin-bottom: 12px; }
.prep-title { font-size: 24px; font-weight: 800; color: var(--gray-900); margin-bottom: 20px; }

.script-card {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 16px;
  line-height: 2;
  color: var(--gray-800);
  white-space: pre-wrap;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.checkpoints-box {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.checkpoints-label { font-size: 13px; font-weight: 700; color: #0369a1; margin-bottom: 10px; }
.checkpoints-list { display: flex; flex-wrap: wrap; gap: 8px; }
.checkpoint-item {
  background: #fff;
  border: 1px solid #bae6fd;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: #0369a1;
  font-weight: 500;
}

.tips-box {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius);
  padding: 14px 18px;
}
.tips-box-label { font-size: 12px; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.tip-item { font-size: 13px; color: #78350f; padding: 3px 0; }
.tip-item::before { content: '💡 '; }

/* ===== RECORD SCREEN ===== */
.record-topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.rec-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(239,68,68,.2);
  border: 1px solid rgba(239,68,68,.4);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #fca5a5;
}
.rec-dot {
  width: 8px; height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: blink 1s infinite;
}
.record-title { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.8); }
.record-timer {
  font-size: 22px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  letter-spacing: 1px;
}

.waveform-wrap {
  background: var(--gray-900);
  padding: 10px 0;
  flex-shrink: 0;
}
#waveform-canvas { display: block; width: 100%; height: 140px; }

.live-transcript-box {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 20px;
  flex-shrink: 0;
  min-height: 80px;
}
.live-label { font-size: 11px; font-weight: 600; color: var(--gray-400); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.live-text { font-size: 15px; color: var(--gray-700); line-height: 1.7; min-height: 40px; }

.script-peek { padding: 12px 20px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); flex-shrink: 0; }
.script-peek-btn {
  background: none; border: none; color: var(--blue);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.script-peek-text {
  margin-top: 10px; font-size: 14px; line-height: 1.9;
  color: var(--gray-700); white-space: pre-wrap;
  background: #fff; padding: 14px; border-radius: 8px;
  border: 1px solid var(--gray-200);
}
.hidden { display: none !important; }

.record-actions {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ===== RESULT SCREEN ===== */
.result-topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.result-topbar-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.result-body { flex: 1; overflow-y: auto; padding: 24px 20px 60px; max-width: 760px; margin: 0 auto; width: 100%; }

.result-overview {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  border: 1.5px solid var(--gray-200);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  align-items: center;
}

.total-score-box { text-align: center; }
.total-score-value {
  font-size: 56px; font-weight: 900;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 4px;
}
.total-score-label { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }
.total-grade {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}
.grade-S { background: #fef3c7; color: #92400e; }
.grade-A { background: #dcfce7; color: #166534; }
.grade-B { background: #dbeafe; color: #1e40af; }
.grade-C { background: #f3f4f6; color: #374151; }
.grade-D { background: #fee2e2; color: #991b1b; }

.radar-wrap { height: 240px; position: relative; }

/* ===== SCORE BARS ===== */
.score-bars {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1.5px solid var(--gray-200);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.score-bar-item { margin-bottom: 18px; }
.score-bar-item:last-child { margin-bottom: 0; }
.score-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.score-bar-name { font-size: 14px; font-weight: 600; color: var(--gray-700); display: flex; align-items: center; gap: 6px; }
.score-bar-val { font-size: 14px; font-weight: 700; }
.score-bar-track {
  background: var(--gray-100);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}
.score-comment { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ===== FEEDBACK ===== */
.section-heading { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 14px; }
.feedback-section { margin-bottom: 24px; }
.feedback-cards { display: flex; flex-direction: column; gap: 12px; }
.feedback-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  border-left: 4px solid;
  box-shadow: var(--shadow);
  border-top: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}
.feedback-card.good  { border-left-color: var(--green); }
.feedback-card.warn  { border-left-color: var(--yellow); }
.feedback-card.error { border-left-color: var(--red); }
.feedback-card.info  { border-left-color: var(--blue); }

.feedback-card-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.feedback-card.good  .feedback-card-title { color: #065f46; }
.feedback-card.warn  .feedback-card-title { color: #92400e; }
.feedback-card.error .feedback-card-title { color: #991b1b; }
.feedback-card.info  .feedback-card-title { color: #1e40af; }
.feedback-card-body  { font-size: 13px; color: var(--gray-600); line-height: 1.6; }

/* ===== FEEDBACK — 종합 판정 배너 ===== */
.fb-overview {
  display: flex; align-items: center; gap: 20px;
  border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 14px;
  border: 1.5px solid;
}
.ov-excellent { background: linear-gradient(135deg,#fefce8,#fef9c3); border-color:#fde68a; }
.ov-pass      { background: linear-gradient(135deg,#f0fdf4,#dcfce7); border-color:#86efac; }
.ov-fail      { background: linear-gradient(135deg,#fff1f2,#ffe4e6); border-color:#fca5a5; }

.fb-ov-left   { display:flex; flex-direction:column; align-items:center; gap:4px; flex-shrink:0; }
.fb-ov-score  {
  font-size: 52px; font-weight: 900; line-height: 1;
  color: var(--gray-800);
}
.ov-excellent .fb-ov-score { color:#92400e; }
.ov-pass      .fb-ov-score { color:#166534; }
.ov-fail      .fb-ov-score { color:#991b1b; }

.fb-ov-badge  {
  font-size: 12px; font-weight: 700; padding: 3px 12px;
  border-radius: 20px; white-space: nowrap;
}
.ov-excellent .fb-ov-badge { background:#fde68a; color:#92400e; }
.ov-pass      .fb-ov-badge { background:#bbf7d0; color:#166534; }
.ov-fail      .fb-ov-badge { background:#fecaca; color:#991b1b; }

.fb-ov-right  { flex:1; min-width:0; }
.fb-ov-msg    { font-size:14px; font-weight:600; color:var(--gray-700); margin-bottom:10px; line-height:1.5; }
.fb-ov-stats  { display:flex; flex-wrap:wrap; gap:8px; }
.fb-stat {
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.08);
  padding: 3px 10px; border-radius: 20px; color: var(--gray-600);
}

.fb-no-speech {
  background:#fee2e2; border:1.5px solid #fca5a5; border-radius:10px;
  padding:12px 16px; font-size:13px; color:#991b1b; font-weight:500;
  margin-bottom:14px; line-height:1.6;
}
.fb-low-content {
  background:#fef3c7; border-color:#fcd34d; color:#92400e;
}

/* ===== FEEDBACK — 카테고리 섹션 ===== */
.fb-group {
  background:#fff; border-radius:var(--radius);
  border:1.5px solid var(--gray-200);
  overflow:hidden; margin-bottom:12px;
  box-shadow: var(--shadow);
}

.fb-group-hd {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; gap:12px;
}
.grade-bg-good { background:linear-gradient(90deg,#f0fdf4,#f8fafc); border-bottom:1.5px solid #bbf7d0; }
.grade-bg-mid  { background:linear-gradient(90deg,#fffbeb,#f8fafc); border-bottom:1.5px solid #fde68a; }
.grade-bg-low  { background:linear-gradient(90deg,#fff1f2,#f8fafc); border-bottom:1.5px solid #fecaca; }

.fb-gh-left   { display:flex; align-items:center; gap:8px; }
.fb-gh-icon   { font-size:18px; }
.fb-gh-name   { font-size:15px; font-weight:700; color:var(--gray-800); }
.fb-gh-right  { display:flex; align-items:center; gap:8px; flex-shrink:0; }

.fb-gh-bar-wrap {
  width:80px; height:7px; background:var(--gray-200);
  border-radius:4px; overflow:hidden;
}
.fb-gh-bar    { height:100%; border-radius:4px; transition:width 1.1s cubic-bezier(.4,0,.2,1); }

.fb-gh-score  { font-size:15px; font-weight:800; color:var(--gray-800); }
.fb-gh-max    { font-size:11px; font-weight:400; color:var(--gray-400); }
.fb-gh-badge  {
  font-size:11px; font-weight:700; padding:2px 10px;
  border-radius:20px; white-space:nowrap;
}
.badge-good { background:#dcfce7; color:#166534; }
.badge-mid  { background:#fef9c3; color:#92400e; }
.badge-low  { background:#fee2e2; color:#991b1b; }

/* 서브 아이템 */
.fb-group-body { padding:4px 0 6px; }

.fb-sub-row { padding:7px 16px; }
.fb-sub-main {
  display:flex; align-items:center; gap:8px;
  font-size:13px;
}
.fb-sub-icon {
  width:18px; text-align:center; font-size:12px; font-weight:700; flex-shrink:0;
}
.sr-good .fb-sub-icon { color:var(--green); }
.sr-mid  .fb-sub-icon { color:var(--yellow); }
.sr-low  .fb-sub-icon { color:var(--red); }

.fb-sub-name  { flex:1; color:var(--gray-700); font-weight:500; }
.fb-sub-score { font-size:13px; font-weight:700; color:var(--gray-800); }
.fb-sub-max   { font-size:11px; font-weight:400; color:var(--gray-400); }
.fb-sub-tag   {
  font-size:11px; font-weight:700; padding:1px 8px;
  border-radius:10px; flex-shrink:0;
}
.tag-good { background:#dcfce7; color:#166534; }
.tag-mid  { background:#fef9c3; color:#92400e; }
.tag-low  { background:#fee2e2; color:#991b1b; }

/* 개선 팁 */
.fb-tip {
  margin:4px 0 2px 26px; padding:7px 12px;
  border-radius:8px; font-size:12px; line-height:1.65;
  display:flex; gap:6px; align-items:flex-start;
}
.tip-mid { background:#fffbeb; border:1px solid #fde68a; color:#78350f; }
.tip-low { background:#fff1f2; border:1px solid #fecaca; color:#991b1b; }
.fb-tip-arrow { flex-shrink:0; font-weight:700; opacity:.7; }

.sr-good { background:transparent; }
.sr-mid  { background:#fffdf0; }
.sr-low  { background:#fff5f5; }

/* ===== TRANSCRIPT COMPARE ===== */
.transcript-section { margin-bottom: 24px; }
.transcript-compare {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  border: 1.5px solid var(--gray-200);
  box-shadow: var(--shadow);
}
.tc-row { display: grid; grid-template-columns: 80px 1fr; gap: 12px; margin-bottom: 14px; align-items: start; }
.tc-row:last-child { margin-bottom: 0; }
.tc-label { font-size: 11px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; padding-top: 2px; }
.tc-text { font-size: 14px; color: var(--gray-700); line-height: 1.8; }
.tc-text.recognized { color: var(--gray-900); }
.word-match { color: var(--green); font-weight: 600; }
.word-miss  { color: var(--red); text-decoration: line-through; opacity: .7; }
.word-extra { color: var(--orange); }

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.loading-box { text-align: center; }
.loading-plane {
  font-size: 48px;
  animation: fly 2s ease-in-out infinite;
  display: block; margin-bottom: 20px;
}
.loading-title { color: #fff; font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.loading-bars { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.loading-bar {
  width: 6px; height: 40px;
  background: var(--blue-mid);
  border-radius: 3px;
  animation: loadbar .8s ease-in-out infinite;
}
.loading-sub { color: rgba(255,255,255,.5); font-size: 13px; }

/* ===== ANIMATIONS ===== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .2; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}
@keyframes fly {
  0%   { transform: translateX(-10px) translateY(0); }
  50%  { transform: translateX(10px) translateY(-6px); }
  100% { transform: translateX(-10px) translateY(0); }
}
@keyframes loadbar {
  0%, 100% { transform: scaleY(.4); opacity: .5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

/* ===== CHECKLIST SUB-ITEMS ===== */
.score-cat-block { margin-bottom: 22px; }
.score-cat-block:last-child { margin-bottom: 0; }

.sub-items {
  margin-top: 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.sub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-100);
  background: #fff;
  font-size: 13px;
}
.sub-item:last-child { border-bottom: none; }
.sub-item:nth-child(even) { background: var(--gray-50); }
.sub-item-name { color: var(--gray-600); flex: 1; }
.sub-item-right { display: flex; align-items: center; gap: 10px; }
.sub-tier {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.tier-good { background: #dcfce7; color: #166534; }
.tier-mid  { background: #fef3c7; color: #92400e; }
.tier-low  { background: #fee2e2; color: #991b1b; }
.sub-score { font-weight: 700; color: var(--gray-800); min-width: 32px; text-align: right; }
.sub-max   { font-weight: 400; color: var(--gray-400); font-size: 11px; }

/* PASS/FAIL 강조 */
.grade-A.pass-badge, .grade-D.fail-badge { font-size: 15px; padding: 6px 20px; }

/* ===== CUSTOM SCRIPT ADD CARD ===== */
.script-card-add {
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; min-height: 130px;
  color: var(--gray-400);
}
.script-card-add:hover {
  border-color: var(--blue-mid);
  background: var(--blue-light);
  color: var(--blue);
}
.script-card-add.card-danger { border-color: #fecaca; color: #dc2626; }
.script-card-add.card-danger:hover { border-color: var(--red); background: #fff1f1; color: var(--red); }
.script-card-add-icon { font-size: 30px; }
.script-card-add-label { font-size: 14px; font-weight: 700; }
.script-card-add-sub { font-size: 12px; text-align: center; }

.scard-delete {
  position: absolute; top: 10px; right: 10px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25);
  color: var(--red); border-radius: 6px;
  padding: 3px 8px; font-size: 11px; font-weight: 700;
  cursor: pointer; opacity: 0; transition: opacity .15s;
  z-index: 2;
}
.script-card-item:hover .scard-delete { opacity: 1; }

.scard-edit {
  position: absolute; top: 10px; right: 10px;
  background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25);
  color: var(--blue); border-radius: 6px;
  padding: 3px 8px; font-size: 11px; font-weight: 700;
  cursor: pointer; opacity: 0; transition: opacity .15s;
  z-index: 2;
}
/* custom 카드에서는 edit이 delete 옆에 */
.script-card-item:hover .scard-edit { opacity: 1; }
.has-delete .scard-edit { right: 64px; }

.scard-custom-badge {
  font-size: 10px; font-weight: 700;
  background: var(--blue-light); color: var(--blue);
  padding: 2px 8px; border-radius: 10px;
  display: inline-block; margin-bottom: 6px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%; max-width: 580px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.modal-close {
  background: none; border: none; font-size: 18px; color: var(--gray-400);
  cursor: pointer; padding: 4px 6px; line-height: 1;
  border-radius: 6px; transition: all .15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px 4px; }
.modal-footer {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--gray-200);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}
.modal-field { margin-bottom: 16px; }
.modal-field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
}
.required { color: var(--red); }
.optional { font-weight: 400; color: var(--gray-400); font-size: 12px; }
.modal-field input[type="text"],
.modal-field select,
.modal-field textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color .15s;
  outline: none;
}
.modal-field input[type="text"]:focus,
.modal-field select:focus,
.modal-field textarea:focus { border-color: var(--blue); background: #fff; }
.modal-field textarea { resize: vertical; min-height: 130px; line-height: 1.75; }
.modal-field-row { display: grid; grid-template-columns: 1fr 100px; gap: 12px; }
.modal-lang-tabs {
  display: flex; gap: 0; margin-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
}
.modal-lang-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--gray-400); padding: 8px 14px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; margin-bottom: -2px; transition: all .15s;
}
.modal-lang-tab:hover { color: var(--gray-700); }
.modal-lang-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.modal-lang-panel { display: none; }
.modal-lang-panel.active { display: block; }

/* ===== PDF IMPORT MODAL ===== */
.pdf-modal-box { max-width: 740px; }

.pdf-step { }
.pdf-drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  transition: all .2s;
  background: var(--gray-50);
}
.pdf-drop-zone.drag-over { border-color: var(--blue); background: var(--blue-light); }
.pdf-drop-icon { font-size: 48px; margin-bottom: 12px; }
.pdf-drop-title { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 8px; }
.pdf-drop-sub { font-size: 13px; color: var(--gray-400); margin-top: 12px; line-height: 1.7; }

.pdf-parsing-box {
  padding: 48px 24px;
  text-align: center;
}

.pdf-preview-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 8px;
}
.pdf-preview-info { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.pdf-preview-actions { display: flex; gap: 8px; }

.pdf-script-list { display: flex; flex-direction: column; gap: 12px; }

.pdf-script-item {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: flex-start;
  transition: border-color .15s;
}
.pdf-script-item.selected { border-color: var(--blue-mid); background: #f8fbff; }
.pdf-script-check { margin-top: 4px; width: 18px; height: 18px; cursor: pointer; accent-color: var(--blue); }
.pdf-script-fields { display: flex; flex-direction: column; gap: 8px; }
.pdf-script-num-title { display: flex; gap: 8px; align-items: center; }
.pdf-script-num {
  background: var(--blue); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.pdf-field-input {
  border: 1.5px solid var(--gray-200); border-radius: 6px;
  padding: 7px 10px; font-size: 14px; font-family: inherit;
  color: var(--gray-800); background: var(--gray-50);
  width: 100%; outline: none; transition: border-color .15s;
}
.pdf-field-input:focus { border-color: var(--blue); background: #fff; }
.pdf-field-textarea {
  border: 1.5px solid var(--gray-200); border-radius: 6px;
  padding: 8px 10px; font-size: 13px; font-family: inherit;
  color: var(--gray-700); background: var(--gray-50);
  width: 100%; outline: none; resize: vertical; min-height: 80px;
  line-height: 1.7; transition: border-color .15s;
}
.pdf-field-textarea:focus { border-color: var(--blue); background: #fff; }

.pdf-chapter-header {
  font-size: 13px; font-weight: 800; color: var(--navy);
  background: var(--gray-200); border-radius: 8px;
  padding: 7px 14px; margin-top: 18px; margin-bottom: 4px;
  letter-spacing: .3px;
}
.pdf-section-header {
  font-size: 12px; font-weight: 600; color: var(--blue);
  padding: 4px 14px; margin-bottom: 4px;
  border-left: 3px solid var(--blue-mid);
  background: var(--blue-light); border-radius: 0 6px 6px 0;
}

.pdf-error-box {
  padding: 48px 24px;
  text-align: center;
}
.pdf-error-msg {
  font-size: 15px; color: var(--gray-600);
  margin-top: 12px; line-height: 1.6;
}

/* ===== AUTH MODAL ===== */
.auth-modal-box { max-width: 380px; }
.auth-modal-body { padding: 24px; }
.auth-desc { font-size: 14px; color: var(--gray-600); line-height: 1.7; margin-bottom: 18px; }
.auth-pw-input {
  width: 100%;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.auth-pw-input:focus { border-color: var(--blue); }
.auth-error {
  margin-top: 10px;
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
}

/* ===== TABLE INSERT TOOLBAR (modal) ===== */
.table-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; flex-wrap: wrap;
}
.btn-table-toggle {
  background: none;
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  color: var(--gray-600);
  font-size: 12px; font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all .15s;
}
.btn-table-toggle:hover,
.btn-table-toggle.active { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.table-builder {
  display: flex; align-items: center; gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 5px 10px;
  flex-wrap: wrap;
}
.table-builder.hidden { display: none; }
.tb-label { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.table-builder select {
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

/* ===== MODEL VOICE SECTION (modal) ===== */
.model-voice-section {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
}
.mv-section-title {
  font-size: 13px; font-weight: 700;
  color: var(--gray-700); margin-bottom: 10px;
}
.mv-current {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.mv-current.hidden { display: none; }
.mv-icon { font-size: 16px; }
.mv-name { font-size: 13px; color: var(--gray-700); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-del-btn { color: var(--red) !important; border-color: rgba(239,68,68,.3) !important; }
.mv-upload-btn {
  display: inline-flex; align-items: center;
  background: #fff;
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
  gap: 6px;
}
.mv-upload-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.mv-hint { font-size: 12px; color: var(--gray-400); margin-top: 8px; }

/* ===== MODEL VOICE BAR (prep screen) ===== */
.model-voice-bar {
  margin: 0 20px 12px;
  max-width: 720px; margin-left: auto; margin-right: auto;
}
.model-voice-bar.hidden { display: none; }
.btn-model-voice {
  width: 100%;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
  letter-spacing: .2px;
}
.btn-model-voice:hover { opacity: .88; }

/* ===== SCRIPT TABLE (rendered in prep/recording) ===== */
.script-text-rendered { white-space: pre-wrap; font-size: inherit; line-height: 1.8; }
.script-table {
  width: 100%; border-collapse: collapse;
  margin: 8px 0; font-size: 13px;
  white-space: normal;
}
.script-table th {
  background: var(--navy); color: #fff;
  padding: 7px 12px; text-align: left;
  font-size: 12px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.15);
}
.script-table td {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  vertical-align: top;
}
.script-table tr:nth-child(even) td { background: var(--gray-50); }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .result-overview { grid-template-columns: 1fr; }
  .radar-wrap { height: 220px; }
  .total-score-value { font-size: 44px; }
  .script-grid { grid-template-columns: 1fr; }
  .modal-field-row { grid-template-columns: 1fr; }
  .modal-box { max-height: 96vh; border-radius: 12px 12px 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .fb-overview { flex-direction: column; gap: 12px; }
  .fb-ov-left { flex-direction: row; align-items: center; gap: 12px; }
  .fb-ov-score { font-size: 40px; }
  .fb-gh-bar-wrap { width: 50px; }
}
