:root {
  color-scheme: light;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 16px;
  --page: #f7f8f6;
  --surface: #fff;
  --ink: #22262d;
  --muted: #595f65;
  --line: #dfe2df;
  --primary: #494180;
  --green: #275d53;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); line-height: 1.65; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, a, input { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .66; }
:focus-visible { outline: 3px solid #756ada; outline-offset: 4px; }
[hidden] { display: none !important; }
.symbols { width: 0; height: 0; position: absolute; overflow: hidden; }
.icon { flex: none; width: 20px; height: 20px; display: inline-block; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, #app { width: calc(100% - 64px); max-width: 1040px; margin: 0 auto; }
.topbar-inner { min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand, .guide-open, .action, .back, .hint, .panel-heading, .card-footer, .dialog-heading, .status, .tools { display: flex; align-items: center; }
.brand { gap: 11px; font-size: 23px; font-weight: 760; line-height: 1; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; background: #383368; border-radius: 10px; color: white; }
.brand-mark svg { width: 32px; height: 32px; }
.guide-open, .back, .icon-button { color: var(--muted); background: transparent; border: 0; }
.guide-open { gap: 8px; padding: 9px 0 9px 10px; font-weight: 550; }
.guide-open:hover, .back:hover { color: var(--primary); }
.startup-feedback { display: none; margin-top: 18px; padding: 14px 16px; background: #eeedf5; border-radius: 10px; }
.role-target:target ~ .startup-feedback, .startup-feedback.failed { display: block; }
.startup-feedback p { margin-bottom: 8px; }
html[data-app-ready="true"] .startup-feedback, dialog:not([open]) { display: none; }
#app { padding: 50px 0 60px; padding: clamp(42px, 8vh, 84px) 0 60px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 40px; font-size: clamp(34px, 4vw, 50px); line-height: 1.2; font-weight: 750; letter-spacing: -.045em; }
h2 { font-size: 25px; line-height: 1.4; letter-spacing: -.025em; }
h3 { font-size: 18px; line-height: 1.45; }
.intro { margin-top: 13px; font-size: 18px; color: var(--muted); }
.choices { margin-top: 32px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.role-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; transition: transform .17s, border-color .17s, box-shadow .17s; }
.role-card:hover { transform: translateY(-3px); border-color: #b5afca; box-shadow: 0 9px 22px #282e3910; }
.role-card.receive:hover { border-color: #a2bdb0; }
.art { position: relative; overflow: hidden; isolation: isolate; display: grid; place-items: center; height: 188px; height: clamp(180px, 17vw, 214px); border-bottom: 1px solid #2826420a; background-color: var(--art-bg); background-image: linear-gradient(to right,var(--grid) 1px,transparent 1px),linear-gradient(to bottom,var(--grid) 1px,transparent 1px); background-size: 24px 24px; }
.send { --art-bg:#e9e7f6; --grid:#8a80b61c; --device:#504973; --inner:#d2cdea; --base:#a099c5; --badge:#60588f; --s1:#bdb4de; --s2:#9286bd; --s3:#6d6197; }
.receive { --art-bg:#e0eee5; --grid:#67927b1f; --device:#38544b; --inner:#bbd5c6; --base:#7caa8d; --badge:#477a62; --s1:#b3d3bb; --s2:#80aa8d; --s3:#5a8168; }
.art:before { content:""; position:absolute; inset:0; z-index:-1; background:radial-gradient(ellipse at center,transparent 30%,var(--art-bg) 100%); }
.illustration { position:relative; width: 237px; height: 147px; color: var(--device); }
.device { position:absolute; background:var(--inner); border:2.4px solid var(--device); box-shadow: 0 4px 0 var(--base), 0 13px 16px -13px var(--device); }
.send .device { width:150px; height:96px; left:38px; top:24px; border-radius:8px; transform:rotate(-7deg) skewX(-3deg); }
.receive .device { width:151px; height:97px; left:49px; top:19px; border-radius:8px; border-bottom-width:3px; transform:rotate(5deg) skewX(1deg); }
.screen { position:absolute; inset:6px; overflow:hidden; isolation:isolate; border-radius:3px; border:1px solid var(--device); background:linear-gradient(140deg,#f7f4fd,var(--s1)); }
.receive .screen { inset:5px 5px 10px; background:linear-gradient(145deg,#ecf5e9,var(--s1)); }
.screen:before, .screen:after { content:""; position:absolute; border-radius:50%; }
.screen:before { width:150%; height:145%; background:var(--s2); transform:rotate(-26deg); top:37%; left:-35%; }
.screen:after { width:139%; height:119%; background:var(--s3); transform:rotate(20deg); top:68%; left:2%; }
.screen i { position:absolute; width:19px; height:19px; background:#ffffffb3; right:16px; top:12px; border-radius:50%; }
.base { position:absolute; left:24px; top:118px; width:174px; height:12px; border:2px solid var(--device); border-radius:2px 2px 8px 8px; background:var(--inner); transform:rotate(-7deg) skewX(-20deg); box-shadow: 0 3px 0 var(--base); }
.base:after { content:""; position:absolute; left:42%; right:42%; top:0; height:3px; background:var(--base); border-radius:0 0 2px 2px; }
.stand { position:absolute; left:112px; top:107px; width:20px; height:20px; background:var(--inner); border:2px solid var(--device); transform:rotate(5deg); }
.stand:after { content:""; position:absolute; height:6px; width:66px; left:-24px; top:16px; border-radius:7px 7px 3px 3px; border:2px solid var(--device); background:var(--inner); }
.float-icon { position:absolute; width:49px; height:49px; border-radius:15px; display:grid; place-items:center; border:2px solid var(--device); background:#faf9fd; box-shadow:0 4px 0 var(--base); color:var(--badge); }
.float-icon .icon { width:25px; height:25px; stroke-width:2; }
.send .float-icon { left:159px; top:7px; transform:rotate(8deg); }
.receive .float-icon { left:23px; top:76px; transform:rotate(-8deg); background:#f7fcf5; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 25px 27px 24px; }
.card-body p { margin-top: 6px; color: var(--muted); }
.card-footer { margin-top: 28px; color: var(--primary); font-weight: 650; justify-content: space-between; }
.receive .card-footer { color: var(--green); }
.arrow-disc { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #f0eef8; }
.receive .arrow-disc { background: #eaf4ec; }
.arrow-disc .icon { width: 17px; height: 17px; }
.hint { gap: 10px; margin-top: 23px; color: var(--muted); }
.hint .icon { width: 18px; height: 18px; }
.back { display:inline-flex; gap:8px; padding:0; margin-bottom:21px; font-weight:550; }
.workspace { max-width: 760px; margin: 0 auto; }
.workspace .intro { font-size: 17px; }
.panel { margin-top: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 24px; padding: clamp(20px,4vw,32px); }
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 22px; }
.panel p { color: var(--muted); }
.panel p + p { margin-top: 8px; }
.panel-heading, .dialog-heading { justify-content: space-between; gap: 12px; }
.config-block { margin: 22px 0; border-block: 1px solid var(--line); padding: 19px 0; }
.actions, .tools { display: flex; gap: 10px; flex-wrap: wrap; }
.action { display: inline-flex; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; min-height: 44px; padding: 8px 16px; font-weight: 625; line-height: 1.4; }
.primary { color: white; background: var(--primary); }
.primary:hover { background: #393165; }
.secondary { color: var(--ink); background: #fff; border-color: #d4d7d4; }
.secondary:hover, .list-item:hover { background: #f3f4f2; }
.danger { background: #fff0ec; color: #9b3c2f; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; }
.icon-button:hover { background: #f2f2f0; }
.notice { padding: 12px 15px; border-radius: 9px; background: #f0eff6; margin-top: 16px; }
.notice.error { background: #fff0ec; color: #8d3427; }
.status { display: inline-flex; gap: 8px; color: var(--green); font-weight: 600; }
.status:before { content: ""; width: 9px; height: 9px; background: #40815f; border-radius: 50%; }
.credential { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 13px 0 19px; }
.code { font-family: ui-monospace, monospace; letter-spacing: .10em; font-size: 24px; font-weight: 650; line-height: 1.5; }
.room-list { margin-top: 18px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; text-align: left; color: var(--ink); padding: 14px; background: #fafbf9; border: 1px solid var(--line); border-radius: 10px; font-size: 17px; }
.list-item + .list-item { margin-top: 9px; }
.list-label { display: flex; align-items: center; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.list-label .icon { color: var(--green); }
.list-info { display: flex; align-items: center; flex: none; gap: 9px; color: var(--muted); }
.empty { display: grid; justify-items: center; text-align: center; padding: 34px 12px; background: #f6f8f5; border-radius: 10px; border: 1px dashed #ced7cf; }
.empty > .icon { width: 34px; height: 34px; color: var(--green); margin-bottom: 12px; }
.empty p { margin-top: 6px; }
.field-label { display: block; font-weight: 650; margin: 20px 0 8px; }
.viewer { background: #15151b; color: white; margin-top: 22px; border-radius: 13px; overflow: hidden; position: relative; }
.viewer-screen { width: 100%; min-height: 200px; display: block; aspect-ratio: 16 / 9; object-fit: contain; background: #101016; }
.tools { justify-content: space-between; padding: 10px 14px; }
.tools .action { background: #35353d; color: #fff; }
.viewer.expanded { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10; }
.viewer:fullscreen, .viewer.expanded { width: 100%; height: 100%; border-radius: 0; margin: 0; }
.viewer:fullscreen .viewer-screen, .viewer.expanded .viewer-screen { width: 100%; height: 100%; }
.viewer:fullscreen .tools, .viewer.expanded .tools { position: absolute; bottom: 0; width: 100%; padding: 20px; background: linear-gradient(transparent,#111b); }
.viewer:fullscreen.quiet, .viewer.expanded.quiet { cursor: none; }
.viewer:fullscreen.quiet .tools, .viewer.expanded.quiet .tools { opacity: 0; pointer-events: none; }
.viewer.quiet:not(.pointer-controls) .tools:focus-within { opacity: 1; pointer-events: auto; }
.viewer.waiting {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #edeaf4; color: #282434; padding: 18px 20px 82px;
}
.viewer.waiting .viewer-screen { display: none; }
.viewer.waiting.has-stream .viewer-screen {
  display: block; flex: none; width: 144px; height: 81px; min-height: 0;
  border-radius: 9px; margin-bottom: 16px; background: #454055;
}
.viewer-message { max-width: 620px; text-align: center; overflow-wrap: anywhere; }
.viewer-message strong { font-size: 24px; line-height: 1.4; }
.viewer-message p { color: #514a62; margin-top: 7px; }
.viewer.waiting .tools { background: transparent; }
.viewer.waiting .tools .action { background: #fff; color: #393246; border-color: #bdb7cb; }
.viewer.waiting .actions .action { color: #fff; background: var(--primary); border-color: var(--primary); }
@media (max-height: 380px) {
  .viewer.waiting { padding-bottom: 66px; }
  .viewer.waiting.has-stream .viewer-screen { width: 96px; height: 54px; margin-bottom: 7px; }
  .viewer.expanded .tools { padding: 9px 14px; }
}
dialog { width: calc(100% - 32px); max-width: 480px; padding: 25px; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 22px 90px #1c22342b; color: var(--ink); }
dialog::backdrop { background: #15202a65; }
dialog h3 { margin: 19px 0 4px; }
dialog p { color: var(--muted); }
@media(max-width:640px) {
  .topbar-inner,#app { width:calc(100% - 36px); }
  .topbar-inner { min-height:64px; }
  #app { padding:32px 0 42px; }
  .brand { font-size:21px; }
  .intro { margin-top:10px; font-size:16px; }
  .choices { grid-template-columns:1fr; gap:16px; margin-top:24px; }
  .art { height:148px; }
  .illustration { transform:scale(.86); }
  .card-body { padding:17px 19px 16px; }
  .card-footer { margin-top:14px; }
  .hint { align-items:flex-start; margin-top:18px; }
  .hint .icon { margin-top:4px; }
  .panel-heading { flex-wrap:wrap; }
  .list-info { gap:5px; }
}
/* The preview mirrors the identity viewers pick from the public directory. */
.workspace.sender-workspace { max-width: 1000px; }
.setup-panel {
  display: grid;
  grid-template-columns: minmax(255px, .82fr) minmax(0, 1.18fr);
  margin-top: 26px;
  border: 1px solid #dadce0;
  border-radius: 22px;
  background: white;
  overflow: hidden;
  box-shadow: 0 3px 8px #302c4606, 0 16px 42px -22px #302c462d;
}
.channel-preview {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 20px; min-width: 0; padding: 26px; padding: clamp(22px, 3vw, 34px);
  color: #fff; background: linear-gradient(148deg,#323057 5%,#51487d 70%,#686096);
}
.channel-preview::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 68% 53%,#b9a6ff4f,transparent 62%),
    radial-gradient(#c4b6ee42 .9px, transparent 1px);
  background-size: auto, 14px 14px;
  mask-image: linear-gradient(transparent, #000 19%, #000 72%, transparent);
}
.channel-preview h2, .preview-caption span { display: flex; align-items: center; gap: 8px; }
.channel-preview h2 { font-weight: 580; font-size: 16px; color: #eeebfc; }
.channel-preview h2 .icon,.preview-caption .icon { width: 18px; height: 18px; }
.preview-art { width: 194px; height: 150px; position: relative; align-self: center; }
.preview-window {
  position: absolute; left: 8px; right: 12px; top: 18px; height: 110px; padding: 14px 5px 5px;
  border: 1px solid #e4ddff; border-radius: 9px; background: #e5dff7;
  transform: rotate(-7deg) skewX(-3deg);
  box-shadow: 3px 5px 0 #9286b8, 10px 13px 0 -1px #50486d, 10px 13px 0 0 #b9add6, 0 17px 25px #211b403b;
}
.preview-window > span { position: absolute; top: 5px; left: 8px; height: 4px; width: 4px; border-radius: 50%; background: #88809f; box-shadow: 7px 0 #aaa2ba,14px 0 #c0b9cc; }
.preview-wallpaper { position: relative; overflow: hidden; isolation: isolate; height: 100%; border-radius: 4px; background: linear-gradient(131deg,#efdff6 8%,#c7b2f4 48%,#a89cdb 87%); }
.preview-wallpaper::before,.preview-wallpaper::after { content:""; position:absolute; border-radius:50%; }
.preview-wallpaper::before { width:153%; height:157%; left:-35%; top:39%; transform:rotate(-27deg); background:linear-gradient(123deg,#a296df,#7366b5 80%); }
.preview-wallpaper::after { width:136%; height:120%; top:73%; left:0; transform:rotate(16deg); background:linear-gradient(115deg,#9183c8,#5a548e); }
.preview-wallpaper i { position: absolute; right: 19px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: #f9e9d9; }
.preview-signal { position: absolute; display: grid; place-items: center; right: 0; top: 0; width: 45px; height: 45px; border: 1px solid #fcf7ff; border-radius: 13px; transform: rotate(8deg); background: #f6f1ff; color: #5c4d8d; box-shadow: 0 4px #aba0c8, 0 7px 11px #27203e38; }
.preview-signal .icon { width: 24px; height: 24px; }
.preview-caption { min-width: 0; }
.preview-caption strong { display: block; font-size: 26px; font-size: clamp(23px, 2.4vw, 31px); line-height: 1.3; letter-spacing: -.03em; overflow-wrap: anywhere; }
.preview-caption span { margin-top: 9px; color: #e9e5f5; }
.setup-controls { min-width: 0; padding: 28px; padding: clamp(24px, 3.2vw, 38px); }
.setup-controls h2 { font-size: 25px; margin-bottom: 20px; }
.setup-field + .setup-field { margin-top: 16px; }
.setup-field label { display: block; margin-bottom: 6px; font-weight: 650; }
.setup-field p, .sound-copy > span { margin-top: 4px; color: var(--muted); line-height: 1.5; }
.text-input {
  display: block; width: 100%; min-width: 0; min-height: 46px; margin: 0;
  border: 1px solid #bfc3c8; border-radius: 9px; background: #fcfcfd; color: var(--ink);
  padding: 9px 13px; line-height: 1.5;
}
.text-input::placeholder { color: #65696e; }
.text-input:focus { outline: 2px solid #7466a6; outline-offset: 1px; background: white; }
.text-input[aria-invalid="true"] { border-color: #b04431; }
.sound-row { display: flex; align-items: center; gap: 12px; margin: 21px 0; padding: 14px 0; border-block: 1px solid var(--line); cursor: pointer; }
.sound-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #f0edf8; color: #62528e; }
.sound-copy { display: grid; flex: 1; }
.sound-copy > span { margin-top: 0; }
.sound-row input { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 44px; height: 26px; border: 1px solid #797b84; border-radius: 20px; margin: 0; background: #81838b; cursor: pointer; transition: background .15s; }
.sound-row input::before { content: ""; position: absolute; left: 3px; top: 3px; height: 18px; width: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #2021324d; transition: transform .15s; }
.sound-row input:checked { border-color: var(--primary); background: var(--primary); }
.sound-row input:checked::before { transform: translateX(18px); }
.start-action { width: 100%; min-height: 48px; justify-content: flex-start; gap: 10px; background: #514583; box-shadow: 0 2px 3px #39306424; }
.start-action .icon:last-child { margin-left: auto; }
.setup-controls .notice { padding: 10px 13px; line-height: 1.5; margin-top: 12px; }
.live-panel h2, .join-panel h2 { overflow-wrap: anywhere; }
.live-panel .panel-heading > div { min-width: 0; }
.live-panel .status { flex: none; }
.room-id { display: block; margin-top: 3px; font-weight: 450; color: var(--muted); font-variant-numeric: tabular-nums; }
.credential .code { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.join-panel .text-input { max-width: 380px; margin-bottom: 20px; }
@media (min-width: 761px) and (max-height: 850px) {
  #app:has(.sender-workspace) { padding-top: 28px; }
  .workspace.sender-workspace .back { margin-bottom: 14px; }
  .setup-panel { margin-top: 20px; }
  .setup-controls { padding: 24px 32px; }
  .setup-controls h2 { margin-bottom: 14px; }
  .setup-field + .setup-field { margin-top: 13px; }
  .sound-row { margin: 14px 0; padding-block: 11px; }
}
@media (max-width: 760px) {
  .setup-panel { grid-template-columns: 1fr; }
  .channel-preview { min-height: 135px; gap: 16px; padding: 20px 25px; }
  .channel-preview h2, .preview-caption { position: relative; z-index: 1; max-width: calc(100% - 126px); }
  .preview-art { position: absolute; right: 10px; top: 50%; transform: translateY(-50%) scale(.63); transform-origin: right center; }
  .preview-caption span { margin-top: 3px; }
}
@media (max-width: 440px) {
  .setup-controls { padding: 19px; }
  .channel-preview { padding: 18px 19px; min-height: 125px; }
  .channel-preview h2,.preview-caption { max-width: calc(100% - 96px); }
  .preview-art { right: 6px; transform: translateY(-50%) scale(.50); }
  .sound-row { gap: 8px; }
  .sound-icon { width: 32px; height: 32px; }
}
@media (forced-colors: active) {
  .sound-row input { appearance: auto; }
  .sound-row input::before { content: none; }
}

@media(prefers-reduced-motion:reduce) { *,*:before,*:after { transition:none !important; } }
