:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-2: #22252b;
  --line: #333741;
  --line-strong: #454a56;
  --text: #f4f5f7;
  --muted: #a6adbb;
  --accent: #2f9e8f;
  --accent-soft: rgba(47, 158, 143, 0.15);
  --accent-2: #e8c468;
  --danger: #e35d5d;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 300px;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

button:hover,
.button:hover {
  border-color: var(--line-strong);
  background: #292d34;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:focus-visible,
.button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(47, 158, 143, 0.72);
  outline-offset: 3px;
}

button:disabled,
.button.disabled {
  opacity: 0.5;
  pointer-events: none;
}

svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(16px, 4vw, 42px);
  background: #101114;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.status-pill {
  min-height: 30px;
  max-width: min(48vw, 360px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill.live {
  border-color: rgba(47, 158, 143, 0.42);
  background: rgba(47, 158, 143, 0.08);
  color: #bcece5;
}

.status-pill.live .status-dot {
  background: #35d07f;
}

.status-pill.expired {
  border-color: rgba(227, 93, 93, 0.4);
  color: #ffb4b4;
}

.status-pill.relay {
  border-color: rgba(232, 196, 104, 0.42);
  background: rgba(232, 196, 104, 0.08);
  color: #eadba8;
}

.status-pill.relay .status-dot {
  background: var(--accent-2);
}

.home-main,
.share-main,
.expired-main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) clamp(16px, 4vw, 30px);
}

.home-main {
  width: min(680px, 100%);
  display: grid;
  align-content: center;
  gap: 24px;
}

.hero {
  max-width: 560px;
  display: grid;
  gap: 8px;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 6vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero-copy {
  max-width: 520px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.drop-zone {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(47, 158, 143, 0.08);
}

.drop-zone.dragging {
  transform: none;
}

.drop-content {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.drop-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 158, 143, 0.42);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.drop-icon svg {
  width: 25px;
  height: 25px;
}

.drop-content strong {
  font-size: 18px;
}

.drop-content span {
  color: var(--muted);
  font-size: 14px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #061a17;
  font-weight: 700;
}

.primary-button:hover {
  border-color: #3bb3a3;
  background: #3bb3a3;
}

.share-main {
  display: grid;
  align-content: start;
  gap: 18px;
}

.share-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 8px;
}

.share-title {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.share-title h1 {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.share-title p {
  color: var(--muted);
  line-height: 1.5;
}

.share-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
  box-shadow: var(--shadow);
}

.share-url {
  min-width: 0;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121317;
  color: var(--muted);
  padding: 0 12px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(232, 196, 104, 0.28);
  border-radius: 8px;
  background: rgba(232, 196, 104, 0.07);
  color: #e9d9a5;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
}

.transfer-mode-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
}

.transfer-mode-card.direct {
  border-color: rgba(47, 158, 143, 0.4);
  background: rgba(47, 158, 143, 0.07);
}

.transfer-mode-card.relayed {
  border-color: rgba(232, 196, 104, 0.34);
  background: rgba(232, 196, 104, 0.06);
}

.mode-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--accent-2);
}

.transfer-mode-card.direct .mode-icon {
  border-color: rgba(47, 158, 143, 0.4);
  background: rgba(47, 158, 143, 0.12);
  color: #aee9e0;
}

.mode-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.mode-copy strong {
  font-size: 14px;
}

.mode-copy > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mode-switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.mode-switch input {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  width: 38px;
  height: 22px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mode-switch > span {
  position: relative;
  width: 38px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #121317;
  transition: border-color 140ms ease, background 140ms ease;
  pointer-events: none;
}

.mode-switch > span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 140ms ease, background 140ms ease;
}

.mode-switch input:checked + span {
  border-color: rgba(232, 196, 104, 0.7);
  background: rgba(232, 196, 104, 0.16);
}

.mode-switch input:checked + span::after {
  background: var(--accent-2);
  transform: translateX(16px);
}

.mode-switch input:focus-visible + span {
  outline: 2px solid rgba(47, 158, 143, 0.72);
  outline-offset: 3px;
}

.mode-switch em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.notice svg {
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.files-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.files-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 15px;
}

.files-header h2 {
  font-size: 16px;
}

.file-count {
  color: var(--muted);
  font-size: 12px;
}

.file-list {
  display: grid;
}

.file-row {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 11px 15px;
}

.file-row + .file-row {
  border-top: 1px solid var(--line);
}

.file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--accent-2);
}

.file-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.file-name {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.download-button {
  min-width: 104px;
}

.file-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.copy-file-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.empty-files {
  padding: 36px 18px;
  color: var(--muted);
  text-align: center;
}

.expired-main {
  display: grid;
  place-items: center;
}

.expired-card {
  width: min(520px, 100%);
  display: grid;
  justify-items: start;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 38px);
}

.expired-card h1 {
  font-size: clamp(32px, 7vw, 48px);
  line-height: 1.05;
}

.expired-card p {
  color: var(--muted);
  line-height: 1.6;
}

.error-banner {
  border: 1px solid rgba(227, 93, 93, 0.45);
  border-radius: 7px;
  background: rgba(227, 93, 93, 0.1);
  color: #ffb4b4;
  padding: 10px 12px;
  font-size: 13px;
}

.footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px clamp(16px, 4vw, 42px);
  color: var(--muted);
  font-size: 12px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 11, 0.7);
}

.busy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 700;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(100vw - 30px);
  border: 1px solid rgba(47, 158, 143, 0.5);
  border-radius: 7px;
  background: rgba(25, 27, 32, 0.97);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  color: #c9f4ed;
  font-size: 13px;
  font-weight: 700;
  transform: translateX(-50%);
  animation: toast-in 180ms ease both;
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 7px); }
}

@media (max-width: 720px) {
  .home-main {
    align-content: start;
  }

  .share-heading {
    align-items: start;
    flex-direction: column;
  }

  .share-actions {
    width: 100%;
    justify-content: stretch;
  }

  .share-actions > * {
    flex: 1 1 auto;
  }

  .link-card {
    grid-template-columns: 1fr;
  }

  .share-url {
    min-height: 40px;
  }
}

@media (max-width: 520px) {
  .topbar {
    min-height: 60px;
  }

  .brand-word {
    display: none;
  }

  .home-main,
  .share-main,
  .expired-main {
    padding-top: 28px;
  }

  .drop-zone {
    min-height: 200px;
    padding: 20px;
  }

  .file-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .file-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .download-button {
    flex: 1 1 auto;
  }

  .transfer-mode-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mode-switch {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

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