:root {
  --ink: #17211c;
  --muted: #66746d;
  --paper: #fbf7ec;
  --panel: rgba(255, 252, 243, 0.86);
  --line: rgba(23, 33, 28, 0.14);
  --green: #12614a;
  --green-dark: #0b3d31;
  --lime: #c9e45f;
  --orange: #e76f3c;
  --sand: #efe2c4;
  --shadow: 0 24px 80px rgba(36, 45, 39, 0.16);
  font-family: "Arita buri", "Noto Serif KR", "Iowan Old Style", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(201, 228, 95, 0.4), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(231, 111, 60, 0.2), transparent 24rem),
    linear-gradient(135deg, #fbf7ec 0%, #f4ead2 48%, #e8f0dc 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(23, 33, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 28, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 236, 0.78);
  backdrop-filter: blur(18px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: var(--green-dark);
  border-radius: 14px;
  box-shadow: 7px 7px 0 var(--lime);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand small {
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
}

.hero,
.workflow,
.workspace,
.analysis,
.region-editor,
.text-review,
.results {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.is-hidden {
  display: none !important;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 48px;
  align-items: center;
  min-height: 620px;
  padding: 72px 0 52px;
}

.hero-copy {
  animation: rise 650ms ease both;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 900px;
  margin-bottom: 22px;
  font-size: clamp(2.6rem, 6vw, 5.9rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.hero-description,
.section-heading p,
.panel p,
.step p,
.footer {
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.7;
}

.hero-description {
  max-width: 680px;
  font-size: 1.05rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  color: var(--green-dark);
  cursor: pointer;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(18, 97, 74, 0.16);
}

.button.primary {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.84rem;
}

.button.full-width {
  width: 100%;
  margin-top: 18px;
}

.hero-visual,
.panel,
.step,
.analysis-stage {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-visual {
  position: relative;
  display: grid;
  min-height: 430px;
  padding: 28px;
  overflow: hidden;
  border-radius: 34px;
  animation: rise 650ms 120ms ease both;
}

.hero-visual::before {
  position: absolute;
  top: -110px;
  right: -80px;
  width: 300px;
  height: 300px;
  content: "";
  background: conic-gradient(from 220deg, var(--lime), rgba(255, 250, 240, 0.9), var(--orange), var(--green), var(--lime));
  border-radius: 50%;
  opacity: 0.82;
}

.hero-visual::after {
  position: absolute;
  right: 30px;
  bottom: 28px;
  width: 140px;
  height: 140px;
  content: "";
  background: linear-gradient(135deg, rgba(18, 97, 74, 0.16), rgba(201, 228, 95, 0.28));
  border: 1px solid rgba(18, 97, 74, 0.12);
  border-radius: 28px;
  transform: rotate(8deg);
}

.label-board {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  align-self: center;
  padding: 28px;
  background: rgba(255, 250, 240, 0.86);
  border: 1px solid rgba(23, 33, 28, 0.12);
  border-radius: 26px;
  box-shadow: 0 20px 56px rgba(18, 97, 74, 0.14);
}

.label-board-top,
.rule-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

.label-board-top span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.label-board-top strong {
  display: inline-grid;
  min-width: 54px;
  min-height: 34px;
  place-items: center;
  color: #fff;
  background: var(--green-dark);
  border-radius: 999px;
}

.label-grid {
  display: grid;
  grid-template-columns: 0.72fr 1fr 1.18fr 1fr 0.72fr;
  gap: 8px;
  min-height: 230px;
}

.label-cell {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  border: 1px solid rgba(18, 97, 74, 0.2);
  border-radius: 16px;
}

.label-cell.front {
  color: #fff;
  background: linear-gradient(160deg, var(--green), var(--green-dark));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.label-cell.side {
  background: rgba(201, 228, 95, 0.32);
}

.label-cell.flap {
  background: rgba(231, 111, 60, 0.12);
}

.rule-strip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.workflow,
.workspace,
.analysis,
.region-editor,
.text-review,
.results {
  padding: 34px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading.compact {
  display: block;
  max-width: 760px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.step {
  min-height: 190px;
  padding: 22px;
  border-radius: 28px;
}

.step span {
  display: inline-grid;
  width: 40px;
  height: 40px;
  margin-bottom: 38px;
  place-items: center;
  color: #fff;
  background: var(--green-dark);
  border-radius: 50%;
}

.step.active {
  background: var(--green-dark);
}

.step.active,
.step.active p {
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.84fr) minmax(0, 1.16fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  padding: 24px;
  border-radius: 30px;
}

.panel-header {
  display: flex;
  gap: 18px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  color: var(--green-dark);
  white-space: nowrap;
  background: rgba(201, 228, 95, 0.4);
  border-radius: 999px;
}

.dropzone {
  display: grid;
  min-height: 220px;
  padding: 28px;
  place-items: center;
  text-align: center;
  cursor: pointer;
  background: #fffaf0;
  border: 2px dashed rgba(18, 97, 74, 0.28);
  border-radius: 28px;
  transition:
    border-color 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.dropzone.dragging {
  background: rgba(201, 228, 95, 0.24);
  border-color: var(--green);
  transform: scale(1.01);
}

.drop-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  background: var(--orange);
  border-radius: 18px;
}

.dropzone small {
  margin-top: 8px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

label {
  color: var(--green-dark);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 14px;
}

input,
select {
  height: 44px;
}

textarea {
  min-height: 96px;
  padding-top: 12px;
  resize: vertical;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.file-item {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background: rgba(255, 250, 240, 0.78);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.file-item small {
  color: var(--muted);
}

.preview-panel {
  min-height: 540px;
}

.preview-empty,
.preview-frame {
  display: grid;
  min-height: 436px;
  overflow: hidden;
  place-items: center;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(18, 97, 74, 0.08), transparent),
    #fffaf0;
  border: 1px solid var(--line);
  border-radius: 24px;
}

.preview-frame {
  align-items: start;
  justify-items: center;
  overflow: auto;
}

.preview-empty[hidden],
.preview-frame[hidden] {
  display: none;
}

.preview-empty span {
  display: grid;
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
  place-items: center;
  color: var(--green);
  font-weight: 900;
  background: rgba(201, 228, 95, 0.32);
  border-radius: 32px;
}

.preview-frame iframe,
.preview-frame img {
  width: 100%;
  height: 436px;
  border: 0;
}

.preview-frame img {
  object-fit: contain;
  padding: 12px;
}

.preview-canvas {
  position: relative;
  width: 100%;
  min-height: 436px;
  transform-origin: top center;
}

.preview-canvas img {
  display: block;
}

.zoom-controls {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

.zoom-controls span {
  min-width: 52px;
  color: var(--green-dark);
  font-weight: 800;
  text-align: center;
}

.area-overlay {
  position: absolute;
  min-width: 44px;
  min-height: 28px;
  pointer-events: none;
  border: 2px solid var(--orange);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(23, 33, 28, 0.02);
}

.area-overlay span {
  position: absolute;
  top: -28px;
  left: -2px;
  max-width: 220px;
  padding: 4px 8px;
  overflow: hidden;
  color: #fff;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--orange);
  border-radius: 8px 8px 8px 0;
}

.analysis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.analysis-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  gap: 8px 12px;
  align-items: center;
  padding: 16px;
  overflow: hidden;
  border-radius: 22px;
}

.analysis-stage span {
  display: block;
  width: 12px;
  height: 12px;
  background: var(--line);
  border-radius: 50%;
}

.analysis-stage.done span {
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(18, 97, 74, 0.1);
}

.analysis-stage.active {
  border-color: rgba(18, 97, 74, 0.42);
  background: rgba(255, 250, 240, 0.98);
}

.analysis-stage.active span {
  background: var(--orange);
  animation: pulse 900ms ease-in-out infinite;
}

.analysis-stage strong,
.analysis-stage small {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-stage small {
  max-width: 100%;
  height: 1.25em;
  color: var(--muted);
  line-height: 1.25;
}

.inline-progress {
  min-height: 42px;
  margin-top: 12px;
  padding: 12px 14px;
  overflow: hidden;
  color: var(--green-dark);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(201, 228, 95, 0.24);
  border: 1px solid rgba(18, 97, 74, 0.18);
  border-radius: 16px;
}

.inline-progress::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  content: "";
  background: var(--orange);
  border-radius: 50%;
}

.analysis:not(.is-hidden) .inline-progress::before,
.inline-progress:not(:empty)::before {
  animation: pulse 900ms ease-in-out infinite;
}

.live-progress {
  grid-column: 1 / -1;
  min-height: 48px;
  padding: 14px 16px;
  overflow: hidden;
  color: var(--green-dark);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 250, 240, 0.86);
  border: 1px solid rgba(18, 97, 74, 0.18);
  border-radius: 18px;
}

.live-progress::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  content: "";
  background: var(--orange);
  border-radius: 50%;
  animation: pulse 900ms ease-in-out infinite;
}

.result-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.text-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.calibration-panel {
  grid-column: 1 / -1;
}

.calibration-help {
  margin-bottom: 16px;
}

.calibration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.calibration-grid textarea {
  min-height: 120px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.calibration-output {
  max-height: 520px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-canvas-shell {
  min-height: 620px;
  overflow: auto;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 24px;
}

.editor-canvas {
  position: relative;
  width: 100%;
  min-height: 620px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(18, 97, 74, 0.08), transparent),
    #fffaf0;
}

.editor-canvas img {
  display: block;
  width: 100%;
  height: 620px;
  object-fit: contain;
  padding: 12px;
  user-select: none;
  -webkit-user-drag: none;
}

.editable-region {
  position: absolute;
  min-width: 36px;
  min-height: 26px;
  cursor: move;
  background: rgba(231, 111, 60, 0.08);
  border: 2px solid var(--orange);
  border-radius: 10px;
}

.editable-region.selected {
  background: rgba(201, 228, 95, 0.14);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 97, 74, 0.12);
}

.editable-region span {
  position: absolute;
  top: -28px;
  left: -2px;
  max-width: 220px;
  padding: 4px 8px;
  overflow: hidden;
  color: #fff;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--orange);
  border-radius: 8px 8px 8px 0;
}

.editable-region.selected span {
  background: var(--green);
}

.region-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background: var(--green);
  border: 2px solid #fff;
  border-radius: 50%;
}

.region-form {
  display: grid;
  gap: 14px;
}

.region-coords {
  padding: 12px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.review-card {
  grid-column: 1 / -1;
}

.debug-card {
  grid-column: 1 / -1;
}

.area-list,
.issue-list,
.panel-text-list {
  display: grid;
  gap: 12px;
}

.area-card,
.issue-card,
.panel-text-card {
  padding: 16px;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.area-card header,
.issue-card header,
.panel-text-card header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  color: var(--green-dark);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(201, 228, 95, 0.38);
  border-radius: 999px;
}

.tag.warning {
  color: #7c330f;
  background: rgba(231, 111, 60, 0.18);
}

.text-block {
  min-height: 360px;
  max-height: 540px;
  padding: 18px;
  overflow: auto;
  color: #27312d;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.75;
  white-space: pre-wrap;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.debug-log {
  max-height: 420px;
  padding: 16px;
  overflow: auto;
  color: #d8f5df;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background: #17211c;
  border-radius: 18px;
}

.issue-card strong {
  display: block;
  margin-bottom: 6px;
}

.issue-card p,
.area-card p,
.panel-text-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.65;
}

.panel-text-card dl {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

.panel-text-card dt {
  color: var(--green-dark);
  font-weight: 900;
}

.panel-text-card dd {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.65;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 40px auto 0;
  padding: 24px 0 42px;
  border-top: 1px solid var(--line);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(231, 111, 60, 0.28);
  }

  50% {
    transform: scale(1.25);
    box-shadow: 0 0 0 9px rgba(231, 111, 60, 0);
  }
}

@media (max-width: 920px) {
  .hero,
  .workspace,
  .editor-layout,
  .calibration-grid,
  .text-result-layout,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .steps,
  .analysis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .nav {
    align-items: flex-start;
  }

  .nav-links {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: 42px;
  }

  .hero-visual {
    min-height: 320px;
    padding: 18px;
  }

  .label-board {
    padding: 18px;
  }

  .label-grid {
    min-height: 180px;
  }

  .rule-strip {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .steps,
  .analysis,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .panel-header {
    display: block;
  }

  .button.small {
    margin-top: 12px;
  }
}
