@font-face { font-family: 'Oranienbaum'; src: url('/fonts/Oranienbaum-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }

:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --muted: #5c5c5c;
  --line: #d9d9d9;
  --soft: #f4f4f4;
  --error: #b00020;
  --ok: #0a0a0a;
  --radius: 10px;
  --tap: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: var(--ink);
  color: var(--paper);
}

.wordmark {
  font-family: 'Oranienbaum', 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: 0.025em;
  font-size: 26px;
  line-height: 1;
}

.lang { display: flex; border: 1px solid var(--paper); border-radius: 999px; overflow: hidden; }

.lang-btn {
  min-width: 52px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.lang-btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}

h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 8px; letter-spacing: -0.01em; }

.lead { margin: 0 0 20px; color: var(--muted); }

fieldset {
  border: 0;
  border-top: 2px solid var(--ink);
  margin: 0 0 24px;
  padding: 16px 0 0;
}

legend {
  padding: 0 8px 0 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field { margin: 0 0 20px; }

label, .label { display: block; font-weight: 650; margin: 0 0 6px; }

.req { color: var(--error); }
.opt { font-weight: 400; color: var(--muted); }

input[type="text"],
input[type="password"],
input[type="date"],
textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 17px; /* >= 16px stops iOS from zooming on focus */
  appearance: none;
  -webkit-appearance: none;
}

input[type="date"] { line-height: 1.2; }

textarea { resize: vertical; min-height: 110px; }

input:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-within {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.field.has-error input, .field.has-error textarea { border-color: var(--error); }

.hint { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.filepick .hint { margin: 0 0 10px; }
.counter { text-align: right; }

.field-error { margin: 6px 0 0; font-size: 15px; font-weight: 600; color: var(--error); }
.field-error:empty { display: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 750;
  font-size: 17px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--ink); color: var(--paper); border: 2px solid var(--ink); }
.btn-primary:active { background: #333; }
.btn-primary:disabled { background: #8a8a8a; border-color: #8a8a8a; cursor: wait; }
.btn-secondary { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); }
.btn-secondary:active { background: var(--soft); }

.btn-small {
  display: inline-flex;
  width: auto;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 15px;
}

.picked { list-style: none; margin: 10px 0 0; padding: 0; }

.picked li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 8px;
  background: var(--soft);
}

.picked .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.picked .size { color: var(--muted); font-size: 14px; white-space: nowrap; }

.remove-btn {
  min-width: 48px;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.total { font-weight: 650; margin: 0 0 12px; }

.banner { padding: 14px 16px; border-radius: var(--radius); margin: 0 0 16px; font-weight: 600; }
.banner-error { background: #fdecef; color: var(--error); border: 1.5px solid var(--error); }

.overall { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-weight: 650; }
.overall progress { flex: 1; }

progress {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}
progress::-webkit-progress-bar { background: #e6e6e6; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--ink); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--ink); border-radius: 999px; }

.upload-list, .done-list { list-style: none; margin: 0 0 20px; padding: 0; }

.upload-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 10px;
}

.upload-list .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.upload-list .name { font-weight: 600; overflow-wrap: anywhere; font-size: 15px; }
.upload-list .kind { color: var(--muted); font-size: 13px; }
.upload-list .status { font-size: 14px; white-space: nowrap; font-weight: 650; }
.upload-list progress { margin: 8px 0 0; }
.upload-list li.failed { border-color: var(--error); }
.upload-list li.failed .status { color: var(--error); }
.upload-list li.done .status { color: var(--ok); }
.upload-list .retry-btn { margin-top: 10px; }

.actions { display: grid; gap: 12px; }

.success-mark {
  width: 72px; height: 72px;
  margin: 12px 0 8px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-size: 40px; font-weight: 800;
}

.folder { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; margin: 0 0 12px; }

.done-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.done-list .kind { display: block; font-size: 13px; color: var(--muted); }
.done-list .name { font-weight: 600; }

[hidden] { display: none !important; }

.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px 0; list-style: none;
  background: #fff; color: #000; border: 1px solid #000; border-radius: 10px; max-height: 288px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.combo-list li { padding: 12px 14px; font-size: 16px; cursor: pointer; min-height: 44px; box-sizing: border-box; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: #000; color: #fff; }
.combo-list li.combo-empty { color: #666; cursor: default; background: none; }
.combo-list li mark { background: none; color: inherit; font-weight: 700; }
