:root {
  color-scheme: light dark;
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f5f6f8;
  --sidebar: #fafbfc;
  --label: #202329;
  --secondary: #626b78;
  --tertiary: #77808d;
  --separator: rgba(40, 48, 60, 0.1);
  --blue: #087dff;
  --blue-pressed: #0064d1;
  --blue-soft: rgba(0, 122, 255, 0.07);
  --green: #32a86c;
  --red: #ed6158;
  --shadow: 0 8px 30px rgba(28, 38, 52, 0.035);
  font-family: "Malgun Gothic", "맑은 고딕", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
* { box-sizing: border-box; font-family: "Malgun Gothic", "맑은 고딕", sans-serif; }
html { overflow-x: clip; }
body { min-width: 280px; min-height: 100vh; margin: 0; color: var(--label); background: var(--canvas); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible, a:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.3); outline-offset: 3px;
}
.sr-only { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.page-shell {
  width: min(1160px, 100%); margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 12px;
}
.topbar { min-height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 2px; }
.brand { flex: none; display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; position: relative; display: grid; place-items: center; border-radius: 10px; background: var(--blue); }
.brand-mark i { position: absolute; border: 1.5px solid white; border-radius: 50%; }
.brand-mark i:first-child { width: 18px; height: 18px; }
.brand-mark i:last-child { width: 6px; height: 6px; }
.brand-word { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.035em; }
.brand-word span { color: inherit; }
.room-tools { display: flex; align-items: center; gap: 8px; }
.network-mode select { max-width: 150px; min-height: 38px; padding: 0 8px; color: var(--secondary); background: var(--surface); border: 1px solid var(--separator); border-radius: 9px; font-size: 0.75rem; }
.network-mode[hidden], .lan-nearby[hidden], .invite-actions[hidden] { display: none; }
.private-entry-button { min-height: 38px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--separator); border-radius: 9px; background: var(--surface); color: var(--secondary); font-size: 0.75rem; cursor: pointer; }
.private-entry-button[hidden] { display: none; }
.private-entry-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.private-entry-button:hover, .private-entry-button[aria-pressed="true"] { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.lan-nearby { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--separator); }
.lan-nearby .panel-heading { font-size: 0.75rem; }
.lan-nearby .panel-heading button { padding: 5px 7px; color: var(--blue); border: 0; border-radius: 6px; background: var(--blue-soft); cursor: pointer; font-size: 0.6875rem; }
.lan-status { margin: 8px 0; color: var(--secondary); font-size: 0.6875rem; line-height: 1.6; }
.lan-nearby .compact-device button { flex: none; }
.help-button, .settings-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--secondary); border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 0.75rem; }
.help-button { padding: 0 10px; }
.settings-button { width: 38px; padding: 0; }
.help-button:hover, .settings-button:hover { color: var(--label); background: var(--separator); }
.help-button svg, .settings-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.exposure-banner { flex: none; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #95483f; border: 1px solid rgba(237,97,88,0.16); border-radius: 9px; background: rgba(237,97,88,0.04); font-size: 0.69rem; }
.exposure-banner strong { font-size: inherit; font-weight: 600; }
.exposure-banner[hidden] { display: none; }
.workspace { flex: none; display: grid; grid-template-columns: 320px minmax(0,1fr); grid-template-rows: auto auto; border: 1px solid var(--separator); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.peer-panel { grid-column: 1; grid-row: 2; min-width: 0; display: flex; flex-direction: column; padding: 20px; border-top: 1px solid var(--separator); border-right: 1px solid var(--separator); border-radius: 0 0 0 18px; background: var(--sidebar); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.875rem; font-weight: 700; }
.panel-tools { display: flex; align-items: center; gap: 6px; }
.panel-tools button { min-height: 28px; padding: 0 7px; color: var(--secondary); border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-size: 0.75rem; }
.panel-tools button:hover { background: var(--separator); color: var(--label); }
.panel-tools strong { min-width: 22px; height: 22px; display: grid; place-items: center; color: var(--secondary); border-radius: 7px; background: var(--separator); font-size: 0.64rem; }
.gate-identity { min-width: 0; margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.gate-identity > strong { display: block; overflow: hidden; color: var(--label); font-size: 1.05rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { min-height: 30px; margin-top: 4px; padding: 0; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--secondary); cursor: pointer; font-size: 0.75rem; text-align: left; }
.pulse-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--tertiary); }
.status-pill.online .pulse-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(50,168,108,0.12); }
.peer-list { min-width: 0; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.empty-peers { min-height: 58px; padding: 10px; display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--secondary); border: 1px solid var(--separator); border-radius: 10px; background: var(--surface); text-align: left; }
.empty-peers p { margin: 0; font-size: 0.8125rem; line-height: 1.6; }
.radar { width: 32px; height: 32px; position: relative; flex: none; border-radius: 50%; background: var(--blue-soft); }
.radar::before, .radar::after { position: absolute; top: 50%; left: 50%; content: ""; border: 1px solid var(--blue); border-radius: 50%; transform: translate(-50%,-50%); animation: radar 2s ease-out infinite; }
.radar::after { animation-delay: 0.7s; }
.peer { min-width: 0; padding: 12px; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 9px; border: 1px solid var(--separator); border-radius: 12px; background: var(--surface); }
.peer-avatar { width: 32px; height: 32px; display: grid; place-items: center; color: var(--blue); border-radius: 10px; background: var(--blue-soft); font-size: 0.76rem; font-weight: 700; }
.peer-copy { min-width: 0; }
.peer-copy strong, .peer-copy span { display: block; }
.peer-copy strong { overflow: hidden; font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.peer-copy span { margin-top: 2px; color: var(--secondary); font-size: 0.65rem; }
.peer-state { width: 6px; height: 6px; border-radius: 50%; background: var(--tertiary); }
.peer.connected .peer-state { background: var(--green); }
.invite-actions { margin-top: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.qr-button, .room-code { width: 100%; min-width: 0; min-height: 44px; padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--label); border: 1px solid var(--separator); border-radius: 9px; background: var(--surface); cursor: pointer; font-size: 0.8125rem; font-weight: 600; }
.qr-button { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.qr-button svg { width: 16px; height: 16px; flex: none; fill: currentColor; }
.room-code svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.room-code:disabled { opacity: 0.5; cursor: default; }
.qr-button[hidden], #newSession[hidden], #sessionNameField[hidden] { display: none; }
.privacy-note { margin: 16px 0 0; display: flex; align-items: center; gap: 6px; color: var(--secondary); font-size: 0.6875rem; }
.privacy-note span { color: var(--green); font-weight: 700; }
.name-settings { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--separator); }
.name-settings summary { color: var(--secondary); cursor: pointer; font-size: 0.75rem; }
.name-settings form { margin-top: 14px; display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; }
.name-settings label { display: grid; gap: 5px; color: var(--secondary); font-size: 0.68rem; }
.name-settings input { width: 100%; min-width: 0; height: 36px; padding: 0 9px; color: var(--label); border: 1px solid var(--separator); border-radius: 8px; background: var(--surface); font-size: 0.73rem; }
.name-settings button { height: 36px; padding: 0 12px; color: white; border: 0; border-radius: 8px; background: var(--blue); cursor: pointer; font-size: 0.7rem; font-weight: 700; }
.name-note { margin: 0; color: var(--secondary); font-size: 0.62rem; }
.main-column { display: contents; }
.send-panel { grid-column: 1 / -1; grid-row: 1; min-width: 0; padding: 24px; }
.send-content { width: 100%; min-width: 0; }
.send-heading { padding-bottom: 14px; text-align: center; }
.send-heading .eyebrow { display: none; }
.eyebrow { margin: 0 0 7px; display: flex; align-items: center; gap: 7px; color: var(--blue); font-size: 0.7rem; font-weight: 600; }
.eyebrow span { width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; }
h1 { margin: 0; font-size: 2rem; line-height: 1.2; letter-spacing: -0.04em; }
h2 { margin: 0; font-size: 1.1rem; line-height: 1.25; letter-spacing: -0.025em; }
.send-heading > p:last-child { margin: 8px 0 0; color: var(--secondary); font-size: 0.875rem; line-height: 1.6; }
.drop-stage { width: 100%; min-height: 152px; margin: 0; padding: 20px; display: grid; place-items: center; color: var(--label); border: 1px dashed #bdc8d6; border-radius: 12px; background: var(--sidebar); cursor: pointer; transition: border-color 140ms ease, background 140ms ease; }
.drop-stage:hover, .drop-stage.dragging { border-color: var(--blue); background: var(--blue-soft); }
.drop-stage:active { background: var(--blue-soft); }
.drop-core { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.send-icon { width: 40px; height: 40px; margin-bottom: 8px; padding: 4px; fill: none; stroke: var(--blue); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-core strong { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; }
.drop-core > span { margin-top: 5px; color: var(--secondary); font-size: 0.8125rem; }
.file-actions { width: 100%; margin: 12px 0 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.file-picker, .folder-picker { min-height: 44px; padding: 10px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--separator); border-radius: 9px; cursor: pointer; font-size: 0.875rem; font-weight: 600; }
.file-picker { color: white; border-color: transparent; background: var(--blue); }
.file-picker:hover { background: var(--blue-pressed); }
.folder-picker { color: var(--secondary); background: var(--surface); }
.folder-picker:hover { color: var(--label); background: var(--surface-muted); }
.file-actions svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.transfer-bar { margin-top: 14px; padding: 12px; border-radius: 9px; background: var(--blue-soft); }
.transfer-copy { margin-bottom: 8px; display: flex; justify-content: space-between; gap: 12px; font-size: 0.72rem; }
.transfer-copy > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-copy strong { flex: none; color: var(--blue); }
.progress-track { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(0,122,255,0.14); }
.progress-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--blue); transition: width 120ms linear; }
.transfer-speed { margin-top: 8px; color: var(--secondary); font-size: 0.72rem; line-height: 1.4; }
.transfer-speed[hidden] { display: none; }
.file-selection-status, .transfer-hint { margin: 12px 0 0; color: var(--secondary); font-size: 0.75rem; overflow-wrap: anywhere; }
.file-selection-status[hidden], .transfer-hint[hidden] { display: none; }
.file-selection-status[data-busy="true"] { position: relative; padding-top: 12px; overflow: hidden; }
.file-selection-status[data-busy="true"]::before, .file-selection-status[data-busy="true"]::after { content: ""; position: absolute; top: 0; left: 0; height: 4px; border-radius: 99px; }
.file-selection-status[data-busy="true"]::before { width: 100%; background: var(--blue-soft); }
.file-selection-status[data-busy="true"]::after { width: 30%; background: var(--blue); animation: file-reading 1.3s ease-in-out infinite alternate; }
.transfer-bar[data-indeterminate="true"] .progress-track span { animation: file-reading 1.3s ease-in-out infinite alternate; }
@keyframes file-reading { from { transform: translateX(0); } to { transform: translateX(230%); } }
@media (prefers-reduced-motion: reduce) { .file-selection-status[data-busy="true"]::after, .transfer-bar[data-indeterminate="true"] .progress-track span { animation: none; } }
.feed-section { grid-column: 2; grid-row: 2; min-width: 0; min-height: 240px; padding: 24px; display: flex; flex-direction: column; border-top: 1px solid var(--separator); }
.feed-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feed-header h2 { flex: none; font-size: 0.875rem; font-weight: 700; }
.pending-file-selection { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--separator); border-radius: 10px; background: var(--blue-soft); font-size: 0.8rem; }
.pending-file-selection[hidden] { display: none; }
.pending-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pending-file-actions button { min-height: 36px; border: 0; border-radius: 7px; padding: 8px 12px; color: var(--label); background: var(--surface); cursor: pointer; }
.pending-file-actions #sendSelectedFiles { background: var(--blue); color: white; }
.pending-file-actions button:disabled { opacity: 0.5; cursor: default; }
.file-history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--secondary); font-size: 0.72rem; }
.file-history-toolbar[hidden], .message-edit-bar[hidden], .remembered-devices[hidden] { display: none; }
.file-history-toolbar label { display: inline-flex; align-items: center; gap: 5px; }
.file-history-toolbar button, .message-edit-bar button { border: 0; border-radius: 7px; padding: 6px 9px; background: var(--blue-soft); color: var(--blue); cursor: pointer; font-size: 0.72rem; }
.file-history-toolbar button:disabled, .feed-action:disabled { opacity: 0.45; cursor: default; }
.feed-icon.file-select { background: transparent; }
.file-select input { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }
.remembered-devices { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--separator); }
.remembered-devices h3 { margin: 0 0 8px; font-size: 0.75rem; }
.remembered-device { align-items: flex-start; flex-wrap: wrap; }
.remembered-device-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.remembered-device-actions .remembered-forget { color: var(--secondary); background: transparent; }
.device-name { min-width: 0; overflow: hidden; color: var(--secondary); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.device-name strong { font-weight: 400; }
.feed { height: 160px; min-height: 112px; max-height: 240px; flex: 1; margin-top: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.feed-empty { min-height: 100%; padding: 16px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.feed-empty[hidden] { display: none; }
.feed-empty svg { width: 32px; height: 32px; margin-bottom: 10px; fill: none; stroke: var(--tertiary); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.feed-empty strong { color: var(--secondary); font-size: 0.8125rem; font-weight: 500; }
.feed-empty > span { margin-top: 4px; color: var(--tertiary); font-size: 0.75rem; }
.feed-item { padding: 12px 2px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--separator); animation: materialize 180ms ease both; }
.feed-icon { width: 32px; height: 36px; display: grid; place-items: center; overflow: hidden; color: var(--blue); border-radius: 7px; background: var(--blue-soft); font-size: 0.57rem; font-weight: 700; }
.feed-icon.message { color: var(--secondary); background: var(--surface-muted); }
.feed-copy { min-width: 0; }
.feed-copy strong { display: block; overflow: hidden; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.feed-copy p { margin: 3px 0 0; color: var(--secondary); font-size: 0.64rem; }
.feed-copy .message-body { font-size: 0.78rem; white-space: pre-wrap; word-break: break-word; }
.feed-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-action { padding: 7px 9px; color: var(--blue); border: 0; border-radius: 7px; background: var(--blue-soft); cursor: pointer; text-decoration: none; font-size: 0.66rem; font-weight: 600; }
.composer { min-height: 44px; flex: none; margin-top: 14px; padding: 3px; display: grid; grid-template-columns: minmax(0,1fr) 36px; align-items: center; border: 1px solid var(--separator); border-radius: 10px; background: var(--sidebar); }
.composer:focus-within { border-color: var(--blue); }
.composer textarea { min-width: 0; width: 100%; min-height: 54px; max-height: 180px; resize: vertical; padding: 8px 10px; color: var(--label); border: 0; outline: 0; background: transparent; font-size: 0.8125rem; line-height: 1.5; }
.composer textarea::placeholder { color: var(--tertiary); }
.message-edit-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; color: var(--blue); font-size: 0.72rem; }
.message-edit-bar:not([hidden]) + .composer { margin-top: 5px; }
.composer-tools { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--secondary); font-size: 0.65rem; }
.send-button { width: 34px; height: 34px; display: grid; place-items: center; color: var(--blue); border: 0; border-radius: 8px; background: var(--blue-soft); cursor: pointer; font-size: 1.05rem; }
.guide-dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100dvh - 32px); padding: 0; color: var(--label); border: 1px solid var(--separator); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,0.22); }
.guide-dialog::backdrop { background: rgba(16,22,30,0.35); }
.guide-dialog-header { padding: 20px 24px; position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--separator); background: var(--surface); }
.guide-dialog-header .dialog-close { position: static; flex: none; }
.guide-body { padding: 24px; }
.guide-heading h2 { font-size: 1.4rem; }
.guide-heading > p:last-child { margin: 10px 0 0; color: var(--secondary); font-size: 0.76rem; line-height: 1.7; }
.guide-steps { margin: 24px 0 0; padding: 0; display: grid; gap: 10px; list-style: none; }
.guide-steps li { min-width: 0; padding: 16px; display: flex; align-items: flex-start; gap: 14px; border-radius: 10px; background: var(--surface-muted); }
.guide-number { width: 26px; height: 26px; flex: none; display: grid; place-items: center; color: var(--blue); border-radius: 8px; background: var(--blue-soft); font-size: 0.7rem; font-weight: 700; }
.guide-steps strong { display: block; font-size: 0.8rem; }
.guide-steps p { margin: 5px 0 0; color: var(--secondary); font-size: 0.72rem; line-height: 1.6; }
.guide-help { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--separator); border-radius: 10px; }
.guide-help summary { color: var(--label); cursor: pointer; font-size: 0.76rem; font-weight: 600; }
.guide-help ul { margin: 12px 0 0; padding-left: 18px; color: var(--secondary); font-size: 0.72rem; line-height: 1.8; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50; padding: 10px 14px; color: white; border-radius: 12px; background: rgba(29,29,31,0.86); box-shadow: var(--shadow); backdrop-filter: blur(18px); font-size: 0.74rem; font-weight: 600; opacity: 0; transform: translate(-50%, 14px); transition: opacity 160ms ease, transform 200ms ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

.invite-dialog {
  width: min(390px, calc(100% - 28px));
  padding: 26px;
  color: var(--label);
  border: 1px solid var(--separator);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0,0,0,0.3);
}

.invite-dialog::backdrop {
  background: rgba(0,0,0,0.46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dialog-close {
  width: 34px;
  height: 34px;
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  place-items: center;
  color: var(--secondary);
  border: 0;
  border-radius: 50%;
  background: var(--surface-muted);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.invite-dialog h2 { font-size: 1.55rem; }
.invite-copy { margin: 8px 0 20px; color: var(--secondary); font-size: 0.8rem; }
.qr-frame { padding: 18px; display: grid; place-items: center; border-radius: 18px; background: white; }
.qr-frame img { width: min(250px, 100%); aspect-ratio: 1; display: block; }
.invite-url { margin: 14px 0; padding: 11px 12px; display: block; overflow-wrap: anywhere; color: var(--secondary); border-radius: 11px; background: var(--surface-muted); font-size: 0.66rem; }
.copy-invite { width: 100%; height: 44px; color: white; border: 0; border-radius: 12px; background: var(--blue); cursor: pointer; font-size: 0.8rem; font-weight: 700; }

.settings-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(880px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
  color: var(--label);
  border: 1px solid var(--separator);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0,0,0,0.32);
}

.settings-dialog::backdrop,
.receive-dialog::backdrop {
  background: rgba(0,0,0,0.46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.settings-header { padding: 24px 26px 18px; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--separator); background: var(--surface); background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%); }
.settings-header .eyebrow { margin-bottom: 4px; }
.settings-header h2 { font-size: 1.65rem; }
.settings-close { position: static; flex: none; }
.settings-content { max-height: calc(min(880px, 100dvh - 28px) - 96px); padding: 18px 26px 28px; overflow-y: auto; }
.settings-group { padding: 20px 0; border-bottom: 1px solid var(--separator); }
.settings-group:first-child { padding-top: 4px; }
.settings-group:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-group h3 { margin: 0 0 16px; font-size: 0.78rem; letter-spacing: -0.01em; }
.setting-field { margin-top: 14px; display: grid; gap: 7px; color: var(--label); font-size: 0.76rem; font-weight: 600; }
.setting-field:first-of-type { margin-top: 0; }
.setting-field input,
.setting-field select,
.setting-action-row output { min-width: 0; height: 42px; padding: 0 12px; color: var(--label); border: 1px solid var(--separator); border-radius: 12px; outline: 0; background: var(--surface-muted); font-size: 0.76rem; font-weight: 500; }
.setting-field input:focus,
.setting-field select:focus { border-color: rgba(0,122,255,0.5); box-shadow: 0 0 0 4px rgba(0,122,255,0.09); }
.setting-field small,
.settings-group > small,
.setting-switch small { display: block; color: var(--secondary); font-size: 0.66rem; font-weight: 400; line-height: 1.55; }
.setting-action-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; }
.setting-action-row.download-folder-actions { display: flex; }
.private-mode-settings { margin: 0; }
.private-mode-heading { margin-bottom: 12px; font-size: 0.76rem; }
.private-mode-heading > strong { color: var(--secondary); font-size: 0.72rem; font-weight: 500; }
.private-mode-actions { grid-template-columns: minmax(0, 1fr) auto; }
.private-mode-actions button { white-space: nowrap; }
.private-mode-actions #leavePrivate { justify-self: start; margin-top: 2px; }
.private-mode-help, .private-mode-status { margin: 8px 0 0; color: var(--secondary); font-size: 0.66rem; line-height: 1.55; }
.private-mode-status:empty { display: none; }
.private-mode-status { color: var(--label); }
.download-folder-actions output { flex: 1; }
.download-folder-actions button { flex: none; }
.settings-content [hidden] { display: none !important; }
.setting-action-row output { display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting-action-row button,
.setting-title-row button,
.compact-list button { min-height: 38px; padding: 0 12px; color: var(--blue); border: 0; border-radius: 10px; background: var(--blue-soft); cursor: pointer; font-size: 0.7rem; font-weight: 700; }
.setting-action-row button:disabled,
.setting-title-row button:disabled { cursor: default; opacity: 0.45; }
.setting-switch { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; }
.setting-switch > span { min-width: 0; }
.setting-switch strong { display: block; margin-bottom: 4px; font-size: 0.76rem; }
.setting-switch input { width: 44px; height: 26px; position: relative; flex: none; appearance: none; border-radius: 999px; outline: 0; background: rgba(120,120,128,0.24); cursor: pointer; transition: background 160ms ease; }
.setting-switch input::after { width: 22px; height: 22px; position: absolute; top: 2px; left: 2px; content: ""; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.22); transition: transform 180ms ease; }
.setting-switch input:checked { background: var(--green); }
.setting-switch input:checked::after { transform: translateX(18px); }
.setting-switch input:focus-visible { outline: 4px solid rgba(0,122,255,0.25); outline-offset: 2px; }
.disabled-setting { cursor: default; opacity: 0.72; }
.compact-field { max-width: 360px; }
.setting-label { display: block; margin-bottom: 8px; color: var(--secondary); font-size: 0.68rem; }
.discovered-devices { margin: 8px 0 12px; padding: 12px; border-radius: 14px; background: var(--surface-muted); }
.setting-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compact-list { display: grid; gap: 7px; }
.compact-list p { margin: 0; color: var(--secondary); font-size: 0.7rem; font-weight: 400; }
.compact-device { padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 11px; background: var(--surface-muted); }
.compact-device-copy { min-width: 0; }
.compact-device-copy strong,
.compact-device-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-device-copy strong { font-size: 0.72rem; }
.compact-device-copy span { margin-top: 2px; color: var(--secondary); font-size: 0.62rem; font-weight: 400; }
.device-id-value { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.68rem !important; }
.diagnostic-row { grid-template-columns: auto minmax(0,1fr); }
.diagnostic-row output { white-space: normal; }

.license-setting { width: 100%; min-height: 54px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; border: 1px solid var(--separator); border-radius: 12px; background: var(--surface-muted); cursor: pointer; }
.license-setting strong { display: block; font-size: 0.76rem; }
.license-setting small { display: block; margin-top: 3px; color: var(--secondary); font-size: 0.66rem; }
.license-setting > span:last-child { color: var(--secondary); font-size: 1.3rem; }
.license-setting:hover { border-color: var(--blue); }
.licenses-dialog .settings-header h2 { font-size: 1.15rem; }
.licenses-content { max-height: calc(100dvh - 130px); }
.licenses-intro, .licenses-status { margin: 0 0 18px; color: var(--secondary); font-size: 0.76rem; line-height: 1.65; }
.license-group + .license-group { margin-top: 24px; }
.license-group > h3 { margin: 0 0 10px; font-size: 0.78rem; }
.license-component { border-top: 1px solid var(--separator); }
.license-component:last-child { border-bottom: 1px solid var(--separator); }
.license-component summary { padding: 13px 2px; cursor: pointer; font-size: 0.76rem; overflow-wrap: anywhere; }
.license-component summary strong { margin-right: 8px; font-weight: 600; }
.license-component summary span { color: var(--secondary); font-size: 0.7rem; }
.license-component-body { padding: 0 2px 16px; }
.license-project { margin: 0 0 10px; color: var(--secondary); font-size: 0.69rem; overflow-wrap: anywhere; user-select: text; }
.license-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.license-action, .license-back { min-height: 40px; padding: 8px 12px; color: var(--blue); border: 0; border-radius: 8px; background: var(--blue-soft); font-size: 0.73rem; cursor: pointer; }
.license-back { margin-bottom: 18px; }
#licenseDocumentTitle { margin: 0 0 12px; font-size: 0.85rem; overflow-wrap: anywhere; }
#licenseDocumentText { margin: 0; padding: 14px; max-height: 58dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--separator); border-radius: 10px; background: var(--surface-muted); font-size: 0.72rem; line-height: 1.7; }

.receive-dialog { width: min(420px, calc(100% - 28px)); padding: 26px; color: var(--label); border: 1px solid var(--separator); border-radius: 24px; background: var(--surface); box-shadow: 0 28px 80px rgba(0,0,0,0.3); }
.receive-dialog h2 { font-size: 1.45rem; }
.receive-file { margin: 18px 0; padding: 14px; border-radius: 14px; background: var(--surface-muted); }
.receive-file strong,
.receive-file span { display: block; overflow-wrap: anywhere; }
.receive-file strong { font-size: 0.82rem; }
.receive-file span { margin-top: 5px; color: var(--secondary); font-size: 0.7rem; }
.trust-choice { display: flex; align-items: flex-start; gap: 9px; color: var(--secondary); font-size: 0.7rem; line-height: 1.5; }
.trust-choice input { margin-top: 2px; accent-color: var(--blue); }
.receive-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.receive-actions button { height: 44px; border: 0; border-radius: 12px; cursor: pointer; font-size: 0.78rem; font-weight: 700; }
.receive-actions button:first-child { color: var(--blue); background: var(--blue-soft); }
.receive-actions button:last-child { color: white; background: var(--blue); }

.status-pill:active,
.room-code:active,
.qr-button:active,
.settings-button:active,
.join-row button:active,
.attach-button:active,
.send-button:active,
.feed-action:active { transform: scale(0.96); }

@keyframes radar { from { width: 4px; height: 4px; opacity: 1; } to { width: 34px; height: 34px; opacity: 0; } }
@keyframes materialize { from { opacity: 0; transform: translateY(6px); } }

@media (min-width: 701px) and (max-height: 760px) {
  .send-panel { padding: 14px 24px; }
  .send-heading { padding-bottom: 12px; }
  h1 { font-size: 1.75rem; }
  .drop-stage { min-height: 116px; padding: 12px; }
  .send-icon { width: 32px; height: 32px; margin-bottom: 6px; }
  .file-actions { margin-top: 10px; }
  .peer-panel { padding: 16px 20px; }
  .privacy-note { margin-top: 12px; }
  .feed-section { padding: 20px 24px; }
  .feed { height: 136px; }
}

@media (max-width: 860px) and (min-width: 701px) {
  .workspace { grid-template-columns: 280px minmax(0,1fr); }
  .peer-panel { padding: 20px 16px; }
}
@media (max-width: 700px) {
  .page-shell { padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); gap: 10px; }
  .topbar { min-height: 48px; flex-wrap: wrap; }
  .brand-word { font-size: 0.84rem; }
  .room-tools { gap: 4px; flex-wrap: wrap; }
  .help-button { padding: 0 6px; font-size: 0.7rem; }
  .help-button svg { display: none; }
  .settings-button { width: 34px; }
  .exposure-banner { align-items: flex-start; flex-direction: column; gap: 3px; padding: 8px 10px; font-size: 0.66rem; }
  .workspace { min-height: 0; flex: none; display: flex; flex-direction: column; border-radius: 14px; }
  .peer-panel { order: 2; padding: 18px; border-right: 0; border-radius: 0; }
  .gate-identity { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
  .gate-identity > strong { max-width: 100%; font-size: 0.86rem; }
  .status-pill { margin: 0; font-size: 0.75rem; }
  .peer-list { margin-top: 12px; }
  .empty-peers { min-height: 58px; padding: 10px; flex-direction: row; text-align: left; gap: 9px; }
  .empty-peers p { font-size: 0.75rem; }
  .radar { width: 28px; height: 28px; }
  .invite-actions { margin-top: 10px; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .qr-button, .room-code { padding: 8px; font-size: 0.75rem; }
  .privacy-note { margin-top: 14px; font-size: 0.6875rem; }
  .name-settings { margin-top: 12px; padding-top: 12px; }
  .send-panel { order: 1; padding: 22px 18px; }
  .send-heading { padding-bottom: 16px; }
  h1 { font-size: 1.5rem; }
  .send-heading > p:last-child { font-size: 0.8125rem; }
  .drop-stage { min-height: 140px; padding: 16px 12px; }
  .send-icon { width: 36px; height: 36px; padding: 4px; }
  .drop-core strong { font-size: 0.9375rem; }
  .drop-core > span { font-size: 0.75rem; }
  .file-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .file-picker, .folder-picker { padding: 8px; font-size: 0.8125rem; }
  .feed-section { order: 3; min-height: 270px; padding: 20px 18px; }
  .feed { height: 160px; flex: auto; max-height: 300px; }
  .feed-item { grid-template-columns: 30px minmax(0,1fr); }
  .feed-actions { grid-column: 2; justify-self: start; }
  .device-name { max-width: 55%; }
  .guide-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
  .guide-dialog-header { padding: 14px 18px; }
  .guide-body { padding: 18px; }
  .guide-heading h2 { font-size: 1.2rem; }
  .guide-steps li { padding: 12px; gap: 10px; }
  .invite-dialog { padding: 22px; border-radius: 18px; }
  .settings-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .settings-header { padding: 20px 18px 15px; }
  .settings-content { max-height: calc(100dvh - 104px); padding: 12px 18px 24px; }
  .setting-action-row { grid-template-columns: minmax(0,1fr) auto; }
  .setting-action-row output { grid-column: 1 / -1; }
  .diagnostic-row { grid-template-columns: 1fr; }
  .receive-dialog { padding: 22px; border-radius: 18px; }
}
@media (prefers-color-scheme: dark) {
  :root { --canvas: #151619; --surface: #1e2024; --sidebar: #1a1c20; --surface-muted: #282b30; --label: #ecedf0; --secondary: #a2a7b0; --tertiary: #79808a; --separator: rgba(235,235,245,0.1); --blue: #419cff; --blue-pressed: #157eff; --blue-soft: rgba(65,156,255,0.1); --shadow: 0 8px 30px rgba(0,0,0,0.1); }
  .exposure-banner { color: #eaa39c; }
  .drop-stage { border-color: #424850; }
  .drop-stage:hover, .drop-stage.dragging { border-color: var(--blue); }
  .file-picker { color: #fff; background: #087dff; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .toast, .settings-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
}

.peer { display: grid; grid-template-columns: 20px minmax(0,1fr) 8px; gap: 10px; cursor: pointer; }
.peer-select { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.peer-copy { min-width: 0; }
.peer-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-copy > span { display: block; color: var(--secondary); font-size: 0.75rem; margin-top: 4px; }
.peer-auth { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--separator); cursor: default; font-size: 0.75rem; line-height: 1.5; overflow-wrap: anywhere; }
.peer-security-code { display: block; color: var(--label); font-family: ui-monospace, monospace; font-size: 1rem; font-weight: 600; letter-spacing: 0.05em; }
.peer-auth-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.peer-auth-actions button { min-height: 38px; padding: 8px 10px; border: 1px solid var(--separator); border-radius: 8px; background: var(--blue-soft); color: var(--blue); font: inherit; cursor: pointer; }
.peer-auth-actions button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.peer-auth-actions button:disabled { opacity: 0.6; cursor: default; }
.recovery-panel { border-bottom: 1px solid var(--separator); padding: 10px 0; font-size: 0.75rem; }
.recovery-panel summary { color: var(--blue); cursor: pointer; }
.recovery-panel > p { color: var(--secondary); line-height: 1.6; margin: 10px 0; }
.recovery-list { max-height: 240px; overflow: auto; }
.recovery-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 0; }
.recovery-copy { min-width: 0; cursor: pointer; padding: 5px 0; }
.recovery-actions { display: flex; gap: 8px; }
.recovery-row strong, .recovery-row span { display: block; overflow-wrap: anywhere; }
.recovery-row span { color: var(--secondary); margin-top: 4px; font-size: 0.6875rem; }
.recovery-row button, .recovery-toolbar button, .receive-folder-button { border: 1px solid var(--separator); border-radius: 8px; padding: 7px 10px; background: var(--surface-muted); color: var(--label); font: inherit; cursor: pointer; }
.recovery-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.recovery-select-all { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-right: auto; cursor: pointer; }
.recovery-panel input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }
.recovery-panel button { min-height: 40px; }
.recovery-panel button:disabled { opacity: 0.45; cursor: default; }
.recovery-panel input:focus-visible, .recovery-panel button:focus-visible, .recovery-download:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.recovery-toolbar #recoverySaveSelected { color: var(--blue); background: var(--blue-soft); }
.recovery-status { overflow-wrap: anywhere; }
.recovery-download { display: inline-block; margin: 0 0 8px; }
.recovery-download[hidden] { display: none; }
@media (max-width: 600px) {
  .recovery-row { grid-template-columns: 18px minmax(0, 1fr); }
  .recovery-actions { grid-column: 2; justify-content: flex-end; }
}
.receive-storage-hint { color: var(--secondary); font-size: 0.8125rem; line-height: 1.6; }
.receive-folder-button { margin-bottom: 12px; }
