:root {
  color-scheme: dark;
  --bg: #06162b;
  --bg-deep: #031022;
  --panel: #0d2038;
  --panel-raised: #122944;
  --panel-soft: #0a1b31;
  --line: #28496b;
  --line-soft: rgba(82, 126, 168, .22);
  --text: #edf4ff;
  --muted: #96adca;
  --muted-strong: #bfd0e5;
  --mint: #42d4bd;
  --mint-deep: #13a998;
  --blue: #4c9bff;
  --amber: #f6bd46;
  --danger: #ff6f78;
  --shadow: 0 24px 60px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg-deep); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 72% -8%, rgba(25, 88, 135, .22), transparent 34rem), var(--bg-deep); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: flex; }
.rail { position: sticky; top: 0; width: 156px; height: 100vh; flex: 0 0 156px; padding: 52px 12px 20px; background: rgba(3, 16, 34, .82); border-right: 1px solid rgba(77, 119, 160, .16); display: flex; flex-direction: column; align-items: stretch; }
.brand-mark { width: 44px; height: 44px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 14px; color: var(--mint); background: rgba(61, 212, 189, .1); border: 1px solid rgba(61, 212, 189, .3); font-size: 24px; }
.rail-label { text-align: center; color: var(--muted-strong); font-size: 14px; letter-spacing: .12em; }
.rail-status { margin-top: auto; padding: 14px 12px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(16, 41, 68, .6); color: var(--muted-strong); font-size: 13px; }
.rail-status i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(66, 212, 189, .1); }
.rail-status small { display: block; padding-top: 7px; color: var(--muted); font-size: 11px; }
.page { flex: 1 1 auto; width: auto; max-width: 1320px; min-width: 0; margin: 0 auto; padding: 64px 48px 28px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 12px; color: var(--mint); font-size: 11px; letter-spacing: .2em; font-weight: 700; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.045em; }
.subtitle { margin-top: 12px; color: var(--muted); font-size: 16px; }
.header-pill { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; color: var(--muted-strong); border: 1px solid var(--line-soft); border-radius: 999px; font-size: 12px; white-space: nowrap; }
.pulse-dot, .state-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px rgba(76, 155, 255, .1); }
.state-dot.ready { background: var(--mint); box-shadow: 0 0 0 5px rgba(66, 212, 189, .1); }
.state-dot.warn { background: var(--amber); box-shadow: 0 0 0 5px rgba(246, 189, 70, .1); }
.state-dot.danger { background: var(--danger); box-shadow: 0 0 0 5px rgba(255, 111, 120, .1); }
.compat-note { margin: -12px 0 22px; padding: 10px 13px; color: #f6d791; border: 1px solid rgba(246, 189, 70, .22); border-radius: 10px; background: rgba(92, 65, 17, .18); font-size: 12px; }
.note-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; color: #1a1e20; background: var(--amber); font-weight: 800; }
.publisher-layout, .receiver-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.publisher-entry { grid-column: 1 / -1; }
.stack { display: grid; gap: 18px; }
.card { border: 1px solid var(--line-soft); border-radius: 15px; background: linear-gradient(145deg, rgba(16, 40, 67, .94), rgba(9, 26, 47, .94)); box-shadow: var(--shadow); }
.file-card, .share-card, .status-card, .activity-card, .info-card { padding: 24px; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.card-heading > div { display: flex; align-items: center; gap: 10px; }
.card-heading.compact { margin: 26px 0 14px; }
.card-heading h2 { font-size: 17px; letter-spacing: -.02em; }
.step, .tiny-label, .expiry { color: var(--muted); font-size: 10px; letter-spacing: .13em; font-weight: 700; }
.step { color: var(--mint); }
.expiry { letter-spacing: 0; font-weight: 500; }
.drop-zone { min-height: 236px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 1px dashed rgba(162, 189, 219, .58); border-radius: 12px; color: var(--muted); background: rgba(3, 16, 34, .16); transition: .18s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--mint); background: rgba(66, 212, 189, .07); transform: translateY(-1px); }
.drop-zone strong { color: var(--muted-strong); font-weight: 500; font-size: 16px; }
.drop-icon { display: grid; place-items: center; width: 62px; height: 62px; color: #d5e0ed; border-radius: 15px; background: rgba(219, 230, 240, .16); font-size: 46px; line-height: 1; transform: rotate(90deg); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 9px; color: var(--text); background: transparent; font-size: 14px; font-weight: 700; transition: .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: #02252a; background: var(--mint); box-shadow: 0 10px 26px rgba(19, 169, 152, .15); }
.button-primary:hover:not(:disabled) { background: #62e2cd; }
.button-small { min-height: 38px; padding: 0 20px; color: #062b30; }
.button-wide { width: 100%; }
.button-ghost { min-width: 104px; border-color: var(--line); color: var(--muted-strong); background: rgba(20, 48, 80, .5); }
.button-ghost:hover:not(:disabled) { border-color: var(--blue); color: var(--text); }
.button-danger { border-color: rgba(255, 111, 120, .72); color: var(--danger); background: rgba(255, 111, 120, .05); }
.button-danger:hover:not(:disabled) { color: #fff; background: rgba(255, 111, 120, .16); }
.button-icon { font-size: 20px; font-weight: 400; }
.file-summary { min-height: 66px; margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(4, 17, 34, .42); }
.file-summary.is-empty { opacity: .78; }
.file-symbol { display: grid; place-items: center; width: 40px; height: 44px; flex: 0 0 40px; color: #ffd56e; border-radius: 7px; background: rgba(246, 189, 70, .18); font-size: 10px; font-weight: 800; }
.file-meta { min-width: 0; flex: 1; display: grid; gap: 5px; }
.file-meta strong { overflow: hidden; color: var(--muted-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { color: var(--muted); font-size: 12px; }
.file-ready { color: var(--mint); font-size: 12px; white-space: nowrap; }
.file-ready.invalid { color: var(--danger); }
.icon-button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: rgba(146, 174, 204, .12); font-size: 22px; line-height: 1; }
.icon-button:hover { color: var(--text); background: rgba(146, 174, 204, .22); }
.progress-line { height: 4px; margin-top: 13px; overflow: hidden; border-radius: 999px; background: rgba(88, 126, 162, .24); }
.progress-line span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--mint); transition: width .2s ease; }
.link-row { display: flex; gap: 8px; }
.link-row input { min-width: 0; flex: 1; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--muted-strong); background: rgba(3, 16, 34, .56); font-size: 12px; }
.code-row { display: flex; gap: 8px; }
.code-row input { min-width: 0; flex: 1; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: rgba(3, 16, 34, .56); font-size: 16px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.code-row input:focus, .link-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76, 155, 255, .1); }
.expiry-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 14px; padding: 11px 13px; border: 1px solid var(--line-soft); border-radius: 9px; color: var(--muted-strong); background: rgba(4, 17, 34, .28); font-size: 12px; }
.expiry-control select { min-height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: rgba(20, 48, 80, .7); font: inherit; }
.code-hint { margin-top: 10px; }
.code-share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 11px 13px; border: 1px solid rgba(66, 212, 189, .22); border-radius: 9px; background: rgba(66, 212, 189, .05); }
.code-share-row div { display: grid; gap: 4px; }
.code-share-row span { color: var(--muted); font-size: 11px; }
.code-share-row strong { color: var(--mint); font-size: 18px; letter-spacing: .17em; }
.expiry-row strong { font-size: 13px; letter-spacing: 0; }
.share-copy-button { margin-top: 12px; }
.copy-fallback-hint { margin: 10px 0 0; color: #f6d791; font-size: 12px; line-height: 1.5; }
.copy-fallback { width: 100%; min-height: 112px; margin-top: 8px; padding: 10px 12px; resize: vertical; border: 1px solid rgba(246, 189, 70, .45); border-radius: 9px; outline: none; color: var(--muted-strong); background: rgba(3, 16, 34, .56); font: inherit; font-size: 12px; line-height: 1.6; }
.warning { display: flex; align-items: center; gap: 8px; margin: 13px 0 18px; color: #f6cd76; font-size: 12px; line-height: 1.5; }
.warning span { display: grid; place-items: center; width: 17px; height: 17px; flex: 0 0 17px; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; font-weight: 800; }
.connection-state { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px 0 6px; color: var(--blue); font-size: 19px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.center { text-align: center; }
.route-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 22px; }
.route { position: relative; min-height: 70px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line-soft); border-radius: 10px; color: var(--muted); background: rgba(4, 17, 34, .25); font-size: 13px; }
.route.active { border-color: var(--blue); color: var(--blue); background: rgba(76, 155, 255, .08); }
.route-icon { font-size: 25px; }
.route small { position: absolute; right: 9px; bottom: 6px; color: var(--muted); font-size: 9px; }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 18px; border-top: 1px solid var(--line-soft); }
.stat-strip div { display: grid; gap: 7px; padding: 0 12px; border-right: 1px solid var(--line-soft); }
.stat-strip div:first-child { padding-left: 0; }
.stat-strip div:last-child { padding-right: 0; border-right: 0; }
.stat-strip span { color: var(--muted); font-size: 11px; }
.stat-strip strong { color: var(--muted-strong); font-size: 16px; }
.stat-strip strong.safe { color: var(--mint); }
.empty-activity { min-height: 220px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-activity strong { color: var(--muted-strong); font-size: 14px; font-weight: 500; }
.empty-activity span:last-child { font-size: 12px; }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 50%; color: var(--blue); font-size: 28px; }
.activity-list { display: grid; gap: 10px; }
.activity-row { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.activity-top, .activity-bottom { display: flex; justify-content: space-between; gap: 12px; }
.activity-top strong { overflow: hidden; color: var(--muted-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.activity-top span, .activity-bottom { color: var(--muted); font-size: 11px; }
.activity-bar { height: 5px; margin: 10px 0 8px; overflow: hidden; border-radius: 99px; background: rgba(88, 126, 162, .28); }
.activity-bar span { display: block; width: 0; height: 100%; background: var(--blue); border-radius: inherit; }
.receiver-main { min-height: 520px; padding: 52px 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.receiver-label { color: var(--mint); font-size: 11px; letter-spacing: .18em; font-weight: 800; }
.receiver-icon { width: 78px; height: 78px; display: grid; place-items: center; margin: 26px 0 20px; border: 1px solid rgba(66, 212, 189, .4); border-radius: 24px; color: var(--mint); background: rgba(66, 212, 189, .08); font-size: 52px; }
.receiver-main h2 { max-width: 600px; overflow-wrap: anywhere; font-size: clamp(22px, 3vw, 32px); letter-spacing: -.035em; }
.receiver-size { margin-top: 10px; color: var(--muted); }
.receiver-expiry { margin-top: 8px; color: #f6d791; font-size: 12px; }
.receiver-rule { width: min(320px, 80%); margin: 28px 0; border-top: 1px solid var(--line-soft); }
.receiver-status { display: flex; align-items: center; gap: 9px; color: var(--blue); }
.receiver-hint { max-width: 380px; margin: 13px 0 24px; }
.receiver-main .button { max-width: 380px; }
.small-print { max-width: 400px; margin-top: 15px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.path-display { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(3, 16, 34, .26); }
.path-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--blue); background: rgba(76, 155, 255, .1); font-size: 25px; }
.path-display div { display: grid; gap: 5px; }
.path-display strong { font-size: 14px; }
.path-display span { color: var(--muted); font-size: 11px; }
.safe-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; color: var(--muted-strong); font-size: 12px; }
.safe-list li { display: flex; align-items: center; gap: 9px; }
.safe-list li::before { content: "✓"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--mint); background: rgba(66, 212, 189, .1); }
.page-footer { display: flex; justify-content: center; gap: 9px; margin-top: 25px; color: rgba(150, 173, 202, .65); font-size: 11px; letter-spacing: .04em; }
.toast { position: fixed; z-index: 4; right: 22px; bottom: 22px; max-width: min(360px, calc(100vw - 44px)); padding: 12px 15px; transform: translateY(20px); opacity: 0; pointer-events: none; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: #102944; box-shadow: var(--shadow); font-size: 13px; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(255, 111, 120, .5); color: #ffd2d5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .rail { width: 92px; flex-basis: 92px; }
  .rail-status { padding: 11px 8px; }
  .rail-status small { display: none; }
  .publisher-layout, .receiver-view { grid-template-columns: 1fr; }
  .receiver-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .app-shell { display: block; }
  .rail { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand-mark { width: 34px; height: 34px; margin: 0; border-radius: 10px; font-size: 19px; }
  .rail-label { font-size: 13px; }
  .rail-status { margin: 0 0 0 auto; padding: 8px 10px; }
  .page { padding: 34px 16px 22px; }
  .page-header { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .page-header .header-pill { align-self: flex-start; }
  h1 { font-size: 33px; }
  .subtitle { font-size: 14px; }
  .file-card, .share-card, .status-card, .activity-card, .info-card { padding: 18px; }
  .drop-zone { min-height: 190px; }
  .link-row, .code-row { align-items: stretch; flex-direction: column; }
  .link-row input { width: 100%; }
  .code-share-row { align-items: stretch; flex-direction: column; }
  .receiver-side { grid-template-columns: 1fr; }
  .receiver-main { min-height: 470px; padding: 34px 20px; }
  .stat-strip strong { font-size: 14px; }
  .page-footer { flex-wrap: wrap; }
}
