:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #71818a;
  --line: #dfe8e7;
  --panel: rgba(255, 255, 255, 0.8);
  --mint: #bdeee2;
  --mint-deep: #37a891;
  --rose: #ffd3dc;
  --apricot: #ffe2b8;
  --sky: #cce8ff;
  --shadow: 0 24px 70px rgba(80, 113, 128, 0.18);
  --radius: 8px;
  --font: "Inter", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(189, 238, 226, 0.72), rgba(204, 232, 255, 0.52) 38%, rgba(255, 211, 220, 0.6)),
    #fbfdfc;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

svg {
  display: block;
}

.icon { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; flex-shrink: 0; padding: 0; border: 1px solid #d6e1da; border-radius: 4px; background: #fff; color: #607869; cursor: pointer; }
.icon-button:hover { background: #e9f1ec; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; color: #307354; background: #dceee2; border-radius: 6px; }
.site-brand { display: inline-flex; align-items: center; gap: 9px; }
.site-mobile-menu { display: none; position: relative; }
.site-mobile-menu > summary { display: grid; place-items: center; list-style: none; width: 44px; height: 44px; border: 1px solid #dce5df; border-radius: 5px; cursor: pointer; background: #fff; color: #53735e; }
.site-mobile-menu > summary::-webkit-details-marker { display: none; }
.site-mobile-menu nav { position: absolute; right: 0; top: 52px; display: grid; width: 210px; padding: 8px; background: white; border: 1px solid #d5e1d8; box-shadow: 0 8px 30px #24492e14; border-radius: 6px; z-index: 30; }
.site-mobile-menu nav a { display: block; padding: 12px; min-height: 44px; color: #45614d; text-decoration: none; font-size: .875rem; }
.site-mobile-menu nav a:hover { background: #e9f1ec; }
@media (max-width: 760px) { .site-header > .site-nav { display: none; } .site-mobile-menu { display: block; } }

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.upload-panel:has(input:focus-visible) .upload-button {
  outline: 3px solid var(--mint-deep);
  outline-offset: 4px;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 36px;
}

.ad-slot {
  width: 100%;
  overflow: hidden;
}

.ad-slot-top {
  min-height: 92px;
  margin-bottom: 22px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
}

.ad-slot-top:not(:has(.adsbygoogle)):not(:has(iframe)) {
  min-height: 0;
  margin-bottom: 0;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.upload-panel,
.control-panel,
.panel,
.tool-bar {
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  min-height: 260px;
  padding: 40px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 14px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(55, 168, 145, 0.14);
  color: #238d78;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 14px;
  font-size: 3.5rem;
  line-height: 1.18;
  letter-spacing: 0;
  word-break: keep-all;
}

.intro {
  max-width: 560px;
  margin-bottom: 0;
  color: #5d6c73;
  font-size: 1.08rem;
  line-height: 1.72;
  word-break: keep-all;
}

.upload-panel {
  min-height: 260px;
  padding: 22px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border-style: dashed;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.upload-panel.is-dragging {
  transform: translateY(-2px);
  border-color: var(--mint-deep);
  background: rgba(255, 255, 255, 0.92);
}

.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--radius);
  background: #263238;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(38, 50, 56, 0.18);
  cursor: pointer;
}

.upload-icon,
.primary-button svg,
.secondary-button svg {
  width: 22px;
  height: 22px;
}

.upload-icon svg,
.primary-button svg,
.secondary-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.upload-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.file-privacy-note {
  width: 100%;
  max-width: 340px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #4a625b;
  font-size: 0.8rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.file-privacy-note p {
  margin: 0;
}

.file-privacy-note p + p {
  margin-top: 6px;
}

.file-privacy-note strong {
  color: #205e4d;
}

.file-privacy-note a {
  color: #18694f;
  text-underline-offset: 3px;
}

.workspace {
  display: grid;
  gap: 18px;
}

@font-face {
  font-family: PdfEditorFont;
  src: url("../fonts/NotoSansKR-Regular.ttf") format("truetype");
  font-display: block;
}

.pdf-editor { min-width: 0; padding: 20px 0; }
.pdf-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pdf-editor-heading h2 { font-size: 1.15rem; margin: 0; }
.pdf-editor-heading > span, .pdf-editor-count { color: var(--muted); font-size: .8rem; }
.pdf-editor-warning, .pdf-editor-notice { font-size: .82rem; line-height: 1.8; color: var(--muted); overflow-wrap: anywhere; }
.pdf-editor-warning a { color: #28695b; text-decoration: underline; }
.pdf-editor-empty { padding: 48px 16px; text-align: center; background: #f0f6f3; border: 1px dashed #a8cbbf; border-radius: 6px; }
.pdf-editor-progress { display: block; width: 100%; height: 6px; margin: 16px 0; accent-color: #579e89; }
.pdf-editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.pdf-editor-filename { width: 100%; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-editor-pager, .pdf-editor-history, .pdf-editor-modes { display: flex; align-items: center; gap: 4px; }
.pdf-icon-button { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid #c8d7d1; border-radius: 4px; background: #fff; color: #284d42; font-size: 1.2rem; }
.pdf-editor select { max-width: 100%; min-width: 0; height: 36px; padding: 4px 6px; border: 1px solid #c8d7d1; border-radius: 4px; background: #fff; font-size: .8rem; }
.pdf-editor button:disabled { opacity: .45; cursor: default; }
.pdf-editor-modes { gap: 0; border: 1px solid #c8d7d1; border-radius: 4px; overflow: hidden; }
.pdf-editor-modes button { min-height: 34px; padding: 5px 9px; border: 0; border-radius: 0; background: #fff; font-size: .8rem; color: #38534a; }
.pdf-editor-modes button[aria-pressed="true"] { background: #dcefe6; color: #163f31; }
.pdf-editor-compare { display: flex; align-items: center; gap: 6px; font-size: .8rem; white-space: nowrap; }
.pdf-editor-compare input { accent-color: #45856f; }
.pdf-editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 250px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pdf-editor-viewport { min-width: 0; max-height: 78vh; overflow: auto; overscroll-behavior: contain; padding: 20px; background: #e9edeb; }
.pdf-page { position: relative; margin: 0 auto; flex-shrink: 0; background: #fff; box-shadow: 0 2px 8px #263a3020; }
.pdf-page > img { display: block; width: 100%; height: auto; user-select: none; }
.pdf-text-layer { position: absolute; inset: 0; }
.pdf-text-region { position: absolute; display: block; padding: 0; border: 1px solid transparent; border-radius: 0; background: transparent; min-width: 0; min-height: 0; cursor: text; }
.pdf-text-region:hover, .pdf-text-region:focus-visible { border-color: #31846a; background: #8ad2bd30; outline: 1px solid #31846a; }
.pdf-text-region.is-edited { border-color: #6694bf; }
.pdf-text-region.is-selected { border-color: #267559; outline: 2px solid #267559; background: #83d1b62b; }
.pdf-text-region:disabled { opacity: 1; pointer-events: none; }
.pdf-page.is-adding { cursor: crosshair; }
.pdf-editor-sidebar { min-width: 0; padding: 18px; background: #fbfcfb; border-left: 1px solid var(--line); }
.pdf-editor-sidebar h3 { margin: 0 0 16px; font-size: .95rem; }
.pdf-editor-download { display: block; padding: 10px 0; color: #28695b; font-size: .85rem; font-weight: 700; text-decoration: underline; }
.pdf-editor-sidebar fieldset { display: grid; gap: 14px; min-width: 0; padding: 0; margin: 0; border: 0; }
.pdf-editor-sidebar label { display: grid; gap: 6px; min-width: 0; color: #3d534a; font-size: .78rem; }
.pdf-editor-sidebar textarea, .pdf-editor-sidebar input { width: 100%; min-width: 0; border: 1px solid #c8d7d1; border-radius: 4px; padding: 8px; background: #fff; color: #263b33; }
.pdf-editor-sidebar textarea { resize: vertical; font-size: .9rem; line-height: 1.6; }
.pdf-editor-sidebar input[type="color"] { height: 36px; padding: 3px; }
.pdf-field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.pdf-editor-sidebar button { min-height: 38px; padding: 8px; font-size: .8rem; justify-content: center; }
.pdf-editor :focus-visible { outline: 2px solid #31846a; outline-offset: 2px; }
@media (max-width: 760px) {
  .pdf-editor-body { grid-template-columns: minmax(0, 1fr); }
  .pdf-editor-viewport { max-height: 58vh; padding: 10px; }
  .pdf-editor-sidebar { border-left: 0; border-top: 1px solid var(--line); padding: 16px; }
  .pdf-editor-sidebar fieldset { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pdf-editor-sidebar fieldset > label:first-child, .pdf-editor-sidebar fieldset > .pdf-field-pair { grid-column: 1 / -1; }
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: var(--radius);
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.control-panel.is-simple {
  grid-template-columns: 1fr;
}

.control-panel.is-simple .option-grid {
  display: none;
}

.mode-button {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
  word-break: keep-all;
}

.background-controls {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 22px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.background-color-field,
.background-range-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.background-color-field input {
  width: 72px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.background-range-field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.background-range-field output {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.background-range-field input {
  width: 100%;
  min-height: 38px;
  margin: 0;
  accent-color: var(--mint-deep);
}

.background-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.85rem;
  font-weight: 700;
}

.background-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--mint-deep);
}

.background-picker {
  cursor: crosshair;
}

.mode-button.is-active {
  border-color: rgba(55, 168, 145, 0.45);
  background: rgba(189, 238, 226, 0.72);
  color: #247f6e;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.option-field[hidden] {
  display: none;
}

.option-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.option-field select,
.option-field input[type="range"] {
  width: 100%;
}

.option-field select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.option-field select:focus {
  border-color: var(--mint-deep);
  box-shadow: 0 0 0 4px rgba(55, 168, 145, 0.14);
}

.option-field input[type="range"] {
  accent-color: var(--mint-deep);
  min-height: 46px;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.status-pill {
  max-width: 52%;
  overflow: hidden;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(189, 238, 226, 0.62);
  color: #247f6e;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list,
.result-list {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.35)),
    rgba(255, 255, 255, 0.48);
}

.file-list:not(.is-empty),
.result-list:not(.is-empty) {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  overflow: auto;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.file-list:not(.is-empty) .empty-state,
.result-list:not(.is-empty) .empty-state {
  display: none;
}

.empty-mark {
  width: 64px;
  height: 64px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, var(--sky), var(--mint)),
    #eef8f6;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.result-mark {
  background: linear-gradient(135deg, var(--rose), var(--apricot));
}

.file-item,
.result-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 10px;
  border: 1px solid rgba(223, 232, 231, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.file-thumb,
.result-thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(204, 232, 255, 0.6);
  color: #2f667a;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.file-thumb img,
.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-details {
  min-width: 0;
}

.visual-list:not(.is-empty) {
  max-height: 620px;
}

.image-preview-item {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 0 0 12px;
  border: 0;
  border-radius: 0;
  background: none;
}

.image-preview-item .file-thumb,
.image-preview-item .result-thumb {
  position: relative;
  grid-column: 1 / -1;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  background-color: #fff;
  background-image: conic-gradient(#edf1f0 25%, #fff 0 50%, #edf1f0 0 75%, #fff 0);
  background-size: 20px 20px;
  border: 1px solid var(--line);
}

.image-preview-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-item.image-preview-item {
  animation: result-reveal 320ms ease-out;
}

.conversion-progress {
  padding: 14px 0;
  border-top: 1px solid rgba(55, 168, 145, 0.25);
  border-bottom: 1px solid rgba(55, 168, 145, 0.25);
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: #247f6e;
  font-size: 0.9rem;
  font-weight: 700;
}

.progress-heading output {
  min-width: 4ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.conversion-progress progress {
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  appearance: none;
  accent-color: var(--mint-deep);
  background: #e3eeeb;
}

.conversion-progress progress::-webkit-progress-bar {
  background: #e3eeeb;
}

.conversion-progress progress::-webkit-progress-value {
  background: var(--mint-deep);
}

.conversion-progress progress::-moz-progress-bar {
  background: var(--mint-deep);
}

.file-name,
.result-name {
  margin: 0 0 4px;
  overflow: hidden;
  font-size: 0.94rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta,
.result-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.download-link {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #263238;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.processing-layer {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.34);
}

.result-list.is-processing .processing-layer {
  display: block;
}

.scan-line {
  position: absolute;
  top: -18%;
  left: 0;
  width: 100%;
  height: 22%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(189, 238, 226, 0.05),
    rgba(55, 168, 145, 0.55),
    rgba(255, 255, 255, 0.72),
    transparent
  );
  animation: scan 1800ms ease-in-out infinite;
}

.sparkles span {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 24px rgba(55, 168, 145, 0.76);
  animation: sparkle 1200ms ease-in-out infinite;
}

.sparkles span:nth-child(1) {
  top: 24%;
  left: 24%;
}

.sparkles span:nth-child(2) {
  top: 48%;
  right: 20%;
  animation-delay: 180ms;
}

.sparkles span:nth-child(3) {
  bottom: 22%;
  left: 52%;
  animation-delay: 340ms;
}

.tool-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  background: #2f8f7d;
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.error-message {
  margin: -6px 4px 0;
  color: #b14b5f;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.5;
}

.error-message[hidden] {
  display: none;
}

@keyframes scan {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  18%,
  82% {
    opacity: 1;
  }
  100% {
    transform: translateY(560%);
    opacity: 0;
  }
}

@keyframes sparkle {
  0%,
  100% {
    transform: scale(0.55);
    opacity: 0.2;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes result-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-line,
  .sparkles,
  .result-item.image-preview-item {
    animation: none;
  }
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 10;
  padding: 10px 16px;
  background: #fff;
  color: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-bottom: 28px;
}

.site-brand,
.footer-brand {
  color: var(--ink);
  font-weight: 800;
  font-size: 1.2rem;
  text-decoration: none;
}

.site-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.site-nav a,
.site-footer a,
.reading-heading > a {
  color: #395c56;
  text-underline-offset: 4px;
  font-size: 0.88rem;
  line-height: 1.6;
}

.site-nav a {
  text-decoration: none;
  padding: 5px 0;
}

.site-nav a[aria-current="page"] {
  color: #176c5a;
  font-weight: 800;
  box-shadow: inset 0 -2px #238b73;
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px 30px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid #c1d7d1;
}

.site-footer .footer-brand {
  font-size: 1.08rem;
  text-decoration: none;
}

.site-footer p {
  margin: 8px 0 0;
  color: #526d69;
  font-size: 0.84rem;
}

.site-footer nav {
  justify-content: flex-end;
  align-content: flex-start;
  max-width: 560px;
}

.site-footer .footer-copyright {
  grid-column: 1 / -1;
  margin: 0;
}

.home-reading {
  padding: 32px 0 0;
  margin-top: 38px;
  border-top: 1px solid #c1d7d1;
}

.reading-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.reading-heading h2 {
  margin: 0;
  font-size: 1.3rem;
}

.reading-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
}

.reading-link {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid #c6d9d3;
  text-decoration: none;
  color: var(--ink);
}

.reading-number,
.reading-link small {
  color: #466c62;
  font-size: 0.78rem;
  font-weight: 600;
}

.reading-link small,
.reading-link strong {
  display: block;
}

.reading-link strong {
  margin-top: 6px;
  font-size: 0.96rem;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.reading-link:hover strong {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.reading-arrow {
  color: #287a65;
  font-size: 1.1rem;
}

.document-page {
  background: rgba(249, 253, 251, 0.84);
}

.document-shell {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0;
}

.document-heading {
  padding: 34px 0 30px;
  border-bottom: 1px solid #cadcd4;
}

.document-category {
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #287c63;
  font-weight: 700;
}

.document-heading h1,
.not-found h1 {
  max-width: 830px;
  font-size: 2.5rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.document-lead {
  max-width: 780px;
  margin-bottom: 18px;
  color: #4a625b;
  font-size: 1.06rem;
  line-height: 1.9;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.document-meta {
  margin-bottom: 0;
  color: #587268;
  font-size: 0.8rem;
  line-height: 1.7;
}

.document-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 44px;
  padding-top: 34px;
  align-items: start;
}

.document-toc {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 12px;
  padding: 0 18px 0 0;
  border-right: 1px solid #cadcd4;
  font-size: 0.83rem;
  line-height: 1.75;
}

.document-toc p {
  margin: 0 0 4px;
  font-weight: 700;
}

.document-toc a,
.document-body a,
.not-found a {
  color: #18694f;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}

.document-toc a {
  color: #506b61;
  text-decoration: none;
}

.document-toc a:hover {
  text-decoration: underline;
}

.document-body {
  min-width: 0;
  font-size: 1rem;
  line-height: 1.95;
  overflow-wrap: anywhere;
}

.document-body section {
  margin-bottom: 38px;
  scroll-margin-top: 24px;
}

.document-body h2 {
  font-size: 1.35rem;
  line-height: 1.6;
  margin-bottom: 16px;
  word-break: keep-all;
}

.document-body p {
  margin-bottom: 18px;
}

.document-body li + li {
  margin-top: 10px;
}

.document-body ul,
.document-body ol {
  padding-left: 24px;
  margin-bottom: 24px;
}

.document-body .reading-list {
  grid-template-columns: 1fr;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 20px 0 24px;
}

.table-scroll table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.8;
  text-align: left;
}

.table-scroll caption {
  text-align: left;
  color: #506b61;
  margin-bottom: 12px;
  font-size: 0.82rem;
}

.table-scroll th,
.table-scroll td {
  padding: 12px 14px;
  border-bottom: 1px solid #cdded6;
  vertical-align: top;
}

.table-scroll thead {
  background: #e2f2e9;
}

.example-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.example-pair figure {
  min-width: 0;
  margin: 0;
}

.image-mat {
  aspect-ratio: 3 / 2;
  border: 1px solid #d4dfda;
  background: repeating-conic-gradient(#e7ece9 0 25%, #fff 0 50%) 0 / 16px 16px;
}

.image-mat img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.example-pair figcaption {
  margin-top: 10px;
  color: #4a625b;
  font-size: 0.8rem;
  line-height: 1.8;
}

.faq-list details {
  padding: 18px 0;
  border-bottom: 1px solid #cdded6;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 700;
  line-height: 1.7;
}

.faq-list details p {
  margin: 14px 0 0;
}

.document-back {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  border-top: 1px solid #cdded6;
  padding-top: 24px;
}

.contact-address {
  font-weight: 700;
}

.not-found {
  padding: 60px 0;
  min-height: 45vh;
}

.not-found a + a {
  margin-left: 24px;
}

@media (max-width: 900px) {
  .site-header {
    margin-bottom: 24px;
    gap: 10px 18px;
  }

  .site-nav {
    gap: 8px 20px;
  }

  .site-nav a {
    font-size: 0.83rem;
  }

  .site-footer {
    grid-template-columns: 1fr;
    margin-top: 36px;
  }

  .site-footer nav {
    justify-content: flex-start;
    gap: 12px 18px;
  }

  .reading-list,
  .document-layout {
    grid-template-columns: 1fr;
  }

  .document-shell {
    width: min(720px, calc(100% - 32px));
    padding-top: 22px;
  }

  .document-heading {
    padding-top: 24px;
  }

  .document-heading h1,
  .not-found h1 {
    font-size: 1.9rem;
  }

  .document-toc {
    position: static;
    border-right: 0;
    border-bottom: 1px solid #cadcd4;
    padding-bottom: 24px;
    gap: 10px;
  }

  .document-layout {
    gap: 26px;
    padding-top: 24px;
  }

  .document-body h2 {
    font-size: 1.2rem;
  }

  .document-body {
    font-size: 0.97rem;
  }

  .example-pair {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .app-shell {
    width: min(100% - 24px, 680px);
    padding-top: 20px;
  }

  .hero-panel,
  .control-panel,
  .work-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .upload-panel,
  .control-panel,
  .panel {
    padding: 18px;
  }

  .hero-copy {
    min-height: 230px;
  }

  h1 {
    font-size: 2rem;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .mode-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .background-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .background-color-field {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .file-list,
  .result-list {
    min-height: 300px;
  }

  .tool-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
