:root {
  --background: #ffffff;
  --surface: #ffffff;
  --ink: #183321;
  --muted: #66766a;
  --line: rgba(24, 51, 33, 0.16);
  --line-strong: rgba(24, 51, 33, 0.28);
  --accent: #3d8a5c;
  --green: #277a4c;
  --red: #b43b2c;
  --radius: 24px;
  --sans: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px;
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  place-items: center;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(61, 138, 92, 0.42);
  outline-offset: 3px;
}

.send-page,
.receive-page,
.invalid-page {
  width: min(100%, 520px);
}

.send-panel,
.receive-panel,
.invalid-panel {
  width: 100%;
}

.upload-box {
  overflow: hidden;
  background: var(--surface);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-box:has(.drop-zone:hover),
.upload-box:has(.drop-zone.is-dragging) {
  background: #f3faf1;
  border-color: var(--accent);
}

.upload-box:has(.file-selection:not([hidden])) {
  border-style: solid;
}

.drop-zone {
  display: flex;
  min-height: 310px;
  padding: 32px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  cursor: pointer;
}

.drop-zone > svg {
  width: 42px;
  height: 42px;
  color: var(--accent);
}

.drop-zone > span {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.drop-zone.is-dragging {
  background: #e8f5e6;
}

.file-selection {
  display: flex;
  max-height: 330px;
  padding: 12px;
  flex-direction: column;
}

.file-list {
  padding: 0;
  margin: 0;
  overflow: auto;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 8px 8px;
  border-bottom: 1px solid rgba(23, 25, 22, 0.08);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-type {
  display: grid;
  width: 34px;
  height: 38px;
  color: var(--muted);
  background: var(--background);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.5rem;
  font-weight: 700;
  place-items: center;
  text-transform: uppercase;
}

.file-info {
  min-width: 0;
}

.file-name {
  display: block;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.file-remove {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
  place-items: center;
}

.file-remove:hover {
  color: var(--red);
  background: rgba(180, 59, 44, 0.08);
}

.file-remove svg {
  width: 14px;
  height: 14px;
}

.add-files,
.text-button {
  padding: 6px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 0.73rem;
  font-weight: 590;
  text-decoration: none;
  cursor: pointer;
}

.add-files {
  align-self: flex-start;
  margin: 8px 8px 2px;
}

.add-files:hover,
.text-button:hover {
  color: var(--ink);
}

.main-button,
.download-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.main-button {
  margin-top: 14px;
}

.main-button:hover:not(:disabled),
.download-button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

.main-button:disabled,
.download-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.share-view {
  width: 100%;
}

.link-row {
  display: flex;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.link-row input {
  min-width: 0;
  padding: 0 10px;
  flex: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  outline: 0;
}

.link-row button {
  min-width: 84px;
  min-height: 42px;
  padding: 0 15px;
  color: var(--surface);
  background: var(--ink);
  border: 0;
  border-radius: 9px;
  font-size: 0.73rem;
  font-weight: 620;
  cursor: pointer;
}

.link-row button:hover {
  background: var(--accent);
}

.status {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.progress-block {
  width: 100%;
  margin-top: 17px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.progress-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  background: rgba(23, 25, 22, 0.09);
  border-radius: 99px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 160ms ease;
}

.done-view {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.done-view p {
  margin: 16px 0 5px;
  font-size: 1rem;
  font-weight: 620;
}

.done-mark {
  display: grid;
  width: 62px;
  height: 62px;
  color: var(--green);
  background: rgba(39, 122, 76, 0.1);
  border-radius: 50%;
  place-items: center;
  animation: pop-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1.2);
}

.done-mark svg {
  width: 32px;
  height: 32px;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.75);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.error {
  margin: 12px 0 0;
  color: var(--red);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
}

.receive-panel {
  min-height: 300px;
}

.receive-panel > div {
  min-height: 242px;
}

.receive-panel #receive-ready {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.download-button {
  min-height: 68px;
  font-size: 1rem;
}

.receive-file-names {
  max-height: 140px;
  padding: 0;
  margin: 0 0 16px;
  overflow: auto;
  list-style: none;
}

.receive-file-names li {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  padding: 3px 4px;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 560;
  text-align: center;
  white-space: nowrap;
}

.receive-file-names .file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receive-file-size {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 500;
}

.loading {
  display: grid;
  place-items: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

#receive-active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#receive-active .status {
  margin-top: 0;
}

.failure-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.failure-view > p:first-child {
  margin: 0;
  font-size: 1rem;
  font-weight: 620;
}

.failure-copy {
  max-width: 340px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.invalid-panel {
  padding: 42px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.invalid-panel p {
  margin: 0 0 22px;
  font-size: 1rem;
  font-weight: 600;
}

.invalid-panel .main-button {
  margin-top: 0;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 20;
  max-width: min(90vw, 360px);
  padding: 10px 14px;
  color: var(--surface);
  background: var(--ink);
  border-radius: 10px;
  font-size: 0.72rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  padding: 14px;
  color: var(--surface);
  background: var(--red);
  border-radius: 10px;
  text-align: center;
}

@media (max-width: 520px) {
  body {
    padding: 16px;
  }

  .drop-zone {
    min-height: 280px;
  }

  .receive-panel {
    padding: 0;
  }
}

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