:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5c6675;
  --accent: #2f6fed;
  --error: #c0392b;
  --success: #1e8e4e;
  --border: #d9dee6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f;
    --card: #1e242e;
    --text: #e8ecf2;
    --muted: #9aa4b2;
    --accent: #5b8cff;
    --error: #ff7b6b;
    --success: #4fc57f;
    --border: #313a47;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 2rem 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  max-width: 26rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}
.card-wide { max-width: 52rem; }
.icon { display: block; margin: 0 auto 1rem; }
h1 { font-size: 1.35rem; margin: 0 0 0.5rem; }
p { color: var(--muted); margin: 0 0 1.5rem; line-height: 1.5; }
a { color: var(--accent); }
form { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; align-items: center; }
input[type="file"] {
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
button {
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
.error { color: var(--error); font-weight: 600; margin: 1rem 0 0; }
#dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3.5rem 1.5rem;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.15s, background-color 0.15s;
}
#dropzone strong { color: var(--text); font-size: 1.05rem; }
#dropzone:hover, #dropzone:focus-visible, #dropzone.drag {
  border-color: var(--accent);
  background: rgba(47, 111, 237, 0.06);
  outline: none;
}
#dropzone.busy { cursor: progress; }
#dropzone p { margin: 0; line-height: 1.6; }
#progress { margin-top: 1.25rem; }
#progress-track {
  height: 10px;
  border-radius: 5px;
  background: var(--border);
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: var(--accent);
  transition: width 0.2s ease;
}
#progress-label { margin-top: 0.5rem; font-size: 0.85rem; }
.success { color: var(--success); margin: 1rem 0 0; }
button.copy, button.delete {
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
button.delete { color: var(--error); }
.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td { overflow-wrap: anywhere; }
td:nth-child(2), td:nth-child(3), td:nth-child(4), td:last-child { white-space: nowrap; }
.note { font-size: 0.9rem; margin-top: 1.5rem; }
footer { margin-top: 1.75rem; font-size: 0.75rem; color: var(--muted); }

/* topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: -1rem 0 1.5rem;
  font-size: 0.85rem;
}
.topbar .who { font-weight: 600; }
.topbar .actions { display: flex; gap: 1rem; flex-wrap: wrap; }
button.linklike {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
button.linklike:hover { text-decoration: underline; filter: none; }

/* upload options + badges */
.upload-opts {
  border: none;
  margin: 0.9rem 0 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.access-choice { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.access-choice label { font-size: 0.85rem; cursor: pointer; }
.access-choice .optdesc { color: var(--muted); }
.opt-toggle {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.opt-toggle:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.badge-public { color: var(--accent); border-color: var(--accent); }
.badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--muted);
  vertical-align: middle;
}

/* notice banner */
.notice { margin-top: 1rem; overflow-wrap: anywhere; }

/* tokens section */
#tokens { margin-top: 2rem; text-align: left; }
#tokens h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
#tokens .note { margin: 0 0 1rem; }
#tokens form { justify-content: flex-start; }
#tokens input[type="text"] {
  flex: 1 1 12rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
#tokens code { font-size: 0.8rem; }

/* mobile: stack table rows as cards so filenames get full width */
@media (max-width: 640px) {
  body { padding: 0.75rem; }
  .card { padding: 1.5rem 1rem; }
  .topbar { margin-top: 0; }
  .table-wrap { overflow-x: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.6rem;
    text-align: left;
  }
  td {
    padding: 0;
    border-bottom: none;
    white-space: normal !important;
  }
  td.file-name {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
    overflow-wrap: anywhere;
  }
  td:not(.file-name):not(.row-actions) {
    display: inline-block;
    width: auto;
    margin-right: 0.9rem;
    color: var(--muted);
    font-size: 0.78rem;
  }
  td[data-label]::before {
    content: attr(data-label) " ";
    opacity: 0.7;
  }
  td.row-actions { margin-top: 0.4rem; }
  td.row-actions:empty { display: none; margin: 0; }
}
