:root {
  color-scheme: light;
  --ink: #14221c;
  --muted: #636f69;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --line: #d9d9cf;
  --green: #173d2e;
  --green-light: #dce8df;
  --orange: #bf3f1c;
  --orange-dark: #982c10;
  --shadow: 0 28px 70px rgba(30, 43, 35, 0.13);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 255, 255, 0.9), transparent 25%),
    linear-gradient(rgba(23, 61, 46, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 61, 46, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 44px 44px, 44px 44px, auto;
}

button, input, textarea { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.clipboard-helper { position: fixed; opacity: 0; pointer-events: none; }
body.modal-open { overflow: hidden; }

.page-shell {
  width: min(1280px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20, 34, 28, 0.15);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.brand b { color: var(--orange); }
.brand-mark { width: 34px; height: 34px; background: var(--green); display: grid; place-items: center; border-radius: 50%; }
.brand-mark svg { width: 25px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.sound-toggle { min-height: 38px; border: 1px solid rgba(20, 34, 28, 0.14); border-radius: 19px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: rgba(255, 253, 248, 0.65); cursor: pointer; font-size: 10px; font-weight: 700; }
.sound-toggle[aria-pressed="true"] { color: var(--green); border-color: #9eb4a8; background: var(--green-light); }
.sound-toggle svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle[aria-pressed="false"] .sound-waves, .sound-toggle[aria-pressed="true"] .sound-muted { display: none; }

.server-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c1a66f; box-shadow: 0 0 0 4px rgba(193, 166, 111, 0.15); }
.server-status.online .status-dot { background: #45a36b; box-shadow: 0 0 0 4px rgba(69, 163, 107, 0.14); }
.server-status.offline .status-dot { background: #c84835; box-shadow: 0 0 0 4px rgba(200, 72, 53, 0.14); }
.server-status.p2p .status-dot { background: #45a36b; box-shadow: 0 0 0 4px rgba(69, 163, 107, 0.14); }

.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(500px, 1fr);
  gap: clamp(56px, 8vw, 120px);
  align-items: center;
  padding: 68px 0 76px;
}

.intro { align-self: center; padding-left: clamp(0px, 3vw, 42px); }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: 0.16em; }
.eyebrow span { width: 28px; height: 2px; background: var(--orange); }

h1 {
  margin: 0;
  max-width: 580px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(66px, 6vw, 92px);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.055em;
}

h1 em { color: var(--orange); font-style: italic; }
.intro-copy { margin: 30px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; }

.feature-list { margin-top: 54px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.feature-list > div { display: flex; gap: 11px; padding-right: 12px; }
.feature-list > div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.feature-list span { color: var(--orange); font-size: 10px; font-weight: 800; margin-top: 3px; }
.feature-list p { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.feature-list b { font-size: 13px; }
.feature-list small { color: var(--muted); font-size: 10px; line-height: 1.4; white-space: nowrap; }

.transfer-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(20, 34, 28, 0.12);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.transfer-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border: 48px solid rgba(191, 63, 28, 0.035);
  border-radius: 50%;
  right: -110px;
  bottom: -120px;
  pointer-events: none;
}

.mode-tabs { height: 76px; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); background: #f4f2eb; }
.mode-tab { position: relative; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 700; }
.mode-tab + .mode-tab { border-left: 1px solid var(--line); }
.mode-tab svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode-tab.active { background: var(--card); color: var(--green); }
.mode-tab.active::after { content: ""; position: absolute; height: 3px; left: 28%; right: 28%; bottom: -1px; border-radius: 3px 3px 0 0; background: var(--orange); }

.card-body { min-height: 448px; padding: 34px 38px 30px; }
.static-notice { position: relative; z-index: 1; margin-bottom: 24px; padding: 13px 14px; border: 1px solid #d7c29d; border-radius: 12px; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; color: #5d4928; background: #fff8e9; }
.static-notice[hidden] { display: none; }
.static-notice > span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #9a6a22; font-family: Georgia, serif; font-weight: 800; }
.static-notice strong { color: var(--ink); font-size: 11px; }
.static-notice p { margin: 4px 0 7px; font-size: 10px; line-height: 1.55; }
.static-notice code { font-size: 0.95em; }
.static-notice a { min-height: 30px; display: inline-flex; align-items: center; color: var(--orange-dark); font-size: 10px; font-weight: 800; text-underline-offset: 2px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.step-label { color: var(--orange); font-size: 10px; font-weight: 850; letter-spacing: 0.14em; }
h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -0.025em; }
.limit-copy { margin-top: 19px; color: var(--muted); font-size: 10px; }

.nearby-devices { margin-bottom: 24px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #faf9f4; }
.peer-list { min-height: 92px; padding: 12px; display: flex; align-items: stretch; gap: 9px; overflow-x: auto; }
.peer-empty { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.peer-empty p { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.peer-empty b { color: var(--ink); font-size: 11px; }
.peer-empty small { font-size: 9px; }
.peer-radar { position: relative; width: 30px; height: 30px; flex: 0 0 auto; border: 1px solid #9bb2a6; border-radius: 50%; }
.peer-radar::before, .peer-radar::after { content: ""; position: absolute; border-radius: 50%; }
.peer-radar::before { inset: 7px; background: #4b9a68; }
.peer-radar::after { inset: -1px; border: 1px solid rgba(75, 154, 104, 0.4); animation: radar 1.8s infinite ease-out; }
.static-demo .peer-radar::after { animation: none; opacity: 0.35; }

.peer-button { min-width: 104px; max-width: 124px; min-height: 68px; padding: 8px 9px; border: 1px solid transparent; border-radius: 10px; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 8px; color: var(--ink); background: #fff; cursor: pointer; text-align: left; transition: border-color 150ms, background 150ms, transform 150ms; }
.peer-button:hover { transform: translateY(-1px); border-color: #9eb4a8; }
.peer-button.selected { border-color: var(--orange); background: #fff7f2; box-shadow: inset 0 0 0 1px rgba(191, 63, 28, 0.08); }
.peer-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: var(--green-light); }
.peer-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.peer-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.peer-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.peer-copy small { color: #2f764b; font-size: 8px; font-weight: 750; }
.peer-actions { min-height: 38px; padding: 0 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; }
.peer-actions[hidden], .upload-cancel[hidden] { display: none; }
.peer-actions button { min-height: 32px; border: 0; padding: 5px 10px; border-radius: 7px; color: var(--green); background: var(--green-light); cursor: pointer; font-size: 9px; font-weight: 800; }

.file-step-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.file-step-heading h3 { margin: 3px 0 0; font-size: 14px; }
.file-step-heading .limit-copy { margin: 0 0 2px; }

.drop-zone {
  min-height: 148px;
  border: 1.5px dashed #aeb8b2;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #faf9f4;
  cursor: pointer;
  transition: border-color 160ms, background 160ms, transform 160ms;
}

.drop-zone:not([aria-disabled="true"]):hover, .drop-zone:not([aria-disabled="true"]).dragging { border-color: var(--orange); background: #fff8f3; transform: translateY(-1px); }
.drop-zone[aria-disabled="true"] { cursor: not-allowed; opacity: 0.62; transform: none; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { font-size: 14px; }
.drop-zone > span:last-child { color: var(--muted); font-size: 12px; }
.drop-zone u { color: var(--orange); font-weight: 700; text-underline-offset: 2px; }
.drop-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 3px; border-radius: 50%; color: var(--green); background: var(--green-light); }
.drop-icon svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.selected-files { margin-top: 17px; }
.file-list-header { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.file-list-header button, .text-button { border: 0; padding: 0; color: var(--orange); background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.file-list-header button { min-height: 28px; padding: 4px; margin: -4px; }
.file-list-header button:disabled, .remove-file:disabled { cursor: not-allowed; opacity: 0.4; }
.file-list, .download-list { list-style: none; margin: 0; padding: 0; }
.file-list { max-height: 116px; overflow: auto; border-top: 1px solid var(--line); }
.file-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 32px; gap: 10px; align-items: center; min-height: 56px; border-bottom: 1px solid var(--line); }
.file-type { width: 31px; height: 34px; display: grid; place-items: center; border-radius: 5px; color: var(--green); background: var(--green-light); font-size: 8px; font-weight: 850; text-transform: uppercase; }
.file-details { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.file-size { color: var(--muted); font-size: 10px; }
.file-progress { color: var(--orange); font-size: 10px; font-weight: 750; }
.remove-file { width: 32px; height: 32px; border: 0; background: transparent; color: #7b847f; cursor: pointer; padding: 2px; font-size: 18px; line-height: 1; }

.primary-button, .secondary-button {
  min-height: 52px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 150ms, background 150ms, opacity 150ms;
}

.primary-button { width: 100%; margin-top: 22px; padding: 0 20px; border: 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: #fff; background: var(--orange); box-shadow: 0 8px 22px rgba(191, 63, 28, 0.2); }
.primary-button:hover:not(:disabled) { background: var(--orange-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.42; box-shadow: none; }
.primary-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.primary-button.loading svg { animation: nudge 850ms infinite alternate ease-in-out; }

.card-footnote { position: relative; z-index: 1; min-height: 48px; padding: 0 24px; display: flex; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid var(--line); color: #59675f; background: #f7f5ef; font-size: 10px; text-align: center; }
.card-footnote svg { width: 16px; fill: none; stroke: #5f7168; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.success-view { padding: 22px 0 6px; text-align: center; }
.success-badge { display: inline-flex; align-items: center; gap: 7px; color: #34734f; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.success-badge span, .ready-icon { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; background: #459563; }
.ready-icon.pending { background: #9a7740; }
.result-kicker { margin: 18px 0 10px; color: var(--muted); font-size: 12px; }
.transfer-code { display: flex; justify-content: center; gap: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(27px, 4.1vw, 36px); font-weight: 850; letter-spacing: 0.02em; color: var(--green); }
.transfer-code span { min-width: 0.72em; padding-bottom: 5px; border-bottom: 2px solid #c7d3cb; }
.transfer-code span:nth-child(4) { margin-right: 7px; }
.expire-copy { min-height: 16px; margin: 12px 0 22px; color: var(--muted); font-size: 10px; }
.share-field { height: 46px; display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #faf9f5; }
.share-field input { min-width: 0; flex: 1; border: 0; padding: 0 10px; color: var(--muted); background: transparent; outline: 0; font-size: 11px; }
.share-field button { border: 0; border-radius: 6px; padding: 0 14px; color: var(--green); background: var(--green-light); cursor: pointer; font-size: 11px; font-weight: 800; }
.result-actions { display: grid; grid-template-columns: 0.7fr 1.3fr; gap: 10px; margin-top: 12px; }
.result-actions .primary-button { margin: 0; }
.secondary-button { border: 1px solid var(--line); background: #fff; }
.secondary-button:hover { background: #f4f3ee; }

.receive-heading { margin-bottom: 38px; }
.code-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
.code-input { width: 100%; height: 68px; border: 1px solid var(--line); border-radius: 11px; padding: 0 18px; outline: 0; color: var(--green); background: #faf9f5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 30px; font-weight: 850; text-align: center; letter-spacing: 0.28em; text-transform: uppercase; transition: border-color 150ms, box-shadow 150ms; }
.code-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(191, 63, 28, 0.1); }
.receive-result { margin-top: -6px; }
.receive-summary { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); text-align: left; }
.receive-summary > div { display: flex; flex-direction: column; gap: 4px; }
.receive-summary b { font-size: 14px; }
.receive-summary small { color: var(--muted); font-size: 10px; }
.download-list { max-height: 204px; overflow: auto; }
.download-item { min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); text-align: left; }
.download-item > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.download-action { min-height: 34px; padding: 0 13px; border-radius: 7px; display: inline-flex; align-items: center; color: #fff; background: var(--green); text-decoration: none; font-size: 10px; font-weight: 750; }
.download-action[aria-disabled="true"] { opacity: 0.45; }
.text-button { margin-top: 20px; }
.upload-cancel { width: 100%; min-height: 36px; margin-top: 7px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 26px; max-width: min(420px, calc(100% - 32px)); transform: translate(-50%, 24px); border-radius: 10px; padding: 11px 16px; color: #fff; background: var(--ink); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); opacity: 0; pointer-events: none; font-size: 12px; transition: opacity 180ms, transform 180ms; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #9d3827; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; padding: 20px; display: grid; place-items: center; background: rgba(10, 23, 17, 0.5); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(430px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: auto; padding: 28px; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 18px; color: var(--ink); background: var(--card); box-shadow: 0 28px 80px rgba(10, 23, 17, 0.3); }
.modal-card > label { display: block; margin: 22px 0 8px; color: var(--muted); font-size: 10px; font-weight: 750; }
.modal-card textarea { width: 100%; min-height: 130px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 12px; outline: 0; color: var(--ink); background: #faf9f5; line-height: 1.6; }
.modal-card textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(191, 63, 28, 0.1); }
.modal-actions { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 10px; margin-top: 18px; }
.modal-actions .primary-button { margin: 0; }
.incoming-card { text-align: center; }
.incoming-icon { width: 50px; height: 50px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); font-size: 25px; }
.incoming-from { margin: 8px 0 18px; color: var(--muted); font-size: 11px; }
.incoming-content { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 13px; background: #faf9f5; font-size: 12px; line-height: 1.6; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }

footer { min-height: 54px; border-top: 1px solid rgba(20, 34, 28, 0.15); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.12em; }

button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(191, 63, 28, 0.3); outline-offset: 2px; }
.drop-zone:has(input:focus-visible) { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(191, 63, 28, 0.1); }

@keyframes nudge { from { transform: translateX(-2px); } to { transform: translateX(3px); } }
@keyframes radar { from { transform: scale(0.65); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }

@media (max-width: 960px) {
  .page-shell { width: min(680px, calc(100% - 40px)); }
  .main-layout { grid-template-columns: 1fr; gap: 48px; padding: 54px 0 64px; }
  .intro { padding: 0; text-align: center; }
  .eyebrow { justify-content: center; }
  h1 { margin: 0 auto; font-size: clamp(64px, 13vw, 92px); }
  .feature-list { max-width: 500px; margin: 40px auto 0; text-align: left; }
}

@media (max-width: 560px) {
  .page-shell { width: calc(100% - 24px); }
  .site-header { min-height: 70px; }
  .brand { font-size: 10px; }
  .brand-mark { width: 30px; height: 30px; }
  .header-actions { gap: 12px; }
  .sound-toggle { width: 40px; min-height: 40px; padding: 0; justify-content: center; }
  .sound-toggle span { display: none; }
  .server-status > span:last-child { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .main-layout { padding: 38px 0 48px; gap: 38px; }
  h1 { font-size: clamp(52px, 18vw, 76px); }
  .intro-copy { margin-top: 22px; font-size: 15px; }
  .feature-list { display: none; }
  .transfer-card { border-radius: 18px; }
  .mode-tabs { height: 65px; }
  .mode-tab { font-size: 13px; }
  .card-body { min-height: 426px; padding: 28px 20px 24px; }
  .panel-heading { margin-bottom: 20px; }
  .limit-copy { max-width: 120px; text-align: right; }
  .peer-list { min-height: 86px; }
  .drop-zone { min-height: 142px; }
  .file-item { grid-template-columns: 32px minmax(0, 1fr) 32px; }
  .file-progress { display: none; }
  .transfer-code { font-size: 25px; gap: 3px; }
  .result-actions { grid-template-columns: 1fr 1.4fr; }
  footer { min-height: 48px; justify-content: center; }
  footer span:last-child { display: none; }
  .modal-card { padding: 24px 20px; }
}

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