:root {
  --bg: #070b14;
  --surface: rgba(15, 23, 42, 0.72);
  --surface-strong: rgba(15, 23, 42, 0.9);
  --border: rgba(148, 163, 184, 0.16);
  --border-hover: rgba(34, 211, 238, 0.45);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #6366f1;
  --success: #10b981;
  --danger: #f43f5e;
  --radius: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Ambient background orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.24;
  pointer-events: none;
  z-index: -1;
}
.orb-1 {
  width: 440px;
  height: 440px;
  background: var(--accent);
  top: -140px;
  left: -100px;
}
.orb-2 {
  width: 480px;
  height: 480px;
  background: var(--accent-2);
  bottom: -160px;
  right: -120px;
}

/* Topbar */
.topbar {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(99, 102, 241, 0.25));
  border: 1px solid rgba(34, 211, 238, 0.35);
  display: grid;
  place-items: center;
  color: var(--accent);
}
.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-text strong {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.brand-text small {
  font-size: 0.72rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zk-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  font-size: 0.76rem;
  font-weight: 600;
}
.zk-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Main container */
.container {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 20px;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff 20%, #a5f3fc 65%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.hero p {
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Mode tabs */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.mode-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mode-tab:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.mode-tab.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(99, 102, 241, 0.14));
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 10px 25px rgba(0, 0, 0, 0.25);
}
.tab-title {
  font-weight: 700;
  font-size: 0.98rem;
}
.tab-desc {
  font-size: 0.78rem;
  color: var(--muted);
}

/* Glass card */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(2, 6, 23, 0.3);
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.06);
}
.dropzone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.dropzone-icon svg {
  width: 26px;
  height: 26px;
}
.dropzone-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}
.dropzone-hint {
  color: var(--muted);
  font-size: 0.84rem;
}

/* Selected files */
.selected-files {
  margin-top: 18px;
}
.selected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}
.file-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.file-item-size {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Options */
.options-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-full {
  grid-column: 1 / -1;
}
.field label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.field input,
.field select {
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

/* Buttons */
.action-area {
  margin-top: 20px;
}

.btn-primary {
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04101d;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  opacity: 0.95;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: rgba(34, 211, 238, 0.2);
}

.btn-ghost {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.4);
}

.btn-danger {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.22);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover {
  text-decoration: underline;
}

/* Progress */
.progress-box {
  margin-top: 18px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.15s ease;
}

/* Share box */
.share-box {
  margin-top: 8px;
}
.share-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--accent);
  margin-bottom: 16px;
}

.share-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 22px;
  align-items: start;
}

.qr-wrapper {
  width: 190px;
  height: 190px;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.qr-wrapper svg {
  width: 100%;
  height: 100%;
  display: block;
}

.share-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.label-small {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.room-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.link-row {
  display: flex;
  gap: 8px;
}
.link-row input {
  flex: 1;
  min-width: 0;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.meta-note {
  font-size: 0.84rem;
  color: var(--muted);
}

.peers-box {
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.peers-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.peers-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
}
.peer-empty {
  color: var(--muted);
  font-style: italic;
}
.peer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* Join bar */
.join-bar {
  margin-top: 18px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.join-text {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
}
.join-text span {
  color: var(--muted);
  font-size: 0.8rem;
}
.join-form {
  display: flex;
  gap: 8px;
}
.join-form input {
  width: 130px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  font-weight: 700;
}
.join-form input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Receive cards */
.receive-card {
  max-width: 580px;
  margin: 24px auto;
}
.receive-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.receive-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.file-card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.file-card-name {
  font-weight: 700;
  font-size: 1.02rem;
  word-break: break-word;
}
.file-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.alert-error {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fecdd3;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.receive-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Footer */
.footer {
  padding: 20px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer a {
  color: var(--muted);
  text-decoration: none;
}
.footer a:hover {
  color: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-strong);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.hidden {
  display: none !important;
}

@media (max-width: 680px) {
  .mode-tabs,
  .options-grid,
  .share-layout {
    grid-template-columns: 1fr;
  }
  .qr-wrapper {
    margin: 0 auto;
  }
  .join-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .join-form input {
    flex: 1;
  }
}
