:root {
  --color-bg: #f1e9db;
  --color-surface: #fffdf8;
  --color-text: #20242a;
  --color-text-muted: #716b61;
  --color-border: #c9bdaa;
  --color-accent: #8a342e;
  --color-accent-hover: #6f2925;
  --color-accent-soft: #e8d4cf;
  --color-focus: #2c5f8a;
  --color-shadow: rgba(32, 36, 42, 0.1);
  --header-height: 64px;
  --footer-height: 48px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: Pretendard, "Pretendard Variable", SUIT, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html, body, #root { min-width: 320px; min-height: 100%; }

body { margin: 0; min-height: 100vh; background: var(--color-bg); }

a { color: inherit; }

button, input, textarea { font: inherit; }

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

.site-shell { display: flex; min-height: 100vh; flex-direction: column; }

.site-header {
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  border-bottom: 1px solid rgba(201, 189, 170, 0.55);
  padding: 0 clamp(20px, 5vw, 64px);
}

.brand { color: var(--color-text); font-size: 15px; font-weight: 650; text-decoration: none; }
.brand:hover { color: var(--color-accent-hover); }
.header-link { margin-left: auto; color: var(--color-text-muted); font-size: 14px; text-decoration: none; }
.header-link:hover { color: var(--color-accent-hover); }

.search-main {
  display: flex;
  flex: 1;
  min-height: calc(100dvh - var(--header-height) - var(--footer-height));
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
}

.search-landing { width: min(640px, 100%); margin-top: -4vh; text-align: center; }

h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 600; line-height: 1.1; letter-spacing: 0; }

.intro-copy { margin: var(--space-4) 0 0; color: var(--color-text-muted); font-size: 17px; line-height: 1.6; }

.search-form {
  display: flex;
  width: 100%;
  height: 58px;
  align-items: center;
  margin-top: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: 0 6px 18px var(--color-shadow);
}

.search-form:hover { border-color: #b2a38e; }
.search-form:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft), 0 6px 18px var(--color-shadow); }
.search-form input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; background: transparent; color: var(--color-text); padding: 0 18px; }
.search-form input::placeholder { color: #8b8378; opacity: 1; }
.search-form input::-webkit-search-cancel-button { cursor: pointer; }
.search-form button { display: grid; width: 52px; height: 52px; flex: 0 0 52px; place-items: center; margin-right: 2px; border: 0; border-radius: 12px; background: transparent; color: var(--color-accent); cursor: pointer; }
.search-form button:hover { color: var(--color-accent-hover); background: var(--color-accent-soft); }
.search-icon { width: 21px; height: 21px; }

.suggested-queries { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 10px; margin-top: var(--space-4); color: var(--color-text-muted); font-size: 14px; line-height: 2; }
.suggested-queries a { text-decoration: none; }
.suggested-queries a:hover { color: var(--color-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.separator { color: var(--color-border); }

.site-footer { display: flex; min-height: var(--footer-height); align-items: center; justify-content: center; padding: 0 var(--space-6); color: var(--color-text-muted); font-size: 13px; }
.site-footer p { margin: 0; }

.content-main { width: min(760px, 100%); flex: 1; margin: 0 auto; padding: 56px 24px 72px; }
.search-page .search-form { max-width: 640px; margin: 0; }
.search-form-compact { height: 52px; }
.results-heading { margin: 40px 0 20px; font-size: 20px; font-weight: 600; line-height: 1.45; text-align: left; }
.search-results { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--color-border); }
.search-result-item { border-bottom: 1px solid var(--color-border); }
.search-result-item a { display: block; padding: 22px 2px; text-decoration: none; }
.search-result-item a:hover h2 { color: var(--color-accent-hover); }
.search-result-item h2 { margin: 6px 0 8px; font-size: 21px; line-height: 1.35; }
.search-result-item p { margin: 0; color: var(--color-text-muted); font-size: 15px; line-height: 1.65; }
.result-type { color: var(--color-accent); font-size: 13px; font-weight: 650; }
.result-date { display: block; margin-top: 10px; color: var(--color-text-muted); font-size: 12px; }
.empty-state { padding: 72px 0; text-align: center; }
.empty-state h1 { font-size: 24px; line-height: 1.45; }
.empty-state p { margin: 14px 0 0; color: var(--color-text-muted); line-height: 1.6; }
.empty-state a { color: var(--color-accent); }

.page-intro { margin: 14px 0 32px; color: var(--color-text-muted); line-height: 1.65; }
.archive-page h1 { font-size: 36px; }
.archive-list { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--color-border); }
.archive-list li { border-bottom: 1px solid var(--color-border); }
.archive-list a { display: grid; gap: 7px; padding: 22px 2px; text-decoration: none; }
.archive-list a:hover strong { color: var(--color-accent-hover); }
.archive-list strong { font-size: 20px; }
.archive-list span:not(.entry-type) { color: var(--color-text-muted); line-height: 1.55; }
.archive-list small { color: var(--color-text-muted); }
.entry-type { color: var(--color-accent); font-size: 13px; font-weight: 700; }

.detail-page { width: min(720px, 100%); }
.breadcrumb { display: flex; gap: 9px; margin-bottom: 36px; color: var(--color-text-muted); font-size: 13px; }
.breadcrumb a:hover { color: var(--color-accent-hover); }
.entry-header { padding-bottom: 32px; border-bottom: 1px solid var(--color-border); }
.entry-header h1 { margin-top: 10px; font-size: 40px; }
.entry-summary { margin: 18px 0 0; color: var(--color-text-muted); font-size: 18px; line-height: 1.7; }
.review-date { margin: 18px 0 0; color: var(--color-text-muted); font-size: 13px; }
.notice { margin: 28px 0 0; border-left: 4px solid var(--color-accent); padding: 16px 18px; background: var(--color-accent-soft); line-height: 1.65; }
.entry-body { padding: 34px 0 12px; font-size: 17px; line-height: 1.85; }
.entry-body p { margin: 0 0 22px; }
.detail-section { padding: 32px 0; border-top: 1px solid var(--color-border); }
.detail-section h2 { margin: 0 0 18px; font-size: 21px; }
.muted-copy { color: var(--color-text-muted); line-height: 1.65; }
.source-list, .related-list { display: grid; gap: 15px; margin: 0; padding-left: 22px; }
.source-list li, .related-list li { line-height: 1.55; }
.source-list a, .related-list a { text-underline-offset: 3px; }
.source-list span, .source-list small, .related-list span { display: block; color: var(--color-text-muted); font-size: 13px; }
.correction-form { display: grid; gap: 10px; }
.correction-form label { margin-top: 7px; font-size: 14px; font-weight: 650; }
.correction-form label span { color: var(--color-text-muted); font-weight: 400; }
.correction-form textarea, .correction-form input { width: 100%; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); padding: 12px; color: var(--color-text); }
.correction-form textarea { min-height: 130px; resize: vertical; }
.button { width: fit-content; margin-top: 8px; border: 0; border-radius: 6px; background: var(--color-accent); padding: 11px 17px; color: #fff; cursor: pointer; font-weight: 650; }
.button:hover { background: var(--color-accent-hover); }
.success-message { border-left: 4px solid #23734b; padding: 12px 14px; background: #e2f0e8; }
.honeypot { position: absolute; left: -9999px; }

.admin-shell { background: #f5f5f2; }
.admin-header { position: relative; z-index: 5; background: #fff; }
.admin-nav { margin-left: auto; }
.admin-nav summary { display: none; width: 40px; height: 40px; place-items: center; border: 1px solid var(--color-border); border-radius: 5px; cursor: pointer; font-size: 22px; list-style: none; }
.admin-nav summary::-webkit-details-marker { display: none; }
.admin-nav-links { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.admin-nav-links a { color: var(--color-text-muted); text-decoration: none; }
.admin-nav-links a:hover { color: var(--color-accent); }
.admin-nav-links form { margin: 0; }
.admin-nav-links button { border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.admin-main { width: min(1080px, 100%); flex: 1; margin: 0 auto; padding: 40px 24px 72px; }
.admin-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.admin-titlebar h1 { font-size: 30px; }
.admin-titlebar p { margin: 9px 0 0; color: var(--color-text-muted); }
.admin-titlebar > a:not(.button) { color: var(--color-accent); }
.admin-titlebar .button { flex: 0 0 auto; white-space: nowrap; }
.admin-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--color-border); background: #fff; }
.admin-stats a { display: grid; min-width: 0; gap: 6px; padding: 18px; border-right: 1px solid var(--color-border); text-decoration: none; }
.admin-stats a:last-child { border-right: 0; }
.admin-stats a:hover { background: #f0ece5; }
.admin-stats strong { font-size: 24px; }
.admin-stats span { color: var(--color-text-muted); font-size: 12px; line-height: 1.35; }
.admin-section { margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--color-border); }
.admin-section h2 { margin: 0 0 16px; font-size: 20px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; }
.section-title-row h2 span { color: var(--color-text-muted); font-size: 14px; font-weight: 500; }
.admin-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 160px 160px auto auto; align-items: end; gap: 10px; margin-bottom: 16px; }
.admin-filters input, .admin-filters select { width: 100%; height: 42px; border: 1px solid var(--color-border); border-radius: 5px; background: #fff; padding: 0 11px; color: var(--color-text); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid #ddd8cf; padding: 13px 14px; text-align: left; font-size: 14px; }
th { color: var(--color-text-muted); font-size: 12px; text-transform: uppercase; }
td a { font-weight: 650; text-underline-offset: 3px; }
.table-subtext { display: block; max-width: 420px; margin-top: 5px; overflow: hidden; color: var(--color-text-muted); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-block; border-radius: 4px; padding: 3px 7px; background: #e7e7e3; font-size: 12px; }
.status-published { background: #dceee4; color: #175c3c; }
.status-review { background: #fff0c9; color: #74500a; }
.status-archived { background: #eadfde; color: #773d38; }
.status-resolved { background: #dceee4; color: #175c3c; }
.status-rejected { background: #eadfde; color: #773d38; }
.status-reviewing { background: #fff0c9; color: #74500a; }
.status-stack { display: flex; flex-wrap: wrap; gap: 5px; }
.pagination { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; margin-top: 18px; text-align: center; }
.pagination a { color: var(--color-accent); font-weight: 650; }
.admin-message-list, .revision-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--color-border); }
.admin-message-list li, .revision-list li { display: grid; gap: 5px; padding: 14px 2px; border-bottom: 1px solid var(--color-border); }
.admin-message-list span, .revision-list span { color: var(--color-text-muted); }
.admin-message-list small, .revision-list small { color: var(--color-text-muted); font-size: 12px; }
.admin-login { display: grid; min-height: calc(100vh - var(--header-height)); place-items: center; padding: 32px 18px; }
.admin-panel { width: min(420px, 100%); border: 1px solid var(--color-border); border-radius: 6px; background: #fff; padding: 28px; }
.admin-login-form { display: grid; gap: 11px; }
.admin-login-form h1 { margin-bottom: 12px; font-size: 26px; }
.admin-login-form label, .admin-entry-form > label, .admin-entry-form fieldset label { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
.admin-login-form input, .admin-entry-form input, .admin-entry-form textarea, .admin-entry-form select { width: 100%; border: 1px solid var(--color-border); border-radius: 5px; background: #fff; padding: 11px 12px; color: var(--color-text); }
.form-error { border-left: 4px solid #a52c24; padding: 11px 13px; background: #f5dfdc; color: #72241e; }
.workflow-notice { display: grid; gap: 4px; margin-bottom: 18px; border-left: 4px solid #9b6b10; padding: 12px 14px; background: #fff0c9; }
.workflow-notice span { color: #65480f; font-size: 14px; }
.admin-entry-form { display: grid; gap: 0; }
.admin-entry-form textarea { min-height: 110px; resize: vertical; }
.admin-entry-form .body-editor { min-height: 340px; line-height: 1.65; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid label { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
.admin-entry-form label { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
.admin-entry-form label > span { color: var(--color-text-muted); font-size: 12px; font-weight: 400; }
.form-section { display: grid; gap: 18px; padding: 30px 0; border-top: 1px solid var(--color-border); }
.form-section-heading h2 { margin: 0; font-size: 19px; }
.form-section-heading p { margin: 6px 0 0; color: var(--color-text-muted); font-size: 13px; line-height: 1.5; }
.form-section-heading-action { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.repeat-list { display: grid; gap: 14px; }
.repeat-row { display: grid; gap: 14px; border: 1px solid var(--color-border); background: #fff; padding: 16px; }
.repeat-row-header { display: flex; align-items: center; justify-content: space-between; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 0; background: transparent; color: #7a2f2a; cursor: pointer; font-size: 24px; line-height: 1; }
.icon-button:hover { background: #f5dfdc; }
.choice-label { display: flex !important; width: fit-content; grid-template-columns: 18px auto; align-items: center; }
.choice-label input { width: 18px; height: 18px; }
.relation-grid { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(130px, .6fr) minmax(220px, 1fr); gap: 14px; }
.empty-inline, .empty-panel { margin: 0; padding: 20px; border: 1px dashed var(--color-border); color: var(--color-text-muted); text-align: center; }
.form-actions { position: sticky; z-index: 2; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; border-top: 1px solid var(--color-border); background: rgba(245, 245, 242, 0.96); padding: 14px 0; }
.button-secondary { border: 1px solid var(--color-border); background: #fff; color: var(--color-text); }
.button-secondary:hover { background: #eeeae3; }
.button-danger { background: #8b2f29; }
.compact-button { min-height: 42px; margin-top: 0; padding: 9px 14px; }
.preview-banner { padding: 10px 20px; background: #fff0c9; color: #74500a; text-align: center; font-size: 13px; font-weight: 650; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--color-border); }
.filter-tabs a { padding: 10px 12px; color: var(--color-text-muted); text-decoration: none; }
.filter-tabs a[aria-current="page"] { border-bottom: 3px solid var(--color-accent); color: var(--color-text); font-weight: 650; }
.correction-list { display: grid; gap: 14px; }
.correction-item { border: 1px solid var(--color-border); background: #fff; padding: 20px; }
.correction-item header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.correction-item header > div { display: flex; align-items: center; gap: 10px; }
.correction-item h2 { margin: 0; font-size: 18px; }
.correction-item time, .correction-contact { color: var(--color-text-muted); font-size: 13px; }
.correction-message { line-height: 1.7; white-space: pre-wrap; }
.correction-action-form { display: grid; grid-template-columns: 180px 1fr auto; align-items: end; gap: 12px; margin-top: 18px; border-top: 1px solid var(--color-border); padding-top: 16px; }
.correction-action-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
.correction-action-form select, .correction-action-form textarea { width: 100%; min-height: 42px; border: 1px solid var(--color-border); border-radius: 5px; background: #fff; padding: 9px; color: var(--color-text); }
.correction-action-form textarea { height: 70px; resize: vertical; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 560px) {
  :root { --header-height: 58px; }
  .site-header { padding: 0 20px; }
  .search-main { min-height: calc(100dvh - var(--header-height) - var(--footer-height)); padding: 40px 18px; }
  .search-landing { margin-top: -2vh; }
  h1 { font-size: clamp(1.8rem, 9vw, 2.4rem); }
  .intro-copy { font-size: 16px; }
  .search-form { height: 52px; margin-top: 20px; }
  .search-form button { width: 48px; height: 48px; flex-basis: 48px; }
  .suggested-queries { margin-top: 12px; font-size: 14px; }
  .content-main { padding: 36px 18px 56px; }
  .results-heading { margin-top: 32px; font-size: 18px; }
  .search-result-item h2 { font-size: 19px; }
  .archive-page h1 { font-size: 30px; }
  .entry-header h1 { font-size: 32px; }
  .entry-summary { font-size: 16px; }
  .admin-main { padding: 28px 18px 56px; }
  .admin-titlebar { align-items: flex-start; gap: 12px; }
  .admin-titlebar h1 { font-size: 25px; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-nav summary { display: grid; }
  .admin-nav:not([open]) .admin-nav-links { display: none; }
  .admin-nav-links { position: absolute; top: calc(100% + 1px); right: 0; left: 0; display: grid; gap: 0; border-bottom: 1px solid var(--color-border); background: #fff; box-shadow: 0 8px 18px var(--color-shadow); }
  .admin-nav-links a, .admin-nav-links form { border-bottom: 1px solid #ece8e1; }
  .admin-nav-links a, .admin-nav-links button { display: block; width: 100%; padding: 14px 20px; text-align: left; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-stats a { border-bottom: 1px solid var(--color-border); }
  .admin-stats a:nth-child(2n) { border-right: 0; }
  .admin-stats a:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .admin-filters { grid-template-columns: 1fr 1fr; }
  .admin-filters label:first-child { grid-column: 1 / -1; }
  .relation-grid, .correction-action-form { grid-template-columns: 1fr; }
  .form-section-heading-action { display: grid; }
  .form-actions { bottom: 0; margin-right: -18px; margin-left: -18px; padding: 12px 18px; }
  .correction-item header, .correction-item header > div { align-items: flex-start; }
  .correction-item header > div { display: grid; }
}

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