:root {
  --bg-deep: #0a0e14;
  --bg-card: #121922;
  --bg-elevated: #1a2332;
  --border: rgba(94, 234, 212, 0.12);
  --text: #e8eef5;
  --text-muted: #8b9cb3;
  --accent: #2dd4bf;
  --accent-dim: rgba(45, 212, 191, 0.15);
  --accent-glow: rgba(45, 212, 191, 0.35);
  --danger: #f87171;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(45, 212, 191, 0.14), transparent),
    radial-gradient(ellipse 60% 50% at 100% 50%, rgba(56, 189, 248, 0.06), transparent);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

.site-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(10, 14, 20, 0.75);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px var(--accent-glow);
}

.logo-mark svg {
  width: 20px;
  height: 20px;
  color: var(--bg-deep);
}

.header-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: right;
  max-width: 280px;
}

main {
  padding: 2.5rem 0 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2.75rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero p {
  margin: 0 auto;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.35rem;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card h2 .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.dropzone {
  display: block;
  width: 100%;
  position: relative;
  border: 2px dashed rgba(45, 212, 191, 0.35);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(26, 35, 50, 0.5);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 0;
}

.dropzone-title {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.25rem;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.dropzone-sub {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
  max-width: 22rem;
  margin-inline: auto;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.preview-wrap {
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  display: none;
  max-height: 200px;
  background: var(--bg-elevated);
}

.preview-wrap.is-visible {
  display: block;
}

.preview-wrap img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.row--split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 420px) {
  .row--split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }
}

.field {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.field label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.3;
  cursor: pointer;
}

select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  color: #042f2e;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(45, 212, 191, 0.4);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.15rem;
  align-items: center;
}

.actions--upload {
  margin-top: 0.85rem;
}

@media (max-width: 419px) {
  .actions--upload {
    flex-direction: column;
    align-items: stretch;
  }

  .actions--upload .btn {
    width: 100%;
    justify-content: center;
  }
}

.textarea {
  width: 100%;
  min-width: 0;
  min-height: 200px;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  resize: vertical;
}

.textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.msg {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: none;
}

.msg.is-error {
  display: block;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.msg.is-success {
  display: block;
  background: var(--accent-dim);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #99f6e4;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(4, 47, 46, 0.3);
  border-top-color: #042f2e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-primary.is-loading .spinner {
  display: inline-block;
}

.btn-primary.is-loading .btn-label {
  opacity: 0.9;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

@media (min-width: 640px) {
  .site-footer .wrap {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.hidden {
  display: none !important;
}

.preview-toolbar {
  padding: 0.5rem 0.65rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.preview-wrap:not(.is-visible) .preview-toolbar {
  display: none;
}

.translate-heading {
  margin: 1.35rem 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.textarea--translated {
  min-height: 160px;
  margin-top: 0.85rem;
}

.ocr-shell {
  position: relative;
}

.textarea.is-blurred {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
}

.scan-blur-cta {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.05) 0%, rgba(10, 14, 20, 0.92) 100%);
  border-radius: var(--radius-sm);
  z-index: 2;
}

.scan-blur-cta.is-on {
  display: flex;
}

.scan-blur-cta__btn {
  display: block;
  width: 100%;
  max-width: 20rem;
  text-align: center;
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #042f2e !important;
  text-decoration: none !important;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.scan-blur-cta__sub {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.scan-blur-cta__alt {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  text-align: center;
  max-width: 20rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.scan-blur-cta__alt a {
  color: var(--accent);
  font-weight: 700;
}

.site-footer--legal .wrap {
  align-items: stretch;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.legal-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
}

.legal-links a:hover {
  color: var(--accent);
}

.footer-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-note {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 42rem;
  margin-inline: auto;
}

.scan-lr {
  margin-top: 1.25rem;
  text-align: center;
}

.pv-dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff !important;
  text-decoration: none;
  background: linear-gradient(135deg, #5b2cff, #00c6ff);
  box-shadow: 0 6px 20px rgba(0, 140, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.pv-dl-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 140, 255, 0.35);
}

.pv-dl-sub {
  display: block;
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 719px) {
  select {
    font-size: 16px;
  }
}
