:root {
  color-scheme: light;
  --ink: #14221f;
  --muted: #60706b;
  --paper: #f8f8f3;
  --panel: #ffffff;
  --line: #dce5df;
  --accent: #1f8069;
  --accent-dark: #155a4b;
  --soft-accent: #e5f3ec;
  --danger: #a64235;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf7f1;
  --muted: #a7b8b0;
  --paper: #101815;
  --panel: #18231f;
  --line: #30423a;
  --accent: #6bd0ad;
  --accent-dark: #9ae4c5;
  --soft-accent: #1d3b31;
  --danger: #ff9f91;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: radial-gradient(circle at top right, #eaf5ed 0, transparent 34rem), var(--paper);
}

.shell { width: min(780px, calc(100% - 32px)); margin: 0 auto; padding: 64px 0 32px; }
.hero { margin-bottom: 28px; }
.hero-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 620px; margin-bottom: 14px; font-size: clamp(2.2rem, 7vw, 4.3rem); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: 1.2rem; letter-spacing: -.02em; }
.lede { max-width: 540px; margin-bottom: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

.panel { margin-top: 18px; padding: clamp(20px, 4vw, 32px); border: 1px solid var(--line); border-radius: 24px; background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: 0 18px 55px rgba(20, 48, 38, .07); }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.hint { color: var(--muted); font-size: .82rem; }
.theme-toggle { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: inherit; font-size: .78rem; font-weight: 750; cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.dropzone { position: relative; display: grid; min-height: 230px; place-items: center; align-content: center; gap: 8px; overflow: hidden; padding: 24px; border: 1.5px dashed #a9c6b8; border-radius: 18px; background: var(--soft-accent); text-align: center; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: #dff0e8; transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--panel); color: var(--accent); font-size: 1.7rem; box-shadow: 0 5px 16px rgba(31, 128, 105, .13); }
.drop-title { font-weight: 750; }
.drop-subtitle { color: var(--muted); font-size: .9rem; }
.dropzone img { width: min(100%, 360px); max-height: 180px; object-fit: contain; border-radius: 12px; }
.source-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.source-button { min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 750; cursor: pointer; touch-action: manipulation; }
.source-button:hover { border-color: var(--accent); color: var(--accent); }
.primary-button, .secondary-button { min-height: 46px; border: 0; border-radius: 11px; font: inherit; font-weight: 750; cursor: pointer; touch-action: manipulation; transition: transform .15s, background .15s, opacity .15s; }
.primary-button { width: 100%; margin-top: 14px; padding: 14px 18px; background: var(--accent); color: white; }
.primary-button.compact { width: auto; min-height: 40px; margin-top: 0; padding: 9px 12px; font-size: .84rem; }
.primary-button:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.secondary-button { padding: 9px 12px; background: var(--soft-accent); color: var(--accent-dark); font-size: .84rem; }
.secondary-button:hover { background: #d5ece1; }
.status { min-height: 1.4em; margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.status.error { color: var(--danger); }

.result-panel { animation: rise .3s ease-out; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.contact-field { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--panel) 88%, var(--soft-accent)); }
.contact-field.full { grid-column: 1 / -1; }
.contact-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .74rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.contact-value { overflow-wrap: anywhere; white-space: pre-wrap; }
details { margin-top: 16px; color: var(--muted); font-size: .9rem; }
summary { cursor: pointer; font-weight: 700; }
pre { max-height: 300px; overflow: auto; padding: 14px; border-radius: 12px; background: #14221f; color: #dff3e8; font-size: .78rem; line-height: 1.5; }
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; color: var(--muted); font-size: .82rem; }
footer a { color: var(--accent-dark); font-weight: 750; text-decoration: none; }
footer a:hover { text-decoration: underline; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 780px); padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .hero { margin-bottom: 20px; }
  h1 { font-size: clamp(2rem, 12vw, 3.2rem); }
  .lede { font-size: .98rem; }
  .panel { padding: 18px; border-radius: 18px; }
  .panel-heading, footer { align-items: flex-start; flex-direction: column; }
  .result-actions { width: 100%; justify-content: stretch; }
  .result-actions button { flex: 1 1 140px; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-field.full { grid-column: auto; }
  .dropzone { min-height: 200px; padding: 18px; }
  .source-actions { grid-template-columns: 1fr; }
  footer { gap: 8px; }
}
