:root {
  --ink: #14181e;
  --ink-soft: #53565a;
  --muted: #858686;
  --line: #cacccd;
  --paper: #eff0ef;
  --white: #ffffff;
  --atlantic: #173a5e;
  --atlantic-mid: #325a86;
  --atlantic-base: #638fc6;
  --danger: #9c161f;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }
html:not(.ready) main { display: none; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(20, 24, 30, 0.14) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--ink);
  font: 16px/1.45 system-ui, sans-serif;
}

a { color: var(--atlantic-mid); }

.top {
  background: var(--ink);
  color: var(--paper);
  padding: 0.85rem 1.5rem;
}

.mark {
  color: var(--paper);
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.field span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field em {
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--atlantic-mid);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 0.7rem 0.75rem;
  font: inherit;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--atlantic-mid);
  outline-offset: 2px;
}

.composer {
  display: grid;
  gap: 1.15rem;
  padding: 1.35rem 1.35rem 1.1rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(20, 24, 30, 0.06);
}

.composer-head h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.composer-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(14rem, 0.9fr);
  gap: 0.9rem 1rem;
}

.composer .fine {
  margin: 0;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.beam {
  position: relative;
  border-radius: 16px;
  padding: 1px;
  overflow: hidden;
  background: var(--line);
}

.beam::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: conic-gradient(from var(--beam), transparent 0 62%, var(--atlantic-base) 78%, var(--atlantic) 86%, transparent 100%);
  animation: beam 5s linear infinite;
}

.drop {
  position: relative;
  margin: 0;
  padding: 1.7rem 1rem 1.45rem;
  border: 0;
  border-radius: 15px;
  background:
    linear-gradient(var(--white), var(--white)) padding-box,
    var(--paper);
  text-align: center;
}

@property --beam {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes beam {
  to { --beam: 360deg; }
}

.drop.is-over { border-style: solid; background: #d6e1f3; }

.drop-title {
  margin: 0;
  font-size: 1.25rem;
}

.drop-sub {
  margin: 0.25rem 0 0.9rem;
  color: var(--muted);
}

button, .button {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 0.95rem;
  background: var(--ink);
  color: var(--paper);
  font: 600 0.92rem system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 10px 30px rgba(99, 143, 198, 0.35);
}

button:disabled { opacity: 0.55; cursor: progress; }

.text-button {
  margin-top: 1rem;
  background: transparent;
  color: var(--atlantic);
  border: 1px solid var(--line);
}

#folder {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.alert { margin: 0.9rem 0 0; color: var(--danger); }

.fine { margin: 1.2rem 0 0; color: var(--muted); font-size: 0.88rem; }

.queue { margin-top: 1.5rem; }

.handoff {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem 1rem;
  align-items: end;
  padding: 0.9rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.handoff .label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mono {
  margin: 0.15rem 0 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

#queue-eta {
  margin: 0.9rem 0 0;
  color: var(--atlantic-mid);
  font-variant-numeric: tabular-nums;
}

.queue-item {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: 0.2rem 0.8rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.pos, .eta, .meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.pos, .eta { font-variant-numeric: tabular-nums; }
.name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eta { color: var(--atlantic-mid); text-align: right; }
.queue-item[data-status="failed"] .eta { color: var(--danger); }

.bar {
  grid-column: 2 / -1;
  height: 3px;
  border-radius: 99px;
  background: #d6e1f3;
  overflow: hidden;
}

.bar span { display: block; height: 100%; background: var(--atlantic-base); }

.gate, .clip {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.gate {
  max-width: 24rem;
  display: grid;
  gap: 0.9rem;
  padding: 1.25rem;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(20, 24, 30, 0.06);
}
.gate h1 { margin: 0; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; }
.gate .field { margin-top: 0.2rem; }
.gate-title { display: flex; align-items: center; gap: 0.55rem; }
.gate-title .icon { width: 1.2rem; height: 1.2rem; color: var(--atlantic); }

.share-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 1.25rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 1.35rem 1.4rem 1.2rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(20, 24, 30, 0.06);
}
.share-kicker {
  margin: 0 0 0.28rem;
  color: var(--atlantic-mid);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.share-head h1 {
  margin: 0;
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.share-facts { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.9rem; }
.fact {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.65rem 0.32rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f7f7;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}
.fact .icon { width: 0.95rem; height: 0.95rem; color: var(--atlantic); }
.share-actions { justify-self: end; }
.share-status {
  grid-column: 1 / -1;
  margin: 0.35rem 0 0;
  color: var(--atlantic-mid);
  font-variant-numeric: tabular-nums;
}
.download-all { display: inline-flex; align-items: center; gap: 0.45rem; }
.icon { width: 1.05rem; height: 1.05rem; display: block; flex: none; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.clip { margin-top: 0.8rem; }
.clip h2 { margin: 0 0 0.6rem; font-size: 1rem; font-weight: 600; }
.clip video { width: 100%; background: #14181e; border-radius: 8px; }
.clip .row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; margin-top: 0.55rem; }

.copied { color: var(--atlantic-mid); font-size: 0.85rem; }

body[data-view="share"] #home { display: none; }

.links { margin-top: 2rem; }
.links h2 { margin: 0 0 0.7rem; font-size: 1.15rem; font-weight: 600; }

.table-card {
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20, 24, 30, 0.06);
}

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.links th:nth-child(1), .links td:nth-child(1) { width: 8.5rem; }
.links th:nth-child(2), .links td:nth-child(2) { width: 22%; }
.links th:nth-child(4), .links td:nth-child(4) { width: 11rem; }
.file-table th:nth-child(1), .file-table td:nth-child(1) { width: 7.2rem; }
.file-table th:nth-child(3), .file-table td:nth-child(3) { width: 7.5rem; }
.file-table th:nth-child(4), .file-table td:nth-child(4) { width: 3.6rem; text-align: right; }
th {
  padding: 0.7rem 0.9rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 0.75rem 0.9rem;
  border-top: 1px solid #eff0ef;
  vertical-align: middle;
}
.links td:nth-child(3),
.file-table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
tbody tr:hover td { background: rgba(214, 225, 243, 0.35); }
td.empty { color: var(--muted); text-align: center; padding: 1.4rem; }

.previews { display: flex; align-items: center; }
.previews img, .thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--white);
  background: #d6e1f3;
  box-shadow: 0 4px 12px rgba(20, 24, 30, 0.12);
}
.previews img + img { margin-left: -18px; }
.shot { position: relative; width: 96px; height: 60px; border: 0; padding: 0; background: transparent; box-shadow: none; cursor: pointer; }
.shot img { width: 96px; height: 60px; object-fit: cover; border-radius: 8px; display: block; }
.play-badge {
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: rgba(20, 24, 30, 0.78);
  color: #fff;
  pointer-events: none;
}
.play-badge .icon { width: 0.72rem; height: 0.72rem; margin-left: 1px; }
.file-fallback {
  width: 96px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #d6e1f3;
  color: var(--atlantic);
}
.file-fallback .icon { width: 1.25rem; height: 1.25rem; }
.file-name { margin: 0; font-weight: 600; }
.size { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--atlantic);
  border: 1px solid var(--line);
  box-shadow: none;
}
.row-download .icon { width: 1rem; height: 1rem; }
.link-cell { display: flex; gap: 0.5rem; align-items: center; min-width: 0; }
.link-cell span {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}
.time { white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ghost {
  background: var(--white);
  color: var(--atlantic);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}
.player-wrap { margin: 0 0 0.8rem; }
.player-wrap video { width: 100%; background: #14181e; border-radius: 12px; }
.file-table td:nth-child(2) { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 560px) {
  .composer-fields { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .share-head { grid-template-columns: 1fr; padding: 1.1rem 1rem 1rem; }
  .share-actions { justify-self: start; }
  .composer { padding: 1.1rem 1rem 0.95rem; }
  .handoff { grid-template-columns: 1fr; }
  .queue-item { grid-template-columns: 2rem minmax(0, 1fr); }
  .eta { grid-column: 2; text-align: left; }
  .bar { grid-column: 2; }
  .links table, .links thead, .links tbody, .links tr, .links td {
    display: block;
    width: auto;
  }
  .links table, .links tr { width: 100%; }
  .links th:nth-child(1), .links td:nth-child(1),
  .links th:nth-child(2), .links td:nth-child(2),
  .links th:nth-child(4), .links td:nth-child(4) { width: auto; }
  .links thead { display: none; }
  .links tr {
    display: grid;
    grid-template-columns: 6.6rem minmax(0, 1fr);
    gap: 0.2rem 0.75rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-top: 1px solid #eff0ef;
  }
  .links td { border: 0; padding: 0; min-width: 0; white-space: normal; overflow: visible; }
  .previews img { width: 52px; height: 36px; }
  .previews img + img { margin-left: -14px; }
  .links td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; }
  .links td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .links td:nth-child(4) { grid-column: 2; grid-row: 2; }
  .links td:nth-child(3) { grid-column: 2; grid-row: 3; }
}

@media (max-width: 520px) {
  .file-table, .file-table thead, .file-table tbody, .file-table tr, .file-table td {
    display: block;
    width: auto;
  }
  .file-table, .file-table tr { width: 100%; }
  .file-table th, .file-table td { width: auto; }
  .file-table thead { display: none; }
  .file-table tr {
    display: grid;
    grid-template-columns: 6.6rem minmax(0, 1fr);
    gap: 0.2rem 0.75rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-top: 1px solid #eff0ef;
  }
  .file-table td { border: 0; padding: 0; min-width: 0; white-space: normal; overflow: visible; }
  .file-table td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; }
  .file-table td:nth-child(2) { grid-column: 2; grid-row: 1; white-space: normal; }
  .file-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .file-table td:nth-child(4) { grid-column: 2; grid-row: 3; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .beam::before { animation: none; }
}
