/* V1.6: 10-second browser-only microphone envelope, colored only by actual AI results. */
#waveform.wave{display:none!important}
.rolling-panel{width:100%;max-width:420px;margin:12px auto 16px;text-align:left;border-radius:16px;padding:12px 13px 10px;background:#17283c;border:1px solid #425c72}
.rolling-header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.rolling-header h2{font-size:13px;font-weight:650;margin:0;color:#f6f8fc}
.rolling-state{font-size:10px;color:#98dacc}
/* V1.6.10: centered, stable current sound name above the waveform. */
.rolling-current{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:48px;margin:2px 0 4px;text-align:center}
.rolling-current-label{font-size:10px;color:#b9cadd;line-height:1.3}
.rolling-current-value{display:block;max-width:100%;font-size:16px;font-weight:650;line-height:1.3;color:#f2f9fa;overflow-wrap:anywhere}
.rolling-current-value[data-warning=true]{color:#ff8795}
html[data-theme=light] .rolling-current-label{color:#52677d}
html[data-theme=light] .rolling-current-value{color:#193048}
html[data-theme=light] .rolling-current-value[data-warning=true]{color:#b52339}
body[data-state=warning] .rolling-current-label,body[data-state=warning] .rolling-current-value,body[data-state=warning] .rolling-current-value[data-warning=true]{color:#fff}
@media(max-width:380px){.rolling-current-value{font-size:14px}}
#rolling-waveform{display:block;width:100%;height:104px;margin:8px 0 4px}
#rolling-events{font-size:11px;color:#ff8491;min-height:16px;margin:5px 0;overflow-wrap:anywhere}
#rolling-note{font-size:10px;color:#b9cadd;line-height:1.5;margin:5px 0 0}
body[data-state=warning] .rolling-panel{background:#52192b;border-color:#ffd5db}
body[data-state=warning] .rolling-panel h2,body[data-state=warning] .rolling-panel #rolling-note{color:#fff}
html[data-theme=light] .rolling-panel{background:#fff;border-color:#cad8e3}
html[data-theme=light] .rolling-header h2{color:#193048}
html[data-theme=light] #rolling-note{color:#52677d}
html[data-theme=light] #rolling-events{color:#b52339}
html[data-theme=light] .rolling-state{color:#0f7e74}
html[data-theme=light] body[data-state=warning] .rolling-panel{background:#6e2036;border-color:#ffffff99}
html[data-theme=light] body[data-state=warning] .rolling-header h2,html[data-theme=light] body[data-state=warning] #rolling-note,html[data-theme=light] body[data-state=warning] #rolling-events{color:#fff}
@media(max-height:740px){.rolling-panel{margin:7px auto;padding:9px 11px}#rolling-waveform{height:84px}main{padding-top:10px;padding-bottom:10px}}
/* V1.6 upload-only human ground-truth editor, pointer/keyboard supported. */
.annotation-editor{border:1px solid #5b8294;border-radius:12px;padding:14px;margin:10px 0;background:#0d1b2c;max-width:100%;overflow:hidden}
.annotation-editor h3{font-size:16px;margin:2px 0 12px}
.annotation-status{font-size:12px;color:#b8c7db;line-height:1.5;overflow-wrap:anywhere}
.annotation-audio{width:100%;min-height:44px;margin:10px 0}
.annotation-canvas{display:block;width:100%;height:150px;border:1px solid #506b82;border-radius:8px;touch-action:none;cursor:crosshair}
.annotation-controls{display:flex;align-items:end;gap:8px;flex-wrap:wrap;margin:12px 0}
.annotation-controls label{display:flex;flex:1 1 100px;flex-direction:column;gap:5px;font-size:12px}
.annotation-controls input[type=range]{width:100%;min-width:85px;accent-color:#5eead4}
.annotation-controls input[type=number]{width:100%;min-width:90px}
.annotation-controls select{flex:1 1 130px;min-width:125px;min-height:44px}
.annotation-controls button{min-height:44px}
.annotation-row{display:flex;justify-content:space-between;align-items:center;gap:8px;border-bottom:1px solid #42576d;padding:8px 0;font-size:12px}
.annotation-row button{min-height:40px}
.annotation-check{display:flex;align-items:center;gap:10px;margin-top:14px;font-size:12px}
.annotation-check input{width:20px;height:20px}
.annotation-legend{font-size:11px;line-height:1.5;color:#b7c7da}
html[data-theme=light] .annotation-editor{background:#edf4f7;border-color:#b4cdd7;color:#15273d}
html[data-theme=light] .annotation-status,html[data-theme=light] .annotation-legend{color:#53677e}
html[data-theme=light] .annotation-row{border-color:#c6d4df}
.theme-picker.standalone{display:flex;justify-content:flex-end;padding:10px max(20px,calc((100vw - 1000px)/2));position:relative;z-index:1}
@media(max-width:440px){.annotation-editor{padding:10px}.annotation-controls{gap:6px}.rolling-panel{padding:10px}}

/* V1.6.1: default-enabled accessible audible alert toggle; no microphone changes. */
.alert-tone-setting{width:100%;margin:12px auto 0;padding:10px 14px;border-radius:12px;border:1px solid #425c72;background:#17283c}
.alert-tone-line{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px}
#alert-tone-label{font-size:13px;font-weight:650;color:#f6f8fc;cursor:pointer}
#alert-tone-toggle{width:44px;height:26px;flex:none;accent-color:#6dddc8;cursor:pointer}
#alert-tone-toggle:focus-visible{outline:3px solid #9cdfd1;outline-offset:4px}
#alert-tone-note{font-size:11px;color:#b9cadd;line-height:1.5;margin:5px 0 0}
html[data-theme=light] .alert-tone-setting{background:#fff;border-color:#cad8e3}
html[data-theme=light] #alert-tone-label{color:#193048}
html[data-theme=light] #alert-tone-note{color:#52677d}
body[data-state=warning] .alert-tone-setting{background:#52192b;border-color:#ffd5db}
body[data-state=warning] #alert-tone-label,body[data-state=warning] #alert-tone-note{color:#fff}
html[data-theme=light] body[data-state=warning] .alert-tone-setting{background:#6e2036;border-color:#ffffff99}
@media(max-height:740px){.alert-tone-setting{margin-top:7px;padding:7px 11px}}

/* V1.6.2: read-only current microphone input; no false Bluetooth assumptions. */
.mic-source-panel{width:100%;margin:9px auto 0;padding:11px 14px;border:1px solid #425c72;border-radius:12px;background:#17283c;min-width:0}
.mic-source-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
#mic-source-label{font-size:12px;color:#b9cadd;font-weight:600}
#mic-source-value{font-size:13px;font-weight:650;color:#8fe0d2;min-width:0;overflow-wrap:anywhere}
.mic-source-name,.mic-source-note{font-size:10px;color:#b9cadd;line-height:1.5;margin:5px 0 0;overflow-wrap:anywhere}
.mic-source-name:empty{display:none}
html[data-theme=light] .mic-source-panel{background:#fff;border-color:#cad8e3}
html[data-theme=light] #mic-source-label,html[data-theme=light] .mic-source-name,html[data-theme=light] .mic-source-note{color:#52677d}
html[data-theme=light] #mic-source-value{color:#147c79}
body[data-state=warning] .mic-source-panel{background:#52192b;border-color:#ffd5db}
body[data-state=warning] .mic-source-panel :is(#mic-source-label,#mic-source-value,.mic-source-name,.mic-source-note){color:#fff}
html[data-theme=light] body[data-state=warning] .mic-source-panel{background:#6e2036;border-color:#ffffff99}
@media(max-height:740px){.mic-source-panel{margin-top:5px;padding:7px 11px}}


/* V1.6.5: only language, appearance, feedback and two test links in Settings.
   The Debug switch stays visible; alert tone and sensitivity controls live with diagnostics. */
.toolbar{justify-content:space-between;align-items:center;margin-top:6px;position:relative;z-index:50}
.toolbar>.debug-switch{min-height:44px}
.settings-menu{position:relative;margin-left:auto}
.settings-menu>summary{list-style:none;display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;min-width:44px;padding:8px 13px;border:1px solid #506b83;border-radius:12px;background:#20354e;color:#f6f8fc;cursor:pointer;font-size:13px;font-weight:600;user-select:none}
.settings-menu>summary::-webkit-details-marker{display:none}
.settings-menu>summary::marker{content:''}
.settings-menu>summary:focus-visible{outline:3px solid #9cdfd1;outline-offset:3px}
.settings-menu[open]>summary{border-color:#9cdfd1;background:#29465e}
/* Narrow .app content has 26px side padding; size the anchored popover inside it. */
.settings-content{box-sizing:border-box;position:absolute;top:calc(100% + 8px);right:0;width:min(380px,calc(100vw - 52px - env(safe-area-inset-left) - env(safe-area-inset-right)));max-height:min(74dvh,680px);overflow-y:auto;overscroll-behavior:contain;padding:16px;border:1px solid #597a92;border-radius:17px;background:#132339;color:#f6f8fc;box-shadow:0 22px 54px #040b16bb}
.settings-group{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;padding:0 0 9px}
.settings-content .language-switch{align-self:auto;margin:0}
.settings-links{display:flex;flex-direction:column;gap:2px;border-top:1px solid #47627b;padding-top:8px;margin-top:12px}
.settings-links .feedback{justify-content:flex-start;text-align:left;min-height:44px;font-size:12px}
.settings-content .theme-picker{border-top:1px solid #47627b;justify-content:space-between;gap:10px;padding-top:12px;margin-top:10px}
.settings-content .theme-picker-label{font-size:12px;color:#cbdbe5}
html[data-theme=light] .settings-menu>summary{background:#fff;color:#172c42;border-color:#b8c9d9}
html[data-theme=light] .settings-menu[open]>summary{background:#edf3f8;border-color:#147c79}
html[data-theme=light] .settings-content{background:#fff;color:#172c42;border-color:#b8c9d9;box-shadow:0 18px 45px #12283c36}
html[data-theme=light] .settings-links,html[data-theme=light] .settings-content .theme-picker{border-color:#d7e2eb}
html[data-theme=light] .settings-content .theme-picker-label{color:#52677d}
body[data-state=warning] .settings-menu>summary{background:#781d32;color:#fff;border-color:#ffffff99}
body[data-state=warning] .settings-content{background:#5e1b30;border-color:#ffffffbb;color:#fff}
body[data-state=warning] .settings-content .theme-picker-label{color:#fff}
body[data-state=warning] .settings-content .settings-links,body[data-state=warning] .settings-content .theme-picker{border-color:#ffffff55}
html[data-theme=light] body[data-state=warning] .settings-menu>summary{background:#781d32;color:#fff;border-color:#ffffff99}
html[data-theme=light] body[data-state=warning] .settings-content{background:#5e1b30;color:#fff;border-color:#ffffffbb}

/* Only the browser-reported name of the actual input track: no explanatory card. */
.mic-source-panel{display:flex;align-items:center;justify-content:center;gap:7px;max-width:100%;width:max-content;min-height:31px;margin:7px auto 0;padding:5px 11px;border:1px solid #425c72;border-radius:999px;background:#17283c;color:#b9cadd}
.mic-source-panel svg{flex:none}
#mic-source-value{font-size:12px;line-height:1.4;font-weight:600;color:#8fe0d2;overflow-wrap:anywhere;min-width:0;text-align:center}
html[data-theme=light] .mic-source-panel{background:#fff;border-color:#cad8e3;color:#52677d}
html[data-theme=light] #mic-source-value{color:#147c79}
body[data-state=warning] .mic-source-panel{background:#52192b;border-color:#ffd5db;color:#fff}
body[data-state=warning] #mic-source-value{color:#fff}

/* V1.6.4: restore the original V1.6.2 ten-second panel layout.
   Quiet-signal visibility is handled in live-timeline.js, not by enlarging the box. */
main .rolling-panel{width:100%;max-width:420px;margin:12px auto 16px;padding:12px 13px 10px}
main #rolling-waveform{width:100%;height:104px}
@media(max-height:740px){main .rolling-panel{margin:7px auto;padding:9px 11px}main #rolling-waveform{height:84px}.settings-content{max-height:70dvh}}

/* V1.6.5: advanced audible-alert and threshold controls belong to model diagnostics. */
.settings-content .alert-tone-setting{width:100%;margin:10px 0 14px;padding:10px 12px}
.debug-content .sensitivity{margin-top:18px}

/* V1.6.6: enlarge the central tap target, including warning and compact layouts. */
.visual .icon-disc{width:132px;height:132px}
.visual .mic-icon{width:48px;height:52px}
.visual .loader{width:40px;height:40px}
body[data-state=warning] .visual .icon-disc{width:136px;height:136px}
body[data-state=warning] .visual .warning-icon{width:67px;height:67px}
@media(max-height:740px){.visual .icon-disc{width:114px;height:114px}body[data-state=warning] .visual .icon-disc{width:116px;height:116px}}

/* V1.6.8: clean status text (no pill/card background), with the only active
   red indicator placed next to 検知中 instead of on the microphone circle. */
main .status{background:transparent;border:0;box-shadow:none;padding:0;border-radius:0}
html[data-theme=light] main .status{background:transparent;border:0;box-shadow:none;color:#53677e}
main .status-dot{width:10px;height:10px;flex:none;border-radius:50%;background:#8495aa;box-shadow:none}
body[data-state=listening] main .status-dot{background:#f43f5e;box-shadow:0 0 10px #f43f5e88;animation:tsg-status-pulse 1.45s ease-in-out infinite}
body[data-state=warning] main .status-dot{background:#fff;box-shadow:none;animation:none}
@keyframes tsg-status-pulse{0%,100%{opacity:1}50%{opacity:.45}}
@media(prefers-reduced-motion:reduce){body[data-state=listening] main .status-dot{animation:none;opacity:1}}

/* V1.6.12: two true same-origin page links in Settings; the active page
   is highlighted, while the existing audio session is stopped by pagehide. */
.settings-content .version-switch{margin:10px 0 12px;padding:10px 0 0;border-top:1px solid #47627b}
.settings-content #version-switch-title{display:block;margin:0 0 7px;font-size:12px;font-weight:600;color:#cbdbe5}
.settings-content .version-options{display:grid;grid-template-columns:1fr 1fr;gap:7px;min-width:0}
.settings-content .version-options a{min-width:0;min-height:44px;padding:9px 7px;border-radius:11px;border:1px solid #617b94;color:#d4eee8;background:#ffffff08;text-decoration:none;text-align:center;font-size:12px;line-height:1.4;display:flex;align-items:center;justify-content:center;overflow-wrap:anywhere}
.settings-content .version-options a[aria-current=page]{background:#235d5d;border-color:#9cdfd1;color:#fff;font-weight:700}
.settings-content .version-options a:focus-visible{outline:3px solid #9cdfd1;outline-offset:2px}
html[data-theme=light] .settings-content .version-switch{border-color:#d7e2eb}
html[data-theme=light] .settings-content #version-switch-title{color:#52677d}
html[data-theme=light] .settings-content .version-options a{color:#193048;background:#f5f8fb;border-color:#b8c9d9}
html[data-theme=light] .settings-content .version-options a[aria-current=page]{background:#d4f1e9;color:#0d4a47;border-color:#147c79}
body[data-state=warning] .settings-content .version-switch{border-color:#ffffff66}
body[data-state=warning] .settings-content #version-switch-title{color:#fff}
body[data-state=warning] .settings-content .version-options a{color:#fff;background:#ffffff12;border-color:#ffffff88}
body[data-state=warning] .settings-content .version-options a[aria-current=page]{background:#ffffff30;border-color:#fff;color:#fff}

/* V1.6.13: language and appearance are side-by-side in Settings, on both layouts.
   Both have visible native dropdowns with accessible labels; avoid a third row. */
.settings-content .settings-group{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:center;gap:10px;padding:0 0 10px;
}
.settings-content .settings-group .language-switch,
.settings-content .settings-group .theme-picker{width:100%;min-width:0;margin:0}
.settings-content .settings-group .language-switch select{
  display:block;width:100%;min-width:0;min-height:44px;
}
.settings-content .settings-group > .theme-picker{
  display:flex;align-items:center;justify-content:stretch;
  border-top:0;margin:0;padding:0;min-width:0;
}
.settings-content .settings-group .theme-picker select{
  display:block;width:100%;min-width:0;max-width:none;min-height:44px;
}
