:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --ok: #059669;
  --okbg: #ecfdf5;
  --warn: #b45309;
  --fail: #dc2626;
  --failbg: #fef2f2;
  --shadow: 0 1px 2px rgba(2,6,23,.04), 0 10px 30px rgba(2,6,23,.07);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17; --card: #131926; --ink: #e8ecf3; --muted: #93a1b5;
    --line: #232c3b; --accent: #5b8cff; --ok: #34d399; --okbg: #0e2620;
    --warn: #f0a83a; --fail: #ff6b60; --failbg: #2a1414;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.6rem); }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

h1 { font-size: 1.4rem; font-weight: 650; margin: 0 0 .2rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 620; margin: 0 0 .8rem; }
.sub { color: var(--muted); margin: 0 0 1.4rem; }
.muted { color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(1.1rem, 3vw, 1.6rem);
}
.card + .card { margin-top: 1.2rem; }
.stack > * + * { margin-top: 1rem; }

label.field { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
input, textarea, select {
  width: 100%; font: inherit; font-size: .95rem; padding: .6rem .7rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
textarea { resize: vertical; min-height: 3rem; }
button, a, input, textarea, select { touch-action: manipulation; }
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px; }
}
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.hint { font-size: .78rem; color: var(--muted); margin: .3rem 0 0; }

button, .btn {
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: .58rem .95rem; border-radius: 10px; transition: transform .06s, background .15s, border-color .15s;
}
button:hover, .btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
button:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
button:disabled { opacity: .55; cursor: default; }
button.mini, .btn.mini { font-size: .8rem; padding: .34rem .6rem; }
/* .btn on an <a>: the file-list Download link is an anchor, not a button. */
a.btn { display: inline-block; text-decoration: none; color: var(--ink); }
.danger { color: var(--fail); }
button.danger { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 30%, var(--line)); }
button.danger:hover { background: color-mix(in srgb, var(--fail) 10%, transparent); border-color: var(--fail); }

/* confirm dialog */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(2,6,23,.5); padding: 1rem; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.dialog {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); width: 100%; max-width: 400px; padding: 1.3rem;
}
.dialog h2 { margin: 0; }
.dialog .check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; cursor: pointer; }
.dialog .check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.dialog .check .muted { font-size: .8rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }

.msg { margin-top: 1rem; padding: .7rem .85rem; border-radius: 10px; font-size: .9rem; }
.msg.ok { background: var(--okbg); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line)); }
.msg.err { background: var(--failbg); color: var(--fail); border: 1px solid color-mix(in srgb, var(--fail) 30%, var(--line)); }

/* request list */
.reqs { display: flex; flex-direction: column; gap: .8rem; }
.req { border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; }
.req .top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.req .name { font-weight: 620; }
.req .pill {
  font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em;
  padding: .12rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.cover-thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.cover-hero { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; }
.req .pill.open { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.req .pill.expired, .req .pill.closed { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 30%, var(--line)); }
.req .lock { font-size: .8rem; }
.req .meta { color: var(--muted); font-size: .8rem; margin-top: .35rem; display: flex; gap: .9rem; flex-wrap: wrap; }
.req .meta a { color: inherit; text-decoration: none; }
.req .meta a:hover { color: var(--ink); text-decoration: underline; }
.req .link {
  margin-top: .55rem; display: flex; gap: .5rem; align-items: center;
}
.req .link code {
  font-family: var(--mono); font-size: .78rem; background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid var(--line); border-radius: 8px; padding: .3rem .5rem; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.req .tools { margin-top: .6rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.files { margin-top: .7rem; border-top: 1px solid var(--line); padding-top: .6rem; display: none; }
.req.expanded .files { display: block; }
.file { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; font-size: .85rem; }
.file .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fsize { color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: .85rem; padding: .3rem 0; }

/* upload progress bar */
.bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 1rem; display: none; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.footer { margin-top: 1.4rem; color: var(--muted); font-size: .78rem; text-align: center; }

/* get.mattia.ninja card */
.pill-get {
  font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em;
  padding: .12rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.pill-get.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
#get a { color: inherit; }

/* the create form's short link */
.check-inline { display: flex; align-items: center; gap: .5rem; font-size: .88rem; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check-inline .muted { font-size: .8rem; }
.short-row { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.short-row .muted { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.short-row[hidden] { display: none; }
