/* 오타 수정기 화면 스타일 — 웹앱 디자인 V1(kjh-webapp-ui)
 *
 * 주제색: 대교뉴이프 브랜드 포레스트그린 #1E3D2E (generate_palette.py 대비 검사 통과)
 * 상태색: 오타 = 차분한 벽돌빨강, 고친 말 = 차분한 파랑, 강조(하이라이트) = 주제색 연한 바탕 + 테두리
 * 색만으로 구분하지 않는다: 오타 = 물결 밑줄, 고친 말 = 굵게, 하이라이트 = 테두리
 */

:root {
  --color-canvas: #F2F0EB;
  --color-surface: #FDFCF9;
  --color-surface-raised: #FFFFFF;
  --color-shell-surface: #FFFFFF;
  --color-ink: #1D1E20;
  --color-muted: #656562;
  --color-line: #D9D6CF;
  --color-brand: #1E3D2E;
  --color-primary: #1E3D2E;
  --color-primary-hover: #2B5240;
  --color-primary-active: #163024;
  --color-primary-soft: #DBE0DE;
  --color-on-primary: #FFFFFF;
  --color-focus: #1E3D2E;
  --color-gold: #C9974A;          /* 브랜드 그림 전용 */
  --color-typo: #A63F3B;          /* 오타 글자: 흰 바탕 대비 5.9, 연한 빨강 바탕 대비 5.1 */
  --color-typo-soft: #F5E7E7;
  --color-fixed: #2F5F98;         /* 고친 말: 흰 바탕 대비 6.6, 연한 파랑 바탕 대비 5.6 */
  --color-fixed-soft: #E6EEF7;
  --color-success: #3C8362;
  --color-success-soft: #E4EEE9;
  --color-warning: #8A5A1F;
  --color-warning-soft: #F4ECE1;
  --color-danger: #B24843;
  --color-danger-soft: #F5E7E7;
  --color-disabled-bg: #ECEAE5;
  --color-disabled-ink: #888784;
  --color-scrim: rgb(29 30 32 / 38%);

  /* 승인된 플로팅 셸 기본값(2026-09-21) */
  --float-edge: 16px;
  --float-edge-compact: 8px;
  --float-gap: 8px;
  --float-control-size: 44px;
  --float-bar-height: 52px;
  --float-icon-size: 20px;
  --float-radius: 16px;
  --card-padding: 16px;
  --float-shadow: 0 8px 24px rgb(36 31 27 / 10%), 0 2px 6px rgb(36 31 27 / 6%);
  --card-shadow: 0 1px 2px rgb(36 31 27 / 5%), 0 6px 18px rgb(36 31 27 / 5%);

  --z-content: 0;
  --z-sticky: 50;
  --z-shell: 100;
  --z-popover: 300;
  --z-modal: 700;
  --z-toast: 900;

  --rail-width: 200px;
  --rail-width-icons: 60px;
  --body-size: 16px;
  --content-top: 76px;
  --content-left: 232px;
  --content-right: 16px;
  --content-bottom: 16px;

  --font-sans: "Pretendard Variable", Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

/* hidden 속성은 언제나 숨김(아래 display 규칙이 브라우저 기본값을 덮어쓰지 않게) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;          /* 한국어는 단어 단위로 줄바꿈 */
  overflow-wrap: anywhere;
}

h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
::selection { background: var(--color-primary-soft); }

:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 10px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; left: 16px; top: -60px; z-index: var(--z-toast); padding: 8px 12px; background: var(--color-primary); color: var(--color-on-primary); border-radius: 10px; }
.skip-link:focus { top: 16px; }
.muted { color: var(--color-muted); }
.small { font-size: 0.875rem; }
.icon { flex: none; }
.noscript { padding: 24px; }

/* ================================================================ 버튼 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 650; white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-small { min-height: 40px; padding: 0 12px; font-size: 0.9375rem; }
.btn-wide { width: 100%; }
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--color-primary-active); }
.btn-secondary { background: var(--color-surface-raised); border-color: var(--color-primary); color: var(--color-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--color-primary-soft); }
.btn-quiet { background: transparent; border-color: var(--color-line); color: var(--color-ink); }
.btn-quiet:hover:not(:disabled) { background: var(--color-surface-raised); border-color: var(--color-muted); }
.btn-quiet-danger { background: transparent; border-color: var(--color-line); color: var(--color-danger); }
.btn-quiet-danger:hover:not(:disabled) { background: var(--color-danger-soft); border-color: var(--color-danger); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn:disabled { background: var(--color-disabled-bg); color: var(--color-disabled-ink); border-color: var(--color-disabled-bg); }
.btn.is-busy:disabled { background: var(--color-primary-hover); color: var(--color-on-primary); }
.btn.is-busy .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 12px; border: 1px solid var(--color-line); background: var(--color-surface-raised); color: var(--color-ink);
}
.icon-btn:hover:not(:disabled) { background: var(--color-primary-soft); }
.icon-btn:disabled { color: var(--color-disabled-ink); background: var(--color-disabled-bg); }
.icon-btn-quiet { border-color: transparent; background: transparent; }
.icon-btn.float { border-color: transparent; background: var(--color-shell-surface); box-shadow: var(--float-shadow); border-radius: var(--float-radius); }
.icon-btn.float[aria-expanded="true"] { background: var(--color-primary); color: var(--color-on-primary); }
.link-btn { border: 0; background: none; padding: 0; color: var(--color-primary); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

/* ================================================================ 셸 */

.float { background: var(--color-shell-surface); box-shadow: var(--float-shadow); border-radius: var(--float-radius); }

.shell-brand {
  position: fixed; z-index: var(--z-shell); top: var(--float-edge); left: var(--float-edge);
  display: flex; align-items: center; gap: 10px; height: var(--float-bar-height); padding: 4px 16px 4px 6px;
  background: var(--color-shell-surface); box-shadow: var(--float-shadow); border-radius: var(--float-radius);
  color: var(--color-ink); text-decoration: none;
}
.brand-mark { display: block; width: 40px; height: 40px; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-size: 1.125rem; font-weight: 800; white-space: nowrap; letter-spacing: -0.02em; }

.shell-utils { position: fixed; z-index: var(--z-shell); top: var(--float-edge); right: var(--float-edge); display: flex; gap: var(--float-gap); }
.shell-utils .icon-btn { width: var(--float-bar-height); height: var(--float-bar-height); }

.shell-menu { position: fixed; z-index: var(--z-shell); padding: 4px; }
.menu-list, .step-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; width: 100%;
  border: 0; border-radius: 12px; background: transparent; color: var(--color-ink); font-weight: 650; white-space: nowrap;
}
.menu-item:hover { background: var(--color-canvas); }
.menu-item.is-active { background: var(--color-primary); color: var(--color-on-primary); }
.menu-label, .step-label { white-space: nowrap; }
.shell-menu.is-icons .menu-label { display: none; }
.shell-menu.is-icons .menu-item { justify-content: center; padding: 0; width: 44px; }

.shell-workflow { position: fixed; z-index: var(--z-shell); display: flex; align-items: center; gap: 4px; padding: 4px; }
.step {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 6px; width: 100%;
  border: 0; border-radius: 12px; background: transparent; color: var(--color-ink); font-weight: 600; white-space: nowrap;
}
.step:hover:not(:disabled) { background: var(--color-canvas); }
.step-dot {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%;
  border: 2px solid var(--color-line); font-size: 0.875rem; font-weight: 750; background: var(--color-surface-raised);
}
.step-current { background: var(--color-primary-soft); }
.step-current .step-dot { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.step-done .step-dot { background: var(--color-success-soft); border-color: var(--color-success); color: var(--color-success); }
.step-blocked { color: var(--color-disabled-ink); }
.step-blocked .step-dot { border-style: dashed; }
.step-summary { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 6px; font-weight: 650; white-space: nowrap; }
.step-summary .step-dot { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.step-toggle { width: 44px; height: 44px; }

.shell-bottom {
  position: fixed; z-index: var(--z-shell); left: var(--float-edge-compact); right: var(--float-edge-compact);
  bottom: calc(var(--float-edge-compact) + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px;
  background: var(--color-shell-surface); box-shadow: var(--float-shadow); border-radius: var(--float-radius);
}
[data-sheet="open"] .shell-bottom { z-index: calc(var(--z-popover) + 1); }
.bottom-btn {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px; border: 0; border-radius: 12px;
  background: transparent; color: var(--color-ink); font-size: 0.75rem; font-weight: 650;
}
.bottom-btn:hover { background: var(--color-canvas); }
.bottom-btn[aria-disabled="true"] { color: var(--color-disabled-ink); }
.bottom-btn[aria-pressed="true"] { background: var(--color-primary); color: var(--color-on-primary); }

/* --- 넓은 작업 화면 / 짧은 가로 화면: 왼쪽 열 하나(위 메뉴, 아래 작업 단계) */
[data-layout="wide"] .shell-menu,
[data-layout="short"] .shell-menu { top: calc(var(--float-edge) + var(--float-bar-height) + var(--float-gap)); left: var(--float-edge); width: var(--rail-width); }
[data-layout="wide"] .menu-list,
[data-layout="short"] .menu-list { flex-direction: column; }
[data-layout="wide"] .shell-menu.is-icons,
[data-layout="short"] .shell-menu.is-icons { width: var(--rail-width-icons); }
[data-layout="wide"] .shell-workflow,
[data-layout="short"] .shell-workflow { bottom: var(--float-edge); left: var(--float-edge); width: var(--rail-width); flex-direction: column; align-items: stretch; }
[data-layout="wide"] .shell-workflow .step-list,
[data-layout="short"] .shell-workflow .step-list { flex-direction: column; }
[data-layout="wide"] .shell-workflow .step-toggle,
[data-layout="short"] .shell-workflow .step-toggle { align-self: center; }
[data-layout="short"] .shell-workflow { width: var(--rail-width-icons); }
[data-layout="short"] .shell-workflow .step-label { display: none; }
[data-layout="short"] .shell-workflow .step { justify-content: center; padding: 0; }
[data-layout="short"] .step-summary { justify-content: center; padding: 0; }
[data-layout="short"] .brand-name { display: none; }
[data-layout="short"] .shell-brand { padding: 4px 6px; }
/* 좁은 왼쪽 열: 작업 단계도 메뉴와 같이 아이콘만 */
[data-rail="icons"][data-layout="wide"] .shell-workflow { width: var(--rail-width-icons); }
[data-rail="icons"][data-layout="wide"] .shell-workflow .step-label { display: none; }
[data-rail="icons"][data-layout="wide"] .shell-workflow .step { justify-content: center; padding: 0; }
[data-rail="icons"][data-layout="wide"] .shell-workflow .step-summary { justify-content: center; padding: 0; }
[data-rail="icons"][data-layout="wide"] .brand-name { display: none; }
[data-rail="icons"][data-layout="wide"] .shell-brand { padding: 4px 6px; }

/* --- 세로 화면(태블릿 세로 포함): 1행 브랜드·메뉴·계정/설정, 2행 작업 단계 */
[data-layout="portrait"] .shell-menu { top: var(--float-edge); left: 50%; transform: translateX(-50%); }
[data-layout="portrait"] .shell-workflow,
[data-layout="mobile"] .shell-workflow { top: calc(var(--float-edge) + var(--float-bar-height) + var(--float-gap)); left: var(--float-edge); }

/* --- 좁은 세로(모바일): 위 브랜드, 아래 통합 바 */
[data-layout="mobile"] { --float-edge: 8px; --card-padding: 14px; }
[data-layout="mobile"] .shell-workflow { top: calc(8px + var(--float-bar-height) + var(--float-gap)); left: 8px; }
[data-layout="mobile"] .shell-workflow.is-collapsed { padding: 0; }
[data-layout="mobile"] .shell-workflow.is-collapsed .step-summary { display: none; }
[data-layout="mobile"] .shell-workflow.is-collapsed .step-toggle { background: var(--color-shell-surface); border-radius: var(--float-radius); }
@media (max-width: 480px) {
  .brand-name { display: none; }
  .shell-brand { padding: 4px 6px; }
}
[data-auth="out"] .shell-utils { display: flex; }

/* ================================================================ 패널(설정·계정·드로어·홈 허브) */

.shell-scrim { position: fixed; inset: 0; z-index: calc(var(--z-popover) - 1); background: var(--color-scrim); }
.shell-panel {
  position: fixed; z-index: var(--z-popover); top: calc(var(--float-edge) + var(--float-bar-height) + 8px); right: var(--float-edge);
  width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - 100px); overflow: auto;
  padding: 12px; background: var(--color-shell-surface); border-radius: var(--float-radius); box-shadow: var(--float-shadow);
}
.shell-panel.panel-drawer {
  top: 0; bottom: 0; left: 0; right: auto; width: min(320px, 86vw); max-height: none; border-radius: 0 var(--float-radius) var(--float-radius) 0;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px;
}
.shell-panel.is-sheet {
  top: auto; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px) + 68px); width: auto; max-height: 70dvh;
}
.panel-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.panel-head h2 { flex: 1; font-size: 1.125rem; font-weight: 800; padding-left: 4px; }
.setting-list { display: grid; gap: 4px; }
.setting-row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; width: 100%;
  border: 0; border-radius: 12px; background: transparent; text-align: left; font-weight: 600;
}
.setting-row:hover { background: var(--color-canvas); }
.setting-text { flex: 1; }
.setting-value { color: var(--color-muted); font-weight: 650; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--color-line); flex: none; }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform .15s; }
.switch.is-on { background: var(--color-primary); }
.switch.is-on span { transform: translateX(18px); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px 0; }
.stepper-value { min-width: 4.5ch; text-align: center; font-size: 1.5rem; font-weight: 800; }
.panel-note { color: var(--color-muted); font-size: 0.875rem; text-align: center; }
.account-card { display: grid; padding: 12px; margin-bottom: 8px; border-radius: 12px; background: var(--color-canvas); }
.account-card strong { font-size: 1.0625rem; }
.account-card span { color: var(--color-muted); font-size: 0.875rem; }
.drawer-nav section { margin-bottom: 12px; }
.drawer-nav h3 { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 0.875rem; color: var(--color-muted); }
.drawer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.drawer-item {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; min-height: 52px; width: 100%;
  padding: 6px 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-weight: 650;
}
.drawer-item small { grid-column: 2; color: var(--color-muted); font-weight: 500; }
.drawer-item.is-active { background: var(--color-primary-soft); }
.drawer-item:disabled { color: var(--color-disabled-ink); }

.tooltip {
  position: fixed; z-index: var(--z-popover); max-width: 260px; padding: 6px 10px; border-radius: 8px;
  background: var(--color-ink); color: #fff; font-size: 0.8125rem; line-height: 1.4; pointer-events: none;
}

/* ================================================================ 본문 */

.content {
  container: page / inline-size;
  min-height: 100dvh;
  padding: var(--content-top) var(--content-right) var(--content-bottom) var(--content-left);
  outline: none;
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.page-head h1 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 850; letter-spacing: -0.02em; }
.page-desc { color: var(--color-muted); margin-top: 4px; }
.page-head > .page-desc { flex-basis: 100%; margin-top: -4px; }

.card {
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 18px; box-shadow: var(--card-shadow);
  padding: var(--card-padding);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-bottom: 8px; }
.card-head h2 { font-size: 1.125rem; font-weight: 800; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 650; }
.field input, .field select, select {
  min-height: 48px; padding: 0 14px; border: 1px solid var(--color-muted); border-radius: 12px; background: var(--color-surface-raised);
  font-size: 16px; /* 모바일 자동 확대 방지 */
}
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }
.field-addon { width: 48px; height: 48px; }
.field-hint { color: var(--color-muted); font-size: 0.8125rem; }
.form-error { color: var(--color-danger); font-weight: 650; }
.form-error::before { content: "⚠ "; }
.notice {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--color-warning-soft); color: var(--color-warning); font-weight: 600;
}
.notice-quiet { background: var(--color-surface-raised); color: var(--color-muted); border: 1px solid var(--color-line); }
.chip {
  display: inline-flex; align-items: center; padding: 1px 8px; margin-left: 6px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: var(--color-canvas); color: var(--color-muted); border: 1px solid var(--color-line); white-space: nowrap; vertical-align: 2px;
}
.chip-admin { background: var(--color-primary-soft); color: var(--color-primary); border-color: transparent; }

/* --- 로그인(첫 화면) */
.landing {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px;
  max-width: 960px; min-height: calc(100dvh - var(--content-top) - var(--content-bottom)); margin: 0 auto;
}
.landing-text { display: grid; gap: 16px; max-width: 560px; }
.eyebrow { color: var(--color-primary); font-weight: 750; }
.display { font-size: clamp(2.125rem, 1.5rem + 3vw, 3.5rem); font-weight: 900; line-height: 1.2; letter-spacing: -0.03em; }
.lead { font-size: 1.0625rem; color: var(--color-muted); }
.login-form { display: grid; gap: 14px; margin-top: 8px; padding: 20px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 18px; box-shadow: var(--card-shadow); }
.login-help { color: var(--color-muted); font-size: 0.875rem; text-align: center; }
.landing-art svg { width: clamp(140px, 18vw, 220px); height: auto; display: block; }

/* --- 원문 넣기 */
.input-card { display: grid; gap: 12px; }
.source-text {
  width: 100%; min-height: max(280px, calc(100dvh - var(--content-top) - var(--content-bottom) - 230px));
  padding: 14px 16px; resize: vertical; border: 1px solid var(--color-muted); border-radius: 12px;
  background: var(--color-surface-raised); font-size: var(--body-size); line-height: 1.75; white-space: pre-wrap;
}
[data-layout="mobile"] .source-text { font-size: max(16px, var(--body-size)); min-height: max(200px, calc(100dvh - var(--content-top) - var(--content-bottom) - 290px)); }
.input-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.char-count { color: var(--color-muted); font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
.char-count.is-over { color: var(--color-danger); font-weight: 700; }
.check-label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
.check-label input { width: 20px; height: 20px; accent-color: var(--color-primary); }
.input-actions { display: flex; gap: 8px; margin-left: auto; }
.slow-note { color: var(--color-muted); }

/* --- 오타 수정(3단) */
.review { display: flex; flex-direction: column; height: calc(100dvh - var(--content-top) - var(--content-bottom)); min-height: 520px; }
.review-head { margin-bottom: 12px; }
.review-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr) minmax(0, 1fr); gap: 12px; }
.review-card { display: flex; flex-direction: column; min-height: 0; padding: 12px; }
.review-card .card-head { padding: 0 4px; }
.card-scroll { flex: 1; min-height: 0; overflow: auto; border-radius: 12px; overscroll-behavior: contain; }
.card-source .card-scroll, .card-result .card-scroll { background: var(--color-surface-raised); border: 1px solid var(--color-line); }
.card-result { border-color: var(--color-fixed); box-shadow: var(--card-shadow), inset 0 3px 0 var(--color-fixed); }
.textbox { padding: 14px 16px; font-size: var(--body-size); line-height: 1.95; white-space: pre-wrap; word-break: keep-all; }
.legend { color: var(--color-muted); font-size: 0.8125rem; }
.legend-typo { color: var(--color-typo); font-weight: 700; text-decoration: underline wavy; text-underline-offset: 3px; }

.mark { position: relative; border-radius: 4px; scroll-margin: 48px; }
/* 번호 배지: inline(원자 상자가 아님)이라 배지 앞뒤에서 줄이 끊기지 않는다(마침표만 다음 줄로 밀리는 문제 방지) */
.mark[data-n]::after {
  content: attr(data-n); display: inline; margin-left: 2px; padding: 0.05em 0.42em;
  border-radius: 999px; font-size: 0.68em; font-weight: 800; line-height: 1; vertical-align: 0.4em;
  background: var(--color-typo); color: #fff; text-decoration: none;
}
.mark-typo { color: var(--color-typo); font-weight: 650; text-decoration: underline wavy var(--color-typo); text-decoration-thickness: 1.5px; text-underline-offset: 4px; background: var(--color-typo-soft); }
button.mark { border: 0; padding: 0; font: inherit; line-height: inherit; }
.mark-applied { background: transparent; color: var(--color-muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.mark-applied[data-n]::after { background: var(--color-muted); }
.mark-ignored { background: transparent; color: var(--color-muted); opacity: 0.7; }
.mark-ignored[data-n]::after { background: var(--color-line); color: var(--color-ink); }
/* button.mark의 font: inherit보다 우선하도록 선택자를 구체적으로(고친 말 = 굵게, 색만으로 구분하지 않음) */
.mark.mark-fixed { background: var(--color-fixed-soft); color: var(--color-fixed); font-weight: 800; }
.mark-fixed:hover, .mark-applied:hover, .mark-ignored:hover { outline: 2px dashed currentColor; outline-offset: 1px; }
.mark.is-hl { outline: 3px solid var(--color-primary); outline-offset: 2px; background: var(--color-primary-soft); }

.suggest-box { padding: 2px; }
.suggest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.suggest {
  display: flex; align-items: stretch; gap: 4px; border: 1px solid var(--color-line); border-radius: 14px; background: var(--color-surface-raised);
  transition: border-color .12s, box-shadow .12s;
}
.suggest.is-hl { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-soft); }
.suggest-main {
  flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px 10px 10px; border: 0; border-radius: 13px;
  background: transparent; text-align: left;
}
.suggest-main:hover { background: var(--color-canvas); }
.suggest .badge, .badge {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; margin-top: 2px; flex: none;
  border-radius: 999px; background: var(--color-typo); color: #fff; font-size: 0.8125rem; font-weight: 800;
}
.suggest-body { display: grid; gap: 4px; min-width: 0; }
.suggest-change { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: var(--body-size); font-weight: 750; }
.change-wrong { color: var(--color-typo); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.change-right { color: var(--color-fixed); }
.suggest-change .icon { color: var(--color-muted); }
.suggest-reason { color: var(--color-muted); font-size: 0.875rem; line-height: 1.45; }
.suggest-reason .chip { margin: 0 6px 0 0; vertical-align: 1px; }
.chip-띄어쓰기 { background: var(--color-fixed-soft); color: var(--color-fixed); border-color: transparent; }
.chip-맞춤법 { background: var(--color-warning-soft); color: var(--color-warning); border-color: transparent; }
.chip-오타 { background: var(--color-typo-soft); color: var(--color-typo); border-color: transparent; }
.suggest-ignore { align-self: center; margin-right: 4px; color: var(--color-muted); }
.done-state, .empty { display: grid; justify-items: center; gap: 8px; padding: 24px 12px; text-align: center; }
.done-state h3 { font-size: 1.125rem; font-weight: 800; }
.done-art svg, .empty-art svg { width: 96px; height: auto; display: block; }
.empty { max-width: 560px; margin: 24px auto; }
.empty h1, .empty h2 { font-size: 1.375rem; font-weight: 850; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

/* 본문 폭이 좁으면 3단을 세로로 쌓는다. 순서: 할 일(오타 수정) → 수정 결과 → 오타 확인 */
@container page (max-width: 839px) {
  .review { height: auto; min-height: 0; }
  .review-grid { display: flex; flex-direction: column; }
  .card-list { order: 1; }
  .card-result { order: 2; }
  .card-source { order: 3; }
  .card-scroll { flex: none; max-height: 46dvh; }
  .card-list .card-scroll { max-height: none; overflow: visible; }
}

/* --- 관리자 */
.admin-card { margin-bottom: 16px; }
.add-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: start; gap: 12px; }
.add-form .btn { margin-top: 30px; }
.add-form .form-error { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--color-line); background: var(--color-surface-raised); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--color-line); white-space: nowrap; }
.data-table thead th { background: var(--color-canvas); color: var(--color-muted); font-size: 0.8125rem; font-weight: 700; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tr.is-inactive > * { color: var(--color-muted); }
.row-actions { display: flex; gap: 6px; }
.status { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700; }
.status::before { content: "●"; margin-right: 6px; font-size: 0.6rem; align-self: center; }
.status-on { background: var(--color-success-soft); color: var(--color-success); }
.status-off { background: var(--color-disabled-bg); color: var(--color-muted); }
.status-warn { background: var(--color-warning-soft); color: var(--color-warning); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--color-surface-raised); border: 1px solid var(--color-line); }
.metric span { color: var(--color-muted); font-size: 0.8125rem; font-weight: 650; }
.metric strong { font-size: 1.375rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.usage-box > div > .muted { margin-top: 10px; }
.card-head select { min-height: 44px; }

@media (max-width: 760px) {
  .add-form { grid-template-columns: 1fr; }
  .add-form .btn { margin-top: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 좁은 화면의 표는 줄마다 카드처럼 쌓는다 */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 8px 12px; border-bottom: 1px solid var(--color-line); }
  .data-table th, .data-table td { padding: 4px 0; border: 0; white-space: normal; }
  .data-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 6.5em; color: var(--color-muted); font-size: 0.8125rem; font-weight: 650; }
  .data-table tbody th { font-size: 1.0625rem; }
  .row-actions { flex-wrap: wrap; padding-top: 6px !important; }
  .landing { grid-template-columns: 1fr; gap: 16px; align-content: start; }
  .landing-art { order: -1; }
  .landing-art svg { width: 96px; }
}

/* ================================================================ 대화상자·알림 */

.dialog {
  width: min(440px, calc(100vw - 24px)); padding: 20px; border: 0; border-radius: 18px; box-shadow: var(--float-shadow);
  background: var(--color-surface); color: var(--color-ink);
}
.dialog::backdrop { background: var(--color-scrim); }
.dialog form { display: grid; gap: 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-head h2 { font-size: 1.25rem; font-weight: 850; }
.dialog-desc { color: var(--color-muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.toasts {
  position: fixed; z-index: var(--z-toast); left: 50%; transform: translateX(-50%);
  bottom: calc(var(--content-bottom) + 8px); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--color-ink); color: #fff;
  box-shadow: var(--float-shadow); animation: toast-in .18s ease-out;
}
.toast div { display: grid; }
.toast span { opacity: 0.85; font-size: 0.875rem; }
.toast-success .icon { color: #9FD3B8; }
.toast-error .icon { color: #F2A8A4; }
.toast.is-leaving { opacity: 0; transition: opacity .35s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

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

@media (forced-colors: active) {
  .mark-typo { text-decoration-color: CanvasText; }
  .mark.is-hl, .suggest.is-hl { outline: 3px solid Highlight; }
}
