:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --preview: #e9eeeb;
  --text: #25352c;
  --muted: #64736a;
  --border: #dce4df;
  --accent: #c1efd1;
  --accent-text: #205636;
  --error: #a93535;
  --disabled: #a5b1aa;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141917;
    --surface: #222b26;
    --preview: #1a211d;
    --text: #e6eee9;
    --muted: #a0afa6;
    --border: #36433b;
    --accent: #bdf2d1;
    --accent-text: #205636;
    --error: #ffaaaa;
    --disabled: #64746a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141917;
  --surface: #222b26;
  --preview: #1a211d;
  --text: #e6eee9;
  --muted: #a0afa6;
  --border: #36433b;
  --accent: #bdf2d1;
  --accent-text: #205636;
  --error: #ffaaaa;
  --disabled: #64746a;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select { font: inherit; }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; color: var(--disabled); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 4px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :focus-visible { outline-color: var(--accent); }
}
:root[data-theme="dark"] :focus-visible { outline-color: var(--accent); }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon, .empty-icon { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon { width: 22px; height: 22px; }
.tool-shell { width: 100%; max-width: 1560px; height: 100svh; min-height: 520px; margin: auto; padding: 32px 40px 24px; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-shrink: 0; }
.app-brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.app-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-text); }
.app-icon .icon { width: 21px; height: 21px; stroke-width: 2; }
.app-name { font-size: 16px; letter-spacing: -.3px; font-weight: 600; }
.app-intro { max-width: 54ch; }
.app-intro h1 { font-size: 13px; letter-spacing: 0; margin-bottom: 3px; }
.app-header p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.guide { width: 100%; max-width: 1560px; margin: auto; padding: 48px 40px 80px; border-top: 1px solid var(--border); }
.guide-content { max-width: 72ch; margin: auto; font-size: 16px; line-height: 1.8; }
.guide h2 { font-size: 28px; line-height: 1.3; letter-spacing: -.6px; margin: 0 0 20px; text-wrap: balance; }
.guide h3 { font-size: 18px; line-height: 1.5; font-weight: 600; margin: 32px 0 10px; text-wrap: balance; }
.guide p { margin: 0; color: var(--muted); }
.guide p + p { margin-top: 14px; }
.guide a { color: var(--text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.guide a:hover { color: var(--accent-text); background: var(--accent); }
.guide a:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 4px; }
.compatibility-lists { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 36px; margin: 28px 0; }
.compatibility-lists h3 { margin: 0 0 12px; }
.compatibility-lists ul { margin: 16px 0 0; padding-left: 20px; color: var(--muted); }
.compatibility-lists li { padding-left: 3px; margin-bottom: 12px; }
.compatibility-lists li:last-child { margin-bottom: 0; }
.compatibility-lists strong { color: var(--text); font-weight: 600; }
.compatibility-lists span { display: block; font-size: 13px; }
.compatibility .compatibility-note { font-size: 13px; line-height: 1.75; }
.faq details { border-bottom: 1px solid var(--border); padding: 20px 0; }
.faq summary { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; font-size: 17px; font-weight: 600; line-height: 1.5; list-style: none; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex-shrink: 0; color: var(--muted); font-weight: 400; }
.faq details[open] > summary::after { content: "-"; }
.faq summary:hover { color: var(--muted); }
.faq summary:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 5px; border-radius: 2px; }
.faq details > p { margin-top: 14px; }
.viewfinder { width: 100%; flex: 1; min-height: 240px; max-height: 960px; position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--preview); }
.viewfinder.is-live, .viewfinder.video-playback { background: #101512; }
.viewfinder video { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }
#camera-video { display: none; }
.is-live #camera-video { display: block; }
.mirrored #camera-video { transform: scaleX(-1); }
.playing #camera-video { visibility: hidden; }
.camera-empty, .audio-playback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; stroke-width: 1; opacity: .6; }
.audio-playback, .playing .camera-empty { display: none; }
.playing:not(.video-playback) .audio-playback { display: grid; }
.recording-indicator { position: absolute; top: 16px; left: 16px; display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.recording-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: #ce4949; flex-shrink: 0; }
.recording-indicator.recording .recording-dot { display: block; animation: pulse 1.5s ease-in-out infinite; }
.recording-separator { color: var(--muted); }
.recording-warning { position: absolute; top: 68px; left: 16px; width: calc(100% - 32px); max-width: 360px; margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 11px; line-height: 1.6; }
.recording-notice { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1; width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 11px 17px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 4px 20px #00000020; font-size: 12px; line-height: 1.5; text-align: center; pointer-events: none; }
.recording-notice:empty { display: none; }
.control-area { position: relative; align-self: center; flex-shrink: 0; }
.control-bar { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--border); border-radius: 19px; background: var(--surface); box-shadow: 0 5px 16px #13281b06; }
.control { width: 52px; height: 48px; display: grid; place-items: center; position: relative; border: 0; border-radius: 11px; background: transparent; transition: background .15s, color .15s; }
.control:hover:not(:disabled), .icon-button:hover { background: var(--preview); }
.control[aria-pressed="true"]:not(.record-control) { background: var(--accent); color: var(--accent-text); }
.control[aria-busy="true"] { opacity: .55; }
.control:disabled { opacity: .55; }
.control-divider { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }
.record-control:not(:disabled) { color: #ce4949; }
.record-control use { fill: currentColor; stroke-width: 0; }
.record-control.recording { background: #ce494914; }
.recording .icon { animation: pulse 1.5s ease-in-out infinite; }
.mic-activity { width: 4px; height: 4px; position: absolute; right: 7px; top: 7px; background: var(--accent-text); border-radius: 50%; opacity: 0; }
.control.is-hearing .mic-activity { opacity: 1; }
.extras-panel { position: absolute; bottom: calc(100% + 16px); right: 0; width: 364px; max-width: calc(100vw - 32px); max-height: calc(100svh - 128px); overflow-y: auto; overscroll-behavior: contain; z-index: 4; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: 0 18px 60px #10231a24; }
.panel-heading, .section-heading, .dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
h1 { font-size: 16px; letter-spacing: -.3px; font-weight: 600; margin: 0; }
h2 { font-size: 13px; font-weight: 600; margin: 0; }
.settings-section { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }
.icon-button { border: 0; background: transparent; border-radius: 8px; display: grid; place-items: center; width: 32px; height: 32px; color: var(--muted); flex-shrink: 0; }
.icon-button .icon { width: 18px; height: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 11px; color: var(--muted); }
select { width: 100%; padding: 9px 10px; height: 39px; color: var(--text); border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-size: 12px; }
.status { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.status-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.status.live { color: var(--text); }
.live .status-dot { background: #5da875; }
.status.error { color: var(--error); }
.status.error .status-dot { background: var(--error); }
.extra-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 1px solid var(--border); padding: 8px 10px; border-radius: 7px; background: var(--surface); color: var(--text); font-size: 11px; }
.button:hover:not(:disabled) { background: var(--preview); }
.button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.button .icon { width: 15px; height: 15px; }
.full-width { width: 100%; margin-top: 10px; }
.settings-section > .full-width:first-child { margin-top: 0; }
.device-detail { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; }
#browser-status { display: flex; align-items: center; gap: 6px; }
.level-heading { display: flex; justify-content: space-between; font-size: 11px; margin: 18px 0 9px; color: var(--muted); }
.level-meter { height: 25px; display: flex; gap: 3px; }
.level-meter span { flex: 1; background: var(--border); border-radius: 2px; min-width: 0; }
.level-meter span.lit { background: #65bd87; }
.level-meter span.warning.lit { background: #d6b85b; }
.level-meter span.danger.lit { background: #e07b70; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 5px 0; font-size: 11px; margin-right: 14px; }
.text-button:hover { color: var(--text); text-decoration: underline; }
.errors { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 32px)); z-index: 5; pointer-events: none; }
.device-error { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 24px #10231a16; padding: 14px 18px; color: var(--error); font-size: 12px; line-height: 1.6; margin: 0 0 8px; pointer-events: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.viewfinder:fullscreen { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
dialog { width: min(440px, calc(100% - 32px)); padding: 24px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 80px #0003; }
dialog::backdrop { background: #101b1580; }
dialog h2 { font-size: 18px; }
#dialog-content { font-size: 13px; line-height: 1.8; color: var(--muted); margin: 18px 0; }
#dialog-content strong { color: var(--text); font-weight: 600; }
#dialog-content a { color: var(--text); text-underline-offset: 3px; }
.site-header { width: 100%; max-width: 1180px; margin: auto; padding: 28px 40px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.site-header .app-brand { color: var(--text); text-decoration: none; }
.site-header .app-brand img { width: 36px; height: 36px; }
.document-body { min-height: 100svh; display: flex; flex-direction: column; }
.document-page { width: 100%; max-width: calc(72ch + 64px); padding: 0 32px; margin: 48px auto 80px; flex: 1; font-size: 16px; line-height: 1.8; }
.document-page h1 { font-size: 36px; line-height: 1.25; letter-spacing: -1px; margin: 20px 0 18px; text-wrap: balance; }
.document-page h2 { font-size: 20px; line-height: 1.4; margin: 32px 0 12px; }
.document-page p { margin: 0 0 16px; color: var(--muted); }
.document-page ul { margin: 0 0 20px; padding-left: 22px; color: var(--muted); }
.document-page li { padding-left: 3px; margin-bottom: 8px; }
.document-page strong { color: var(--text); font-weight: 600; }
.document-page a { color: var(--text); text-underline-offset: 3px; overflow-wrap: anywhere; }
.document-page a:hover { color: var(--accent-text); background: var(--accent); }
.document-page .back-link { font-size: 12px; color: var(--muted); }
.document-page .updated { font-size: 12px; margin-bottom: 28px; }
.document-page .contact-email { display: inline-block; font-size: 20px; font-weight: 600; margin: 8px 0 24px; }
.page-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.document-page .button { font-size: 13px; padding: 10px 16px; text-decoration: none; }
.site-footer { width: 100%; max-width: 1560px; margin: 0 auto; padding: 26px 40px 32px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .footer-brand { color: var(--text); font-size: 13px; font-weight: 600; }
.site-footer nav { display: flex; gap: 12px 20px; flex-wrap: wrap; }
.site-footer [aria-current="page"] { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.error-page .error-code { font-size: 72px; line-height: 1; font-weight: 600; letter-spacing: -3px; margin: 0; }
.error-page h1 { font-size: 32px; }
.error-page > p:not(.error-code) { max-width: 52ch; }
@keyframes pulse { 50% { opacity: .4; } }
@media (max-width: 600px) {
  .tool-shell { padding: 16px 16px max(16px, env(safe-area-inset-bottom)); gap: 20px; }
  .app-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .app-header p { font-size: 11px; }
  .guide { padding: 32px 20px 56px; }
  .guide h2 { font-size: 24px; }
  .guide-content { font-size: 15px; }
  .compatibility-lists { grid-template-columns: 1fr; gap: 28px; }
  .viewfinder { border-radius: 14px; }
  .control-bar { gap: 3px; padding: 7px; border-radius: 17px; }
  .control { width: 46px; height: 46px; }
  .control-divider { margin: 0 1px; height: 20px; }
  .extras-panel { position: fixed; bottom: calc(98px + env(safe-area-inset-bottom)); left: 16px; right: 16px; width: auto; max-width: none; max-height: calc(100svh - 122px - env(safe-area-inset-bottom)); }
  .site-header { padding: 20px; }
  .document-page { padding: 0 20px; margin: 28px auto 48px; }
  .document-page h1 { font-size: 30px; }
  .site-footer { padding: 24px 20px; align-items: flex-start; }
}
@media (max-width: 340px) {
  .control { width: 40px; }
  .control-bar { gap: 2px; }
}
@media (min-width: 1024px) {
  main.extras-open .tool-shell, main.extras-open .guide, main.extras-open + .site-footer { padding-left: 364px; }
  .extras-panel { position: fixed; top: 32px; bottom: 24px; left: max(40px, calc(50vw - 740px)); right: auto; width: 300px; max-height: none; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
