:root {
  color-scheme: light dark;
  /* One source of truth per token via light-dark(); the element's used
     color-scheme (inherited `light dark` here) picks the value. */
  --bg: light-dark(#f4f4f2, #10100f);
  --card: light-dark(#ffffff, #181816);
  --ink: light-dark(#1c1c1a, #f1f1ed);
  --accent: light-dark(#2563eb, #6ea8ff);
  --accent-dark: light-dark(#1d4ed8, #93c0ff);
  --muted: light-dark(#6b6b63, #a7a79c);
  --stroke: light-dark(#d7d7d2, #2a2a27);
  /* light-dark() only takes colors, so the shadow geometry is shared
     (was 12px offset in dark — an imperceptible 2px change). */
  --shadow: 0 10px 30px light-dark(rgba(28, 28, 26, 0.08), rgba(0, 0, 0, 0.4));
  --code-bg: light-dark(#1a1a19, #0b0b0a);
  --code-ink: light-dark(#f2f2ef, #f1f1ed);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

.shell > * {
  width: 100%;
}

.hero {
  text-align: center;
}

.hero h1 {
  font-size: 56px;
  margin: 0 0 12px;
  letter-spacing: -1px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.card form {
  text-align: left;
}

.drop {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--stroke);
  border-radius: 20px;
  padding: 32px;
  cursor: pointer;
  background: transparent;
  text-align: center;
}

.drop input {
  display: none;
}

.drop.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--card), var(--accent) 6%);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.token-row {
  grid-template-columns: 1fr;
}

#upload-form[data-auth-required="false"] .token-row {
  display: none;
}

.mode-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  width: fit-content;
}

.mode-tab {
  margin-top: 0;
  padding: 6px 18px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.mode-tab[aria-selected="true"] {
  background: var(--accent);
  color: #ffffff;
}

.mode-tab:hover {
  background: color-mix(in srgb, var(--card), var(--accent) 10%);
  color: var(--ink);
}

.mode-tab[aria-selected="true"]:hover {
  background: var(--accent-dark);
  color: #ffffff;
}

.text-row {
  margin-top: 0;
}

#text-input {
  width: 100%;
  resize: vertical;
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
}

#upload-form[data-mode="file"] .text-row {
  display: none;
}

#upload-form[data-mode="text"] .drop {
  display: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input,
select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  color: var(--ink);
}

button,
.primary {
  margin-top: 18px;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.primary:hover {
  background: var(--accent-dark);
  color: #ffffff;
}

.result {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--stroke);
}

.result.hidden,
.hidden {
  display: none;
}

.result a {
  color: var(--accent-dark);
  font-weight: 600;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
  align-items: center;
}

/* Both actions share the same secondary/outline style and one baseline:
   reset the default button top margin and give the anchor matching button
   geometry so the row stays aligned. */
.result-actions a,
.result-actions button {
  margin-top: 0;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--ink);
}

.result-actions a:hover,
.result-actions button:hover {
  background: var(--card);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.link-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.link-row input {
  flex: 1;
}

.link-row button {
  margin-top: 0;
  white-space: nowrap;
}

.row-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  min-width: 64px;
  text-align: right;
}

.hash-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.notes {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 20px;
  text-align: center;
}

.notes > div {
  width: 100%;
  max-width: 480px;
}

.notes h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.notes pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px;
  border-radius: 12px;
  overflow: auto;
  text-align: left;
}

.file-meta h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.file-meta p {
  margin: 6px 0;
  color: var(--muted);
}

.expiry {
  color: color-mix(in srgb, var(--accent-dark), var(--ink) 20%);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.actions button {
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--ink);
}

.code {
  margin-top: 20px;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px;
  border-radius: 12px;
}

.code span {
  font-size: 12px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent), white 20%);
}

.code pre {
  margin: 8px 0 0;
  overflow: auto;
}

.content-block {
  margin-top: 20px;
  text-align: left;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.content-head button {
  margin-top: 0;
  white-space: nowrap;
}

.content-block pre {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px;
  border-radius: 12px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.warn {
  color: color-mix(in srgb, var(--accent), var(--ink) 20%);
  font-weight: 600;
}

.file-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
  text-align: center;
}

.file-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.file-card-error p {
  margin: 6px 0;
}

.qr-block {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* Hide the tile entirely if qr.js failed to load */
.qr-block:empty {
  display: none;
}

/* Always black-on-white: inverted QR codes scan unreliably, so no
   dark-mode treatment here */
.qr-block svg {
  width: 148px;
  height: 148px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}

.upload-progress {
  margin-top: 4px;
  text-align: center;
}

.upload-progress progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.progress-text {
  font-size: 13px;
  color: var(--muted);
}

.admin-card {
  text-align: left;
  overflow-x: auto;
}

.admin-login {
  max-width: 360px;
  margin: 0 auto;
}

.admin-empty {
  text-align: center;
  color: var(--muted);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
  text-align: left;
}

.admin-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.admin-table td form {
  display: inline;
}

.admin-table td form button {
  margin-top: 0;
  padding: 6px 12px;
  font-size: 13px;
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--ink);
}

.admin-table td form button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--card);
}

.admin-table a {
  color: var(--accent-dark);
  font-weight: 600;
}

.result h3,
.file-meta {
  text-align: center;
}

@media (max-width: 720px) {
  .hero h1 {
    font-size: 40px;
  }

  .row,
  .notes {
    grid-template-columns: 1fr;
  }

  .link-row {
    flex-direction: column;
    align-items: stretch;
  }

  .row-label {
    min-width: 0;
    text-align: left;
  }
}
