:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #dfe4ec;
  --soft: #f3f6fa;
  --paper: #ffffff;
  --blue: #0b63f6;
  --blue-dark: #0752cd;
  --blue-soft: #eaf2ff;
  --danger: #c73535;
  --success: #1c9b61;
  --shadow: 0 24px 70px rgba(24, 39, 75, 0.09);
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 2%, rgba(11, 99, 246, 0.1), transparent 29rem),
    linear-gradient(180deg, #f9fbfe 0%, #f4f7fb 100%);
}

button,
input,
select {
  font: inherit;
}

button,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(100% - 32px, 760px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 10px;
  background: var(--blue);
}

.brand-mark i {
  width: 2px;
  border-radius: 999px;
  background: white;
}

.brand-mark i:nth-child(1),
.brand-mark i:nth-child(5) { height: 7px; }
.brand-mark i:nth-child(2),
.brand-mark i:nth-child(4) { height: 13px; }
.brand-mark i:nth-child(3) { height: 19px; }

.icon-button {
  width: 42px;
  height: 42px;
  padding: 10px;
  display: grid;
  place-items: center;
  color: #4a5568;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--blue);
  border-color: #a9c7fa;
  background: white;
}

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

main {
  flex: 1;
  padding: 42px 0 56px;
}

.intro {
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

h1 span {
  color: var(--blue);
}

.intro > p:last-child {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.workspace,
.result-panel {
  padding: 28px;
  border: 1px solid rgba(214, 222, 233, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.drop-zone {
  min-height: 228px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed #b9c4d4;
  border-radius: 18px;
  background: #fbfcfe;
  cursor: pointer;
  transition: 150ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: #91b8f8;
  background: var(--blue-soft);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  padding: 12px;
  color: var(--blue);
  border-radius: 15px;
  background: var(--blue-soft);
}

.drop-zone strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-zone > span:nth-of-type(2) {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.choose-file {
  margin-top: 18px;
  padding: 9px 15px;
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 9px;
  background: var(--blue-soft);
}

.options-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span:first-child {
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 49px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: var(--paper);
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 99, 246, 0.12);
}

.check-row {
  margin: 21px 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
}

.check-row input {
  position: absolute;
  opacity: 0;
}

.check-box {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid #aeb9c8;
  border-radius: 6px;
  background: white;
}

.check-row input:checked + .check-box {
  border-color: var(--blue);
  background: var(--blue);
}

.check-row input:checked + .check-box::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg);
}

.check-row input:focus-visible + .check-box {
  box-shadow: 0 0 0 3px rgba(11, 99, 246, 0.18);
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row strong {
  font-size: 0.9rem;
}

.check-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.primary-button {
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  font-weight: 800;
  border: 0;
  border-radius: 13px;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(11, 99, 246, 0.22);
  cursor: pointer;
  transition: 150ms ease;
}

.progress-panel {
  margin: 3px 0 20px;
  padding: 16px;
  border: 1px solid #cfddf2;
  border-radius: 13px;
  background: #f7faff;
}

.progress-copy {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.88rem;
  font-weight: 700;
}

.progress-copy strong {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce7f6;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b63f6, #4a91ff);
  transition: width 320ms ease;
}

.progress-panel small {
  margin-top: 9px;
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.progress-panel.is-error .progress-track span {
  background: var(--danger);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.primary-button svg {
  width: 20px;
}

.status {
  min-height: 21px;
  margin: 12px 0 -4px;
  color: var(--muted);
  font-size: 0.87rem;
  text-align: center;
}

.status.is-error,
.settings-error {
  color: var(--danger);
}

.result-panel {
  margin-top: 24px;
}

.result-heading,
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.result-heading h2,
.dialog-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.secondary-button {
  min-height: 38px;
  padding: 0 13px;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  cursor: pointer;
}

.secondary-button:hover {
  color: var(--blue);
  border-color: #a9c7fa;
}

#result-content {
  max-height: 420px;
  margin: 22px 0 0;
  padding: 20px;
  overflow: auto;
  color: #263244;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 13px;
  background: var(--soft);
}

footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a8b0bc;
}

.connection-dot.is-ready {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(28, 155, 97, 0.12);
}

dialog {
  width: min(calc(100% - 32px), 500px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(17, 24, 39, 0.28);
}

dialog::backdrop {
  background: rgba(20, 29, 43, 0.48);
  backdrop-filter: blur(4px);
}

.settings-card {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.dialog-description {
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 66px;
}

.password-field button {
  position: absolute;
  top: 6px;
  right: 7px;
  height: 37px;
  padding: 0 10px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 700;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.settings-error {
  min-height: 18px;
  margin: -6px 0;
  font-size: 0.84rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 22px, 760px);
  }

  .topbar {
    height: 70px;
  }

  main {
    padding-top: 28px;
  }

  .intro {
    margin-bottom: 26px;
  }

  .intro > p:last-child br {
    display: none;
  }

  .workspace,
  .result-panel {
    padding: 18px;
    border-radius: 19px;
  }

  .drop-zone {
    min-height: 205px;
    padding: 20px 14px;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .result-heading {
    align-items: center;
  }
}

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