/**
 * Where a transfer is reported.
 *
 * Above the zoomer in the corner the rest of the space chrome already occupies, and `fixed` so
 * panning and zooming do not carry it off with the canvas.
 *
 * It is absent rather than empty when there is nothing moving. A permanent button for something
 * that happens twice a week is a button in the way for the rest of the week — this appears with
 * the first transfer and goes when the last one is cleared.
 *
 * Its colours are its own rather than the app's. Blue, green, red and amber here are carrying a
 * meaning — moving, finished, failed, stuck — and a palette tuned for buttons and links does not
 * keep those four apart at the size of a three-pixel bar. They are declared per theme rather than
 * mixed out of `--text`, because a token that does not exist falls back to transparent silently
 * and takes a whole panel with it.
 */
atomics-transfer-queue {
  --tq-size: 58px;
  --tq-surface: #ffffff;
  --tq-edge: rgba(0, 0, 0, 0.12);
  --tq-line: rgba(0, 0, 0, 0.07);
  --tq-mut: color-mix(in srgb, var(--text), transparent 58%);
  --tq-hover: color-mix(in srgb, var(--text), transparent 95%);
  --tq-track: color-mix(in srgb, var(--text), transparent 88%);
  --tq-blue: #2f6bff;
  --tq-blue-text: #2356d8;
  --tq-green: #1f9d55;
  --tq-green-text: #13773c;
  --tq-red: #d93a3a;
  --tq-red-text: #b82828;
  --tq-amber: #b7791f;
  --tq-amber-text: #8f5c0f;
  --tq-shadow: 0 24px 60px rgba(20, 20, 20, 0.16), 0 4px 12px rgba(20, 20, 20, 0.06);

  position: fixed;
  z-index: 9998;
  bottom: 4.25rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: all;
  color: var(--text);
}

[data-theme='dark'] atomics-transfer-queue {
  --tq-surface: #1d1d20;
  --tq-edge: rgba(255, 255, 255, 0.13);
  --tq-line: rgba(255, 255, 255, 0.07);
  --tq-blue: #5b8cff;
  --tq-blue-text: #8aadff;
  --tq-green: #3ccf7a;
  --tq-green-text: #5ee29a;
  --tq-red: #ff6b6b;
  --tq-red-text: #ff8f8f;
  --tq-amber: #f0b44c;
  --tq-amber-text: #f5c877;
  --tq-shadow: 0 26px 64px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.35);
}

atomics-transfer-queue[idle] {
  display: none;
}

/* The edits row moves down beside the zoomer on a narrow screen, so this moves up over both. */
@media (max-width: 720px) {
  atomics-transfer-queue {
    bottom: 7.5rem;
  }
}

/*
 * With the chrome hidden there is nothing to clear, so it sits in the corner itself.
 *
 * Written by `viewport/ui/toggle`, which is what `?ui=false` and the floating space window both
 * come down to. Outside the media query above and more specific than it, so the phone offset does
 * not win in a 520px floating window where none of what it avoids is on screen.
 */
:root[atomics-minimal] atomics-transfer-queue {
  bottom: 0.85rem;
  right: 0.85rem;
}

/* ── The corner ── */

/*
 * The button reports without being opened: a ring that fills with how far along everything is, an
 * arc that turns while anything moves, and a count on its shoulder. That is the whole of what
 * somebody watching a large upload from a small window needs, and it is why the panel no longer
 * has to open itself to say it.
 */
atomics-transfer-queue [toggle] {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tq-size);
  height: var(--tq-size);
  border-radius: 50%;
  background: var(--tq-surface);
  color: var(--text);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  box-shadow:
    0 0 0 1px var(--tq-edge),
    0 10px 26px rgba(0, 0, 0, 0.14);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
  appearance: none;
}

atomics-transfer-queue [toggle]:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px var(--tq-edge),
    0 14px 30px rgba(0, 0, 0, 0.18);
}

atomics-transfer-queue [toggle]:active {
  transform: scale(0.95);
}

atomics-transfer-queue[open] [toggle] {
  box-shadow:
    0 0 0 2px var(--tq-blue),
    0 10px 26px rgba(0, 0, 0, 0.14);
}

atomics-transfer-queue [toggle]:focus-visible {
  outline: 2px solid var(--tq-blue);
  outline-offset: 3px;
}

atomics-transfer-queue [tq-track] {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--tq-track);
  transition: box-shadow 300ms ease;
}

atomics-transfer-queue[data-state='done'] [tq-track] {
  box-shadow: inset 0 0 0 3px var(--tq-green);
}

atomics-transfer-queue[data-state='fail'] [tq-track] {
  box-shadow: inset 0 0 0 3px var(--tq-red);
}

/*
 * The turning arc, cut out of a cone by a mask rather than drawn as a border.
 *
 * A border cannot be a gradient, and four rotating borders is the trick that gives every spinner
 * on the web its faint square corners.
 */
atomics-transfer-queue [tq-arc] {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  display: none;
  mask: radial-gradient(farthest-side, rgba(0, 0, 0, 0) calc(100% - 3.5px), #000 calc(100% - 3px));
  background: conic-gradient(from 0deg, transparent 0deg, var(--tq-blue) 250deg, transparent 251deg);
  animation: tq-spin 950ms linear infinite;
}

atomics-transfer-queue[data-state='active'] [tq-arc] {
  display: block;
}

atomics-transfer-queue [tq-flood] {
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  overflow: hidden;
}

atomics-transfer-queue [tq-flood] > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: var(--tq-blue);
  opacity: 0.16;
  transition: height 450ms ease;
}

atomics-transfer-queue[data-state='done'] [tq-flood] > span {
  background: var(--tq-green);
}

atomics-transfer-queue[data-state='fail'] [tq-flood] > span {
  background: var(--tq-red);
}

atomics-transfer-queue [tq-mark] {
  position: relative;
  z-index: 1;
  display: flex;
}

atomics-transfer-queue [tq-tick],
atomics-transfer-queue[data-state='done'] [tq-arrow] {
  display: none;
}

atomics-transfer-queue[data-state='done'] [tq-tick] {
  display: block;
  color: var(--tq-green-text);
}

atomics-transfer-queue[data-state='active'] [tq-mark] {
  animation: tq-bob 1.4s ease-in-out infinite;
}

atomics-transfer-queue [badge] {
  display: none;
  position: absolute;
  top: -3px;
  right: -3px;
  z-index: 2;
  min-width: 20px;
  height: 20px;
  box-sizing: border-box;
  padding: 0 6px;
  border-radius: 100vmax;
  background: var(--tq-blue);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2.5px var(--background);
  font-variant-numeric: tabular-nums;
}

atomics-transfer-queue[counted] [badge] {
  display: flex;
}

atomics-transfer-queue[data-state='fail'] [badge] {
  background: var(--tq-red);
}

/* The announcement channel is for screen readers; there is nothing to look at. */
atomics-transfer-queue [announcer] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Panel ── */

atomics-transfer-queue [panel] {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.6rem);
  right: 0;
  width: 404px;
  max-height: min(660px, 70vh);
  box-sizing: border-box;
  flex-direction: column;
  background: var(--tq-surface);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px var(--tq-edge),
    var(--tq-shadow);
  overflow: hidden;
  transform-origin: calc(100% - 29px) calc(100% + 44px);
  animation: tq-rise 200ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

atomics-transfer-queue[open] [panel] {
  display: flex;
}

atomics-transfer-queue [panel-header] {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 16px 10px 12px 18px;
  flex-shrink: 0;
}

atomics-transfer-queue [panel-titles] {
  flex: 1 1 auto;
  min-width: 0;
}

atomics-transfer-queue [panel-title] {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

atomics-transfer-queue [panel-sub] {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--tq-mut);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

atomics-transfer-queue [clear-btn] {
  appearance: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
  flex: 0 0 auto;
}

atomics-transfer-queue [clear-btn]:hover {
  background: var(--tq-hover);
  opacity: 1;
}

atomics-transfer-queue [clear-btn]:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}

atomics-transfer-queue [close-btn] {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  color: var(--tq-mut);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

atomics-transfer-queue [close-btn]:hover {
  background: var(--tq-hover);
  color: var(--text);
}

atomics-transfer-queue [clear-btn]:focus-visible,
atomics-transfer-queue [close-btn]:focus-visible,
atomics-transfer-queue [tq-tab]:focus-visible,
atomics-transfer-queue [tq-action]:focus-visible {
  outline: 2px solid var(--tq-blue);
  outline-offset: 1px;
}

/* Everything in the queue as one bar, so the panel answers "how much longer" at a glance. */
atomics-transfer-queue [panel-agg] {
  position: relative;
  height: 4px;
  margin: 0 18px;
  border-radius: 100vmax;
  background: var(--tq-track);
  overflow: hidden;
  flex: 0 0 auto;
}

atomics-transfer-queue [panel-agg] > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 100vmax;
  background: var(--tq-blue);
  transition:
    width 400ms linear,
    background-color 300ms ease;
}

atomics-transfer-queue [panel-agg][unmeasured] > span {
  width: 40%;
  transition: none;
  animation: tq-sweep 1.4s ease-in-out infinite;
}

atomics-transfer-queue [panel-agg][is-done] > span {
  background: var(--tq-green);
}

atomics-transfer-queue [panel-agg][is-fail] > span {
  background: var(--tq-red);
}

atomics-transfer-queue [panel-tabs] {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--tq-line);
  flex: 0 0 auto;
}

atomics-transfer-queue [tq-tab] {
  appearance: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  height: 28px;
  padding: 0 11px;
  border-radius: 100vmax;
  background: transparent;
  color: var(--tq-mut);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

atomics-transfer-queue [tq-tab]:hover {
  color: var(--text);
  background: var(--tq-hover);
}

atomics-transfer-queue [tq-tab][is-on] {
  background: var(--text);
  color: var(--tq-surface);
}

atomics-transfer-queue [tq-tab] i {
  font-style: normal;
  opacity: 0.62;
  font-variant-numeric: tabular-nums;
}

atomics-transfer-queue [panel-list] {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--tq-track) transparent;
}

atomics-transfer-queue [tq-section] {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tq-mut);
}

atomics-transfer-queue [tq-section] i {
  font-style: normal;
  opacity: 0.7;
}

atomics-transfer-queue [panel-empty] {
  display: none;
  padding: 40px 24px 44px;
  text-align: center;
  color: var(--tq-mut);
  font-size: 13px;
  line-height: 1.5;
}

atomics-transfer-queue[empty] [panel-empty] {
  display: block;
}

atomics-transfer-queue[empty] [panel-list] {
  display: none;
}

atomics-transfer-queue [panel-empty] b {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  margin: 12px 0 4px;
}

/* ── A transfer ── */

atomics-transfer-queue [tq-item] {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 11px;
}

atomics-transfer-queue [tq-item]:hover {
  background: var(--tq-hover);
}

atomics-transfer-queue [tq-main] {
  min-width: 0;
}

atomics-transfer-queue [tq-name] {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

atomics-transfer-queue [tq-item][data-lane='done'] [tq-name],
atomics-transfer-queue [tq-item][data-lane='queued'] [tq-name],
atomics-transfer-queue [tq-item][data-lane='cancelled'] [tq-name] {
  font-weight: 500;
}

/*
 * One line, four parts, and any of them may be empty.
 *
 * The separators are drawn by the parts that follow rather than written into them, so a row with
 * no speed to report does not carry a stray dot, and so the whole line ellipses as one thing.
 */
atomics-transfer-queue [tq-meta] {
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--tq-mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

atomics-transfer-queue [tq-status] {
  font-weight: 600;
  color: var(--text);
}

atomics-transfer-queue [tq-percent]:not(:empty)::before,
atomics-transfer-queue [tq-detail]:not(:empty)::before,
atomics-transfer-queue [tq-rate]:not(:empty)::before {
  content: '·';
  margin: 0 0.35em;
  opacity: 0.65;
}

atomics-transfer-queue [tq-item][data-lane='moving'] [tq-status] {
  color: var(--tq-blue-text);
}

atomics-transfer-queue [tq-item][data-lane='done'] [tq-status] {
  color: var(--tq-green-text);
}

atomics-transfer-queue [tq-item][data-lane='failed'] [tq-status] {
  color: var(--tq-red-text);
}

atomics-transfer-queue [tq-item][data-lane='queued'] [tq-status],
atomics-transfer-queue [tq-item][data-lane='cancelled'] [tq-status] {
  color: var(--tq-mut);
}

atomics-transfer-queue [tq-item][stalled] [tq-status] {
  color: var(--tq-amber-text);
}

atomics-transfer-queue [tq-acts] {
  display: flex;
  align-items: center;
  gap: 2px;
}

atomics-transfer-queue [tq-action] {
  appearance: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  height: 30px;
  padding: 0 9px;
  border-radius: 100vmax;
  background: transparent;
  color: color-mix(in srgb, var(--text), transparent 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 150ms ease,
    color 150ms ease,
    opacity 150ms ease;
}

atomics-transfer-queue [tq-action][tq-glyph] {
  width: 30px;
  padding: 0;
  border-radius: 50%;
  color: var(--text);
  opacity: 0.75;
}

/*
 * Cancel keeps out of the way until the row is reached for.
 *
 * It is the one action on a healthy row, and a healthy row is one nobody needs to touch — a button
 * offering to stop it, drawn at full strength on every line, reads as something gone wrong.
 */
atomics-transfer-queue [tq-item][data-lane='moving'] [tq-action][tq-glyph],
atomics-transfer-queue [tq-item][data-lane='queued'] [tq-action][tq-glyph] {
  opacity: 0;
}

atomics-transfer-queue [tq-item]:hover [tq-action][tq-glyph],
atomics-transfer-queue [tq-item]:focus-within [tq-action][tq-glyph] {
  opacity: 0.75;
}

atomics-transfer-queue [tq-item][data-lane='failed'] [tq-action][tq-glyph] {
  color: var(--tq-red-text);
  opacity: 1;
}

atomics-transfer-queue [tq-action]:hover {
  background: var(--tq-hover);
  color: var(--text);
  opacity: 1;
}

atomics-transfer-queue [tq-item][data-lane='failed'] [tq-action][tq-glyph]:hover {
  color: var(--tq-red-text);
}

atomics-transfer-queue [tq-action][hidden] {
  display: none;
}

/* ── The tile ── */

/*
 * What is moving, at a glance, before the name is read.
 *
 * Drawn rather than fetched: the row exists from the moment somebody asked for the thing, which is
 * before there is a file to make a thumbnail of, and a picture that arrives two seconds late is
 * worse than a picture that was never promised.
 */
atomics-transfer-queue [tq-tile] {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
}

atomics-transfer-queue [tq-tile][data-tile='image'] {
  background:
    radial-gradient(circle at 30% 34%, #f2b88a 0 22%, transparent 22.5%),
    radial-gradient(circle at 70% 68%, #7b8fd1 0 28%, transparent 28.5%),
    linear-gradient(135deg, #efe4d6, #d9c9b8);
}

atomics-transfer-queue [tq-tile][data-tile='video'] {
  background: radial-gradient(circle at 60% 40%, #3b4a63 0%, #12151c 75%);
  color: rgba(255, 255, 255, 0.9);
}

atomics-transfer-queue [tq-tile][data-tile='audio'] {
  background: #efeae4;
}

[data-theme='dark'] atomics-transfer-queue [tq-tile][data-tile='audio'] {
  background: #2a2826;
}

atomics-transfer-queue [tq-vinyl] {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, #1a1a1d 0 1.2px, #26262b 1.2px 2.4px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

atomics-transfer-queue [tq-vinyl]::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: radial-gradient(circle, #0a0a0c 0 1.3px, #5f9f7f 1.6px 100%);
}

atomics-transfer-queue [tq-item][data-lane='moving'] [tq-vinyl] {
  animation: tq-spin 2.4s linear infinite;
}

atomics-transfer-queue [tq-tile][data-tile='doc'] {
  background: #e9edf8;
  color: #2d4aa8;
}

atomics-transfer-queue [tq-tile][data-tile='data'] {
  background: #eceae4;
  color: #55524a;
}

atomics-transfer-queue [tq-tile][data-tile='zip'] {
  background: #f5ead9;
  color: #8a5a14;
}

atomics-transfer-queue [tq-tile][data-tile='archive'] {
  background: #ece7f8;
  color: #5b3ea8;
}

[data-theme='dark'] atomics-transfer-queue [tq-tile][data-tile='doc'] {
  background: #1f2a45;
  color: #a7bbff;
}

[data-theme='dark'] atomics-transfer-queue [tq-tile][data-tile='data'] {
  background: #2a2925;
  color: #d0ccc0;
}

[data-theme='dark'] atomics-transfer-queue [tq-tile][data-tile='zip'] {
  background: #33291a;
  color: #f0c27a;
}

[data-theme='dark'] atomics-transfer-queue [tq-tile][data-tile='archive'] {
  background: #272044;
  color: #c2b0f5;
}

atomics-transfer-queue [tq-ext] {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

atomics-transfer-queue [tq-fold] {
  position: absolute;
  right: 0;
  top: 0;
  width: 11px;
  height: 11px;
  background: linear-gradient(225deg, transparent 50%, rgba(0, 0, 0, 0.12) 50%);
}

/* A failure marked on the thing that failed, so a filtered list is readable without its heading. */
atomics-transfer-queue [tq-item][data-lane='failed'] [tq-tile]::after {
  content: '!';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tq-red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--tq-surface);
}

/* ── Progress ── */

atomics-transfer-queue [tq-bar] {
  position: relative;
  grid-column: 2 / 4;
  height: 3px;
  margin-top: 9px;
  border-radius: 100vmax;
  background: var(--tq-track);
  overflow: hidden;
}

atomics-transfer-queue [tq-item][data-lane='queued'] [tq-bar] {
  display: none;
}

atomics-transfer-queue [tq-fill] {
  height: 100%;
  width: 0%;
  border-radius: 100vmax;
  background: var(--tq-blue);
  transition: width 400ms linear;
}

/*
 * A bar that is moving says so by moving.
 *
 * A width that changes twice a second is not motion anybody sees on a 400px row, and the whole
 * complaint about the old corner was that it announced loudly and then told you nothing.
 */
atomics-transfer-queue [tq-item][data-lane='moving'][measured]:not([stalled]) [tq-fill] {
  background-color: var(--tq-blue);
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  background-size: 60px 100%;
  background-repeat: no-repeat;
  animation: tq-shine 1.3s linear infinite;
}

/*
 * Unmeasured phases sweep instead of filling. The sweep says "working, and I cannot tell you how
 * far along" — which is the truth while a server is packing a space, and is a different statement
 * from a bar that stops at 40%.
 */
atomics-transfer-queue [tq-item]:not([measured]):not([stalled]) [tq-fill] {
  width: 40%;
  animation: tq-sweep 1.4s ease-in-out infinite;
}

/* A stalled row that was never measured has nothing to draw, so it draws the whole bar amber. */
atomics-transfer-queue [tq-item]:not([measured])[stalled] [tq-fill] {
  width: 100%;
}

atomics-transfer-queue [tq-item][data-phase='done'] [tq-fill] {
  width: 100%;
  background: var(--tq-green);
  animation: none;
}

atomics-transfer-queue [tq-item][data-phase='error'] [tq-fill] {
  width: 100%;
  background: var(--tq-red);
  animation: none;
}

atomics-transfer-queue [tq-item][data-phase='cancelled'] [tq-fill] {
  width: 100%;
  background: var(--tq-track);
  animation: none;
}

/* Stopped moving. The sweep would keep insisting otherwise. */
atomics-transfer-queue [tq-item][stalled][stalled] [tq-fill] {
  background: var(--tq-amber);
  background-image: repeating-linear-gradient(-45deg, var(--tq-amber) 0 4px, transparent 4px 7px);
  animation: none;
}

/*
 * What an export cost, listed under it.
 *
 * Amber rather than red: the file exists and is usable, it is just not everything that was asked
 * for. A failure and a compromise reading the same is how one of them stops being noticed.
 */
atomics-transfer-queue [tq-notes] {
  grid-column: 2 / 4;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.4rem 0 0;
  padding: 0 0 0 0.75rem;
  list-style: none;
}

atomics-transfer-queue [tq-notes][hidden] {
  display: none;
}

atomics-transfer-queue [tq-notes] li {
  position: relative;
  font-size: 11px;
  line-height: 1.35;
  color: var(--tq-amber-text);
}

atomics-transfer-queue [tq-notes] li::before {
  content: '';
  position: absolute;
  left: -0.6rem;
  top: 0.45em;
  width: 3px;
  height: 3px;
  border-radius: 100vmax;
  background: var(--tq-amber);
}

/* ── A window too small to be covered ── */

/*
 * The floating space window is 520 by 380. A 404px panel anchored above a button is most of it,
 * and a panel that opens itself is all of it — which is what made this obnoxious in there.
 *
 * So under this the panel stops being a thing over the window and becomes the window, with its own
 * scroll and its own way out, and it waits to be asked for. The ring in the corner carries the
 * report in the meantime. `logic.ts` holds the same query for the half of this that is behaviour.
 */
@media (max-width: 560px), (max-height: 460px) {
  atomics-transfer-queue {
    --tq-size: 46px;
  }

  atomics-transfer-queue [panel] {
    position: fixed;
    inset: 0.5rem;
    width: auto;
    max-height: none;
    border-radius: 14px;
    transform-origin: bottom right;
  }

  atomics-transfer-queue [panel-header] {
    padding: 12px 8px 10px 14px;
  }

  atomics-transfer-queue [panel-title] {
    font-size: 15px;
  }

  atomics-transfer-queue [panel-agg] {
    margin: 0 14px;
  }

  atomics-transfer-queue [panel-tabs] {
    padding: 10px 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  /* The sheet is the window, so a button poking out from under it is a button over nothing. */
  atomics-transfer-queue[open] [toggle] {
    visibility: hidden;
  }

  atomics-transfer-queue [tq-track],
  atomics-transfer-queue [tq-arc] {
    inset: 4px;
  }

  atomics-transfer-queue [tq-flood] {
    inset: 9px;
  }

  atomics-transfer-queue [tq-mark] svg {
    width: 17px;
    height: 17px;
  }

  /* Four rows rather than three in a 380px window, without making anything unreadable. */
  atomics-transfer-queue [tq-item] {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    column-gap: 10px;
    padding: 7px 8px;
  }

  atomics-transfer-queue [tq-tile] {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  atomics-transfer-queue [tq-vinyl] {
    width: 24px;
    height: 24px;
  }

  atomics-transfer-queue [tq-bar] {
    margin-top: 7px;
  }

  atomics-transfer-queue [tq-section] {
    padding: 9px 8px 3px;
  }

  /* Reached by a finger rather than a pointer, so it is always there rather than on hover. */
  atomics-transfer-queue [tq-item][data-lane='moving'] [tq-action][tq-glyph],
  atomics-transfer-queue [tq-item][data-lane='queued'] [tq-action][tq-glyph] {
    opacity: 0.75;
  }
}

@keyframes tq-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tq-bob {
  0%,
  100% {
    transform: translateY(1.5px);
  }
  50% {
    transform: translateY(-1.5px);
  }
}

@keyframes tq-shine {
  from {
    background-position: -60px 0;
  }
  to {
    background-position: 420px 0;
  }
}

@keyframes tq-sweep {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(150%);
  }
  100% {
    transform: translateX(250%);
  }
}

@keyframes tq-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  atomics-transfer-queue [tq-arc],
  atomics-transfer-queue [tq-mark],
  atomics-transfer-queue [tq-vinyl],
  atomics-transfer-queue [tq-fill],
  atomics-transfer-queue [panel-agg] > span,
  atomics-transfer-queue [panel] {
    animation: none !important;
  }

  atomics-transfer-queue [tq-fill] {
    transition: none;
  }
}
