:root {
  color-scheme: light;
  --canvas: #f3f4ef;
  --paper: #ffffff;
  --ink: #1c211f;
  --muted: #68706b;
  --line: #ced3cc;
  --line-dark: #aeb5ad;
  --forest: #285b45;
  --forest-dark: #1d4936;
  --forest-pale: #e7efe9;
  --clay: #c65d43;
  --clay-pale: #f7ebe7;
  --danger: #a1372e;
  --focus: #986b25;
  font-family: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(28, 33, 31, 0.028) 1px, transparent 1px),
    var(--canvas);
  background-size: 100% 24px;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent);
  outline-offset: 3px;
}

.site-header {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
}

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

.brand svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.header-note { color: var(--muted); font-size: 13px; }

main { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }

.intro { padding: 72px 0 36px; border-bottom: 1px solid var(--line); }
.intro h1 { margin: 0; font-size: clamp(36px, 6vw, 68px); line-height: 0.98; letter-spacing: -0.055em; font-weight: 650; }
.intro p { margin: 18px 0 0; color: var(--muted); font-size: 18px; line-height: 1.55; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.85fr); }
.upload-panel, .viewer-panel, .download-panel { padding: 40px 0 64px; }
.upload-panel, .viewer-panel { padding-right: 56px; }
.download-panel { padding-left: 48px; border-left: 1px solid var(--line); }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -0.025em; }
.section-heading span { color: var(--muted); font-size: 13px; }

.drop-zone {
  min-height: 276px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  border: 1.5px dashed var(--line-dark);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
  cursor: pointer;
}

.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--forest); background: var(--forest-pale); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone svg { width: 52px; margin-bottom: 10px; fill: none; stroke: var(--forest); stroke-width: 1.5; }
.drop-zone strong { font-size: 17px; }
.drop-zone span { color: var(--muted); font-size: 14px; }

.file-card { align-items: center; gap: 14px; min-height: 82px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.file-card:not([hidden]) { display: flex; }
.file-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid #b8c9be; border-radius: 6px; background: var(--forest-pale); }
.file-icon svg, .download-file svg { width: 22px; fill: none; stroke: var(--forest); stroke-width: 1.7; }
.file-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.file-copy strong, .download-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-copy span, .download-file span { color: var(--muted); font-size: 13px; }

.text-button { padding: 6px; border: 0; background: transparent; color: var(--forest); font-weight: 650; font-size: 13px; }
.text-button:hover { color: var(--forest-dark); text-decoration: underline; }

.resume-notice, .form-error { margin-top: 14px; padding: 11px 13px; border: 1px solid #e0bbb2; border-radius: 6px; background: var(--clay-pale); color: #71372a; font-size: 13px; line-height: 1.45; }
.resume-notice { border-color: #b8c9be; background: var(--forest-pale); color: var(--forest-dark); }

.actions { display: flex; gap: 10px; margin-top: 18px; }
.primary-button, .secondary-button, .dark-button, .copy-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 7px;
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.primary-button { border: 1px solid var(--forest); background: var(--forest); color: white; }
.primary-button:hover:not(:disabled) { border-color: var(--forest-dark); background: var(--forest-dark); }
.primary-button:disabled { border-color: #c2c7c1; background: #c2c7c1; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line-dark); background: var(--paper); color: var(--ink); }
.secondary-button:hover { border-color: var(--ink); }
.dark-button { width: 100%; border: 1px solid var(--ink); background: var(--ink); color: white; }
.dark-button:hover { background: #343b37; }
.copy-button { border: 1px solid var(--forest); background: var(--forest-pale); color: var(--forest-dark); white-space: nowrap; }
.copy-button:hover { background: #d5e3d9; }

.upload-progress { margin-top: 22px; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 14px; }
.progress-copy span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tape-track { position: relative; height: 28px; overflow: hidden; border: 1px solid var(--line-dark); border-radius: 4px; background: #e2e4df; }
.tape-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--forest); transition: width 180ms linear; }
.tape-marks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 21px, rgba(255,255,255,.62) 21px 23px); }
.upload-progress p { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.upload-result { padding: 12px 0 0; }
.result-check { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 22px; border-radius: 50%; background: var(--forest-pale); }
.result-check svg { width: 25px; fill: none; stroke: var(--forest); stroke-width: 2; }
.upload-result h2 { font-size: 28px; }
.upload-result > p { margin: 8px 0 22px; color: var(--muted); }
.share-code-row { display: flex; gap: 10px; }
.share-code-row output { min-width: 0; flex: 1; padding: 13px 15px; border: 1px solid var(--line-dark); border-radius: 7px; background: var(--paper); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: clamp(20px, 4vw, 28px); font-weight: 700; letter-spacing: .08em; text-align: center; }
.full-width { width: 100%; margin-top: 10px; }
.start-over { display: block; margin: 14px auto 0; }

.download-panel > p { margin: 8px 0 28px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.download-panel label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.download-panel input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line-dark); border-radius: 7px; background: var(--paper); color: var(--ink); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 17px; letter-spacing: .06em; text-transform: uppercase; }
.download-panel form .dark-button { margin-top: 10px; }
.video-preview video { display: block; width: 100%; max-height: min(60vh, 480px); border-radius: 10px; background: #000; }
.video-unsupported { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line-dark); border-radius: 7px; background: var(--paper); color: var(--muted); font-size: 13px; line-height: 1.5; }
.viewer-panel .download-file { margin: 18px 0 14px; }
.download-file { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.download-file > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.download-file svg { flex: 0 0 auto; }
.privacy-note { display: flex; gap: 10px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); }
.privacy-note svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; }
.privacy-note p { margin: 0; font-size: 12px; line-height: 1.5; }
.privacy-note strong { color: var(--ink); }

footer { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 22px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

[hidden] { display: none !important; }

@media (max-width: 780px) {
  .site-header { height: 64px; padding: 0 20px; }
  .header-note { display: none; }
  main, footer { width: min(100% - 32px, 620px); }
  .intro { padding: 48px 0 28px; }
  .intro h1 { font-size: 44px; }
  .intro p { max-width: 34ch; font-size: 16px; }
  .workspace { display: block; }
  .upload-panel, .viewer-panel { padding: 32px 0 44px; }
  .download-panel { padding: 36px 0 48px; border-top: 1px solid var(--line); border-left: 0; }
  .drop-zone { min-height: 220px; }
}

@media (max-width: 430px) {
  .intro h1 { font-size: 40px; }
  .drop-zone { padding: 24px 18px; }
  .file-card { padding: 12px; }
  .actions, .share-code-row { flex-direction: column; }
  .actions > button { width: 100%; }
  .copy-button { width: 100%; }
}

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