/* 심풀스터디 3.0 공통 스타일 — shadcn/ui(zinc) 디자인 토큰과 컴포넌트 모양을 일반 CSS로 옮김.
   클래스 이름은 그대로라서 페이지 스크립트는 바꾸지 않아도 된다. 기본 다크 모드, 버튼으로 라이트 모드. */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

/* ── 디자인 토큰 (shadcn/ui zinc) ──
   기본은 다크 모드. 상단의 해·달 버튼을 누르면 <html data-theme="light">로 라이트 모드가 된다. */
:root {
  color-scheme: dark;
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 5.5%;
  --card-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 72% 51%;
  --success: 142 69% 45%;
  --warning: 38 92% 50%;
  --info: 217 91% 65%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
  --radius: 0.5rem;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.5);
  --wrap: 1120px;
  --logo-filter: none;
}
html[data-theme="light"] {
  color-scheme: light;
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --success: 142 71% 35%;
  --info: 221 83% 53%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --logo-filter: invert(1) brightness(0.15);
}

/* ── 기본 ── */
*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss06';
}
a { color: hsl(var(--foreground)); text-underline-offset: 4px; }
a:hover { color: hsl(var(--foreground)); }
:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; border-radius: calc(var(--radius) - 2px); }
::selection { background: hsl(var(--primary) / 0.15); }
img { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; background: hsl(var(--muted)); padding: 0.15em 0.4em; border-radius: calc(var(--radius) - 4px); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 48px, var(--wrap)); margin-inline: auto; }

/* ── 상단 바 ── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: hsl(var(--background) / 0.85);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}
.site-header .wrap { display: flex; align-items: center; gap: 8px 24px; min-height: 56px; flex-wrap: wrap; }
.site-logo { display: inline-flex; align-items: center; padding: 6px 0; border-radius: var(--radius); }
.site-logo img { height: 22px; width: auto; display: block; filter: var(--logo-filter); }
.site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.site-nav a, .nav-btn {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground)); text-decoration: none; font-size: 14px; font-weight: 500; transition: color .15s, background-color .15s;
}
.site-nav a:hover, .nav-btn:hover { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.site-nav a[aria-current="page"] { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.nav-btn { border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }

/* ── Button ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px);
  font: inherit; font-size: 14px; font-weight: 500; line-height: 1; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: hsl(var(--primary) / 0.9); color: hsl(var(--primary-foreground)); }
.btn-secondary { background: hsl(var(--background)); color: hsl(var(--foreground)); border-color: hsl(var(--input)); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkish {
  border: 0; background: none; padding: 4px 2px; color: hsl(var(--muted-foreground)); font: inherit; font-size: 13px;
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer; border-radius: 4px;
}
.linkish:hover { color: hsl(var(--foreground)); }

/* ── Input · Select · Textarea ── */
.field { display: grid; gap: 8px; align-content: start; }
.field > span { font-size: 14px; font-weight: 500; line-height: 1; color: hsl(var(--foreground)); }
.input, .select, .textarea, .question-card textarea {
  width: 100%; height: 36px; padding: 4px 12px; font: inherit; font-size: 14px; color: hsl(var(--foreground));
  background: transparent; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder, .question-card textarea::placeholder { color: hsl(var(--muted-foreground)); }
.textarea, .question-card textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select option { background: hsl(var(--background)); color: hsl(var(--foreground)); }
.input:focus, .select:focus, .textarea:focus, .question-card textarea:focus {
  outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}
input[type="file"].input { height: auto; padding: 6px 8px; cursor: pointer; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 13px; font-weight: 500; margin-right: 12px; height: 26px; padding: 0 10px; cursor: pointer;
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 4px); background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
}
input[type="checkbox"] { accent-color: hsl(var(--primary)); }

/* ── 페이지 머리 ── */
.page-head { padding: 40px 0 24px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 4vw, 36px); font-weight: 700; line-height: 1.2; letter-spacing: -0.03em; }
.page-head p { margin: 10px 0 0; color: hsl(var(--muted-foreground)); font-size: 16px; max-width: 42em; }
.page-head p a { color: hsl(var(--foreground)); font-weight: 500; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: hsl(var(--muted-foreground)); margin-bottom: 12px; }
.crumbs a { color: hsl(var(--muted-foreground)); text-decoration: none; }
.crumbs a:hover { color: hsl(var(--foreground)); }

.section { padding: 8px 0 36px; }
.section-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 14px; }
.section-title small, .sub-title small { font-weight: 400; color: hsl(var(--muted-foreground)); font-size: 13px; margin-left: 8px; letter-spacing: 0; }
.sub-title { font-size: 15px; font-weight: 600; margin: 24px 0 10px; }
.empty { padding: 20px; color: hsl(var(--muted-foreground)); font-size: 14px; text-align: center; }
.tip { color: hsl(var(--muted-foreground)); font-size: 14px; }
.status-line { font-size: 14px; color: hsl(var(--muted-foreground)); margin: 12px 0 0; }
.status-line a { color: hsl(var(--foreground)); font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ── Card ── */
.panel, .concept, .question-card, .resume, .concept-group {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm);
}
.panel { padding: 24px; margin-top: 16px; }
.panel > .section-title:first-child { margin-top: 0; }

/* ── Alert ── */
.notice {
  position: relative; padding: 14px 16px 14px 44px; border-radius: calc(var(--radius) + 2px); font-size: 14px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); color: hsl(var(--foreground));
}
.notice::before {
  content: ''; position: absolute; left: 16px; top: 16px; width: 16px; height: 16px;
  background: currentColor; -webkit-mask: var(--icon-info) no-repeat center / contain; mask: var(--icon-info) no-repeat center / contain;
}
:root { --icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }

/* ── 이어서 보기 ── */
.resume { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 20px; margin-bottom: 28px; }
.resume-text { flex: 1 1 280px; min-width: 0; }
.resume-label { font-size: 12px; color: hsl(var(--muted-foreground)); font-weight: 500; }
.resume-title { display: block; font-size: 16px; font-weight: 600; margin-top: 2px; }

/* ── 홈 강조 카드 ── */
.home-cloud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 24px; margin-bottom: 32px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm);
}
.home-cloud p { margin: 0; flex: 1 1 260px; }
.home-cloud strong { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.home-cloud span { color: hsl(var(--primary-foreground) / 0.7); font-size: 14px; }
.home-cloud .btn-primary { background: hsl(var(--primary-foreground)); color: hsl(var(--primary)); }
.home-cloud .btn-primary:hover { background: hsl(var(--primary-foreground) / 0.9); }
.home-cloud .btn-secondary { background: transparent; color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary-foreground) / 0.25); box-shadow: none; }
.home-cloud .btn-secondary:hover { background: hsl(var(--primary-foreground) / 0.1); }

/* ── 과목 고르기 ── */
.subject-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.subject-link {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px;
  align-items: center; align-content: start; height: 100%; padding: 18px; text-decoration: none;
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.subject-link:hover { border-color: hsl(var(--foreground) / 0.25); box-shadow: var(--shadow-sm); color: hsl(var(--card-foreground)); }
.subject-mark { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff; }
.subject-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.subject-meta { font-size: 13px; color: hsl(var(--muted-foreground)); }
.subject-summary { grid-column: 1 / -1; margin-top: 12px; font-size: 13px; color: hsl(var(--muted-foreground)); line-height: 1.5; }

/* ── Tabs (과목 탭) ── */
.subject-tabs {
  display: flex; gap: 2px; overflow-x: auto; padding: 3px; margin: 0 0 20px; list-style: none; scrollbar-width: none;
  width: fit-content; max-width: 100%; background: hsl(var(--muted)); border-radius: var(--radius);
}
.subject-tabs::-webkit-scrollbar { display: none; }
.subject-tabs a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground)); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s;
}
.subject-tabs a:hover { color: hsl(var(--foreground)); }
.subject-tabs a[aria-current="page"] { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: var(--shadow-sm); }

/* ── 자료 목록 ── */
.item-list { list-style: none; margin: 0; padding: 0; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px); overflow: hidden; box-shadow: var(--shadow-xs); }
.item-list li + li { border-top: 1px solid hsl(var(--border)); }
.item-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 16px; padding: 14px 18px; color: hsl(var(--foreground)); text-decoration: none; transition: background-color .15s; }
.item-row:hover { background: hsl(var(--muted) / 0.5); color: hsl(var(--foreground)); }
.item-title { font-weight: 600; font-size: 15px; line-height: 1.45; }
.item-meta { grid-column: 1; font-size: 13px; color: hsl(var(--muted-foreground)); }
.item-action { grid-row: 1 / span 2; grid-column: 2; font-size: 13px; font-weight: 500; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.item-row:hover .item-action { color: hsl(var(--foreground)); }
.item-row .dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 8px; vertical-align: 2px; }

/* ── 검색 ── */
.search-box { display: flex; gap: 8px; max-width: 640px; margin-bottom: 12px; }
.search-box .input { flex: 1; }
.search-status { font-size: 13px; color: hsl(var(--muted-foreground)); margin: 0 0 10px; }

/* ── 자료 보기 ── */
.viewer-body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: hsl(var(--background)); }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 16px; background: hsl(var(--background)); border-bottom: 1px solid hsl(var(--border)); }
.viewer-back { color: hsl(var(--muted-foreground)); text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 4px; white-space: nowrap; }
.viewer-back:hover { color: hsl(var(--foreground)); }
.viewer-title { flex: 1 1 200px; min-width: 0; font-size: 15px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 6px; }
.viewer-actions a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); text-decoration: none; font-size: 13px; font-weight: 500; border: 1px solid hsl(var(--input)); box-shadow: var(--shadow-xs);
}
.viewer-actions a:hover { background: hsl(var(--accent)); }
.viewer-actions a[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.viewer-frame { flex: 1; width: 100%; border: 0; display: block; background: #fff; }

/* ── 문제 카드 ── */
.practice-wrap { max-width: 780px; }
.concept { padding: 20px 22px; margin-bottom: 20px; }
.concept p { margin: 0 0 8px; }
.concept p:last-child { margin-bottom: 0; }
.formula { font-size: 16px; font-weight: 600; }
.question-list { display: grid; gap: 12px; margin-top: 16px; }
.question-card { padding: 20px 24px; }
.question-card h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: hsl(var(--muted-foreground)); letter-spacing: 0.01em; }
.question-card p { margin: 0 0 10px; }
.question-card label { display: block; font-size: 14px; font-weight: 500; margin: 14px 0 8px; }
.question-card details { margin-top: 14px; border-top: 1px solid hsl(var(--border)); padding-top: 4px; }
.question-card details p { margin: 8px 0 0; }
.bank-text { white-space: pre-wrap; }

/* Accordion (details) */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.question-card summary, .concept-peek summary, .concept-group summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: hsl(var(--foreground));
}
.question-card summary:hover, .concept-peek summary:hover, .concept-group summary:hover { text-decoration: underline; text-underline-offset: 4px; }
.question-card summary::after, .concept-peek summary::after, .concept-group summary::after {
  content: ''; width: 16px; height: 16px; flex: none; background: hsl(var(--muted-foreground));
  -webkit-mask: var(--icon-chevron) no-repeat center / contain; mask: var(--icon-chevron) no-repeat center / contain; transition: transform .2s;
}
details[open] > summary::after { transform: rotate(180deg); }
:root { --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }

/* ── 무한 문제 클라우드 ── */
.cloud-filters { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 12px; margin: 0 0 16px; }
.cloud-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 4px; }
.cloud-stats div { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px); padding: 14px 16px; box-shadow: var(--shadow-xs); }
.cloud-stats dt { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 500; }
.cloud-stats dd { margin: 4px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cloud-card { margin-top: 16px; }
.cloud-q { font-size: 17px; font-weight: 600; line-height: 1.65; letter-spacing: -0.01em; }
.choice-list { display: grid; gap: 8px; margin-top: 8px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; min-height: 44px; padding: 11px 14px;
  font: inherit; font-size: 15px; color: hsl(var(--foreground)); background: hsl(var(--background));
  border: 1px solid hsl(var(--input)); border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow-xs);
  transition: border-color .15s, background-color .15s;
}
.choice:hover:not([disabled]) { background: hsl(var(--accent)); border-color: hsl(var(--foreground) / 0.3); }
.choice[disabled] { cursor: default; }
.choice-no { font-weight: 600; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.choice.is-right { border-color: hsl(var(--success)); background: hsl(var(--success) / 0.08); }
.choice.is-right .choice-no { color: hsl(var(--success)); }
.choice.is-wrong { border-color: hsl(var(--destructive)); background: hsl(var(--destructive) / 0.08); }
.choice.is-wrong .choice-no { color: hsl(var(--destructive)); }
.cloud-explain { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: hsl(var(--muted) / 0.6); }
.cloud-explain p { margin: 0 0 6px; }
.cloud-explain p:last-child { margin-bottom: 0; }
.cloud-answer { font-weight: 600; }
.result-ok, .result-bad { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.result-ok { color: hsl(var(--success)); }
.result-bad { color: hsl(var(--destructive)); }
.grade-ask { font-size: 14px; font-weight: 500; margin-right: 4px; }
.cloud-foot { text-align: right; }

/* ── 폼 배치 ── */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-grid .span-2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; background: hsl(var(--muted) / 0.6); border-radius: calc(var(--radius) - 2px); font-size: 13px; }
.file-list button { border: 0; background: transparent; color: hsl(var(--muted-foreground)); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; height: 28px; padding: 0 8px; border-radius: calc(var(--radius) - 4px); }
.file-list button:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

/* ── 자동화 센터 · 관리자 ── */
.auto-wrap { max-width: 980px; }
.auto-stats { margin-top: 16px; }
.provider-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
/* Badge */
.chip, .job-state {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: hsl(var(--foreground));
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--muted-foreground)); }
.chip.ok::before { background: hsl(var(--success)); }
.chip.off { color: hsl(var(--muted-foreground)); }
.dropzone {
  display: grid; gap: 4px; place-items: center; text-align: center; padding: 32px 16px; cursor: pointer; font-size: 14px;
  border: 1px dashed hsl(var(--input)); border-radius: calc(var(--radius) + 2px); background: hsl(var(--muted) / 0.4); transition: background-color .15s, border-color .15s;
}
.dropzone span { font-size: 13px; color: hsl(var(--muted-foreground)); }
.dropzone.is-over, .dropzone:hover { border-color: hsl(var(--foreground) / 0.4); background: hsl(var(--muted)); }
.job-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.job { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; background: hsl(var(--background)); }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.job-head strong { font-size: 14px; font-weight: 600; }
.job.is-queued .job-state { background: hsl(var(--secondary)); border-color: transparent; color: hsl(var(--secondary-foreground)); }
.job.is-running .job-state { background: hsl(var(--info) / 0.12); border-color: transparent; color: hsl(var(--info)); }
.job.is-done .job-state { background: hsl(var(--success) / 0.12); border-color: transparent; color: hsl(var(--success)); }
.job.is-error .job-state { background: hsl(var(--destructive) / 0.12); border-color: transparent; color: hsl(var(--destructive)); }
.job-meta { font-size: 13px; color: hsl(var(--muted-foreground)); }
/* Progress */
.bar, .mini-bar { display: block; height: 6px; border-radius: 999px; background: hsl(var(--primary) / 0.12); overflow: hidden; }
.bar > span, .mini-bar > span { display: block; height: 100%; border-radius: 999px; background: hsl(var(--primary)); transition: width .3s; }
.mini-bar { width: 80px; margin-top: 4px; }
/* Table */
.table-wrap { overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.unit-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.unit-table th, .unit-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.unit-table tr:last-child td { border-bottom: 0; }
.unit-table th { height: 40px; font-size: 13px; font-weight: 500; color: hsl(var(--muted-foreground)); }
.unit-table tbody tr:hover { background: hsl(var(--muted) / 0.5); }
.review-note { color: hsl(var(--destructive)); font-size: 13px; }
.log-list { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 6px; }
.log-at { color: hsl(var(--muted-foreground)); margin-right: 8px; font-variant-numeric: tabular-nums; }
.question-card .input { height: 36px; }
.login-panel { max-width: 400px; }
.concept-peek { margin-top: 16px; border-top: 1px solid hsl(var(--border)); padding-top: 4px; }
.concept-unit { padding: 12px 0; border-top: 1px solid hsl(var(--border)); }
.concept-unit:first-child { border-top: 0; }
.concept-unit h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.concept-unit p, .concept-group p { margin: 4px 0; color: hsl(var(--muted-foreground)); font-size: 14px; }
.concept-unit ul, .concept-group ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.concept-unit li, .concept-group li { margin: 3px 0; }
.concept-group { padding: 4px 18px 14px; margin-bottom: 8px; box-shadow: var(--shadow-xs); }
.concept-group:not([open]) { padding-bottom: 4px; }
.terms { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 0; font-size: 14px; padding: 12px; border-radius: var(--radius); background: hsl(var(--muted) / 0.6); }
.terms dt { font-weight: 600; }
.terms dd { margin: 0; color: hsl(var(--muted-foreground)); }
.mine-choices { margin: 0 0 8px; padding-left: 22px; font-size: 14px; }
.key-box { margin-top: 24px; padding-top: 20px; border-top: 1px solid hsl(var(--border)); }
.key-box p { margin: 0 0 10px; font-size: 14px; }
.key-box span { color: hsl(var(--muted-foreground)); font-size: 13px; }
.draft-card .check { min-height: 28px; margin: 0 0 6px; }
.draft-card .input { margin-bottom: 4px; }
/* Chart */
.chart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; padding: 16px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.chart-col { display: grid; gap: 6px; justify-items: center; }
.chart-bars { height: 120px; width: 100%; display: flex; gap: 2px; align-items: flex-end; justify-content: center; border-bottom: 1px solid hsl(var(--border)); }
.chart-bars span { width: 40%; max-width: 12px; min-height: 2px; border-radius: 3px 3px 0 0; }
.bar-users, .lg-users::before { background: hsl(var(--primary)); }
.bar-gens, .lg-gens::before { background: hsl(var(--muted-foreground) / 0.5); }
.chart-label { font-size: 11px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.chart-legend { grid-column: 1 / -1; display: flex; gap: 16px; margin: 4px 0 0; font-size: 12px; color: hsl(var(--muted-foreground)); }
.chart-legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* ── 바닥글 ── */
.site-footer { border-top: 1px solid hsl(var(--border)); padding: 24px 0 40px; margin-top: 24px; color: hsl(var(--muted-foreground)); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: hsl(var(--muted-foreground)); text-underline-offset: 4px; }
.site-footer a:hover { color: hsl(var(--foreground)); }

/* ── 반응형 ── */
@media (max-width: 960px) {
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wrap { width: min(100% - 32px, var(--wrap)); }
  .site-header .wrap { min-height: 52px; }
  .site-nav a, .nav-btn { padding: 0 8px; font-size: 13px; }
  .page-head { padding: 28px 0 18px; }
  .page-head p { font-size: 15px; }
  .subject-grid { gap: 8px; }
  .subject-link { padding: 14px; column-gap: 10px; }
  .subject-mark { width: 36px; height: 36px; font-size: 15px; }
  .subject-name { font-size: 15px; }
  .subject-summary { display: none; }
  .item-row { padding: 14px 16px; grid-template-columns: 1fr; }
  .item-action { grid-row: auto; grid-column: 1; margin-top: 4px; }
  .search-box { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .cloud-filters { grid-template-columns: 1fr; }
  .cloud-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .panel { padding: 18px; }
  .question-card { padding: 18px; }
  .chart { gap: 2px; padding: 12px 8px; }
  .viewer-bar { padding: 4px 8px; flex-wrap: nowrap; }
  .viewer-back { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
  .viewer-title, .viewer-actions #open-link { display: none; }
  .resume { padding: 14px 16px; }
  .resume .btn { width: 100%; }
  /* 휴대폰에서 입력할 때 화면이 확대되지 않도록 16px */
  .input, .select, .textarea, .question-card textarea { font-size: 16px; }
}
@media (pointer: coarse) {
  .btn, .input, .select { height: 40px; }
  .btn-sm { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ── 라이트·다크 모드 버튼 (shadcn ModeToggle 모양: 테두리 있는 아이콘 버튼) ── */
.theme-toggle {
  display: inline-grid; place-items: center; width: 36px; height: 36px; margin-left: 6px; padding: 0; flex: none; cursor: pointer;
  color: hsl(var(--foreground)); background: hsl(var(--background)); border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px); box-shadow: var(--shadow-xs); transition: background-color .15s;
}
.theme-toggle:hover { background: hsl(var(--accent)); }
.theme-toggle svg { width: 16px; height: 16px; grid-area: 1 / 1; transition: transform .25s, opacity .25s; }
.theme-toggle .icon-sun { transform: rotate(90deg) scale(0); opacity: 0; }
.theme-toggle .icon-moon { transform: rotate(0) scale(1); opacity: 1; }
html[data-theme="light"] .theme-toggle .icon-sun { transform: rotate(0) scale(1); opacity: 1; }
html[data-theme="light"] .theme-toggle .icon-moon { transform: rotate(-90deg) scale(0); opacity: 0; }
.viewer-bar .theme-toggle { width: 32px; height: 32px; margin-left: 0; }
@media (max-width: 640px) { .theme-toggle { width: 32px; height: 32px; margin-left: 2px; } }
/* 관리자 로그인 전처럼 메뉴가 숨겨져 있어도 버튼은 오른쪽 끝에 */
.site-nav[hidden] + .theme-toggle, .site-header .wrap > .site-logo + .theme-toggle { margin-left: auto; }
