/* Drop — Private file transfer */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e4e7ec;
  --border-strong: #ccd2db;
  --text: #1b2330;
  --muted: #68717e;
  --accent: #2e4a6e;
  --accent-strong: #23405f;
  --accent-bright: #5f7fa8;
  --accent-soft: #edf2f8;
  --on-accent: #ffffff;
  --ring: rgba(46, 74, 110, 0.28);
  --danger: #b3372f;
  --danger-soft: #faf1f0;
  --warn: #9a6514;
  --ok: #2e7d4f;
  --track: #e9ecf1;
  --hover: #f3f5f8;
  --overlay: rgba(16, 22, 31, 0.45);
  --toast-bg: #242d3b;
  --toast-text: #eef1f5;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 28, 40, 0.05), 0 2px 6px rgba(20, 28, 40, 0.05),
    0 10px 26px rgba(20, 28, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 28, 40, 0.22);
  --panel-hi: rgba(255, 255, 255, 0.65);
  --dot: rgba(20, 28, 40, 0.05);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino,
    Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --panel: #161c25;
    --border: #262e3b;
    --border-strong: #39434f;
    --text: #dde3ec;
    --muted: #8b95a6;
    --accent: #8ba9cf;
    --accent-strong: #a5bedd;
    --accent-bright: #6f8fb8;
    --accent-soft: #1d2733;
    --on-accent: #10141b;
    --ring: rgba(139, 169, 207, 0.35);
    --danger: #d97066;
    --danger-soft: #2a1e1d;
    --warn: #d0a052;
    --ok: #6cb48d;
    --track: #232b37;
    --hover: #1c232e;
    --overlay: rgba(4, 7, 12, 0.6);
    --toast-bg: #2a3342;
    --toast-text: #e7ecf3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.28),
      0 12px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --panel-hi: rgba(163, 190, 220, 0.07);
    --dot: rgba(163, 190, 220, 0.045);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-width: 320px; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-color: var(--bg);
  /* whisper-quiet dot grid over the page background */
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--text); }

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right))
    max(64px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

/* ---- header ---- */

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 34px 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.brand h1 {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.brand h1::before {
  content: "";
  width: 11px;
  height: 11px;
  background: var(--accent);
  border-radius: 50% 50% 50% 2px;
  transform: rotate(-45deg) translateY(-1px);
  flex: none;
  animation: brand-pulse 4s ease-in-out infinite;
}

/* slow, subtle pulse — alive but not distracting */
@keyframes brand-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

.brand .subtitle {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ---- panels ---- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* layered drop shadows plus a 1px inner top highlight (a faint
     top-edge glow in dark mode) */
  box-shadow: inset 0 1px 0 var(--panel-hi), var(--shadow);
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.panel-body { padding: 16px; }
.panel-body-drop { padding: 12px; }

.empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---- dropzone ---- */

/* animatable angle driving the border sheen; browsers without @property
   support simply render a static sheen */
@property --dz-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: var(--panel);
  transition: border-color 0.2s ease, background 0.2s ease,
    transform 0.2s ease, box-shadow 0.2s ease, padding 0.35s ease;
}

/* hero state: no files and no uploads — the dropzone takes the stage.
   drop.js toggles .stage when the file list re-renders */
.dropzone.stage { padding: 88px 32px; }

.dropzone.stage .dz-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 7px;
}

.dropzone.stage .dz-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 16px;
}

.dropzone.stage .dz-hint { font-size: 13.5px; }

/* slow, barely-there light traveling along the dashed border */
.dropzone::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--dz-angle),
    transparent 0deg,
    var(--accent-bright) 24deg,
    transparent 70deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.5;
  animation: dz-sheen 7s linear infinite;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

@keyframes dz-sheen {
  to { --dz-angle: 360deg; }
}

.dropzone:hover { border-color: var(--accent-bright); }

.dropzone:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.dropzone.dragover {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: scale(1.008);
}

.dropzone.dragover::before { opacity: 0; }

/* quick settle right after files land — no bounce, just a calm release */
.dropzone.dropped {
  animation: dz-settle 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes dz-settle {
  from {
    transform: scale(1.012);
    background: var(--accent-soft);
    border-color: var(--accent);
  }
  to { transform: scale(1); }
}

.dz-icon {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: color 0.2s ease, transform 0.25s ease, width 0.35s ease,
    height 0.35s ease, margin 0.35s ease;
}

.dropzone:hover .dz-icon {
  color: var(--accent);
  transform: translateY(-2px);
}

.dropzone.dragover .dz-icon {
  color: var(--accent);
  animation: dz-lift 1.1s ease-in-out infinite;
}

@keyframes dz-lift {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-4px); }
}

.dropzone .dz-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text);
  margin-bottom: 4px;
  transition: color 0.2s ease, font-size 0.35s ease;
}

.dropzone.dragover .dz-title { color: var(--accent-strong); }

.dropzone .dz-hint { font-size: 13px; }

/* ---- buttons ---- */

.btn {
  display: inline-block;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { background: var(--hover); }

.btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-primary[disabled]:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn.copied {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn[disabled] { opacity: 0.5; cursor: default; }

.btn-sm { padding: 4px 11px; font-size: 12px; }

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

/* the panel starts hidden and drop.js toggles `hidden`; belt and braces so
   an empty queue never renders as an empty box */
#uploadsPanel[hidden] { display: none; }

.overall {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* hairline queue bar with the same shimmer treatment as file rows */
.overall .bar { height: 2px; margin-top: 8px; border-radius: 1px; }
.overall .bar > .fill { border-radius: 1px; }

#uploadList { padding: 6px; }

.up-row {
  position: relative;
  margin: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  contain: paint;
  animation: row-in 0.15s ease-out both;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.up-row:hover { border-color: var(--border-strong); }

@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* after the bar fills, a thin success underline sweeps the card once */
.up-row.done::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ok) 30%, var(--ok) 70%, transparent);
  transform: scaleX(0);
  transform-origin: left;
  animation: done-sweep 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) 0.15s 1 forwards;
}

@keyframes done-sweep {
  0% { transform: scaleX(0); opacity: 1; }
  60% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.up-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.up-name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-stats {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.up-stats.error { color: var(--danger); }
.up-stats.done { color: var(--ok); }

.bar {
  height: 5px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}

.bar > .fill {
  position: relative;
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: inherit;
  overflow: hidden;
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
  transition: background 0.3s ease;
}

/* slow-moving light shimmer while the upload is active */
.bar > .fill:not(.done):not(.error)::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  animation: bar-shimmer 2.3s ease-in-out infinite;
}

@keyframes bar-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(350%); }
}

.bar > .fill.done { background: var(--ok); }
.bar > .fill.error { background: var(--danger); }

/* ---- files table ---- */

table.files {
  width: 100%;
  border-collapse: collapse;
}

table.files th {
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}

table.files td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background 0.12s ease;
}

table.files tr:last-child td { border-bottom: none; }

table.files tr:hover td { background: var(--hover); }

/* body rows enter with a quick fade+rise; drop.js staggers the delay */
table.files tr.frow { animation: row-in 0.15s ease-out both; }

td.fname {
  font-weight: 550;
  width: 40%;
  max-width: 320px;
}

td.fname .fwrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

td.fname .fname-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-progress {
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.download-progress .fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

tr.downloading .download-progress,
tr.downloaded .download-progress {
  opacity: 1;
  transform: none;
}

tr.downloaded .download-progress .fill { background: var(--ok); }

/* tiny stroke glyph by file type, muted */
.ficon {
  display: inline-flex;
  flex: none;
  color: var(--muted);
}

.ficon svg { width: 16px; height: 16px; display: block; }

td.num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.expires { color: var(--muted); white-space: nowrap; }
td.expires .warn { color: var(--warn); }
td.expires .soon { color: var(--danger); }

td.actions { white-space: nowrap; text-align: right; }
td.actions .btn {
  margin-left: 6px;
  opacity: 0.45;
  transition: opacity 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
}

/* action buttons reveal on row hover (or keyboard focus within) */
table.files tr:hover td.actions .btn,
table.files tr:focus-within td.actions .btn { opacity: 1; }

/* ---- overlays (login / modal) ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.overlay[hidden] { display: none; }

.dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--panel-hi), var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 26px;
  animation: dlg-in 0.18s ease-out;
}

@keyframes dlg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.dialog h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dialog .dlg-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

.dialog label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 7px;
}

.dialog input[type="password"],
.dialog input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dialog input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.dlg-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: -6px 0 8px;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* TTL picker — segmented control */

.ttl-row {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 18px;
  background: var(--track);
  border-radius: var(--radius-sm);
}

.ttl-row .ttl {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.ttl-row .ttl:hover { color: var(--text); }

.ttl-row .ttl.selected {
  background: var(--panel);
  color: var(--accent-strong);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 22, 31, 0.18);
}

/* generated link: large mono field with an accent underline that
   animates in when the result is revealed */
.share-url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.share-url-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.share-url-field input {
  width: 100%;
  margin-bottom: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 11px 12px;
}

.share-underline {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: -1px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

#shareResult.reveal .share-underline {
  animation: underline-in 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) 0.05s forwards;
}

@keyframes underline-in {
  to { transform: scaleX(1); }
}

/* ---- toasts ---- */

#toasts {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: var(--toast-bg);
  color: var(--toast-text);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.toast.error { background: #7c2d27; }
.toast.success { background: #27603f; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

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

.share-note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}

.share-list { list-style: none; margin: 0; padding: 0; }

.share-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
  animation: row-in 0.15s ease-out both;
}

.share-list li:last-child { border-bottom: none; }

.share-list li:hover { background: var(--hover); }

.share-list .sname {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-list .ssize {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.share-list .smeta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding-top: 4px;
}

/* ---- responsive workspace ---- */

@media (hover: none), (pointer: coarse) {
  td.actions .btn { opacity: 1; }
  .btn { -webkit-tap-highlight-color: transparent; }
}

@media (max-width: 720px) {
  .container {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(36px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .brand {
    gap: 10px;
    padding: max(19px, env(safe-area-inset-top)) 4px 14px;
    margin-bottom: 14px;
  }

  .brand h1 { font-size: 24px; }
  .brand .subtitle { font-size: 10px; letter-spacing: 0.11em; }

  .panel { margin-bottom: 12px; border-radius: 9px; }
  .panel-head { min-height: 48px; padding: 10px 13px 10px 15px; }
  .panel-body-drop { padding: 8px; }

  .dropzone { padding: 30px 16px; }
  .dropzone.stage { padding: 52px 18px; }
  .dropzone.stage .dz-title { font-size: 22px; }
  .dropzone.stage .dz-hint { font-size: 12.5px; }

  .btn { min-height: 44px; padding: 9px 13px; }
  .btn-sm { min-height: 44px; padding: 9px 11px; }

  .overall { padding: 11px 14px 12px; line-height: 1.45; }
  .overall .bar { height: 4px; margin-top: 9px; }
  #uploadList { padding: 4px; }
  .up-row { margin: 6px; padding: 12px; }

  table.files {
    display: block;
    padding: 5px;
  }

  table.files > tr:not(.frow),
  table.files > tbody > tr:not(.frow) { display: none; }

  table.files tr.frow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    margin: 5px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel);
    box-shadow: 0 1px 3px rgba(20, 28, 40, 0.04);
  }

  table.files tr.frow:hover { background: var(--hover); }

  table.files tr.frow td {
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
  }

  table.files tr.frow td.fname {
    grid-column: 1 / -1;
    min-width: 0;
    margin-bottom: 2px;
    font-size: 14px;
  }

  table.files tr.frow td.num,
  table.files tr.frow td.expires {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
  }

  table.files tr.frow td.num::before,
  table.files tr.frow td.expires::before {
    content: attr(data-label);
    color: var(--muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.3;
    text-transform: uppercase;
  }

  table.files tr.frow td.actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 7px;
    margin-top: 3px;
    padding-top: 11px;
    border-top: 1px solid var(--border);
  }

  td.actions .btn {
    flex: 1 1 0;
    min-width: 0;
    margin-left: 0;
    opacity: 1;
    text-align: center;
  }

  .dialog {
    max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px;
  }
}

@media (max-width: 460px) {
  .brand { align-items: center; }
  .brand .subtitle {
    max-width: 180px;
    line-height: 1.3;
  }

  .dropzone.stage { padding: 42px 14px; }
  .dropzone .dz-hint { max-width: 280px; margin: 0 auto; }

  .up-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .up-stats {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .ttl-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ttl-row .ttl { min-height: 44px; padding: 10px 4px; }

  .share-url-row { flex-direction: column; }
  .share-url-row > .btn { width: 100%; }
  .dlg-actions .btn { flex: 1; }

  .overlay {
    align-items: flex-start;
    padding: max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .dialog { padding: 20px 17px; border-radius: 11px; }

  #toasts {
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    max-width: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .container { padding-bottom: max(20px, env(safe-area-inset-bottom)); }

  .brand {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: 9px;
    margin-bottom: 10px;
  }

  .brand h1 { font-size: 22px; }
  .panel { margin-bottom: 10px; }

  .dropzone,
  .dropzone.stage {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 14px;
    padding: 14px 20px;
    text-align: left;
  }

  .dropzone .dz-icon,
  .dropzone.stage .dz-icon {
    grid-row: 1 / 3;
    align-self: center;
    width: 30px;
    height: 30px;
    margin: 0;
  }

  .dropzone .dz-title,
  .dropzone.stage .dz-title {
    align-self: end;
    margin: 0;
    font-size: 19px;
  }

  .dropzone .dz-hint,
  .dropzone.stage .dz-hint { align-self: start; font-size: 12px; }
  td.actions .btn { opacity: 1; }
  .overlay { align-items: flex-start; }
}

/* ---- reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
