:root {
  color-scheme: light;
  --navy: #0b1f3a;
  --navy-2: #16365f;
  --ink: #172033;
  --muted: #64748b;
  --line: #e4e8ef;
  --page: #f6f7f9;
  --soft: #eef3f8;
  --green: #16a364;
  --shadow: 0 14px 34px rgba(11, 31, 58, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--page); }
button, select, input, textarea { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; padding: 24px 16px;
  display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; padding: 6px; display: grid; place-items: center; border-radius: 12px; background: var(--navy); }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { display: flex; gap: 12px; align-items: center; padding: 11px 13px; border-radius: 10px; color: #526178; text-decoration: none; font-weight: 650; }
.nav-item span { width: 20px; text-align: center; font-size: 18px; }
.nav-item:hover, .nav-item.active { color: var(--navy); background: #eaf0f7; }
.side-note { margin-top: auto; padding: 14px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(22, 163, 100, .12); }

main { margin-left: 248px; min-height: 100vh; }
.topbar { min-height: 106px; padding: 24px 42px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.privacy-pill { padding: 9px 14px; color: var(--navy); font-size: 13px; border-radius: 999px; background: #edf3f9; }
.content { width: min(1240px, 100%); margin: 0 auto; padding: 42px; }

.intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.intro h2 { margin: 0 0 10px; font-size: clamp(28px, 3.5vw, 42px); letter-spacing: -.04em; }
.intro p { max-width: 730px; margin: 0; color: var(--muted); line-height: 1.75; }
.limit { min-width: 116px; padding: 14px 16px; text-align: right; border-left: 1px solid var(--line); }
.limit strong, .limit span { display: block; }
.limit strong { color: var(--navy); font-size: 22px; }
.limit span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(380px, 1.1fr); gap: 22px; align-items: start; }
.workspace.four-code-layout { grid-template-columns: minmax(0, 1fr); }
.workspace.four-code-layout .sender-panel { width: 100%; max-width: 900px; }
.workspace.four-code-layout .qr-panel { width: 100%; max-width: 960px; margin: 0 auto; }
.sender-panel, .qr-panel, .guide { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.sender-panel { overflow: hidden; }
.panel-heading { min-height: 69px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-heading.compact { padding: 0 0 16px; min-height: 0; border: 0; }
.panel-heading > div, .qr-toolbar > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h3, .qr-toolbar h3 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 12px; }
.step { width: 27px; height: 27px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: #fff; background: var(--navy); font-size: 12px; font-weight: 800; }

.source-tabs { margin: 18px 20px 0; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 12px; background: #edf1f6; }
.source-tabs button { height: 39px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; }
.source-tabs button.active { color: var(--navy); background: #fff; box-shadow: 0 2px 8px rgba(11,31,58,.09); }
.source-tabs button:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 1px; }
.drop-zone { margin: 14px 20px 20px; min-height: 250px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; border: 1.5px dashed #b8c4d2; border-radius: 17px; background: #fbfcfe; outline: none; transition: .2s ease; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--navy-2); background: #f1f5fa; transform: translateY(-1px); }
.upload-icon { width: 48px; height: 48px; margin-bottom: 4px; display: grid; place-items: center; border-radius: 14px; color: var(--navy); background: #e7eef7; font-size: 25px; font-weight: 700; }
.drop-zone > span { color: var(--muted); font-size: 13px; }
.primary { margin-top: 14px; padding: 11px 26px; border: 0; border-radius: 11px; color: #fff; background: var(--navy); font-weight: 700; box-shadow: 0 6px 16px rgba(11,31,58,.18); }
.primary:hover { background: var(--navy-2); }
.primary:disabled { cursor: not-allowed; opacity: .45; }

.text-zone { min-height: 250px; margin: 14px 20px 20px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 17px; background: #fbfcfe; }
.text-zone > label { margin-bottom: 9px; color: var(--ink); font-size: 13px; font-weight: 750; }
.text-zone textarea { width: 100%; min-height: 142px; resize: vertical; padding: 13px 14px; color: var(--ink); border: 1px solid #cbd5e1; border-radius: 11px; background: #fff; font-size: 14px; line-height: 1.65; outline: none; }
.text-zone textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(22,54,95,.1); }
.text-zone textarea::placeholder { color: #94a3b8; }
.text-zone-footer { margin-top: 11px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.text-zone-footer span { color: var(--muted); font-size: 12px; }
.text-zone-footer .primary { margin-top: 0; padding: 10px 18px; }
.text-zone > p { margin: 11px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.settings { padding: 19px 20px 21px; border-top: 1px solid var(--line); }
.setting-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.setting-grid label { color: var(--muted); font-size: 12px; font-weight: 650; }
select { width: 100%; height: 40px; margin-top: 7px; padding: 0 30px 0 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 12px; }
.qr-size-setting { margin-top: 14px; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(120px, 1fr) 58px; align-items: center; gap: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 11px; background: #f7f9fc; font-size: 12px; font-weight: 650; }
.qr-size-setting input { width: 100%; accent-color: var(--navy); cursor: pointer; }
.qr-size-setting output { color: var(--navy); font-variant-numeric: tabular-nums; text-align: right; }
.setting-hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.qr-panel { padding: 18px; }
.qr-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 16px; }
.qr-toolbar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--navy); background: #fff; font-size: 20px; }
.icon-button:hover { background: var(--soft); }
.qr-stage { position: relative; width: 100%; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.qr-stage img { width: min(100%, var(--qr-display-size, 640px)); height: min(100%, var(--qr-display-size, 640px)); display: block; object-fit: contain; background: #fff; }
.qr-stage.idle img { display: none; }
.qr-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--muted); background: linear-gradient(145deg, #f7f9fc, #eef3f8); }
.qr-placeholder > span { color: #9aabc0; font-size: 54px; line-height: 1; }
.qr-placeholder small { font-size: 12px; }
.qr-stage:not(.idle) .qr-placeholder { display: none; }
.stream-progress { padding: 16px 2px 4px; }
.stream-progress > div:first-child { display: flex; justify-content: space-between; gap: 20px; font-size: 13px; }
.stream-progress span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-progress strong { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.progress-track { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: #e7ebf0; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .12s linear; }
.stream-specs { margin: 12px 0; padding: 12px 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 12px; }
.stream-specs div { padding: 0 10px; text-align: center; border-right: 1px solid var(--line); }
.stream-specs div:last-child { border: 0; }
.stream-specs dt { color: var(--muted); font-size: 10px; }
.stream-specs dd { margin: 5px 0 0; font-size: 12px; font-weight: 750; }
.stop-button { width: 100%; height: 43px; border: 1px solid #d9e0e8; border-radius: 11px; color: var(--navy); background: #fff; font-weight: 700; }
.stop-button:hover:not(:disabled) { background: var(--soft); }
.stop-button:disabled { cursor: not-allowed; opacity: .45; }

.guide { margin-top: 22px; overflow: hidden; box-shadow: none; }
.guide ol { margin: 0; padding: 24px 24px 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; list-style-position: inside; }
.guide li { color: var(--navy); font-weight: 800; }
.guide li span { display: block; margin: 7px 0 0 22px; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.65; }
.security { margin: 15px 24px 24px; padding: 13px 15px; color: #79530a; border-radius: 10px; background: #fff8e7; font-size: 12px; line-height: 1.6; }

/* Independent help route; it shares the sender's navigation and visual system. */
.back-link { padding: 9px 14px; color: var(--navy); border-radius: 999px; background: #edf3f9; font-size: 13px; font-weight: 700; text-decoration: none; }
.back-link:hover { background: #e2ebf5; }
.guide-content { width: min(1040px, 100%); margin: 0 auto; padding: 56px 42px 72px; }
.guide-hero { max-width: 760px; margin-bottom: 30px; }
.guide-hero h2 { margin: 6px 0 14px; font-size: clamp(34px, 5vw, 58px); letter-spacing: -.055em; line-height: 1.08; }
.guide-hero > p:last-child { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.75; }
.guide-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.guide-steps article, .guide-details { border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.guide-steps article { min-height: 230px; padding: 26px; }
.guide-steps h3 { margin: 22px 0 10px; font-size: 18px; }
.guide-steps p, .guide-details p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.guide-details { margin-top: 20px; padding: 8px 28px; box-shadow: none; }
.guide-details > div { padding: 22px 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; border-bottom: 1px solid var(--line); }
.guide-details > div:last-child { border-bottom: 0; }
.guide-details h3 { margin: 0; font-size: 15px; }

.qr-panel:fullscreen { padding: 0; display: flex; flex-direction: column; background: #fff; }
.qr-panel:fullscreen .qr-toolbar { display: none; }
.qr-panel:fullscreen .qr-stage { flex: 1; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; border: 0; border-radius: 0; }
.qr-panel:fullscreen .qr-stage img { width: min(100vw, var(--qr-display-size, 640px)); height: min(100vh, var(--qr-display-size, 640px)); }
.qr-panel:fullscreen .stream-progress, .qr-panel:fullscreen .stream-specs, .qr-panel:fullscreen .stop-button { display: none; }

@media (max-width: 1020px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 20px; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .sidebar nav { margin-left: auto; display: flex; }
  .side-note { display: none; }
  main { margin-left: 0; }
  .workspace { grid-template-columns: 1fr; }
  .qr-panel { max-width: 720px; width: 100%; margin: 0 auto; }
}

@media (max-width: 680px) {
  .sidebar { padding: 12px 15px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand small, .nav-item span { display: none; }
  .nav-item { padding: 9px 10px; font-size: 13px; }
  .topbar { min-height: 82px; padding: 18px 20px; }
  .topbar h1 { font-size: 19px; }
  .privacy-pill { display: none; }
  .content { padding: 28px 15px; }
  .intro { align-items: start; }
  .intro h2 { font-size: 30px; }
  .limit { display: none; }
  .panel-heading { align-items: flex-start; }
  .panel-heading > .muted { display: none; }
  .setting-grid { grid-template-columns: 1fr; }
  .drop-zone { min-height: 220px; margin: 14px; }
  .source-tabs { margin: 14px 14px 0; }
  .text-zone { margin: 14px; }
  .text-zone-footer { align-items: stretch; flex-direction: column; }
  .text-zone-footer .primary { width: 100%; }
  .qr-size-setting { grid-template-columns: 1fr auto; }
  .qr-size-setting input { grid-column: 1 / -1; grid-row: 2; }
  .stream-specs { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .stream-specs div:nth-child(2) { border-right: 0; }
  .guide ol { grid-template-columns: 1fr; }
  .guide-content { padding: 34px 15px 56px; }
  .guide-steps { grid-template-columns: 1fr; }
  .guide-steps article { min-height: 0; }
  .guide-details { padding: 4px 20px; }
  .guide-details > div { grid-template-columns: 1fr; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

