/* Lamp layer structure adapted from Aceternity UI: https://ui.aceternity.com/components/lamp-effect.
   The small cursor light uses the surface/border split demonstrated at https://coyoteconcept.com/lab/spot. */
.app {
  --tray-top: 4px;
  --tray-x: clamp(42px, var(--tray-position, 50vw), calc(100vw - 42px));
  --tray-panel-half: min(259px, calc(50vw - 14px));
  --lamp-blue: #2684ff;
  --lamp-deep-blue: #145bd7;
  --lamp-ice: #a4ddff;
}
#tray-glow {
  --lamp-strength: 70%;
  position: fixed; isolation: isolate; z-index: 9; inset: 0 auto auto var(--tray-x);
  width: min(720px, 96vw); height: 194px; pointer-events: none;
  opacity: 0; transform: translateX(-50%) scale(.21,.07); transform-origin: 50% 0;
  transition: transform 290ms cubic-bezier(.48,.07,.65,1), opacity 230ms;
}
:root[data-theme-mode="dark"] #tray-glow { --lamp-strength: 84%; }
#tray-glow > span { position: absolute; pointer-events: none; }
.tray-lamp-beam {
  top: 0; width: 50%; height: 82%; opacity: .93;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 23%, transparent 100%), var(--lamp-edge-mask);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, #000 0%, #000 23%, transparent 100%), var(--lamp-edge-mask);
  mask-composite: intersect;
}
.tray-lamp-left {
  --lamp-edge-mask: linear-gradient(to right, transparent, #000 52%);
  right: 50%;
  background: conic-gradient(from 70deg at center top,
    color-mix(in srgb, var(--lamp-blue) var(--lamp-strength), transparent) 0deg,
    color-mix(in srgb, var(--lamp-blue) 39%, transparent) 65deg, transparent 174deg, transparent 360deg);
}
.tray-lamp-right {
  --lamp-edge-mask: linear-gradient(to left, transparent, #000 52%);
  left: 50%;
  background: conic-gradient(from 290deg at center top,
    transparent 0deg, transparent 184deg,
    color-mix(in srgb, var(--lamp-blue) 39%, transparent) 295deg,
    color-mix(in srgb, var(--lamp-blue) var(--lamp-strength), transparent) 360deg);
}
.tray-lamp-veil {
  z-index: 2; inset: 48% 0 0; opacity: .5;
  background: linear-gradient(transparent, color-mix(in srgb, var(--canvas) 54%, transparent));
  -webkit-mask-image: radial-gradient(ellipse 50% 100% at 50% 0, #000, transparent 94%);
  mask-image: radial-gradient(ellipse 50% 100% at 50% 0, #000, transparent 94%);
  filter: blur(11px);
}
.tray-lamp-bloom {
  z-index: 3; inset: -27px 9% auto; height: 118px; opacity: .75; filter: blur(22px);
  background: radial-gradient(ellipse at 50% 10%, color-mix(in srgb, var(--lamp-blue) 82%, transparent), transparent 62%),
    radial-gradient(ellipse at 50% 22%, color-mix(in srgb, var(--lamp-deep-blue) 53%, transparent), transparent 72%);
}
.tray-lamp-core {
  z-index: 4; inset: -12px 21% auto; height: 52px; filter: blur(10px); opacity: .78;
  background: radial-gradient(ellipse at 50% 25%, var(--lamp-ice), transparent 69%);
}
.tray-lamp-spot {
  z-index: 6; inset: 0 0 auto; height: 105px; opacity: 0;
  background: radial-gradient(ellipse 23% 71% at clamp(32%, calc(50% + var(--lamp-spot-offset, 0px)), 68%) 0,
    color-mix(in srgb, var(--lamp-blue) 38%, var(--lamp-ice)) 0%, transparent 90%);
  transition: opacity 130ms;
}
.app:is([data-tray-offer],[data-guide-pointer-offer]) #tray-glow {
  opacity: .83; transform: translateX(-50%) scale(1);
  transition-timing-function: cubic-bezier(.15,.74,.24,1);
}
.app:is([data-tray-hit],[data-guide-pointer-hit]) #tray-glow { opacity: 1; transform: translateX(-50%) scale(1.09,1.13); }
.app:is([data-tray-hit],[data-guide-pointer-hit]) .tray-lamp-spot { opacity: .91; }
#tray-drop-zone {
  position: fixed; z-index: 10; inset: 0 auto auto var(--tray-x); transform: translateX(-50%);
  display: grid; place-items: end center; width: min(350px, 58vw);
  height: 128px; padding-bottom: 12px; pointer-events: none; visibility: hidden;
}
.app:is([data-tray-offer],[data-guide-pointer-offer]) #tray-drop-zone { visibility: visible; }
#tray-drop-label {
  padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 640; letter-spacing: .015em;
  color: color-mix(in srgb, var(--lamp-blue) 68%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--lamp-blue) 34%, var(--line));
  background: color-mix(in srgb, var(--surface) 91%, var(--lamp-blue));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--lamp-blue) 24%, transparent),
    inset 0 1px var(--shine);
  animation: tray-label-in 150ms cubic-bezier(.18,.7,.24,1);
}
.app:is([data-tray-hit],[data-guide-pointer-hit]) #tray-drop-label {
  color: #fff; background: var(--lamp-deep-blue); border-color: transparent;
  box-shadow: 0 5px 17px color-mix(in srgb, var(--lamp-blue) 41%, transparent);
}
@keyframes tray-label-in { from { opacity: 0; transform: translateY(-5px); } }

#tray-count {
  position: fixed; z-index: 10; inset: var(--tray-top) auto auto var(--tray-x); transform: translateX(-50%);
  width: 66px; height: 28px; padding: 0; display: grid; place-items: center;
  color: #34343a; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 650;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#tray-count:focus-visible { outline: 2px solid #686875; outline-offset: 2px; border-radius: 20px; }
#tray-count:active { cursor: grabbing; }
#tray-count .tray-badge-shape {
  position: absolute; inset: 0; pointer-events: none; border-radius: 999px;
  background: #fff; box-shadow: 0 2px 9px rgb(24 24 29 / .13), 0 1px 2px rgb(24 24 29 / .07);
}
.tray-badge-face {
  position: relative; display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  pointer-events: none;
}
.tray-badge-symbol svg { width: 14px; height: 14px; stroke-width: 1.6; }
#tray-count:hover .tray-badge-shape { box-shadow: 0 3px 11px rgb(24 24 29 / .18); }
.app:is([data-tray-offer],[data-guide-pointer-offer]) #tray-count { visibility: hidden; pointer-events: none; }
.file-tray {
  --tray-tab-width: 69px;
  --tray-glass: color-mix(in srgb, var(--surface-raised) 85%, transparent);
  position: fixed; z-index: 10; top: calc(var(--tray-top) + 36px);
  left: clamp(calc(var(--tray-panel-half) + 14px), var(--tray-x), calc(100vw - var(--tray-panel-half) - 14px));
  transform: translateX(-50%);
  width: min(518px, calc(100vw - 28px)); border: 1px solid var(--shine); border-radius: 24px;
  background: radial-gradient(ellipse at 22% 0%, color-mix(in srgb, var(--shine) 62%, transparent), transparent 72%),
    var(--tray-glass);
  -webkit-backdrop-filter: blur(24px) saturate(145%); backdrop-filter: blur(24px) saturate(145%);
  box-shadow: 0 20px 48px rgb(var(--shadow-color) / .20), 0 4px 13px rgb(var(--shadow-color) / .08),
    inset 0 1px var(--shine);
  transform-origin: center top; animation: tray-panel-in 210ms cubic-bezier(.18,.72,.27,1);
}
@keyframes tray-panel-in {
  from { transform: translate(-50%,-9px) scale(.965); opacity: 0; }
}
.tray-header, .tray-heading-group, .tray-tabs, .tray-actions, .tray-select-actions, .tray-selection {
  display: flex; align-items: center;
}
.tray-header { justify-content: space-between; gap: 10px; padding: 15px 15px 10px 17px; }
.tray-heading-group { gap: 10px; }
.tray-heading-icon {
  width: 36px; height: 36px; color: var(--accent); border: 1px solid var(--line-strong); border-radius: 11px;
  background: linear-gradient(145deg, var(--selected), var(--surface-subtle)); box-shadow: inset 0 1px var(--shine);
}
.tray-heading-icon svg { width: 19px; height: 19px; }
.tray-header h2 { margin: 0; font-size: 16px; font-weight: 670; letter-spacing: -.025em; white-space: nowrap; }
#tray-summary { font-size: 11px; color: var(--muted); }
#tray-close { border-radius: 8px; }
.tray-tabs {
  position: relative; isolation: isolate; width: max-content; padding: 3px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-tinted);
}
.tray-tabs button, .tray-actions button {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px;
  padding: 4px 8px; border-radius: 7px; color: var(--muted); font-size: 12px;
}
.tray-tabs button { justify-content: center; width: var(--tray-tab-width); }
.tray-tab-indicator {
  position: absolute; z-index: -1; inset: 3px auto 3px 3px; width: var(--tray-tab-width);
  background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: 7px;
  box-shadow: 0 1px 5px rgb(var(--shadow-color) / .07), inset 0 1px var(--shine);
  transform: translateX(calc(var(--tray-tab-index, 0) * var(--tray-tab-width)));
  transition: transform 300ms cubic-bezier(.18,.76,.25,1);
}
.tray-tabs button:hover, .tray-tabs [aria-selected="true"] { color: var(--accent); }
.tray-tabs [aria-selected="true"] { font-weight: 630; }
.tray-actions button:not(:disabled):hover { color: var(--accent); background: var(--hover); }
.tray-tabs svg, .tray-actions svg { width: 14px; height: 14px; }
.tray-select-actions { flex-wrap: wrap; gap: 8px; padding: 0 17px; }
.tray-selection { gap: 2px; margin-inline-start: auto; }
.tray-selection button { min-height: 28px; padding: 5px 7px; color: var(--accent); font-size: 11px; border-radius: 6px; white-space: nowrap; }
.tray-selection button:not(:disabled):hover { background: var(--hover); }
#tray-clear { color: var(--danger); }
.tray-view { padding: 8px 17px 14px; overflow: auto; max-height: min(310px, calc(100vh - 194px)); overscroll-behavior: contain; }
#tray-items { display: grid; gap: 5px; }
.tray-empty {
  margin: 2px 0; padding: 18px 12px; border: 1px dashed var(--line-strong); border-radius: 11px;
  color: var(--muted); text-align: center; font-size: 12px; background: var(--surface-subtle);
}
.tray-item {
  --tray-item-color: var(--accent);
  position: relative; display: flex; min-width: 0;
  border: 1px solid transparent; border-radius: 11px; text-align: left;
  background: color-mix(in srgb, var(--surface-raised) 68%, transparent);
  user-select: none; -webkit-user-select: none;
}
.tray-item-body {
  display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; min-height: 46px;
  padding: 6px 33px 6px 9px; border-radius: inherit; text-align: left; outline-offset: -2px;
}
.tray-item-remove {
  position: absolute; top: 50%; right: 5px; translate: 0 -50%; width: 25px; height: 24px;
  opacity: .64; transition: opacity 100ms;
}
.tray-item:is(:hover,:focus-within) .tray-item-remove, .tray-item-remove:focus-visible {
  opacity: 1; pointer-events: auto;
}
.tray-item[data-tray-kind="image"] { --tray-item-color: var(--info); }
.tray-item[data-tray-kind="pdf"] { --tray-item-color: var(--danger); }
.tray-item[data-tray-kind="archive"] { --tray-item-color: var(--success); }
.tray-item-icon {
  --finder-folder-size: 25px;
  flex: none; width: 34px; height: 34px; color: var(--tray-item-color); border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--tray-item-color) 20%, var(--surface));
  background: linear-gradient(150deg,color-mix(in srgb, var(--tray-item-color) 15%, var(--surface)), var(--surface-raised));
  box-shadow: inset 0 1px var(--shine);
}
.tray-item-icon svg { width: 20px; height: 20px; stroke-width: 1.55; }
.tray-item-art { position: relative; display: grid; place-items: center; flex: none; border-radius: 9px; }
.tray-item-preview {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  border-radius: inherit; pointer-events: none;
}
.tray-item-preview img {
  width: 100%; height: 100%; min-height: 0; object-fit: contain; background: var(--surface-subtle);
}
.tray-item[data-tray-kind="folder"] .tray-item-preview img { object-fit: cover; }
.tray-item-art[data-has-preview] .tray-item-icon { visibility: hidden; }
.tray-item-text { min-width: 0; overflow: hidden; }
.tray-item-name, .tray-item-path { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-item-name { font-size: 12px; font-weight: 580; }
.tray-item-path { color: var(--muted); font-size: 11px; }
.tray-item[data-unavailable] .tray-item-name { color: var(--muted); }
.tray-item-unavailable { margin-left: auto; flex: none; color: var(--danger); font-size: 11px; white-space: nowrap; }
.tray-item:hover { background: var(--surface-subtle); }
.tray-item[data-selected] { background: var(--selected); border-color: var(--line-strong); }
.tray-view[data-layout="card"] #tray-items:not([data-empty]) { grid-template-columns: repeat(var(--tray-card-columns, 3),minmax(0,1fr)); gap: 8px; }
.tray-view[data-layout="card"] #tray-items[data-single] { grid-template-columns: minmax(0,180px); }
.tray-view[data-layout="card"] .tray-item {
  background: linear-gradient(150deg, var(--surface-raised), var(--surface));
  border-color: var(--line); box-shadow: inset 0 1px var(--shine), 0 1px 3px rgb(var(--shadow-color) / .045);
}
.tray-view[data-layout="card"] .tray-item-body {
  flex-direction: column; gap: 7px; align-items: flex-start; min-height: 98px; padding: 10px;
}
.tray-view[data-layout="card"] .tray-item-remove { top: 5px; translate: none; }
.tray-view[data-layout="card"] .tray-item-remove:not(:disabled) { background: var(--surface); }
.tray-view[data-layout="card"] .tray-item[data-selected] { background: var(--selected); border-color: var(--line-strong); }
.tray-view[data-layout="card"] .tray-item-art {
  width: 100%; height: 84px; overflow: hidden; border-radius: 7px; background: var(--surface-subtle);
}
.tray-view[data-layout="card"] .tray-item-icon { --finder-folder-size: 29px; width: 38px; height: 38px; }
.tray-view[data-layout="card"] .tray-item-icon svg { width: 24px; height: 24px; }
.tray-view[data-layout="card"] .tray-item-text { width: 100%; }
.tray-view[data-layout="card"] .tray-item-unavailable { margin-left: 0; }
.tray-view[data-layout="pack"] { position: relative; overflow: hidden; }
.tray-view[data-layout="pack"] #tray-items:not([data-empty]) {
  position: relative; min-height: 131px; border-radius: 13px;
  background: radial-gradient(ellipse 50% 74% at 50% 37%, var(--surface-tinted), transparent);
}
.tray-view[data-layout="pack"] .tray-item {
  position: absolute; inset: var(--tray-item-y) auto auto calc(50% + var(--tray-item-x)); z-index: var(--tray-item-layer);
  width: min(195px, 75%); height: 57px; translate: -50% 0; transform: rotate(var(--tray-item-tilt));
  border-radius: 11px; border-color: var(--line-strong);
  background: linear-gradient(145deg,var(--surface-raised),var(--surface));
  box-shadow: 0 5px 16px rgb(var(--shadow-color) / .13), inset 0 1px var(--shine);
}
.tray-view[data-layout="pack"] .tray-item:nth-child(n+5) { opacity: 0; }
.tray-view[data-layout="pack"] .tray-item:nth-child(n+5) .tray-item-preview { display: none; }
.tray-view[data-layout="pack"] .tray-item-body { padding-inline: 11px; }
.tray-view[data-layout="pack"] :is(.tray-item-path,.tray-item-remove) { display: none; }
.tray-pack-drag {
  position: absolute; z-index: 6; inset: 10px auto 12px 50%; transform: translateX(-50%);
  display: grid; align-items: end; justify-items: center; padding-bottom: 5px;
  width: min(246px, 90%); border-radius: 10px; color: var(--accent); cursor: grab;
}
.tray-pack-drag:active { cursor: grabbing; }
.tray-pack-drag span {
  background: var(--surface-tinted); padding: 3px 10px; border: 1px solid var(--line-strong);
  border-radius: 15px; font-size: 11px;
}
.tray-pack-drag:hover span { background: var(--selected); }
.tray-actions {
  padding: 10px 16px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 8px;
  justify-content: space-between;
}
.tray-destination, .tray-transfer-actions { display: flex; align-items: center; gap: 7px; }
.tray-destination { min-width: 0; flex: 1; }
.tray-destination > div { display: grid; min-width: 0; }
.tray-destination > span { color: var(--accent); display: inline-flex; }
.tray-destination svg { width: 17px; height: 17px; }
.tray-destination > div span { font-size: 10px; color: var(--muted); }
#tray-destination-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-transfer-actions { flex: none; }
.tray-transfer-actions button { min-height: 32px; border: 1px solid var(--line); background: var(--surface-subtle); color: var(--ink); }
#tray-move { min-width: 87px; justify-content: center; color: var(--surface); background: var(--accent); border-color: transparent; }
#tray-move:not(:disabled):hover { color: var(--surface); background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.undo-file-drop { color: var(--accent); font-size: 11px; padding: 4px 6px; border-radius: 5px; }
.undo-file-drop:hover { background: var(--hover); }
#file-marquee { position: fixed; z-index: 13; pointer-events: none; border: 1px solid var(--focus);
  border-radius: 3px; background: color-mix(in srgb, var(--accent) 17%, transparent); }
html[data-file-gesture] { user-select: none; -webkit-user-select: none; }
#file-drag-stack { position: fixed; z-index: 14; inset: 0 auto auto 0; pointer-events: none;
  width: 162px; height: 55px; will-change: transform; }
#file-drag-stack[data-guide-drag] { z-index: 23; }
.file-drag-card {
  position: absolute; inset: 0 auto auto 0; width: 145px; height: 30px; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 7px; box-shadow: 0 3px 10px rgb(var(--shadow-color) / .16);
}
.file-drag-card span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.file-drag-card span:first-child { color: var(--accent); flex: none; }
#file-drag-label, #file-return-hint {
  position: absolute; inset: -15px 0 auto auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 6px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: 11px;
}
#file-return-hint { position: fixed; z-index: 14; inset: auto; pointer-events: none; }
html [data-drag-source] { opacity: .44; }
html [data-file-drop] {
  box-shadow: inset 0 0 0 2px var(--accent); background-color: var(--selected);
  outline: 2px solid var(--focus); outline-offset: -2px;
}
html [data-file-spring] { outline: 2px solid var(--accent); outline-offset: -2px; }
.content[data-file-drop-current] { box-shadow: inset 0 0 0 2px var(--focus); }
html[data-tray-reduced-motion] :is(#tray-glow,.tray-lamp-spot,#tray-count,.tray-badge-shape,.tray-badge-face,#tray-drop-label,.file-tray,.tray-tab-indicator,.tray-item-remove) {
  animation: none; transition: none;
}
