/* Interactive sound-threshold sample. All styles stay inside this section. */
.sound-demo { border-top: 1px solid var(--line); padding-block: 78px; }
.sound-demo .section-heading { margin-bottom: 28px; }
.sound-demo .section-heading .section-intro { max-width: 350px; }
.sound-demo .sound-demo-heading-icon { width: 19px; height: 19px; }
.sound-demo-stage { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(285px, 1fr); border: 1px solid var(--line); border-radius: 26px; background: var(--surface); overflow: hidden; }
.sound-demo-studio { padding: 25px; min-width: 0; align-self: center; }
.sound-demo-panel-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 16px; }
.sound-demo-source { display: flex; align-items: center; gap: 12px; }
.sound-demo-source-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; color: var(--sage); background: var(--raised); border: 1px solid var(--line); border-radius: 11px; }
.sound-demo-source-icon .icon { width: 20px; height: 20px; }
.sound-demo-source strong { display: block; font-size: 16px; font-weight: 500; line-height: 1.4; }
.sound-demo-source small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sound-demo-graph { position: relative; padding: 13px 15px 11px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.sound-demo-graph-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.sound-demo-level-readout { display: flex; align-items: baseline; gap: 5px; }
.sound-demo-level-readout > span { margin-right: 5px; }
.sound-demo-level-readout output { font-size: 20px; font-weight: 500; line-height: 1; letter-spacing: -.04em; color: var(--text); font-variant-numeric: tabular-nums; }
.sound-demo-level-readout small { font-size: 10px; }
.sound-demo-chart { display: block; width: 100%; height: 112px; margin-top: 8px; overflow: visible; }
.sound-demo-chart .sound-demo-grid-line { stroke: var(--line); stroke-width: 1; }
.sound-demo-chart [data-sound-bars] rect { fill: var(--sage); opacity: .25; }
.sound-demo-chart [data-sound-bars] rect[data-played="true"] { opacity: .85; }
.sound-demo-chart [data-sound-bars] rect[data-played="true"][data-over="true"] { fill: var(--peach); opacity: 1; }
.sound-demo-chart [data-sound-threshold-line] { stroke: var(--peach); stroke-width: 2; stroke-dasharray: 5 6; vector-effect: non-scaling-stroke; }
.sound-demo-chart [data-sound-playhead] { visibility: hidden; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sound-demo:is([data-state="playing"], [data-state="stopped"], [data-state="completed"]) [data-sound-playhead] { visibility: visible; }
.sound-demo-graph-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.sound-demo-threshold-legend { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--peach); }
.sound-demo-threshold-legend::before { content: ""; width: 19px; border-top: 2px dashed currentColor; }
.sound-demo .sound-demo-accessible { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sound-demo-transport { display: flex; align-items: center; min-width: 0; }
.sound-demo-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sound-demo .sound-demo-start { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 14px; border: 1px solid transparent; border-radius: 26px; background: var(--sage); color: var(--on-green); font-size: 12px; font-weight: 500; line-height: 1.4; }
.sound-demo-start .icon { width: 18px; height: 18px; }
/* Keep the control row stable as labels change between play, stop and mute. */
.sound-demo .sound-demo-start { min-width: 174px; }
.sound-demo .sound-demo-mute { min-width: 102px; }
.sound-demo .sound-demo-stop-icon, .sound-demo .sound-demo-volume-off { display: none; }
.sound-demo:is([data-state="playing"], [data-state="loading"]) .sound-demo-play-icon { display: none; }
.sound-demo:is([data-state="playing"], [data-state="loading"]) .sound-demo-stop-icon { display: block; }
.sound-demo-mute[aria-pressed="true"] .sound-demo-volume-waves { display: none; }
.sound-demo-mute[aria-pressed="true"] .sound-demo-volume-off { display: block; }
.sound-demo .sound-demo-start:hover:enabled { filter: brightness(1.08); }
.sound-demo .sound-demo-mute { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 26px; background: transparent; color: var(--muted); font-size: 12px; line-height: 1.4; }
.sound-demo-mute .icon { width: 18px; height: 18px; }
.sound-demo .sound-demo-mute:hover:enabled, .sound-demo .sound-demo-mute[aria-pressed="true"] { border-color: var(--sage); color: var(--text); background: var(--raised); }
.sound-demo button:disabled { opacity: .5; cursor: not-allowed; }
.sound-demo [data-sound-time] { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sound-demo-threshold-control { margin-top: 14px; padding: 12px 16px 11px; border: 1px solid var(--line); border-left: 3px solid var(--peach); border-radius: 14px; background: var(--raised); }
.sound-demo-threshold-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.sound-demo-threshold-heading label { font-size: 14px; font-weight: 500; }
.sound-demo-threshold-heading output { padding: 2px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--peach); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sound-demo input[type="range"] { display: block; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; accent-color: var(--peach); cursor: pointer; }
.sound-demo input[type="range"]::-webkit-slider-runnable-track { height: 7px; border-radius: 5px; background: var(--line); }
.sound-demo input[type="range"]::-moz-range-track { height: 7px; border-radius: 5px; background: var(--line); }
.sound-demo input[type="range"]::-webkit-slider-thumb { appearance: none; width: 25px; height: 25px; margin-top: -9px; border: 4px solid var(--surface); border-radius: 50%; background: var(--peach); box-shadow: 0 0 0 1px var(--peach); }
.sound-demo input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; border: 4px solid var(--surface); border-radius: 50%; background: var(--peach); box-shadow: 0 0 0 1px var(--peach); }
.sound-demo input[type="range"]:focus-visible { outline: 2px solid var(--peach); outline-offset: 4px; border-radius: 5px; }
.sound-demo input[type="range"]:disabled { cursor: not-allowed; opacity: .5; }
.sound-demo-threshold-help { max-width: 420px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sound-demo-result { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; padding: 26px 22px; border-left: 1px solid var(--line); background: var(--raised); overflow: hidden; }
.sound-demo-result-caption { position: relative; z-index: 1; max-width: 220px; font-size: 11px; line-height: 1.5; text-align: center; color: var(--muted); }
.sound-demo-phone-caption { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; min-height: 54px; max-width: 240px; text-align: center; }
.sound-demo-phone-caption .sound-demo-result-caption { display: flex; align-items: center; justify-content: center; min-height: 33px; }
.sound-demo-hint { color: var(--sage); font-size: 11px; font-weight: 500; line-height: 1.5; }
.sound-demo-next { position: relative; z-index: 1; width: 100%; max-width: 240px; min-height: 94px; }
.sound-demo-next-actions { display: grid; gap: 6px; }
.sound-demo-next-actions[hidden] { display: none; }
.sound-demo-next-actions > :is(button, a) { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; font-size: 12px; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; }
.sound-demo-next-actions .icon { flex: 0 0 auto; width: 17px; height: 17px; }
.sound-demo-next-actions > button { background: var(--surface); color: var(--sage); }
.sound-demo-next-actions > button:hover:enabled { border-color: var(--sage); background: var(--bg); }
.sound-demo-next-actions > a { background: var(--sage); border-color: var(--sage); color: var(--on-green); }
.sound-demo-next-actions > a:hover { filter: brightness(1.08); }
.sound-demo-next-actions > :is(button, a):focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; border-radius: 13px; }
.sound-demo-result::before { content: ""; position: absolute; width: 330px; height: 330px; border-radius: 50%; border: 1px solid var(--line); pointer-events: none; }
.sound-demo-phone { position: relative; z-index: 1; display: flex; flex-direction: column; flex: 0 0 auto; width: min(220px, 100%); aspect-ratio: var(--device-ratio, 9 / 19.5); min-height: 0; padding: 25px 10px 25px; border: 5px solid #283a33; border-radius: 30px; color: #fff; background-color: #284a3b; background-image: linear-gradient(180deg, #091d174d 0%, #0d251921 42%, #0d24180d 68%, #091d1761 100%), url('/assets/lockscreen-art.webp'); background-size: cover; background-position: center; box-shadow: 0 15px 28px #10261929, 0 0 0 1px #829286, inset 0 0 0 1px #ffffff1f; overflow: hidden; }
.sound-demo-phone::after { content: ""; position: absolute; z-index: 3; bottom: 9px; left: 50%; width: 57px; height: 3px; transform: translateX(-50%); border-radius: 4px; background: #ffffffb8; }
.sound-demo-phone-camera { position: absolute; z-index: 3; top: 8px; left: 50%; width: 8px; height: 8px; transform: translateX(-50%); border: 2px solid #19342a; border-radius: 50%; background: #071a12; box-shadow: 0 0 0 1px #ffffff0d; }
.sound-demo-lockscreen { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sound-demo-phone-top { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 4px; color: #fffffff0; }
.sound-demo-phone-top .icon { width: 14px; height: 14px; color: inherit; stroke-width: 1.8; }
.sound-demo-system-icons { display: inline-flex; align-items: center; gap: 6px; }
.sound-demo-system-icons .icon:last-child { width: 18px; }
.sound-demo-lock-clock { flex: 0 0 auto; margin-top: 32px; text-align: center; color: #fff; text-shadow: 0 2px 14px #071b163d; }
.sound-demo-lock-clock time { display: block; font-size: 52px; font-weight: 300; line-height: 1.12; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.sound-demo-lock-clock > span { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; line-height: 1.6; letter-spacing: .01em; }
.sound-demo-notification-slot { display: grid; align-items: start; flex: 0 0 138px; min-height: 138px; margin-top: 26px; }
.sound-demo-notification-slot > * { grid-area: 1 / 1; }
.sound-demo-notification { display: flex; flex-direction: column; width: 100%; padding: 11px 12px 12px; border: 1px solid #ffffffab; border-radius: 15px; background: #f8faf3ed; color: #22372b; box-shadow: 0 5px 17px #091d1726; backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15); overflow-wrap: break-word; text-align: left; }
.sound-demo-notification:hover { background: #fffffff5; border-color: #fff; }
.sound-demo-notification:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 15px; box-shadow: 0 0 0 6px #284a3b; }
.sound-demo-notification-heading { display: flex; align-items: center; gap: 6px; color: #4b6053; font-size: 10px; font-weight: 500; line-height: 1.5; }
.sound-demo-notification-app { display: block; flex: 0 0 auto; width: 17px; height: 17px; border-radius: 5px; object-fit: contain; }
.sound-demo-notification-heading small { margin-left: auto; color: #596b60; font-size: 9px; font-weight: 400; }
.sound-demo-notification strong { display: block; margin-top: 7px; font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: -.01em; }
.sound-demo-notification-body { display: block; margin-top: 4px; font-size: 11px; line-height: 1.5; color: #405448; }
.sound-demo [data-sound-parent][data-alert="true"] .sound-demo-notification { animation: sound-demo-notice-in .25s ease-out; }
.sound-demo-lock-bottom { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 20px; margin-top: auto; padding-inline: 5px; color: #fffffff0; }
.sound-demo-lock-bottom > span { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #ffffff26; border-radius: 50%; background: #0c2a254d; backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.sound-demo-lock-bottom .icon { width: 15px; height: 15px; stroke-width: 1.7; }
.sound-demo-app { --app-bg: #faf7f2; --app-surface: #fffdfa; --app-raised: #edf0e6; --app-text: #303d35; --app-muted: #606f63; --app-line: #d1d9cd; --app-sage: #426653; --app-peach: #9d583c; position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: 23px 10px 25px; background: var(--app-bg); color: var(--app-text); border-radius: 24px; }
.sound-demo-phone[data-screen="app"]::after { background: var(--line); }
.sound-demo-phone[data-screen="app"] .sound-demo-app { animation: sound-demo-app-in .28s ease-out; }
.sound-demo-app-header { display: flex; flex: 0 0 44px; align-items: center; justify-content: space-between; gap: 4px; }
.sound-demo-app-brand { min-width: 0; }
.sound-demo-app-brand strong { display: block; font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: -.04em; }
.sound-demo-app-brand span { display: block; margin-top: 3px; color: var(--app-muted); font-size: 11px; line-height: 1.3; }
.sound-demo-app-lock { display: grid; flex: 0 0 44px; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--app-line); border-radius: 13px; background: var(--app-surface); color: var(--app-muted); }
.sound-demo-app-lock .icon { width: 20px; height: 20px; }
.sound-demo-app-status { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 18px; color: var(--app-sage); background: var(--app-raised); font-size: 11px; line-height: 1.4; }
.sound-demo-app-status .icon { width: 15px; height: 15px; stroke-width: 2.3; }
.sound-demo-app-sound { display: flex; flex: 1; flex-direction: column; min-height: 112px; padding: 10px; border: 1px solid var(--app-line); border-radius: 17px; background: var(--app-surface); }
.sound-demo-app-sound > strong { font-size: 12px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.sound-demo-app-sound > [data-sound-app-listening] { margin-top: 3px; color: var(--app-muted); font-size: 11px; line-height: 1.4; }
.sound-demo-app-chart { display: block; flex: 1; width: 100%; min-height: 30px; height: 50px; margin-block: 7px; overflow: visible; }
.sound-demo-app-chart rect { fill: var(--app-sage); }
.sound-demo-app-chart rect[data-over="true"] { fill: var(--app-peach); }
.sound-demo-app-readings { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 8px; color: var(--app-muted); font-size: 11px; line-height: 1.4; }
.sound-demo-app-readings output { margin-left: 3px; color: var(--app-text); font-weight: 500; font-variant-numeric: tabular-nums; }
.sound-demo-app-mute { display: flex; flex: 0 0 auto; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--app-line); border-radius: 13px; background: var(--app-raised); color: var(--app-sage); font-size: 12px; font-weight: 500; line-height: 1.4; }
.sound-demo-app-mute .icon { width: 19px; height: 19px; }
.sound-demo-app-mute[aria-pressed="true"] .sound-demo-volume-waves { display: none; }
.sound-demo-app-mute[aria-pressed="true"] .sound-demo-volume-off { display: block; }
.sound-demo-app-lock:hover, .sound-demo-app-mute:hover { border-color: var(--app-sage); }
.sound-demo-app-lock:focus-visible, .sound-demo-app-mute:focus-visible { outline: 3px solid var(--app-peach); outline-offset: 2px; border-radius: 13px; }
.sound-demo-app-alert { flex: 0 0 auto; padding: 8px; border: 1px solid var(--app-line); border-left: 3px solid var(--app-peach); border-radius: 11px; background: var(--app-surface); }
.sound-demo-app-alert strong { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; line-height: 1.4; }
.sound-demo-app-alert strong .icon { width: 13px; height: 13px; color: var(--app-peach); }
.sound-demo-app-alert p { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--app-muted); }
html[data-theme="night"] .sound-demo-app { --app-bg: #15191f; --app-surface: #20252c; --app-raised: #293039; --app-text: #f4eee7; --app-muted: #bbc0c7; --app-line: #363d45; --app-sage: #afc4ae; --app-peach: #edb89a; }
.sound-demo-bottom { margin-top: 13px; display: flex; align-items: flex-start; gap: 24px; justify-content: space-between; }
.sound-demo [data-sound-status] { flex: 1; color: var(--sage); font-size: 12px; line-height: 1.7; min-height: 21px; }
.sound-demo-note { max-width: 560px; color: var(--muted); font-size: 11px; line-height: 1.7; text-align: right; }
.sound-demo-note a { color: var(--sage); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.sound-demo-note a:hover { color: var(--peach); }
.sound-demo-noscript { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 13px; }
.sound-demo[data-state="stopped"] .sound-demo-graph, .sound-demo[data-state="completed"] .sound-demo-graph { border-color: var(--sage); }
.sound-demo[data-state="error"] [data-sound-status] { color: var(--peach); }
.sound-demo[data-state="error"] .sound-demo-graph { border-color: var(--peach); }
@keyframes sound-demo-notice-in { from { transform: translateY(-10px); opacity: 0; filter: blur(2px); } to { transform: none; opacity: 1; filter: blur(0); } }
@keyframes sound-demo-app-in { from { transform: translateY(9px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 1000px) {
  .sound-demo-stage { grid-template-columns: minmax(0, 1.45fr) minmax(252px, 1fr); }
  .sound-demo-studio { padding: 22px; }
  .sound-demo-result { padding-inline: 16px; }
}
@media (max-width: 760px) {
  .sound-demo { padding-block: 56px; }
  .sound-demo-stage { grid-template-columns: minmax(0, 1fr); border-radius: 24px; }
  .sound-demo-result { border-left: 0; border-top: 1px solid var(--line); padding: 26px 18px; }
  .sound-demo-result::before { display: none; }
  .sound-demo-phone { width: min(var(--device-mobile-width, 216px), 100%); }
  .sound-demo-bottom { flex-direction: column; gap: 7px; }
  .sound-demo-note { text-align: left; max-width: none; }
  .sound-demo [data-sound-status] { flex: none; }
  .sound-demo .section-heading .section-intro { max-width: 440px; }
}
@media (max-width: 440px) {
  .sound-demo-studio { padding: 20px 16px; }
  .sound-demo-panel-top { gap: 13px; }
  .sound-demo-source strong { font-size: 15px; }
  .sound-demo-source small { font-size: 11px; }
  .sound-demo-graph { padding-inline: 12px; }
  .sound-demo-graph-top { gap: 8px; font-size: 11px; }
  .sound-demo-level-readout { gap: 4px; }
  .sound-demo-level-readout > span { margin-right: 2px; }
  .sound-demo-level-readout output { font-size: 18px; }
  .sound-demo-chart { height: 105px; }
  .sound-demo-graph-footer { font-size: 10px; gap: 8px; }
  .sound-demo-controls { gap: 8px; width: 100%; }
  .sound-demo .sound-demo-start { padding-inline: 13px; }
  .sound-demo .sound-demo-mute { padding-inline: 10px; }
  .sound-demo-result { padding-inline: 18px; }
  .sound-demo-threshold-control { padding-inline: 12px; }
  .sound-demo-threshold-heading label { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .sound-demo *, .sound-demo *::before, .sound-demo *::after { animation: none !important; transition: none !important; }
}
html[data-motion="paused"] .sound-demo *, html[data-motion="paused"] .sound-demo *::before, html[data-motion="paused"] .sound-demo *::after { animation: none !important; transition: none !important; }
