:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --zoomist-slider-bg-color: rgba(248, 250, 252, 0.95);
  --zoomist-slider-track-color: rgba(15, 23, 42, 0.15);
  --zoomist-slider-track-color-hover: rgba(15, 23, 42, 0.25);
  --zoomist-slider-button-color: rgba(15, 23, 42, 0.7);
  --zoomist-zoomer-button-color: rgba(248, 250, 252, 0.95);
  --zoomist-zoomer-button-color-hover: rgba(255, 255, 255, 1);
  --zoomist-zoomer-button-color-disabled: rgba(148, 163, 184, 0.35);
  --zoomist-zoomer-icon-color: rgba(15, 23, 42, 0.75);
  --zoomist-zoomer-icon-color-hover: rgba(15, 23, 42, 0.95);
  --zoomist-zoomer-icon-color-disabled: rgba(148, 163, 184, 0.7);
}

@media (prefers-color-scheme: dark) {
  body {
    --zoomist-slider-bg-color: rgba(15, 23, 42, 0.88);
    --zoomist-slider-track-color: rgba(255, 255, 255, 0.18);
    --zoomist-slider-track-color-hover: rgba(255, 255, 255, 0.32);
    --zoomist-slider-button-color: rgba(255, 255, 255, 0.9);
    --zoomist-zoomer-button-color: rgba(15, 23, 42, 0.92);
    --zoomist-zoomer-button-color-hover: rgba(15, 23, 42, 0.98);
    --zoomist-zoomer-button-color-disabled: rgba(148, 163, 184, 0.4);
    --zoomist-zoomer-icon-color: rgba(255, 255, 255, 0.92);
    --zoomist-zoomer-icon-color-hover: white;
    --zoomist-zoomer-icon-color-disabled: rgba(148, 163, 184, 0.65);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, #e0e7ff, #bae6fd);
  padding: clamp(1.25rem, 5vw, 3rem);
  color: #0f172a;
}

main,
.top-bar,
.sale-bar {
  width: min(880px, 100%);
}

.sale-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #fb7185);
  color: white;
  font-weight: 600;
  font-size: 1.05rem;
  text-align: center;
  box-shadow: 0 12px 30px rgba(249, 115, 22, 0.25);
}

.sale-bar a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-weight: 700;
}

.sale-bar-link {
  white-space: nowrap;
}

.sale-bar a:hover,
.sale-bar a:focus-visible {
  text-decoration-thickness: 3px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.session-hint {
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.7);
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.doc-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 32px;
  padding: clamp(2rem, 5vw, 3.25rem);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 4vw, 2.5rem);
}

.card-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
}

.card-header p {
  margin: 0.5rem 0 0;
  color: rgba(15, 23, 42, 0.65);
  font-size: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: white;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
}

.btn.primary:hover,
.btn.primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(14, 165, 233, 0.35);
}

.btn.secondary {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

.btn.secondary:hover,
.btn.secondary:focus-visible {
  background: rgba(15, 23, 42, 0.12);
}

.btn.disabled {
  background: rgba(100, 116, 139, 0.25);
  color: rgba(15, 23, 42, 0.5);
  cursor: not-allowed;
  box-shadow: none;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 1.75rem);
}

.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.language-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.8);
}

.language-options {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

.language-option-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.language-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.7);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.language-option:hover {
  background: rgba(14, 165, 233, 0.12);
}

.language-option-input:checked + .language-option {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: white;
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.25);
}

.language-option-input:focus-visible + .language-option {
  outline: 3px solid rgba(14, 165, 233, 0.35);
  outline-offset: 2px;
}

.drop-area {
  border-radius: 24px;
  border: 3px dashed rgba(14, 165, 233, 0.6);
  background: rgba(240, 249, 255, 0.8);
  padding: clamp(2.5rem, 6vw, 3.5rem);
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
  outline: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.drop-area .label {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 600;
}

.drop-area .hint {
  margin: 0;
  color: rgba(15, 23, 42, 0.7);
  font-size: 1rem;
}

.drop-area .status {
  margin: 0;
  color: rgba(14, 165, 233, 0.9);
  font-size: 0.95rem;
}

.drop-area:hover,
.drop-area:focus-visible {
  border-color: #0ea5e9;
  background: rgba(224, 242, 254, 0.92);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(14, 165, 233, 0.2);
}

.drop-area.dragover {
  border-color: #0284c7;
  background: rgba(191, 219, 254, 0.95);
}

.drop-area.loading {
  border-style: solid;
  border-color: #a855f7;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(14, 165, 233, 0.18));
}

.results-box {
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.92);
  padding: clamp(1.5rem, 4vw, 1.85rem);
  color: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.results-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.results-box h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.copy-button {
  appearance: none;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.6);
  color: #e2e8f0;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease,
    box-shadow 0.18s ease;
}

.copy-button:hover,
.copy-button:focus-visible {
  background: rgba(59, 130, 246, 0.25);
  color: #f8fafc;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.copy-button:focus-visible {
  outline: none;
}

.copy-button:disabled,
.copy-button[aria-disabled='true'] {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.3);
  color: rgba(148, 163, 184, 0.6);
  cursor: not-allowed;
  box-shadow: none;
}

.copy-feedback {
  font-size: 0.75rem;
  color: rgba(148, 197, 253, 0.9);
}

.copy-feedback.error {
  color: rgba(252, 165, 165, 0.9);
}

.preview-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.preview-wrapper h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.85);
}

.labeled-result {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  align-items: stretch;
}

.labeled-result figcaption {
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.65);
}

.zoomist-container {
  width: 100%;
  max-height: clamp(240px, 55vh, 560px);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.32);
  position: relative;
}

.zoomist-container .zoomist-wrapper {
  width: 100%;
  height: 100%;
}

.zoomist-container .zoomist-image {
  width: 100%;
  height: 100%;
}

.zoomist-container img {
  display: block;
  width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

pre#ocr-result {
  margin: 0;
  max-height: 45vh;
  overflow: auto;
  background: transparent;
  color: inherit;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

noscript {
  display: block;
  margin-top: 1rem;
  text-align: center;
  color: #b91c1c;
  font-weight: 600;
}

@media (max-width: 720px) {
  body {
    gap: 1.25rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    border-radius: 24px;
  }

  .actions {
    justify-content: flex-end;
  }

  .doc-links {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .card {
    padding: 1.75rem;
    border-radius: 24px;
  }

  .drop-area {
    padding: 2.25rem 1.75rem;
  }
}
