/* ================================================================
   Mobile UI  -  <= 768 px only.
   The mobile shell reuses the real subtitle renderer and controls,
   then skins them with the preview_mobile.html visual direction.
   ================================================================ */

.mobile-view { display: none; }

@keyframes mobile-aurora-a {
  0% { transform: translate3d(-8%, -6%, 0) scale(1.08) rotate(0deg); }
  50% { transform: translate3d(6%, 9%, 0) scale(1.22) rotate(8deg); }
  100% { transform: translate3d(-8%, -6%, 0) scale(1.08) rotate(0deg); }
}

@keyframes mobile-aurora-b {
  0% { transform: translate3d(9%, 8%, 0) scale(1.12) rotate(0deg); }
  50% { transform: translate3d(-6%, -8%, 0) scale(1.28) rotate(-10deg); }
  100% { transform: translate3d(9%, 8%, 0) scale(1.12) rotate(0deg); }
}

@keyframes mobile-sub-enter {
  0% { opacity: 0; transform: translateY(16px) scale(0.98); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes mobile-glow-breathe {
  0%, 100% {
    text-shadow:
      0 0 22px rgba(255, 255, 255, 0.18),
      0 0 8px rgba(var(--m-accent-rgb), 0.22);
  }
  50% {
    text-shadow:
      0 0 34px rgba(255, 255, 255, 0.3),
      0 0 16px rgba(var(--m-accent-rgb), 0.38);
  }
}

@keyframes mobile-record-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(255, 59, 48, 0.54), 0 0 0 0 rgba(255, 59, 48, 0.46); }
  50% { box-shadow: 0 8px 32px rgba(255, 59, 48, 0.54), 0 0 0 14px rgba(255, 59, 48, 0); }
}

@keyframes mobile-ripple {
  0% { opacity: 0.72; transform: translate(-50%, -50%) scale(0.82); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.15); }
}

@keyframes mobile-bar-dance {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

@keyframes mobile-popover-in {
  0% { opacity: 0; transform: translateY(10px) scale(0.86); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mobile-sheet-in {
  0% { transform: translateY(100%); }
  100% { transform: translateY(0); }
}

@media (max-width: 768px) {

  body {
    padding: 0;
    overflow: hidden;
    height: 100dvh;
    height: 100vh;
  }

  .ambient-canvas,
  .ambient-blob {
    display: none !important;
    animation: none !important;
  }

  .expert-panel,
  .top-glass-bar,
  .bottom-player-bar,
  #sessionEventStrip,
  .app,
  .auth-modal {
    display: none !important;
  }

  body.expert-mode-active .expert-panel {
    display: flex !important;
    width: min(400px, calc(100vw - 24px));
    height: 100dvh;
    z-index: 20000;
  }

  .auth-gate { padding: 24px; }
  .auth-gate-card {
    max-width: 360px;
    margin: 0 auto;
    box-shadow: none;
  }

  .mobile-view {
    --m-accent: #38d0ff;
    --m-accent-rgb: 56, 208, 255;
    --m-text: #edf6ff;
    --m-strong: #ffffff;
    --m-subtle: rgba(255, 255, 255, 0.38);
    --m-history: rgba(255, 255, 255, 0.42);
    --m-line: rgba(255, 255, 255, 0.06);
    --m-glass: rgba(255, 255, 255, 0.06);
    --m-glass-strong: rgba(255, 255, 255, 0.1);
    --m-glass-stroke: rgba(255, 255, 255, 0.12);
    --m-panel: rgba(12, 17, 26, 0.96);
    --m-danger: #ff453a;

    display: flex !important;
    flex-direction: column;
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(160deg, #05080e 0%, #080d16 50%, #060912 100%);
    color: var(--m-text);
    font-family: "Plus Jakarta Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

  body.authenticated .mobile-view {
    opacity: 1;
    pointer-events: auto;
  }

  html[data-theme="light"] .mobile-view {
    --m-accent: #00b96b;
    --m-accent-rgb: 0, 185, 107;
    --m-text: #111111;
    --m-strong: #0a0a0a;
    --m-subtle: rgba(0, 0, 0, 0.42);
    --m-history: rgba(0, 0, 0, 0.43);
    --m-line: rgba(0, 0, 0, 0.07);
    --m-glass: rgba(0, 0, 0, 0.055);
    --m-glass-strong: rgba(0, 0, 0, 0.08);
    --m-glass-stroke: rgba(0, 0, 0, 0.11);
    --m-panel: rgba(250, 251, 255, 0.96);
    background: linear-gradient(160deg, #f5faf6 0%, #fafcfa 55%, #f4f9f5 100%);
  }

  .mobile-view::before,
  .mobile-view::after,
  .recording-glow {
    content: "";
    position: absolute;
    inset: -18%;
    pointer-events: none;
    z-index: 0;
  }

  .mobile-view::before {
    background:
      radial-gradient(ellipse at 40% 40%, rgba(56, 200, 255, 0.28) 0%, transparent 55%),
      radial-gradient(ellipse at 20% 75%, rgba(130, 80, 255, 0.18) 0%, transparent 46%);
    animation: mobile-aurora-a 18s ease-in-out infinite;
  }

  .mobile-view::after {
    background:
      radial-gradient(ellipse at 70% 65%, rgba(255, 109, 74, 0.16) 0%, transparent 50%),
      linear-gradient(to bottom, transparent 48%, rgba(0, 0, 0, 0.44) 100%);
    animation: mobile-aurora-b 22s ease-in-out infinite;
    transition: opacity 0.5s ease;
  }

  .recording-glow {
    background: radial-gradient(ellipse at 70% 70%, rgba(255, 59, 48, 0.32) 0%, transparent 50%);
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.45s ease, transform 0.45s ease;
  }

  body.is-recording .recording-glow {
    opacity: 1;
    transform: scale(1.06);
  }

  html[data-theme="light"] .mobile-view::before {
    background:
      radial-gradient(ellipse at 35% 28%, rgba(0, 185, 107, 0.13) 0%, transparent 50%),
      radial-gradient(ellipse at 15% 80%, rgba(180, 230, 180, 0.14) 0%, transparent 44%);
  }

  html[data-theme="light"] .mobile-view::after {
    background:
      radial-gradient(ellipse at 75% 68%, rgba(0, 185, 107, 0.08) 0%, transparent 52%),
      linear-gradient(to bottom, transparent 58%, rgba(255, 255, 255, 0.58) 100%);
  }

  html[data-theme="light"] .recording-glow {
    background: radial-gradient(ellipse at 75% 68%, rgba(255, 59, 48, 0.14) 0%, transparent 52%);
  }

  .top-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
  }

  .lang-btn {
    height: 40px;
    min-width: 0;
    border: 1px solid var(--m-glass-stroke);
    border-radius: 12px;
    background: var(--m-glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    color: var(--m-text);
    -webkit-text-fill-color: currentColor;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 12px;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .lang-btn:active {
    transform: scale(0.97);
    background: var(--m-glass-strong);
  }

  .lang-btn[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--m-accent) 42%, var(--m-glass-stroke));
    background: var(--m-glass-strong);
    box-shadow: 0 8px 26px rgba(var(--m-accent-rgb), 0.14);
  }

  .swap-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border: 1px solid var(--m-glass-stroke);
    border-radius: 50%;
    background: var(--m-glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    color: var(--m-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .swap-btn:active { background: var(--m-glass-strong); }
  .swap-btn.swapping { transform: rotate(180deg); }
  .swap-btn svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .subtitle-area {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    contain: layout paint;
  }

  body.focus-mode #bilingualSubtitleCard {
    display: block !important;
    position: relative !important;
    flex: 1 1 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: clamp(72px, 11vh, 96px) 22px clamp(210px, 31vh, 330px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overflow-anchor: none !important;
    overscroll-behavior: contain;
    scroll-behavior: auto !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    contain: layout paint;
    transform: translateZ(0);
    mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
  }

  body.focus-mode #bilingualSubtitleCard::-webkit-scrollbar {
    display: none;
  }

  body.focus-mode .subtitle-placeholder {
    width: 100%;
    text-align: center;
    color: var(--m-subtle);
    font-size: 16px;
    font-weight: 650;
    line-height: 1.6;
    white-space: pre-line;
    position: fixed;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    padding: 0 28px;
    z-index: 0;
  }

  body.focus-mode .bilingual-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--m-line);
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    transform-origin: left center;
    animation: mobile-sub-enter 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: padding 0.28s ease, opacity 0.28s ease;
  }

  body.focus-mode .bilingual-group[data-state="active"] {
    gap: 6px;
    padding: 14px 0;
  }

  body.focus-mode .bilingual-group[data-speaker="b"] {
    align-items: flex-end;
    text-align: right;
  }

  body.focus-mode .bilingual-source > span,
  body.focus-mode .bilingual-translation > span {
    display: inline-block;
    max-width: 100%;
    color: var(--m-strong);
    letter-spacing: 0;
    white-space: pre-wrap;
    word-break: break-word;
    transition: color 0.28s ease, opacity 0.28s ease, transform 0.28s ease, font-size 0.28s ease;
  }

  body.focus-mode .bilingual-source > span {
    --line-size: clamp(18px, 4.85vw, 21px) !important;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: clamp(18px, 4.85vw, 21px) !important;
    font-weight: 620;
    line-height: 1.45;
  }

  body.focus-mode .bilingual-translation > span {
    --line-size: clamp(15px, 4.05vw, 17px) !important;
    font-size: clamp(15px, 4.05vw, 17px) !important;
    font-weight: 520;
    line-height: 1.5;
  }

  body.focus-mode .bilingual-source > .history-lyric {
    color: var(--m-history);
    opacity: 1;
  }

  body.focus-mode .bilingual-translation > .history-lyric {
    color: rgba(var(--m-accent-rgb), 0.35);
    opacity: 1;
  }

  body.focus-mode .bilingual-source > .active-lyric {
    color: var(--m-strong);
    font-size: clamp(19px, 5.2vw, 23px) !important;
    font-weight: 800;
    transform: scale(1.01);
    animation: mobile-glow-breathe 2.8s ease-in-out infinite;
  }

  body.focus-mode .bilingual-translation > .active-lyric {
    color: var(--m-accent);
    font-size: clamp(16px, 4.45vw, 18px) !important;
    font-weight: 700;
  }

  body.focus-mode .timeline-marker-group {
    align-items: center;
    padding: 8px 0;
    border-bottom: 0;
  }

  body.focus-mode .speaker-change-marker,
  body.focus-mode .silence-marker,
  body.focus-mode .lang-change-marker {
    border: 1px solid var(--m-glass-stroke);
    border-radius: 999px;
    background: var(--m-glass);
    color: var(--m-subtle);
    font-size: 11px;
    font-weight: 750;
    padding: 6px 10px;
  }

  body.focus-mode .silence-marker {
    border-color: rgba(255, 196, 87, 0.26);
    color: rgba(255, 225, 170, 0.9);
  }

  .status-bar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    padding: 8px 22px 6px;
    flex-shrink: 0;
  }

  .status-text {
    min-width: 0;
    color: var(--m-subtle);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-wave-bars {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    height: 22px;
    min-width: 84px;
  }

  .mobile-wave-bars span {
    width: 2.5px;
    height: 100%;
    border-radius: 999px;
    background: var(--m-subtle);
    opacity: 0.25;
    transform: scaleY(0.25);
    transform-origin: center;
    transition: background 0.24s ease, opacity 0.24s ease, transform 0.24s ease;
  }

  body.is-recording .status-text {
    color: var(--m-accent);
  }

  body.is-recording .mobile-wave-bars span {
    background: var(--m-accent);
    opacity: 0.58;
    animation: mobile-bar-dance 0.66s ease-in-out infinite;
  }

  body.is-recording .mobile-wave-bars span:nth-child(2n) { animation-duration: 0.54s; opacity: 0.72; }
  body.is-recording .mobile-wave-bars span:nth-child(3n) { animation-duration: 0.76s; opacity: 0.86; }
  body.is-recording .mobile-wave-bars span:nth-child(4n) { animation-delay: 0.08s; }
  body.is-recording .mobile-wave-bars span:nth-child(5n) { animation-delay: 0.16s; }
  body.is-recording .mobile-wave-bars span:nth-child(7n) { animation-delay: 0.24s; }

  .bottom-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    gap: 20px;
    padding: 10px 30px calc(env(safe-area-inset-bottom, 0px) + 24px);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
  }

  .bottom-bar > :first-child { justify-self: start; }
  .bottom-bar > :last-child { justify-self: end; }

  .icon-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border-radius: 16px;
    background: var(--m-glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--m-glass-stroke);
    color: var(--m-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
      transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
      background 0.2s ease,
      border-color 0.2s ease,
      color 0.2s ease,
      box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .icon-btn:active {
    transform: scale(0.9);
    background: var(--m-glass-strong);
  }

  .icon-btn svg {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .icon-btn .voice-person-icon {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .icon-btn .voice-slash {
    opacity: 0.82;
    stroke-width: 2.1;
  }

  .icon-btn.active {
    color: var(--m-accent);
    background: rgba(var(--m-accent-rgb), 0.14);
    border-color: rgba(var(--m-accent-rgb), 0.38);
    box-shadow: 0 0 20px rgba(var(--m-accent-rgb), 0.28);
  }

  .record-btn {
    width: 72px;
    height: 72px;
    min-width: 72px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a84ff, #30b0ff);
    box-shadow: 0 8px 32px rgba(10, 132, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.2);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    transition:
      transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
      background 0.55s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .record-btn:active {
    transform: scale(0.95);
  }

  .record-btn::before,
  .record-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    pointer-events: none;
  }

  .record-btn::before {
    border: 2px solid rgba(10, 132, 255, 0.62);
    opacity: 0;
  }

  .record-btn::after {
    background: rgba(255, 59, 48, 0.14);
    opacity: 0;
  }

  .record-btn:active::before {
    animation: mobile-ripple 0.58s ease-out forwards;
  }

  .record-btn.recording {
    background: linear-gradient(135deg, #ff3b30, #ff6b6b);
    box-shadow: 0 8px 32px rgba(255, 59, 48, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.06);
    animation: mobile-record-pulse 2s ease-in-out 0.6s infinite;
  }

  .record-btn.recording::after {
    animation: mobile-ripple 1.6s ease-out infinite;
  }

  .record-btn .toggle-icon {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    fill: currentColor;
    stroke: none;
    flex: 0 0 28px;
  }

  .record-btn .morph-path {
    transition: d 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.32s ease;
  }

  .record-btn:not(.recording) .morph-path {
    d: path("M 9,6 L 20,12 L 20,12 L 9,18 Z");
  }

  .record-btn.recording .morph-path {
    d: path("M 12,5.5 C 15.6,5.5 18.5,8.4 18.5,12 C 18.5,15.6 15.6,18.5 12,18.5 C 8.4,18.5 5.5,15.6 5.5,12 C 5.5,8.4 8.4,5.5 12,5.5 Z");
  }

  .record-btn .btn-text {
    display: none !important;
  }

  .sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    opacity: 0;
    background: transparent;
    pointer-events: none;
    transition: opacity 0.22s ease, background 0.22s ease;
  }

  .sheet-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-view.lang-menu-open .sheet-backdrop.visible {
    background: transparent;
  }

  .mobile-view.lang-menu-open .top-bar {
    z-index: 502;
  }

  .mobile-view.settings-menu-open .sheet-backdrop.visible {
    background: transparent;
  }

  .lang-sheet,
  .settings-sheet {
    position: fixed;
    z-index: 501;
    border: 1px solid var(--m-glass-stroke);
    background: var(--m-panel);
    color: var(--m-text);
    box-shadow: 0 10px 44px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(36px) saturate(175%);
    -webkit-backdrop-filter: blur(36px) saturate(175%);
  }

  .lang-sheet {
    left: var(--lang-popover-left, 16px);
    top: var(--lang-popover-top, calc(env(safe-area-inset-top, 0px) + 58px));
    right: auto;
    bottom: auto;
    z-index: 503;
    width: var(--lang-popover-width, min(228px, calc(100vw - 24px)));
    max-height: var(--lang-popover-max-height, min(360px, calc(100dvh - 84px)));
    overflow-y: auto;
    border-width: 1px;
    border-radius: 14px;
    padding: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.16s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .lang-sheet.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .lang-sheet::-webkit-scrollbar {
    display: none;
  }

  #mobileLangOptions {
    display: grid;
    gap: 2px;
  }

  .sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--m-subtle) 60%, transparent);
    margin: 12px auto 16px;
    flex-shrink: 0;
  }

  .sheet-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--m-subtle);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    padding: 0 20px 8px;
  }

  .lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    border-top: 0;
    color: var(--m-text);
    transition: background 0.18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .lang-option:active {
    background: var(--m-glass);
  }

  .lang-option.selected {
    color: var(--m-accent);
  }

  .lang-option .check {
    flex: 0 0 auto;
    font-size: 15px;
    opacity: 0;
  }

  .lang-option.selected .check {
    opacity: 1;
  }

  .settings-sheet {
    left: 22px;
    right: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
    width: min(238px, calc(100vw - 44px));
    min-width: 210px;
    max-height: none;
    overflow: visible;
    padding: 0;
    border-radius: 18px;
    transform: translateY(10px) scale(0.86);
    transform-origin: bottom left;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .settings-sheet.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: mobile-popover-in 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .settings-sheet::after {
    content: "";
    position: absolute;
    left: 20px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: var(--m-panel);
    border: 1px solid var(--m-glass-stroke);
    border-top: 0;
    border-left: 0;
    border-radius: 0 0 3px 0;
    transform: rotate(45deg);
  }

  .settings-sheet .sheet-handle {
    display: none;
  }

  .settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 13px 18px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    border: 0;
    border-top: 1px solid var(--m-line);
    background: none;
    cursor: pointer;
    color: var(--m-text);
    overflow: hidden;
    transition: background 0.18s ease;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }

  .settings-row:first-of-type {
    border-top: 0;
  }

  .settings-row:active {
    background: var(--m-glass);
  }

  .settings-row svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    opacity: 0.74;
  }

  .settings-row > span {
    min-width: 0;
    flex: 1 1 auto;
  }

  #mobileAuthLabel {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 30px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 30px), transparent 100%);
  }

  .settings-row.danger {
    color: var(--m-danger);
  }

  .settings-row.danger svg {
    opacity: 0.92;
  }

  .settings-divider {
    display: none;
  }

  html[data-theme="light"] .lang-sheet,
  html[data-theme="light"] .settings-sheet {
    box-shadow: 0 10px 44px rgba(15, 43, 82, 0.14);
  }

  html[data-theme="light"] .record-btn {
    background: linear-gradient(135deg, #0a84ff, #30b0ff);
    box-shadow: 0 8px 32px rgba(10, 132, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  html[data-theme="light"] .record-btn.recording {
    background: linear-gradient(135deg, #ff3b30, #ff6b6b);
    box-shadow: 0 8px 32px rgba(255, 59, 48, 0.38), 0 2px 8px rgba(0, 0, 0, 0.14);
  }

  .scroll-console {
    top: calc(env(safe-area-inset-top, 0px) + 76px) !important;
    width: min(calc(100vw - 28px), 360px) !important;
    max-width: calc(100vw - 28px) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap !important;
    gap: 6px;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid var(--m-glass-stroke);
    background: color-mix(in srgb, var(--m-panel) 84%, transparent);
    color: var(--m-text);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    transform: translateX(-50%);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .scroll-console.hidden {
    opacity: 0;
    transform: translate(-50%, -10px);
  }

  .scroll-status-text {
    min-width: 0 !important;
    flex: 1 1 auto;
    max-width: none;
    padding: 0 8px 0 10px;
    overflow: hidden;
    color: var(--m-subtle);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .scroll-status-text::before {
    width: 6px;
    height: 6px;
    background: var(--m-accent);
    box-shadow: 0 0 10px rgba(var(--m-accent-rgb), 0.64);
  }

  .scroll-console button {
    min-height: 30px;
    min-width: 0;
    width: auto;
    padding: 0 10px;
    border-radius: 999px;
    border-color: var(--m-glass-stroke);
    background: var(--m-glass);
    color: var(--m-text);
    box-shadow: none;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  .scroll-console .btn-lock {
    color: rgba(255, 224, 166, 0.94);
    background: rgba(255, 196, 87, 0.12);
    border-color: rgba(255, 196, 87, 0.18);
  }

  .scroll-console .btn-lock[aria-pressed="true"] {
    color: #111827;
    background: #ffe0a6;
    border-color: rgba(255, 255, 255, 0.32);
  }

  .scroll-console .btn-live {
    color: #03131a;
    background: linear-gradient(135deg, #75e7ff, #3aa8ff);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 6px 16px rgba(var(--m-accent-rgb), 0.2);
  }

  html[data-theme="light"] .scroll-console .btn-live {
    color: #ffffff;
    background: linear-gradient(135deg, #007aff, #35d6ff);
    border-color: rgba(0, 122, 255, 0.28);
  }

  .scroll-console .btn-return.hidden {
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    margin: 0;
    border-width: 0;
    overflow: hidden;
  }

  .session-event-strip {
    backdrop-filter: blur(16px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(150%) !important;
  }
}
