:root {
  color-scheme: light;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-tint: #f7f8fc;
  --ink: #1b1d2b;
  --muted: #6d7180;
  --muted-2: #9297a6;
  --line: #eaebf2;
  --line-strong: #dcdee8;
  --accent: #0d9488;
  --accent-ink: #0f766e;
  --accent-tint: #e6f6f4;
  --success: #16a34a;
  --success-tint: #e7f8ee;
  --danger: #dc2626;
  --danger-tint: #fdecec;
  --shadow-card: 0 1px 2px rgba(27, 29, 43, .04), 0 16px 40px rgba(27, 29, 43, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.site-header {
  flex: none;
  width: min(1180px, calc(100% - 40px));
  margin: clamp(10px, 2vh, 20px) auto 0;
  padding: clamp(10px, 1.6vh, 14px) 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; min-width: 34px; height: 32px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: white; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700; }
.privacy-pill { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: var(--surface-tint); }
.privacy-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

main {
  flex: 1 1 auto;
  min-height: 0;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro { flex: none; padding: clamp(8px, 2vh, 18px) 0 clamp(6px, 1.2vh, 10px); display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-icon {
  display: inline-grid; place-items: center;
  min-width: clamp(30px, 4.4vh, 40px); height: clamp(26px, 4.4vh, 34px);
  padding: 0 7px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: clamp(12px, 1.7vh, 15px);
  box-shadow: 0 8px 18px rgba(13, 148, 136, .28);
}
h1 { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: clamp(24px, min(5vw, 5vh), 40px); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; color: var(--ink); }
.lede { margin: clamp(6px, 1.2vh, 12px) 0 0; max-width: 540px; color: var(--muted); font-size: clamp(13px, 1.7vh, 15px); line-height: 1.45; }

.workspace { flex: none; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-height: clamp(230px, 38vh, 380px); overflow: hidden; margin-top: clamp(8px, 2vh, 20px); box-shadow: var(--shadow-card); }
.drop-zone { min-height: clamp(230px, 38vh, 380px); margin: 12px; border: 1.5px dashed var(--line-strong); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: .2s ease; outline: none; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--accent); background: var(--accent-tint); transform: translateY(-1px); }
.drop-icon { display: grid; place-items: center; width: clamp(44px, 7vh, 64px); height: clamp(44px, 7vh, 64px); margin-bottom: clamp(10px, 1.8vh, 18px); border-radius: 50%; background: var(--accent-tint); color: var(--accent-ink); font-size: clamp(20px, 3.4vh, 30px); }
.drop-zone h2 { margin: 0 0 7px; font-size: clamp(18px, 2.8vh, 24px); font-weight: 700; color: var(--ink); }
.drop-zone p { margin: 0; color: var(--muted); }
.browse-link { color: var(--accent-ink); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.drop-zone .limit { margin-top: clamp(10px, 2vh, 22px); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }

.processing, .error-box { min-height: clamp(230px, 36vh, 360px); padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.processing-file { width: min(500px, 100%); display: flex; align-items: center; gap: 17px; }
.file-badge { display: grid; place-items: center; min-width: 58px; height: 64px; padding: 0 8px; border-radius: 10px; background: var(--accent); color: white; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; }
.processing-file div { display: flex; flex-direction: column; min-width: 0; }
.processing-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.processing-file div span { margin-top: 5px; color: var(--muted); font-size: 13px; }
.progress { width: min(500px, 100%); height: 4px; margin-top: 26px; overflow: hidden; background: var(--line); border-radius: 9px; }
.progress span { display: block; width: 45%; height: 100%; background: var(--accent); animation: progress 1.1s ease-in-out infinite alternate; }
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(225%); } }

.error-box { text-align: center; }
.error-box::before { content: "!"; display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 18px; border-radius: 50%; background: var(--danger-tint); color: var(--danger); font: 700 22px Inter, sans-serif; }
.error-box strong { font: 700 24px Inter, sans-serif; color: var(--ink); }
.error-box span { max-width: 500px; margin: 10px 0 24px; color: var(--muted); line-height: 1.5; }
.error-box button, .text-button { padding: 0; border: 0; background: none; color: var(--accent-ink); font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }

.result { padding: 28px 32px 30px; }
.result-toolbar, .result-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result-toolbar { margin-bottom: 26px; }
.result-file { display: flex; align-items: center; gap: 12px; min-width: 0; }
.result-file > div { display: flex; flex-direction: column; min-width: 0; }
.result-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-file span:not(.success-mark) { color: var(--muted); font-size: 12px; margin-top: 3px; }
.success-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--success-tint); color: var(--success); font-weight: 900; }
.editor-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#markdown-output { display: block; width: 100%; height: 330px; resize: vertical; padding: 22px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: var(--surface-tint); color: var(--ink); font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
#markdown-output:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.result-actions { padding-top: 20px; }
.result-actions > span { color: var(--muted); font-size: 13px; }
.result-actions > div { display: flex; gap: 10px; }
.primary-button, .secondary-button { min-height: 44px; padding: 0 20px; border-radius: 10px; font-weight: 750; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: white; }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.primary-button:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.secondary-button:hover { border-color: var(--muted-2); }

.details { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: clamp(10px, 2.6vh, 32px) 0 clamp(10px, 2.2vh, 28px); }
.details > div { padding: clamp(12px, 2vh, 22px) clamp(16px, 2vw, 26px); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-card); }
.details span { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-ink); font: 700 11px ui-monospace, monospace; letter-spacing: .04em; }
.details h3 { margin: clamp(8px, 1.4vh, 14px) 0 6px; font-size: clamp(15px, 2vh, 18px); font-weight: 700; color: var(--ink); }
.details p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

footer { flex: none; width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: clamp(10px, 1.8vh, 20px) 0 clamp(12px, 2.2vh, 26px); border-top: 1px solid var(--line-strong); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
footer p { margin: 0; } footer span:not(.link) { color: var(--muted-2); margin: 0 5px; } .formats { letter-spacing: .05em; }
footer .link { color: var(--accent-ink); font-weight: 700; }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .site-header { padding: 12px 16px; border-radius: 14px; }
  .privacy-pill { font-size: 10px; padding: 8px 10px; }
  .intro { padding: 32px 0 20px; }
  h1 { font-size: clamp(28px, 9vw, 44px); }
  .lede { font-size: 15px; }
  .workspace { border-radius: 16px; }
  .drop-zone { min-height: 320px; margin: 10px; }
  .result { padding: 20px 17px; }
  .result-toolbar, .result-actions { align-items: flex-start; }
  .result-actions { flex-direction: column; }
  .result-actions > div { width: 100%; }
  .result-actions button { flex: 1; }
  .details { grid-template-columns: 1fr; margin: 50px 0 65px; }
  footer { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
