:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-2: #e7eef9;
  --card: rgba(255, 255, 255, 0.82);
  --card-strong: rgba(255, 255, 255, 0.94);
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.1);
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1220;
    --bg-2: #101a33;
    --card: rgba(12, 18, 32, 0.82);
    --card-strong: rgba(15, 23, 42, 0.92);
    --text: #e5edf7;
    --muted: #9fb0c8;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #60a5fa;
    --accent-strong: #3b82f6;
    --accent-soft: rgba(96, 165, 250, 0.12);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(96, 165, 250, 0.12), transparent 24%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.home,
.app-shell {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.center-card {
  width: min(680px, calc(100vw - 32px));
  min-height: min(70vh, 720px);
  margin: 32px auto;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  border-radius: 28px;
}

.hero,
.card,
.modal {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 32px;
  border-radius: 28px;
  text-align: center;
}

.hero-inner {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero h1 {
  font-size: clamp(2.7rem, 8vw, 5.6rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.lede {
  margin: 18px auto 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.primary-button,
.secondary-button,
.icon-button,
.chip-button,
.modal-button,
.text-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.button-reset {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  text-decoration: none;
  font-weight: 700;
}

.primary-button {
  margin-top: 28px;
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.25);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.chip-button:hover,
.modal-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 18px;
  margin-bottom: 14px;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.03em;
}

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

.icon-button {
  min-height: 42px;
  padding: 0 14px;
  background: var(--card-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.icon-button.danger {
  color: #dc2626;
}

.app-main {
  min-height: calc(100vh - 110px);
}

.empty-state,
.panel {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 24px;
}

.panel {
  margin-bottom: 18px;
}

.panel h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.04em;
}

.panel .subtle {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.center-stage {
  min-height: 58vh;
  display: grid;
  place-items: center;
}

.action-grid {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.p2p-launch {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.p2p-launch .secondary-button {
  min-width: 200px;
}

.chip-button {
  min-height: 72px;
  border: 1px solid var(--line);
  background: var(--card-strong);
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
}

.chip-button.primary {
  background: var(--accent);
  color: white;
}

.list {
  display: grid;
  gap: 14px;
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card-strong);
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  font-weight: 700;
  word-break: break-word;
}

.item-meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.item-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-strong);
  text-decoration: none;
  overflow: hidden;
}

.link-pill code {
  font-size: 0.9rem;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.56);
}

.modal {
  width: min(720px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border-radius: 24px;
  background: var(--card-strong);
  padding: 22px;
}

.modal h2 {
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.modal p {
  color: var(--muted);
  line-height: 1.65;
}

.modal-grid {
  display: grid;
  gap: 14px;
}

.modal-row {
  display: grid;
  gap: 10px;
}

.modal-row input,
.modal-row textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.modal-row textarea {
  min-height: 160px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.modal-button,
.text-button {
  min-height: 44px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.text-button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.delete-warning {
  display: grid;
  gap: 10px;
}

.delete-warning strong {
  color: #dc2626;
}

.share-list {
  display: grid;
  gap: 12px;
}

.share-row {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.share-row small {
  color: var(--muted);
}

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

.share-value {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.copy-block {
  width: 100%;
  text-align: left;
  word-break: break-all;
}

.share-count {
  color: var(--muted);
  font-size: 0.95rem;
}

.p2p-panel {
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.p2p-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.p2p-device {
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.95rem;
}

.p2p-panel .share-value {
  display: grid;
  gap: 8px;
}

.file-queue-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.file-queue {
  display: grid;
  gap: 10px;
}

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.queue-remove {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.share-file-box {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.share-file-box .name {
  font-weight: 700;
  word-break: break-word;
}

.share-text-box {
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: white;
  box-shadow: var(--shadow);
}

.loading {
  color: var(--muted);
}

@media (max-width: 760px) {
  .home,
  .app-shell {
    width: min(100vw - 20px, 1100px);
    padding-top: 10px;
  }

  .hero {
    min-height: calc(100vh - 20px);
    padding: 22px;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

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