/* ═══════════════════════════════════════════════════════════════
   시나브로 AI · style.css  —  가을 테마
   개발자: 학성고 홍창민 (fbdubdf@on.use.go.kr)
   ═══════════════════════════════════════════════════════════════ */

/* ── 디자인 토큰 ────────────────────────────────────────────────── */
:root {
  /* 가을 주황 팔레트 */
  --accent:       #D95F00;   /* 메인 주황 */
  --accent-dark:  #B34D00;   /* 호버 */
  --accent-light: #FFF0E0;   /* 배경 강조 */
  --accent-mid:   #F28320;   /* 보조 주황 */

  /* 중립 팔레트 */
  --bg:           #FDFAF6;   /* 전체 배경 */
  --surface:      #FFFFFF;
  --surface-2:    #FBF7F2;
  --border:       #E8DFD0;
  --border-2:     #D5C9B8;

  /* 텍스트 */
  --text-primary:   #1E1A14;
  --text-secondary: #5C4F3A;
  --text-muted:     #6E5F49;

  /* 기능색 */
  --danger: #C03920;
  --success: #1E6B3A;
  --info:   #1A4D8C;

  /* 타이포 */
  --font: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
          system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  font-family: var(--font);
  color: var(--text-primary);
  font-synthesis: none;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}

/* ── 포커스 ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── 버튼 ───────────────────────────────────────────────────────── */
button {
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap; flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: background .13s, border-color .13s, box-shadow .13s, transform .08s;
}
button:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-2);
  box-shadow: 0 2px 8px rgba(100,60,0,.08);
}
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* 주 버튼 — 가을 주황 */
button.primary, .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(180,70,0,.22);
}
button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(180,70,0,.30);
}

/* 링크형 버튼 */
.guide-link {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background .13s, border-color .13s;
  white-space: nowrap;
  text-decoration: none;
}
.guide-link:hover {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  color: var(--accent-dark);
}

/* ── 레이아웃 ───────────────────────────────────────────────────── */
.shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 32px; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 800;
  color: var(--accent);
  letter-spacing: -.03em;
}
.brand span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.actions {
  display: flex; align-items: center; gap: 7px;
  flex-wrap: wrap; justify-content: flex-end;
}

/* ── 배지 / 칩 ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  letter-spacing: .04em;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-mid);
  flex-shrink: 0;
}

.eyebrow {
  font-size: 10px; letter-spacing: .14em;
  color: var(--accent-dark); font-weight: 700;
  text-transform: uppercase;
}
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* ── 카드 (공용 컨테이너) ───────────────────────────────────────── */
.card {
  padding: 40px 44px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 600px;
  margin: 48px auto 24px;
  box-shadow: 0 8px 40px rgba(120,70,10,.08);
}
h1 {
  font-size: 38px; line-height: 1.25;
  letter-spacing: -.04em;
  margin: 16px 0 18px;
  font-weight: 800;
  color: var(--text-primary);
}
p { line-height: 1.75; }

.login-row { display: flex; gap: 10px; margin-top: 10px; }
input[type=password], input[type=email], input[type=number] {
  width: 100%; min-width: 0;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
  color: var(--text-primary);
}
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(217,95,0,.12); }
label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

#login-form { margin: 20px 0 4px; }

/* ── 로그인 화면 (2단 레이아웃) ─────────────────────────────────── */
.login-view {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 40px;
  align-items: center;
  max-width: 820px;
  margin: 28px auto 8px;
  padding: 8px 4px;
}

/* 왼쪽: 소개 */
.login-intro { max-width: 380px; }
.login-intro h1 {
  font-size: 32px; line-height: 1.2;
  margin: 14px 0 14px;
}
.login-lede {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin-bottom: 26px;
}
.login-points {
  list-style: none;
  display: grid; gap: 13px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}
.login-points li {
  display: flex; align-items: baseline; gap: 11px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.login-points strong { color: var(--text-primary); font-weight: 700; }
.point-mark {
  flex-shrink: 0;
  width: 7px; height: 7px; margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

/* 오른쪽: 로그인 패널 */
.login-panel {
  margin: 0;
  max-width: none;
  padding: 26px 26px 22px;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--accent-light) 0%, transparent 55%),
    var(--surface);
}
.login-panel-title {
  font-size: 22px; font-weight: 800;
  letter-spacing: -.03em;
  margin: 6px 0 14px;
}
.login-panel-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.login-google {
  display: flex; justify-content: center; align-items: center;
  width: 100%;
  padding: 11px 16px;
  font-size: 14.5px; font-weight: 700;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 10px rgba(180,70,0,.22);
  transition: background .13s, box-shadow .13s, transform .08s;
}
.login-google:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 0 4px 14px rgba(180,70,0,.30);
}
.login-google:active { transform: scale(.99); }
.login-note {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── 인트로 ─────────────────────────────────────────────────────── */
.intro { padding: 24px 0 28px; text-align: center; }
.intro h1 { font-size: 28px; }
.intro > p:last-child { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

/* ── 대화 메시지 ─────────────────────────────────────────────────── */
#messages {
  display: flex; flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.message {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  overflow-wrap: anywhere;
  max-width: 88%;
  width: fit-content;
  min-width: 160px;
}

/* 학생 메시지 — 오른쪽, 가을 주황 */
.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 5px var(--radius-lg);
}
.message.user h2 { color: rgba(255,255,255,.75); }
.message.user .content { color: #fff; }

/* AI 메시지 — 왼쪽, 흰 배경 */
.message.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 5px;
  max-width: 94%;
  box-shadow: 0 2px 10px rgba(100,60,0,.06);
}

.message h2 {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.message .content {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  white-space: normal;
}
.message.user .content { white-space: pre-wrap; }
.message img {
  max-width: min(220px,100%); max-height: 200px;
  border-radius: 10px; margin: 10px 8px 0 0;
}

/* ── Prose 렌더링 ────────────────────────────────────────────────── */
.prose-line {
  white-space: pre-wrap;
  line-height: 1.75;
}
.prose-line.blank { display: block; height: .5em; }
.prose-list { margin: 6px 0 6px 1.3em; padding: 0; }
.prose-list li { line-height: 1.7; margin: 3px 0; }
.prose-line code {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: .87em;
}
.content h3 {
  font-size: 16px; font-weight: 700;
  margin: 16px 0 6px;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.content code { font-family: var(--font-mono); }

/* ── 코드 에디터 ─────────────────────────────────────────────────── */
.code-editor {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
  background: var(--surface-2);
}
.code-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  background: #F2EBE0;
  border-bottom: 1px solid var(--border);
  font: 12px var(--font-mono);
  gap: 12px;
}
.code-bar button {
  font-size: 11px; padding: 4px 9px;
  border-radius: 6px;
}
.code-grid { display: flex; overflow: auto; max-height: 540px; }
.code-grid pre {
  background: transparent; border: 0; border-radius: 0;
  margin: 0; padding: 14px;
  white-space: pre; overflow-wrap: normal;
  line-height: 1.65;
  font: 13px/1.65 var(--font-mono);
}
.code-grid .line-numbers {
  color: var(--text-muted); text-align: right;
  background: #F7EFE6; user-select: none;
  border-right: 1px solid var(--border);
  padding-right: 10px; min-width: 2.5em;
}
.code-input {
  min-height: 240px; max-height: 540px;
  white-space: pre; overflow: auto;
  tab-size: 4; padding: 14px;
  font: 13px/1.65 var(--font-mono);
  width: 100%; border: 0; outline: none;
  background: #FDF8F2; resize: vertical;
}

/* 신택스 하이라이팅 */
.token-keyword { color: var(--accent-dark); font-weight: 600; }
.token-string  { color: var(--success); }
.token-comment { color: var(--text-muted); font-style: italic; }
.token-number  { color: #7A3B00; }

/* ── 내보내기 도구바 ─────────────────────────────────────────────── */
.answer-tools {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px; margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}
.tool-label {
  font-size: 11px; color: var(--text-muted);
  font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; margin-right: 2px;
}
.tool-sep {
  display: inline-block; width: 1px; height: 16px;
  background: var(--border); margin: 0 4px; vertical-align: middle;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 6px 11px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
  transition: background .12s, border-color .12s;
}
.tool-btn:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  color: var(--accent-dark);
}
.tool-btn:disabled { opacity: .5; cursor: wait; }
.tool-btn-copy {
  background: var(--accent-light);
  border-color: #E8C090;
  color: var(--accent-dark);
  font-weight: 600;
}
.tool-btn-export { font-weight: 600; }
/* 센서 시트 버튼 — 특별 강조 */
.tool-btn-sensor {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff; font-weight: 700;
  box-shadow: 0 2px 8px rgba(180,70,0,.2);
}
.tool-btn-sensor:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

/* ── 피드백 바 ──────────────────────────────────────────────────── */
.feedback {
  display: flex; flex-wrap: wrap; gap: 7px;
  align-items: center; margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.feedback button { font-size: 12px; padding: 5px 10px; }

/* ── 컴포저 (입력창) ─────────────────────────────────────────────── */
.composer {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(100,60,0,.06);
  transition: border-color .15s;
}
.composer:focus-within {
  border-color: var(--accent-mid);
  box-shadow: 0 4px 20px rgba(180,80,0,.12);
}
textarea {
  resize: vertical; width: 100%;
  border: 0; outline: none;
  line-height: 1.65;
  color: var(--text-primary);
  background: transparent;
  min-height: 76px;
  font-size: 15px;
}
textarea::placeholder { color: var(--text-muted); }
.compose-tools {
  display: flex; gap: 8px; align-items: center;
  margin-top: 10px; flex-wrap: wrap;
}
.compose-tools .file-button {
  margin-right: auto;
  font-size: 13px; color: var(--text-muted);
  cursor: pointer;
}
.file-button { cursor: pointer; }

/* ── 상태 표시줄 ─────────────────────────────────────────────────── */
.status {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px; text-align: center;
  margin: 6px 0;
}

/* ── 첨부 칩 ────────────────────────────────────────────────────── */
.attachment {
  display: inline-flex; gap: 6px; align-items: center;
  border: 1.5px solid var(--border);
  padding: 4px 10px; margin: 4px;
  border-radius: 8px;
  font-size: 12px; color: var(--text-secondary);
  background: var(--surface-2);
  overflow-wrap: anywhere;
}
.attachment button { padding: 1px 6px; font-size: 12px; }

/* ── pre 블록 ───────────────────────────────────────────────────── */
pre {
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px; font-size: 13px; line-height: 1.65;
  font-family: var(--font-mono);
}

/* ── 다이어그램 ─────────────────────────────────────────────────── */
.diagram {
  margin: 14px 0;
  border: 1.5px solid var(--border);
  padding: 10px; border-radius: var(--radius);
  background: var(--surface-2);
}
.message .diagram img {
  width: 100%; max-width: 680px; max-height: none; margin: 0;
}
.diagram button { font-size: 12px; margin-top: 8px; }

/* ── 스타터 카드 ─────────────────────────────────────────────────── */
.starter-section { margin: 0 0 24px; }
.section-heading {
  display: flex; justify-content: space-between;
  align-items: center; gap: 16px;
}
.section-heading h2 {
  font-size: 20px; letter-spacing: -.035em;
  margin: 6px 0 14px; font-weight: 700;
  color: var(--text-primary);
}
.starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.starter-card {
  white-space: normal; text-align: left;
  padding: 16px; display: flex; flex-direction: column; gap: 7px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.starter-card span {
  font-size: 10px; letter-spacing: .07em;
  color: var(--accent-dark); font-weight: 700; text-transform: uppercase;
}
.starter-card strong { font-size: 14px; color: var(--text-primary); }
.starter-card small {
  line-height: 1.6; color: var(--text-muted); font-size: 12px;
}
.starter-card:hover {
  border-color: var(--accent-mid);
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(180,80,0,.1);
}

/* ── FAQ ────────────────────────────────────────────────────────── */
.faq-help {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding: 14px 0;
}
.faq-help summary,
.verification-panel summary,
.analytics-method summary {
  cursor: pointer; font-size: 13px;
  color: var(--text-secondary); font-weight: 600;
  list-style: none;
}
.faq-help summary::before,
.verification-panel summary::before { content: "▸ "; color: var(--accent); }
.faq-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 20px; padding: 12px 0;
}
.faq-grid h3 { font-size: 13px; color: var(--text-primary); margin-bottom: 4px; }
.faq-grid p { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ── 팔로업 ─────────────────────────────────────────────────────── */
.followup-panel {
  border-top: 1px solid var(--border);
  margin-top: 18px; padding-top: 14px;
}
.followup-panel h3 { font-size: 14px; color: var(--text-primary); margin-bottom: 4px; }
.followup-panel p { font-size: 12px; color: var(--text-muted); margin: 4px 0 10px; }
.followup-panel button {
  display: block; white-space: normal; text-align: left;
  width: 100%; font-size: 12px; line-height: 1.55; margin: 5px 0;
  background: var(--accent-light);
  border-color: #E8C090; color: var(--accent-dark);
}
.followup-panel button:hover:not(:disabled) {
  background: #FFE4C0; border-color: var(--accent-mid);
}

/* ── 검증 패널 ──────────────────────────────────────────────────── */
.verification-panel {
  margin-top: 12px;
  background: var(--surface-2);
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.verification-panel p { font-size: 12px; color: var(--text-muted); line-height: 1.65; }
.verification-panel a { color: var(--accent); }

/* ── 에이전트 배지 ───────────────────────────────────────────────── */
.agent-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--accent-dark);
  background: var(--accent-light);
  border: 1.5px solid #E8C090;
  border-radius: 20px;
  padding: 3px 10px;
  margin-bottom: 10px;
}

/* ── 에이전트 진행 패널 ──────────────────────────────────────────── */
.job-progress {
  white-space: pre-line !important;
  font-size: 13px; line-height: 1.85;
  color: var(--text-secondary);
  background: linear-gradient(135deg, #FFF8F0 0%, #FFF2E6 100%);
  border: 1.5px solid #E8C090;
  border-radius: var(--radius);
  padding: 16px 18px;
}

/* ── 라이브러리 카드 ─────────────────────────────────────────────── */
.library-cards { display: grid; gap: 10px; margin-top: 12px; }
.library-cards article {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
}
.library-cards p { font-size: 13px; margin: 6px 0; color: var(--text-secondary); }

/* ── URL 동의 다이얼로그 ─────────────────────────────────────────── */
.url-consent-overlay {
  position: fixed; inset: 0;
  background: rgba(20,10,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  backdrop-filter: blur(3px);
}
.url-consent-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  max-width: 460px; width: 100%;
  box-shadow: 0 24px 64px rgba(80,30,0,.2);
  border: 1.5px solid var(--border);
}
.url-consent-dialog h3 { font-size: 17px; margin-bottom: 12px; color: var(--text-primary); }
.url-consent-dialog p { font-size: 13px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 10px; }
.url-consent-list {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px; margin: 10px 0;
  font-size: 12px; word-break: break-all;
}
.url-consent-list li { margin: 4px 0; }
.url-consent-list a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.url-consent-warning {
  font-size: 12px; color: var(--danger);
  background: #FFF0EE; border: 1px solid #F5CCC7;
  border-radius: var(--radius-sm);
  padding: 8px 12px; margin: 10px 0;
}
.url-consent-buttons {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px;
}
.url-consent-buttons button { min-width: 88px; }

/* ── 동의 모달 ──────────────────────────────────────────────────── */
.consent-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,10,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998; padding: 20px;
  backdrop-filter: blur(4px);
}
.consent-modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px 34px 28px;
  max-width: 480px; width: 100%;
  box-shadow: 0 28px 72px rgba(80,30,0,.2);
  border: 1.5px solid var(--border);
}
.consent-modal-box h2 {
  font-size: 20px; font-weight: 800;
  margin-bottom: 16px; color: var(--text-primary);
  letter-spacing: -.03em;
}
.consent-list { padding: 0 0 0 1.2em; margin-bottom: 18px; }
.consent-list li {
  font-size: 14px; line-height: 1.7; color: var(--text-secondary); margin: 6px 0;
}
.consent-check-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 18px; cursor: pointer;
}
.consent-check-row input[type=checkbox] {
  width: 18px; height: 18px;
  accent-color: var(--accent); flex-shrink: 0; cursor: pointer;
}
#consent-modal-confirm {
  width: 100%; padding: 14px;
  font-size: 15px; font-weight: 700; border-radius: var(--radius);
}
#consent-modal-confirm:disabled { opacity: .4; cursor: not-allowed; }

/* ── 피처 그리드 ─────────────────────────────────────────────────── */
.feature-row {
  max-width: 600px; margin: 18px auto 0;
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px;
}
.feature {
  padding: 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.feature strong { display: block; font-size: 13px; margin-bottom: 5px; }
.feature p { font-size: 12px; color: var(--text-muted); line-height: 1.55; }

/* ── 가이드 ─────────────────────────────────────────────────────── */
.guide { max-width: 720px; }
.guide h2 { font-size: 19px; margin-top: 28px; letter-spacing: -.03em; font-weight: 700; }
.guide li { line-height: 1.85; margin: 7px 0; }
.guide code {
  background: var(--accent-light); color: var(--accent-dark);
  border-radius: 5px; padding: 2px 6px;
  font-family: var(--font-mono); font-size: .88em;
}
.guide a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ── 리뷰 카드 ──────────────────────────────────────────────────── */
.review-card {
  background: var(--surface); padding: 22px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); margin: 16px 0;
}
.review-text {
  white-space: pre-wrap; overflow-wrap: anywhere;
  line-height: 1.75; max-height: 400px; overflow: auto;
}
.review-card img { max-width: 200px; max-height: 200px; }
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ── 분석 패널 ──────────────────────────────────────────────────── */
.analytics-panel h1 { font-size: 26px; margin: 8px 0 10px; }
.analytics-panel select {
  font: inherit; font-size: 13px; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}
.insight-note { font-size: 13px; color: var(--text-secondary); }
.analytics-kpis {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 20px 0;
}
.stat-card {
  padding: 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.stat-card span { font-size: 12px; color: var(--text-muted); }
.stat-card strong {
  display: block; font-size: 22px; margin-top: 8px;
  color: var(--accent-dark); font-weight: 800;
}
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.analytics-panel h2 { font-size: 15px; font-weight: 700; }
.stat-row { margin: 11px 0; font-size: 12px; color: var(--text-secondary); }
.stat-row progress {
  width: 100%; height: 7px; margin-top: 6px;
  border: 0; border-radius: 8px; overflow: hidden;
  background: var(--border);
}
.stat-row progress::-webkit-progress-bar { background: var(--border); }
.stat-row progress::-webkit-progress-value {
  background: var(--accent); border-radius: 8px;
}
.table-scroll { overflow-x: auto; }
.table-scroll table {
  border-collapse: collapse; width: 100%; font-size: 12px;
}
.table-scroll th, .table-scroll td {
  padding: 10px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.metric-chip {
  display: inline-block; border: 1.5px solid var(--border);
  border-radius: 20px; padding: 5px 10px; margin: 3px; font-size: 12px;
}
.analytics-method { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 14px; }
.analytics-method p, .analytics-method li {
  font-size: 12px; line-height: 1.75; color: var(--text-muted);
}
#analytics-status { font-size: 12px; color: var(--text-muted); }

/* ── 개인 프로필 사이드바 ────────────────────────────────────────── */
.personal-profile {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px; margin: 18px auto;
  max-width: 820px;
  font-size: 13px; color: var(--text-secondary);
}
.personal-profile h3 {
  font-size: 24px; color: var(--accent-dark);
  margin: 10px 0 4px; font-weight: 800;
}
.personal-profile p { overflow-wrap: anywhere; }
.personal-profile progress { width: 100%; accent-color: var(--accent); }
.personal-profile summary { cursor: pointer; }

/* ── 히스토리 사이드바 ──────────────────────────────────────────── */
.history-sidebar {
  border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 14px; margin: 14px;
  font-size: 13px;
}
.history-row { display: flex; gap: 3px; border-bottom: 1px solid var(--border); }
.history-row button {
  border: 0; background: transparent; padding: 8px 3px; font-size: 12px;
}
.history-row button:first-child {
  flex: 1; text-align: left; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.history-sidebar p { font-size: 11px; color: var(--text-muted); }
.history-sidebar h3 { font-size: 14px; font-weight: 700; }
.history-new-chat {
  display: block; width: 100%; margin: 10px 0; padding: 8px 10px;
  border: 1.5px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--accent-dark);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.history-new-chat:hover { background: var(--accent-light); }

/* ── 사용량 테이블 ───────────────────────────────────────────────── */
.usage-tables { overflow: auto; }
.usage-tables table { width: 100%; margin: 12px 0; font-size: 13px; border-collapse: collapse; }
.usage-tables th, .usage-tables td {
  padding: 10px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.quota-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.quota-form label { display: flex; flex-direction: column; font-size: 13px; gap: 4px; }
.quota-form input[type=number] {
  width: 130px; padding: 8px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
#usage-panel details { padding: 13px; border-bottom: 1px solid var(--border); }
#usage-panel summary { cursor: pointer; }

/* ── Google 로그인 ──────────────────────────────────────────────── */
#google-entry { margin: 22px 0; }
#google-button, #login-challenge, #enroll-challenge { margin: 14px 0; }
#issue-invites { display: grid; gap: 10px; max-width: 500px; }
#student-list p, #invite-list p, #key-list p {
  overflow-wrap: anywhere; font-size: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
#student-list button, #invite-list button, #key-list button { margin: 5px; }

/* ── 푸터 ───────────────────────────────────────────────────────── */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 28px 0 16px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  line-height: 1.8;
}
footer span { padding: 0 6px; }
footer a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration: underline;
}
.footer-dev {
  font-size: 11px; color: var(--text-muted);
  margin-top: 4px;
}

/* ── 데스크탑 사이드바 ──────────────────────────────────────────── */
@media (min-width: 1200px) {
  .shell { margin-left: 236px; margin-right: 24px; width: auto; max-width: none; }
  /* 로그인 화면에서는 사이드바가 없으므로 콘텐츠를 가운데로 유지한다. */
  .shell:has(#login:not([hidden])) { margin-left: auto; margin-right: auto; max-width: 1040px; }
  .history-sidebar {
    position: fixed; left: 18px; top: 72px;
    width: 200px; box-sizing: border-box;
    max-height: 38vh; overflow: auto; margin: 0;
  }
}

/* ── 모바일 ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .login-view {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 540px;
    margin-top: 24px;
  }
  .login-intro { max-width: none; }
  .login-intro h1 { font-size: 36px; }
}

@media (max-width: 600px) {
  .shell { padding: 16px 14px 36px; }
  header { margin-bottom: 16px; align-items: flex-start; }
  .brand { font-size: 20px; }
  .brand span { font-size: 14px; white-space: nowrap; }
  .card { padding: 24px 20px; margin: 24px auto 16px; border-radius: var(--radius-lg); }
  h1 { font-size: 30px; }
  .login-view { gap: 22px; }
  .login-intro h1 { font-size: 30px; margin: 16px 0 16px; }
  .login-lede { font-size: 15px; }
  .login-panel { padding: 26px 22px 22px; }
  .login-row { flex-direction: column; }
  .actions { gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  .actions button, .guide-link { padding: 7px 10px; font-size: 12px; }
  .message { padding: 13px 16px; max-width: 96%; }
  .message.assistant { max-width: 100%; width: 100%; }
  .composer { padding: 14px 16px; }
  .intro h1 { font-size: 24px; }
  .file-button .muted { display: none; }
  .feature-row { grid-template-columns: 1fr; gap: 8px; }
  .code-bar { gap: 5px; }
  .code-bar button { padding: 3px 7px; }
  .code-grid pre { font-size: 12px; }
  .starter-grid { grid-template-columns: 1fr 1fr; }
  .faq-grid, .analytics-grid { grid-template-columns: 1fr; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0; }
  .starter-card { padding: 12px; }
  .starter-card small { display: none; }
  .url-consent-buttons { flex-direction: column-reverse; }
  .url-consent-buttons button { width: 100%; }
  .consent-modal-box { padding: 22px 18px; }
  .answer-tools { gap: 5px; }
  .tool-btn { font-size: 11px; padding: 5px 8px; }
  .tool-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── 센서 참고 파일 다운로드 패널 ────────────────────────────────── */
.sensor-sheet-panel {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--accent-light);
  border: 1.5px solid #E8C090;
  border-radius: var(--radius);
}
.sensor-sheet-title {
  font-size: 13px; font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 10px;
}
.sensor-sheet-row {
  display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap;
  padding: 6px 0;
  border-bottom: 1px solid #EED4B0;
}
.sensor-sheet-row:last-child { border-bottom: 0; }
.sensor-sheet-row > span {
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  min-width: 140px;
}

/* ── 음성 입력 ──────────────────────────────────────────────────── */
.voice-button.recording {
  background: var(--danger, #c62828); color: #fff; border-color: transparent;
  animation: voice-pulse 1.2s ease-in-out infinite;
}
.voice-button.transcribing { opacity: .7; cursor: progress; }
.voice-auto { font-size: 12px; color: var(--text-muted); display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(198,40,40,.45); } 50% { box-shadow: 0 0 0 6px rgba(198,40,40,0); } }
@media (prefers-reduced-motion: reduce) { .voice-button.recording { animation: none; } }


/* ═══════════════════════════════════════════════════════════════
   모션 레이어 — 역동적 애니메이션
   (상단의 prefers-reduced-motion 전역 리셋이 아래 전부를 비활성화함)
   ═══════════════════════════════════════════════════════════════ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pop-in {
  0%   { opacity: 0; transform: translateY(14px) scale(.96); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: none; }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(26px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-26px); }
  to   { opacity: 1; transform: none; }
}
@keyframes badge-shimmer {
  0%   { background-position: -140% 0; }
  100% { background-position: 240% 0; }
}
@keyframes brand-float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-3px); }
}
@keyframes dot-bounce {
  0%,80%,100% { transform: scale(.6); opacity: .4; }
  40%         { transform: scale(1);  opacity: 1; }
}
@keyframes accent-sheen {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ── 헤더 / 브랜드 ──────────────────────────────────────────────── */
header { animation: fade-in .5s ease both; }
.brand { animation: fade-up .5s ease both; }
.brand:hover { animation: brand-float 1.6s ease-in-out infinite; }
.actions > * { animation: fade-up .5s ease both; }
.actions > *:nth-child(1) { animation-delay: .04s; }
.actions > *:nth-child(2) { animation-delay: .09s; }
.actions > *:nth-child(3) { animation-delay: .14s; }
.actions > *:nth-child(4) { animation-delay: .19s; }
.actions > *:nth-child(5) { animation-delay: .24s; }

/* ── 로그인 화면 등장 ───────────────────────────────────────────── */
.login-intro .badge { animation: fade-up .55s ease .05s both; }
.login-intro h1     { animation: fade-up .6s ease .12s both; }
.login-lede         { animation: fade-up .6s ease .2s both; }
.login-points li    { animation: slide-in-left .5s ease both; }
.login-points li:nth-child(1) { animation-delay: .30s; }
.login-points li:nth-child(2) { animation-delay: .40s; }
.login-points li:nth-child(3) { animation-delay: .50s; }
.login-panel        { animation: pop-in .6s cubic-bezier(.22,1,.36,1) .22s both; }

/* 배지에 은은한 빛 흐름 */
.badge {
  background-image: linear-gradient(100deg,
    var(--surface-2) 30%, var(--accent-light) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: badge-shimmer 6s linear infinite;
}

/* 로그인 CTA 호버 리프트 */
.login-google { will-change: transform; }
.login-google:hover { transform: translateY(-2px); }

/* ── 채팅 진입(인트로/스타터) ───────────────────────────────────── */
#chat:not([hidden]) .intro { animation: fade-up .55s ease both; }
#chat:not([hidden]) .starter-section { animation: fade-up .6s ease .08s both; }
.starter-card { animation: fade-up .5s ease both; }
.starter-card:nth-child(1) { animation-delay: .05s; }
.starter-card:nth-child(2) { animation-delay: .11s; }
.starter-card:nth-child(3) { animation-delay: .17s; }
.starter-card:nth-child(4) { animation-delay: .23s; }
.starter-card:nth-child(5) { animation-delay: .29s; }
.starter-card:nth-child(6) { animation-delay: .35s; }
.starter-card:hover { box-shadow: 0 8px 22px rgba(180,70,0,.12); }

/* ── 메시지 버블 등장 ───────────────────────────────────────────── */
.message { will-change: transform, opacity; }
.message.user      { animation: slide-in-right .4s cubic-bezier(.22,1,.36,1) both; }
.message.assistant { animation: slide-in-left  .42s cubic-bezier(.22,1,.36,1) both; }
.message img { animation: fade-in .5s ease .1s both; }

/* 작성 영역 등장 */
.composer { animation: fade-up .5s ease .12s both; }

/* ── "답변 준비 중" 타이핑 점 애니메이션 ────────────────────────── */
/* .content 안 텍스트가 준비중 문구일 때 JS가 .thinking 클래스를 부여 */
.message.assistant .content.thinking { color: var(--text-muted); }
.message.assistant .content.thinking::after {
  content: "";
  display: inline-flex;
  gap: 4px;
  margin-left: 2px;
  vertical-align: middle;
}
.thinking-dots {
  display: inline-flex; gap: 5px; margin-left: 8px; vertical-align: middle;
}
.thinking-dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-mid);
  display: inline-block;
  animation: dot-bounce 1.3s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: .18s; }
.thinking-dots i:nth-child(3) { animation-delay: .36s; }

/* ── 주 버튼 미세 상호작용 ──────────────────────────────────────── */
button.primary { position: relative; overflow: hidden; }
button.primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  background-size: 220% 100%;
  background-position: -120% 0;
  opacity: 0; transition: opacity .2s;
}
button.primary:hover::after { opacity: 1; animation: accent-sheen 1.1s linear; }
button.primary:hover:not(:disabled) { transform: translateY(-1px); }

/* ── 상태 메시지 부드러운 등장 ──────────────────────────────────── */
.status:not(:empty) { animation: fade-in .3s ease both; }

/* ── 다이어그램/센서 패널 등장 ──────────────────────────────────── */
.diagram, .sensor-sheet-panel { animation: fade-up .5s ease both; }

/* ── 로딩 중 학습 지식 카드 (답변 작성 중 표시 대체) ─────────────── */
@keyframes learn-card-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.learn-wait { animation: fade-in .4s ease both; }
.learn-kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}
.learn-card {
  background: linear-gradient(135deg, #F4F8FF 0%, #EAF1FC 100%);
  border: 1.5px solid #C9DBF2;
  border-left: 4px solid var(--accent, #2E5AAC);
  border-radius: var(--radius, 14px);
  padding: 16px 18px;
  animation: learn-card-in .45s cubic-bezier(.22,1,.36,1) both;
}
.learn-term {
  margin: 0 0 6px; font-size: 17px; font-weight: 800;
  color: #1F2A44; letter-spacing: -.01em;
}
.learn-def {
  margin: 0; font-size: 14px; line-height: 1.7; color: #35405A;
}
.learn-progress {
  margin: 12px 0 0; font-size: 12.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   전역 부드러움 보강 — 켜질 때 샤샥, 사라질 때 샤라락
   ═══════════════════════════════════════════════════════════════ */
/* 버튼·링크·입력 등 상호작용 요소의 공통 전환 */
button, .tool-btn, .starter-card, .file-button, a.guide-link, a.brand,
input, textarea, details, .card, summary {
  transition:
    background-color .18s ease, color .18s ease, border-color .18s ease,
    box-shadow .2s ease, transform .16s cubic-bezier(.22,1,.36,1), opacity .2s ease;
}
button:not(:disabled):hover { transform: translateY(-1px); }
button:not(:disabled):active { transform: translateY(0) scale(.98); }
.tool-btn:hover { box-shadow: 0 3px 10px rgba(46,90,172,.14); }

/* 답변 완료 시 콘텐츠가 부드럽게 나타나도록 */
.message .content > * { animation: fade-up .34s ease both; }
.message .content { transition: opacity .25s ease; }

/* 내보내기/도구 바가 떠오르듯 등장 */
.message .tool-row, .feedback, .verification-panel, .library-cards, .followups {
  animation: fade-up .4s ease .05s both;
}

/* 섹션 전환 시 숨김/표시 부드럽게 (hidden 토글) */
#login, #chat { transition: opacity .3s ease; }
#login[hidden], #chat[hidden] { display: none; }

/* 첨부·동의 모달 등장 */
.consent-modal-overlay:not([hidden]) { animation: fade-in .25s ease both; }
.consent-modal-box { animation: pop-in .4s cubic-bezier(.22,1,.36,1) both; }

/* 모션이 꺼진 환경에서는 상단 전역 리셋이 모두 비활성화한다. */
#invite-code { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .03em; }
#enroll-submit { margin-top: 10px; }

/* ── 그룹 · 게스트 ─────────────────────────────────────────────── */
.group-card { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; background: var(--surface); }
.group-card.inactive { opacity: .65; }
.group-card h3 { margin: 0 0 4px; font-size: 15px; }
.group-card .actions { flex-wrap: wrap; align-items: center; }
.small-number { width: 72px; }
.guest-login { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
#guest-code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .03em; }
#guest-codes { white-space: pre-wrap; }

/* ── 서버 혼잡도 ─────────────────────────────────────────────────── */
.server-load { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; margin: 18px auto -6px; max-width: 820px; font-size: 13px; color: var(--text-secondary); }
.server-load p { margin: 4px 0; }
.load-head { display: flex; align-items: center; gap: 8px; }
.load-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.load-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 6px 0 2px; }
.load-bar span { display: block; height: 100%; transition: width .4s; }
.load-green { background: #2e9e4f; } .load-yellow { background: #e0a800; } .load-red { background: #d64545; } .load-down { background: #8a8f98; }
.server-load[data-level="red"] { border-color: #d64545; } .server-load[data-level="yellow"] { border-color: #e0a800; }
/* ── 진로 탐색 ───────────────────────────────────────────────────── */
.career-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.career-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.career-note { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; background: var(--surface); }
.career-note h3 { margin: 0 0 4px; font-size: 15px; }
.career-note p { margin: 3px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.career-starters button { margin: 4px 6px 4px 0; text-align: left; }
.chip { display: inline-block; padding: 2px 8px; margin: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.career-callout { border-left: 4px solid var(--accent-mid, #e07a1f); padding: 8px 12px; background: var(--surface-2); border-radius: 6px; font-size: 13px; }

/* 혼잡도 + 활용 패턴을 한 묶음으로 (데스크탑: 왼쪽 아래 사이드바) */
.side-stack { max-width: 820px; margin: 18px auto; display: flex; flex-direction: column; gap: 10px; }
.side-stack .server-load, .side-stack .personal-profile { margin: 0; }
@media (min-width: 1200px) {
  .side-stack { position: fixed; left: 18px; bottom: 18px; width: 200px; margin: 0; max-height: 56vh; overflow: auto; }
  .side-stack .personal-profile { position: static; width: auto; max-height: none; overflow: visible; }
  .side-stack .server-load { padding: 10px 12px; font-size: 12px; }
  .side-stack .server-load p { line-height: 1.5; }
}
/* 텍스트 입력·선택 상자 공통 스타일 (진로·게스트·초대 코드 화면) */
input[type=text], .card input:not([type]), .review-card input:not([type]), .card select, .review-card select, .card textarea {
  width: 100%; min-width: 0; box-sizing: border-box;
  border: 1.5px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; color: var(--text-primary);
}
.card textarea { min-height: 70px; resize: vertical; }
#profile-form > label, #note-form > label { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
#profile-form > label.check-row, #note-form > label.check-row { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.check-row input { width: auto; }
#profile-form > button, #note-form > button { margin-top: 14px; }

/* ── 수업용 작은 창·프로젝터 가독성 (2026-10-02) ───────────────────── */
h1 { font-size: clamp(24px, 5vw, 38px); }
.eyebrow, .starter-card span { font-size: 11px; }
.history-sidebar p, .badge, .footer-dev { font-size: 12px; }
progress::-moz-progress-bar { background: var(--accent); }
/* 반쪽 화면(700~1199px): 사이드바 없이 한 줄 흐름, 여백 축소 */
@media (max-width: 1199px) {
  .shell { padding-left: 16px; padding-right: 16px; }
  .history-sidebar, .side-stack { max-width: 820px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 600px) {
  .compose-tools { gap: 6px; }
  #voice-auto-label { order: 3; flex-basis: 100%; }
  #send { margin-left: auto; }
  .code-grid .line-numbers { min-width: 2em; padding-right: 6px; }
  .code-input, .code-grid pre { font-size: 12px; }
  .starter-card small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .message { min-width: 0; }
  header .actions { flex-wrap: wrap; }
}
/* 터치 화면: 누르기 쉬운 최소 크기 */
@media (pointer: coarse) {
  button, .guide-link, .tool-btn, .file-button, select { min-height: 44px; }
  .code-bar button { min-height: 36px; }
}
/* 표·긴 주소가 카드 밖으로 넘치지 않도록 */
.content table, .usage-tables, .usage-tables table { display: block; max-width: 100%; overflow-x: auto; }
.content a, .content code { overflow-wrap: anywhere; }
/* 확대(125~150%)·좁은 창에서 머리글이 넘치지 않도록 */
@media (max-width: 760px) {
  header { flex-wrap: wrap; gap: 8px; }
  .brand span { white-space: normal; }
}

/* ── 📝 퀴즈 ─────────────────────────────────────────────────────── */
.quiz-builder { margin-top: 16px; padding: 16px 18px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.quiz-builder h3 { margin: 0 0 8px; }
.quiz-builder form > label { display: block; margin-top: 8px; }
.quiz-builder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 10px 0; }
.quiz-builder-grid label { display: flex; flex-direction: column; gap: 4px; }
.quiz-builder select { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.quiz-types { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.quiz-types legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.check-row { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.check-row input { width: auto; }
.quiz-card { border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin: 10px 0; background: var(--surface); }
.quiz-title { margin: 0; font-size: 18px; }
.quiz-q { border-top: 1px solid var(--border); padding: 12px 0; }
.quiz-q-head { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.quiz-num { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; }
.quiz-stem { font-size: 16px; line-height: 1.7; }
.quiz-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.quiz-choices input, .quiz-choices textarea { width: 100%; box-sizing: border-box; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); font-size: 15px; }
.quiz-choice { text-align: left; white-space: normal; font-size: 15px; line-height: 1.5; }
.quiz-choice.right { border-color: #2e9e4f; background: #e9f7ee; }
.quiz-choice.wrong { border-color: #d64545; background: #fdecec; }
.quiz-ok { color: #1f7a3a; font-weight: 700; } .quiz-no { color: #b23333; font-weight: 700; }
.quiz-expl { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 4px; }
.quiz-verified { border-color: #2e9e4f; color: #1f7a3a; }
.quiz-score { font-weight: 700; font-size: 15px; }
.quiz-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.quiz-hint { margin-top: 6px; font-size: 13px; }
@media (min-width: 700px) { .quiz-choices.inline { flex-direction: row; flex-wrap: wrap; } }

/* 질문 기록 접기 (작은 창 기본 접힘) */
.history-toggle { all: unset; cursor: pointer; font-weight: 700; display: flex; justify-content: space-between; width: 100%; }
.history-toggle::after { content: '▾'; }
.history-sidebar.collapsed .history-toggle::after { content: '▸'; }
.history-sidebar.collapsed > :not(h3) { display: none; }
.history-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 1199px) { .history-sidebar { max-height: 260px; overflow: auto; } }
@media (max-width: 1199px) { .history-sidebar, .side-stack { width: calc(100% - 24px); box-sizing: border-box; margin: 12px auto; } }

/* ── AI 재구성 내보내기 · 배선도 ──────────────────────────────────── */
.compose-panel { border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; background: var(--surface); }
.compose-panel p { margin: 4px 0; }
.compose-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.compose-bar span { display: block; width: 35%; height: 100%; background: var(--accent); animation: compose-slide 1.4s ease-in-out infinite; }
@keyframes compose-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .compose-bar span { animation: none; width: 100%; opacity: .5; } }
.wiring-figure img.wiring-image { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.wiring-figure figcaption { margin: 6px 0; }

.prose-table { margin: 8px 0; }
.prose-table table { border-collapse: collapse; font-size: 14px; min-width: 60%; }
.prose-table th, .prose-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose-table th { background: var(--surface-2); font-weight: 700; }
.prose-quote { margin: 8px 0; padding: 8px 12px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 6px; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── 인지적 외주 지수 게이지 ── */
.cog-gauge{display:inline-flex;align-items:center;gap:6px;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;padding:4px 10px;cursor:pointer;font:inherit;color:var(--text-secondary)}
.cog-gauge:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.cog-track{width:64px;height:8px;background:var(--border);border-radius:4px;overflow:hidden;display:inline-block}
.cog-fill{display:block;height:100%;width:0;transition:width .4s,background .4s;background:var(--success)}
.cog-pct{font-weight:800;font-size:.85em;min-width:32px;text-align:right}
.cog-good .cog-fill{background:var(--success)} .cog-good .cog-pct{color:var(--success)}
.cog-mid .cog-fill{background:var(--accent-mid)} .cog-mid .cog-pct{color:var(--accent-dark)}
.cog-high .cog-fill{background:var(--danger)} .cog-high .cog-pct{color:var(--danger)}
.cog-pane{position:fixed;top:64px;right:16px;z-index:1000;width:min(340px,calc(100vw - 32px));background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:0 10px 30px rgba(60,40,10,.18);padding:14px 16px;color:var(--text-primary);font-size:.92em;line-height:1.55}
.cog-pane ul{padding-left:18px;margin:6px 0}
.cog-tip{background:var(--accent-light);border-radius:8px;padding:6px 8px}
.cog-privacy{color:var(--text-muted);font-size:.85em}
.cog-reset{background:none;border:1px solid var(--border-2);border-radius:8px;padding:4px 10px;cursor:pointer;color:var(--text-secondary)}
@media (max-width:600px){.cog-track{width:40px}.cog-ico{display:none}}
