:root {
  --bg: #f4f4f8;
  --card: #fff;
  --fg: #15141a;
  --muted: #5b5b66;
  --line: #e0e0e6;
  --soft: #f0f4ff;
  --accent: #0061e0;
  --accent-hover: #0250bb;
  --accent-fg: #fff;
  --danger: #c50042;
  --ok: #017a40;
  --shadow: 0 1px 2px rgb(21 20 26 / 6%), 0 8px 24px rgb(21 20 26 / 8%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b22;
    --card: #2b2a33;
    --fg: #fbfbfe;
    --muted: #bfbfc9;
    --line: #4a4a55;
    --soft: #23304d;
    --accent: #00ddff;
    --accent-hover: #80ebff;
    --accent-fg: #15141a;
    --danger: #ff848b;
    --ok: #54ffbd;
    --shadow: 0 8px 24px rgb(0 0 0 / 35%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
}

/* ------------------------------------------------------------ frame */

.top { padding: 18px 24px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.knock { stroke: var(--card); }

.layout {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  display: grid;
  gap: 20px;
  align-items: start;
}
@media (min-width: 900px) {
  .layout:not(.single):has(#history:not([hidden])) { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
.layout.single { max-width: 560px; }

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}
@media (max-width: 520px) { .card { padding: 20px; } }

footer { padding: 16px; text-align: center; color: var(--muted); font-size: .85rem; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.langs button { padding: 2px 4px; border: 0; color: var(--muted); font-weight: 500; font-size: .85rem; }
.langs button[aria-pressed=true] { color: var(--fg); font-weight: 700; }

h1 { margin: 0 0 6px; font-size: 1.5rem; line-height: 1.25; }
h2 { margin: 0 0 12px; font-size: 1.1rem; }
p { margin: 0 0 12px; }
.sub { color: var(--muted); }
.small, small { font-size: .85rem; }
.center { display: flex; flex-direction: column; align-items: center; text-align: center; }
.name { font-weight: 600; overflow-wrap: anywhere; margin: 8px 0 4px; }
.error { color: var(--danger); }
.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--fg);
  font-size: .95rem;
}
.notice p { margin: 0 0 6px; }

/* ------------------------------------------------------------ controls */

button {
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary-outline { color: var(--accent); border-color: var(--accent); }
button.danger { color: var(--danger); }
button.big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 8px; }
button.icon { padding: 6px 10px; border-color: transparent; color: var(--muted); }
button.icon:hover { color: var(--danger); border-color: transparent; }
button.link { padding: 0; border: 0; color: var(--accent); font-weight: 500; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input:not([type=checkbox]):not([type=radio]):not([type=file]), select {
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]) { width: 100%; }
select { padding: 6px 8px; font-weight: 600; }

/* ------------------------------------------------------------ upload form */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 20px 0 16px;
  padding: 36px 16px;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop svg { width: 48px; height: 48px; color: var(--accent); margin-bottom: 4px; }
.drop strong { font-size: 1.1rem; }
.drop .pick { color: var(--accent); font-weight: 600; text-decoration: underline; }
.drop small { color: var(--muted); margin-top: 6px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--soft); }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.file-row svg { flex: none; width: 28px; height: 28px; color: var(--accent); }
.file-row div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-row strong { overflow-wrap: anywhere; }
.file-row small { color: var(--muted); }

.options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 10px; }
.check input[type=checkbox], .check input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
#password-row { margin-bottom: 12px; }

/* ------------------------------------------------------------ progress */

.ring { position: relative; width: 140px; height: 140px; margin: 8px 0 12px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--line); }
.ring .value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .15s linear; }
.ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
}
#progress button { margin: 8px 0 16px; }

/* ------------------------------------------------------------ share */

.badge { width: 56px; height: 56px; color: var(--ok); margin-bottom: 12px; }
.badge.file, #locked-file .badge { color: var(--accent); }
.badge.muted { color: var(--muted); }
.link-row { display: flex; gap: 8px; width: 100%; margin: 16px 0 8px; }
.link-row input { flex: 1; min-width: 0; }
.link-row button { flex: none; }
@media (max-width: 520px) {
  .link-row { flex-direction: column; }
}
.qr { display: flex; justify-content: center; margin: 8px 0 16px; }
.qr svg { width: 200px; height: 200px; border-radius: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .primary-outline { margin-left: auto; }
@media (max-width: 520px) { .actions button { flex: 1 1 auto; } .actions .primary-outline { margin-left: 0; } }

/* ------------------------------------------------------------ my uploads */

#uploads, .rows { list-style: none; margin: 0 0 8px; padding: 0; }
.upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.upload:last-child { border-bottom: 0; }
.u-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.u-main strong { overflow-wrap: anywhere; }
.u-main small { color: var(--muted); }
.u-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.u-actions button:not(.icon) { padding: 6px 10px; font-size: .85rem; }

/* ------------------------------------------------------------ admin */

.tag { font-size: .75rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.layout.admin { max-width: 760px; }
.stack { display: grid; gap: 20px; }
h3 { margin: 16px 0 4px; font-size: 1rem; }
.form-grid { display: grid; gap: 14px; }
.form-grid > label > span:first-child, legend { display: block; font-weight: 600; margin-bottom: 6px; }
.form-grid .inline { display: flex; gap: 8px; }
.form-grid .inline input { max-width: 140px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
fieldset .check { margin: 0; }
input.narrow { width: 90px !important; }
.form-grid button { justify-self: start; }
#created { margin-top: 16px; }
.stats { margin: 0 0 8px; padding-left: 18px; color: var(--muted); }
.stats li { margin: 2px 0; }
