    * { margin: 0; padding: 0; box-sizing: border-box; }
    html, body {
      overflow-x: clip;
      max-width: 100%;
    }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background: linear-gradient(135deg, #0f3460 0%, #16213e 50%, #0f3460 100%);
      color: #eee;
      min-height: 100vh;
      padding: 10px;
      padding-bottom: calc(168px + env(safe-area-inset-bottom, 0px));
      padding-left: max(10px, env(safe-area-inset-left, 0px));
      padding-right: max(10px, env(safe-area-inset-right, 0px));
    }
    .container {
      max-width: 1000px;
      width: 100%;
      margin: 0 auto;
      min-width: 0;
    }
    header {
      margin-bottom: 8px;
      padding: 10px 12px 8px;
      background: rgba(0,0,0,0.32);
      border-radius: 12px;
      border: 1px solid rgba(255,255,255,0.08);
      box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    }
    .header-row {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .header-brand {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      flex: 0 1 auto;
    }
    .global-player-bar {
      display: none;
      align-items: center;
      gap: 10px;
      flex: 1 1 200px;
      min-width: 0;
      padding: 6px 12px;
      border-radius: 10px;
      border: 1px solid rgba(46, 204, 113, 0.35);
      background: rgba(20, 70, 40, 0.28);
    }
    .global-player-bar.active {
      display: flex;
    }
    .global-play-btn {
      flex: 0 0 auto;
      width: 32px;
      height: 28px;
      padding: 0;
      border: none;
      border-radius: 6px;
      background: #e94560;
      color: #fff;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      line-height: 1;
    }
    .global-play-btn:hover {
      opacity: 0.9;
    }
    .global-player-link {
      flex: 1 1 auto;
      min-width: 0;
      color: #86efac;
      font-size: 0.82rem;
      font-weight: 600;
      text-decoration: none;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .global-player-link:hover {
      color: #bbf7d0;
      text-decoration: underline;
    }
    .global-player-time {
      flex: 0 0 auto;
      font-size: 0.74rem;
      color: #94a3b8;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .header-session {
      flex: 1 1 220px;
      min-width: 0;
      display: none;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border-radius: 10px;
      border: 1px solid rgba(233, 69, 96, 0.35);
      background: rgba(44, 10, 18, 0.38);
    }
    .header-session.active {
      display: flex;
    }
    .header-session .session-file {
      font-size: 0.86rem;
      font-weight: 600;
      color: #fff;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      min-width: 0;
    }
    .header-session .session-detail {
      font-size: 0.72rem;
      color: #ffb9c4;
      white-space: nowrap;
      flex: 0 0 auto;
    }
    .signal-row {
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px solid rgba(255,255,255,0.06);
    }
    .signal-meter {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 10px;
    }
    .signal-label {
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #94a3b8;
      min-width: 42px;
    }
    .signal-peak {
      font-size: 0.82rem;
      font-weight: 700;
      color: #f8fafc;
      font-variant-numeric: tabular-nums;
      min-width: 72px;
      text-align: right;
    }
    .meter-lg {
      height: 10px;
      border-radius: 999px;
      background: rgba(255,255,255,0.08);
    }
    .meter-lg .meter-fill {
      border-radius: 999px;
    }
    .meta-row {
      margin-top: 10px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }
    .meta-chip {
      appearance: none;
      border: 1px solid rgba(255,255,255,0.1);
      background: rgba(255,255,255,0.04);
      color: #dbe4f0;
      border-radius: 999px;
      padding: 5px 12px;
      font-size: 0.74rem;
      font-weight: 600;
      cursor: pointer;
      transition: border-color 0.15s ease, background 0.15s ease;
    }
    .meta-chip:hover {
      border-color: rgba(255,255,255,0.22);
      background: rgba(255,255,255,0.07);
    }
    .meta-chip.sync-warn {
      border-color: rgba(251,146,60,0.7);
      background: rgba(251,146,60,0.12);
      color: #fed7aa;
      animation: sync-warn-pulse 2s ease-in-out infinite;
    }
    .system-strip {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-left: auto;
    }
    .sys-meter {
      display: grid;
      grid-template-columns: auto auto 56px;
      align-items: center;
      gap: 6px;
      min-width: 118px;
    }
    .sys-label {
      font-size: 0.62rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #64748b;
    }
    .sys-value {
      font-size: 0.74rem;
      font-weight: 700;
      color: #e2e8f0;
      font-variant-numeric: tabular-nums;
      min-width: 34px;
      text-align: right;
    }
    .meter.sys {
      height: 4px;
      margin-top: 0;
    }
    .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      border: 1px solid transparent;
      white-space: nowrap;
    }
    .status-pill::before {
      content: '';
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: currentColor;
      opacity: 0.95;
    }
    .status-pill.tone-listening {
      color: #86efac;
      background: rgba(34, 197, 94, 0.12);
      border-color: rgba(34, 197, 94, 0.28);
    }
    .status-pill.tone-recording {
      color: #fda4af;
      background: rgba(233, 69, 96, 0.16);
      border-color: rgba(233, 69, 96, 0.35);
      animation: pulse 1.2s ease-in-out infinite;
    }
    .status-pill.tone-paused {
      color: #fbbf24;
      background: rgba(245, 158, 11, 0.12);
      border-color: rgba(245, 158, 11, 0.28);
    }
    .status-pill.tone-processing {
      color: #93c5fd;
      background: rgba(59, 130, 246, 0.12);
      border-color: rgba(59, 130, 246, 0.28);
    }
    .status-pill.tone-warn,
    .status-pill.tone-idle {
      color: #cbd5e1;
      background: rgba(148, 163, 184, 0.12);
      border-color: rgba(148, 163, 184, 0.24);
    }
    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-left: auto;
      flex: 0 0 auto;
    }
    @keyframes sync-warn-pulse {
      0%, 100% { border-color: rgba(251,146,60,0.7); }
      50%       { border-color: rgba(251,146,60,0.15); }
    }
    .sync-warn-banner {
      background: rgba(251,146,60,0.1);
      border: 1px solid rgba(251,146,60,0.5);
      border-radius: 8px;
      padding: 9px 16px;
      margin-bottom: 12px;
      color: #fed7aa;
      font-size: 0.84rem;
    }
    #audioStatTooltip, #diskStatTooltip {
      position: fixed;
      z-index: 9999;
      background: rgba(10, 18, 36, 0.97);
      border: 1px solid rgba(255,255,255,0.18);
      border-radius: 10px;
      padding: 10px 14px;
      color: #e2e8f0;
      font-size: 0.78rem;
      line-height: 1.65;
      white-space: nowrap;
      pointer-events: none;
      display: none;
      box-shadow: 0 8px 32px rgba(0,0,0,0.6);
      max-width: 340px;
    }
    #audioStatTooltip table, #diskStatTooltip table { border-collapse: collapse; width: 100%; }
    #audioStatTooltip td, #diskStatTooltip td { padding: 1px 0; }
    #audioStatTooltip td:first-child, #diskStatTooltip td:first-child {
      color: #94a3b8;
      padding-right: 12px;
      font-size: 0.73rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      white-space: nowrap;
    }
    #audioStatTooltip td:last-child, #diskStatTooltip td:last-child { color: #f1f5f9; font-weight: 600; }
    #audioStatTooltip .tooltip-section, #diskStatTooltip .tooltip-section {
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #64748b;
      padding-top: 6px;
      padding-bottom: 2px;
    }
    h1 {
      font-size: 1rem;
      font-weight: 650;
      letter-spacing: 0.2px;
      white-space: nowrap;
    }
    .format-select {
      border: 1px solid rgba(255,255,255,0.25);
      background: rgba(255,255,255,0.08);
      color: #fff;
      border-radius: 8px;
      padding: 4px 8px;
      font-size: 0.74rem;
      font-weight: 700;
      min-width: 74px;
      cursor: pointer;
    }
    .format-select option {
      color: #111;
      background: #fff;
    }
    .format-select:disabled {
      opacity: 0.7;
      cursor: wait;
    }
    .audio-config-row {
      align-items: flex-start;
      gap: 10px;
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid rgba(255,255,255,0.08);
    }
    .settings-page {
      padding-bottom: 24px;
    }
    .settings-section {
      display: flex;
      flex-direction: column;
      gap: 14px;
      margin-top: 8px;
      padding: 16px 0 0;
      border-top: 1px solid rgba(255,255,255,0.08);
    }
    .settings-section h3 {
      margin: 0;
      font-size: 1rem;
      font-weight: 650;
      color: #f1f5f9;
    }
    .settings-lead {
      margin: 0;
      color: #94a3b8;
      font-size: 0.86rem;
      line-height: 1.45;
      max-width: 42rem;
    }
    .settings-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
      margin-top: 4px;
    }
    .settings-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 12px 14px;
      max-width: 44rem;
    }
    .settings-input {
      appearance: none;
      width: 100%;
      max-width: 12rem;
      box-sizing: border-box;
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(15, 23, 42, 0.55);
      color: #e2e8f0;
      border-radius: 8px;
      padding: 8px 10px;
      font: inherit;
      font-size: 0.92rem;
      font-weight: 600;
      text-transform: none;
      letter-spacing: 0;
    }
    .settings-input:focus {
      outline: none;
      border-color: rgba(251, 191, 36, 0.5);
    }
    .volume-row {
      display: flex;
      align-items: center;
      gap: 12px;
      max-width: 28rem;
    }
    .volume-slider {
      flex: 1 1 auto;
      min-width: 120px;
      accent-color: #fbbf24;
    }
    .volume-slider-compact {
      width: 88px;
      min-width: 72px;
      flex: 0 0 auto;
    }
    .global-volume {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 0 0 auto;
      color: #86efac;
      font-size: 0.75rem;
    }
    .global-volume-icon {
      opacity: 0.85;
    }
    .danger-btn {
      appearance: none;
      border: 1px solid rgba(248, 113, 113, 0.45);
      background: rgba(127, 29, 29, 0.35);
      color: #fecaca;
      border-radius: 8px;
      padding: 8px 12px;
      font: inherit;
      font-size: 0.86rem;
      font-weight: 650;
      cursor: pointer;
    }
    .danger-btn:hover {
      border-color: rgba(248, 113, 113, 0.75);
      color: #fee2e2;
    }
    .danger-btn:disabled {
      opacity: 0.55;
      cursor: default;
    }
    .pause-presets {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .pause-preset-btn {
      appearance: none;
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(15, 23, 42, 0.55);
      color: #e2e8f0;
      border-radius: 8px;
      padding: 8px 12px;
      font: inherit;
      font-size: 0.86rem;
      font-weight: 600;
      cursor: pointer;
    }
    .pause-preset-btn:hover {
      border-color: rgba(251, 191, 36, 0.45);
      color: #fde68a;
    }
    .pause-preset-btn:disabled {
      opacity: 0.55;
      cursor: default;
    }
    .audio-cfg-label {
      display: flex;
      flex-direction: column;
      gap: 6px;
      font-size: 0.68rem;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: #94a3b8;
      font-weight: 650;
    }
    .audio-dev-select {
      min-width: min(420px, 100%);
      max-width: 36rem;
      text-transform: none;
      letter-spacing: 0;
      font-weight: 600;
    }
    .audio-channels {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      max-width: 36rem;
    }
    .audio-channel-opt {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.18);
      background: rgba(255,255,255,0.06);
      color: #e2e8f0;
      font-size: 0.72rem;
      font-weight: 650;
      cursor: pointer;
      user-select: none;
      text-transform: none;
      letter-spacing: 0;
    }
    .audio-channel-opt input {
      accent-color: #38bdf8;
      margin: 0;
    }
    .audio-apply-btn {
      min-width: 88px;
      border-radius: 999px;
      border: 1px solid rgba(56, 189, 248, 0.45);
      background: rgba(14, 116, 144, 0.35);
      color: #e0f2fe;
      font-size: 0.74rem;
      font-weight: 700;
      padding: 6px 12px;
      cursor: pointer;
    }
    .audio-apply-btn:hover {
      opacity: 0.92;
    }
    .audio-apply-btn:disabled {
      opacity: 0.65;
      cursor: wait;
    }
    .audio-cfg-hint {
      font-size: 0.7rem;
      color: #94a3b8;
      text-transform: none;
      letter-spacing: 0;
      font-weight: 500;
    }
    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.7; }
    }
    .main-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-bottom: 10px;
    }
    .card {
      background: rgba(0,0,0,0.4);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 10px;
      padding: 8px;
      backdrop-filter: blur(10px);
    }
    .card h2 {
      font-size: 0.82rem;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: #b0b0b0;
      margin-bottom: 6px;
      font-weight: 500;
    }
    .status-metrics .block-title {
      font-size: 0.72rem;
      color: #8e98a8;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      margin-bottom: 4px;
    }
    .stat {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 5px 0;
      border-bottom: 1px solid rgba(255,255,255,0.05);
      font-size: 0.86rem;
    }
    .stat:last-child { border-bottom: none; }
    .stat-value {
      font-weight: 600;
      color: #fff;
    }
    .stat-label {
      color: #888;
      font-size: 0.78rem;
    }
    .meter {
      width: 100%;
      height: 5px;
      background: rgba(255,255,255,0.1);
      border-radius: 3px;
      overflow: hidden;
      margin-top: 0;
    }
    .meter-fill {
      height: 100%;
      background: linear-gradient(90deg, #2ecc71, #f39c12, #e94560);
      width: 0%;
      border-radius: 3px;
      transition: width 0.2s ease;
    }
    .files-section {
      grid-column: 1 / -1;
    }
    .live-recording {
      display: none;
      border-color: rgba(233, 69, 96, 0.45);
      background: rgba(44, 10, 18, 0.48);
    }
    .live-recording.active {
      display: block;
    }
    .live-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 6px;
    }
    .live-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #e94560;
      box-shadow: 0 0 8px rgba(233, 69, 96, 0.8);
      animation: pulse 1s infinite;
      flex: 0 0 auto;
      margin-right: 6px;
    }
    .live-label {
      display: flex;
      align-items: center;
      color: #ffb9c4;
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    .live-name {
      font-weight: 600;
      color: #fff;
      font-size: 0.88rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .live-meta {
      color: #c4a8ad;
      font-size: 0.78rem;
      white-space: nowrap;
    }
    .dir-stats {
      display: flex;
      flex-wrap: wrap;
      gap: 4px 14px;
      margin-bottom: 6px;
      font-size: 0.78rem;
      color: #94a3b8;
    }
    .dir-stats-sep {
      color: #4a5568;
    }
    .file-list {
      display: block;
      width: 100%;
    }
    .file-group {
      margin-bottom: 10px;
    }
    .file-group:last-child {
      margin-bottom: 0;
    }
    .file-group-header {
      margin: 4px 0 6px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }
    .file-group-heading {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      flex: 1 1 auto;
    }
    .file-group-title {
      margin: 0;
      font-size: 0.92rem;
      font-weight: 700;
      color: #f1f5f9;
      letter-spacing: 0.2px;
      white-space: nowrap;
    }
    .day-comment-line {
      display: inline-flex;
      align-items: center;
      max-width: min(420px, 55vw);
      margin: 0;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid rgba(52, 211, 153, 0.35);
      background: rgba(16, 185, 129, 0.14);
      font-size: 0.76rem;
      font-weight: 600;
      color: #a7f3d0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      vertical-align: middle;
    }
    .file-group-list,
    .staging-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      width: 100%;
      align-items: stretch;
      overflow: visible;
    }
    .file-item {
      background: rgba(0,0,0,0.5);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 8px;
      padding: 3px;
      transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
      display: flex;
      flex-direction: column;
      gap: 0;
      min-width: 72px;
      max-width: 100%;
      box-sizing: border-box;
      position: relative;
      overflow: visible;
    }
    .staging-section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-bottom: 4px;
    }
    .staging-section-header h2 {
      margin: 0;
    }
    .staging-expand-btn {
      flex: 0 0 auto;
      padding: 4px 10px;
      border-radius: 6px;
      border: 1px solid rgba(255,255,255,0.18);
      background: rgba(255,255,255,0.06);
      color: #cbd5e1;
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
    }
    .staging-expand-btn:hover {
      background: rgba(255,255,255,0.12);
      border-color: rgba(255,255,255,0.28);
      color: #f1f5f9;
    }
    .staging-stats {
      font-size: 0.8rem;
      color: #94a3b8;
      margin-bottom: 10px;
    }
    .staging-empty {
      color: #6b7280;
      font-size: 0.85rem;
      padding: 4px 0 8px;
    }
    .staging-actions {
      display: flex;
      gap: 4px;
      flex-wrap: nowrap;
      justify-content: flex-end;
      margin-top: 4px;
      padding: 0 2px 2px;
    }
    .staging-actions-popup {
      margin-top: 8px;
      padding: 0;
      justify-content: flex-start;
    }
    .staging-actions-inline {
      display: none;
    }
    @media (hover: none), (pointer: coarse) {
      .staging-actions-inline {
        display: flex;
      }
      .staging-actions-popup {
        display: none;
      }
    }
    .staging-actions button {
      width: 26px;
      height: 26px;
      padding: 0;
      border-radius: 6px;
      border: 1px solid rgba(255,255,255,0.18);
      background: rgba(255,255,255,0.06);
      color: #e2e8f0;
      font-size: 0.95rem;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }
    .staging-actions button.promote {
      border-color: rgba(52, 211, 153, 0.45);
      color: #d1fae5;
      background: rgba(16, 185, 129, 0.12);
    }
    .staging-actions button.promote:hover {
      background: rgba(16, 185, 129, 0.28);
      border-color: rgba(52, 211, 153, 0.7);
    }
    .staging-actions button.delete {
      border-color: rgba(248, 113, 113, 0.4);
      color: #fecaca;
      background: rgba(239, 68, 68, 0.1);
    }
    .staging-actions button.delete:hover {
      background: rgba(239, 68, 68, 0.28);
      border-color: rgba(248, 113, 113, 0.65);
    }
    .file-item:hover {
      background: rgba(0,0,0,0.6);
      border-color: #e94560;
      z-index: 40;
    }
    .file-item.playing {
      border-color: #2ecc71;
      box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.5), 0 0 12px rgba(46, 204, 113, 0.25);
      background: rgba(20, 70, 40, 0.28);
    }
    .file-name {
      font-weight: 600;
      font-size: 0.9rem;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .file-subtitle {
      font-size: 0.78rem;
      color: #cbd5e1;
      text-transform: uppercase;
      letter-spacing: 0.7px;
      white-space: nowrap;
    }
    .file-meta {
      font-size: 0.8rem;
      color: #888;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .file-summary {
      display: flex;
      align-items: baseline;
      gap: 8px;
      min-width: 0;
    }
    .file-summary .file-name,
    .file-summary .file-meta {
      min-width: 0;
    }
    .file-meta-line {
      font-size: 0.74rem;
      color: #cbd5e1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      letter-spacing: 0.2px;
    }
    .file-name-line {
      font-size: 0.8rem;
      color: #f8fafc;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 0;
      font-weight: 600;
      font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    }
    .file-comment-line {
      font-size: 0.72rem;
      color: #c4d2e8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 0;
    }
    .file-actions {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 4px;
      margin-top: 0;
      flex-shrink: 0;
    }
    .file-wave-stack {
      display: flex;
      flex-direction: column;
      gap: 2px;
      width: 100%;
    }
    .file-wave-stack .file-wave-wrap {
      max-width: 100%;
    }
    .file-hover-card {
      position: absolute;
      left: 0;
      top: calc(100% + 6px);
      z-index: 30;
      min-width: 200px;
      width: max(100%, 220px);
      max-width: min(340px, 92vw);
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid rgba(255,255,255,0.18);
      background: rgba(10, 14, 28, 0.97);
      box-shadow: 0 10px 28px rgba(0,0,0,0.5);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.12s ease, visibility 0.12s ease;
    }
    .file-hover-card::before {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      top: -8px;
      height: 8px;
    }
    .file-item:hover .file-hover-card,
    .file-item:focus-within .file-hover-card {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }
    .file-hover-card .project-tags,
    .file-hover-card .region-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 4px;
    }
    .file-actions .fav-btn,
    .file-actions .comment-btn,
    .file-actions .edit-btn,
    .file-actions .download-btn,
    .file-actions .delete-btn {
      width: 28px;
      height: 24px;
      padding: 0;
      font-size: 0.88rem;
      font-weight: 700;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .comment-btn {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.2);
      color: #b7c0cf;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .comment-btn:hover {
      color: #a7f3d0;
      border-color: #34d399;
      background: rgba(16, 185, 129, 0.14);
    }
    .fav-btn {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.2);
      color: #b7c0cf;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .fav-btn:hover {
      color: #ffd166;
      border-color: #ffd166;
      background: rgba(255, 209, 102, 0.12);
    }
    .fav-btn.active {
      color: #ffd166;
      border-color: #ffd166;
      background: rgba(255, 209, 102, 0.18);
    }
    .file-fav-badge {
      position: absolute;
      top: 4px;
      right: 4px;
      z-index: 2;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.78rem;
      line-height: 1;
      color: #ffd166;
      background: rgba(15, 23, 42, 0.82);
      border: 1px solid rgba(255, 209, 102, 0.55);
      box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.12);
      pointer-events: none;
    }
    .file-item.is-favorite {
      border-color: rgba(255, 209, 102, 0.45);
    }
    .file-item.is-favorite .file-wave-wrap {
      box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.18);
    }
    .player-fav-mark {
      color: #ffd166;
      font-weight: 700;
    }
    #filterFavBtn.active {
      color: #ffd166;
      border-color: #ffd166;
      background: rgba(255, 209, 102, 0.2);
    }
    .edit-btn {
      background: rgba(59, 130, 246, 0.14);
      border: 1px solid rgba(59, 130, 246, 0.45);
      color: #93c5fd;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .edit-btn:hover {
      color: #dbeafe;
      border-color: #60a5fa;
      background: rgba(59, 130, 246, 0.24);
    }
    .delete-btn {
      background: linear-gradient(135deg, #e94560, #c0392b);
      border: none;
      color: #fff;
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      transition: opacity 0.2s ease;
    }
    .delete-btn:hover {
      opacity: 0.9;
    }
    .download-btn {
      background: linear-gradient(135deg, #3b82f6, #2563eb);
      color: #fff;
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      text-decoration: none;
      line-height: 1;
      transition: opacity 0.2s ease;
    }
    .download-btn:hover {
      opacity: 0.9;
    }
    .filter-btn {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.2);
      color: #b7c0cf;
      width: auto;
      height: auto;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 0.74rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
    }
    .filter-btn:hover {
      color: #ffd166;
      border-color: #ffd166;
      background: rgba(255, 209, 102, 0.12);
    }
    .filter-btn.active {
      color: #ffd166;
      border-color: #ffd166;
      background: rgba(255, 209, 102, 0.18);
    }
    .player-section {
      position: fixed;
      left: 50%;
      transform: translateX(-50%);
      width: min(1000px, calc(100% - 16px));
      max-width: calc(100% - max(16px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)));
      bottom: calc(8px + env(safe-area-inset-bottom, 0px));
      background: rgba(10, 14, 28, 0.96);
      border: 1px solid rgba(233, 69, 96, 0.35);
      border-radius: 10px;
      padding: 8px 10px 6px;
      z-index: 1000;
      display: none;
    }
    .player-section.active {
      display: block;
    }
    .player-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
      margin-bottom: 6px;
    }
    .player-info-top {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
    }
    .player-section h2 {
      color: #fff;
      margin: 0;
      font-size: 0.92rem;
      line-height: 1.25;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 1;
      min-width: 0;
      max-width: none;
    }
    .player-info-meta {
      font-size: 0.74rem;
      color: #94a3b8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .player-info-extra {
      display: flex;
      flex-wrap: wrap;
      gap: 4px 8px;
      align-items: center;
      min-height: 0;
    }
    .player-info-extra:empty {
      display: none;
    }
    .player-info-comment {
      font-size: 0.74rem;
      color: #c4d2e8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .player-info-extra .tag-chip,
    .player-info-extra .region-chip {
      font-size: 0.68rem;
      padding: 1px 6px;
    }
    .player-wave-wrap {
      position: relative;
      border-radius: 8px;
      overflow: hidden;
      background: rgba(0,0,0,0.35);
    }
    .player-chrome {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 8px 6px;
      pointer-events: none;
      background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.72) 100%);
    }
    .player-chrome > * {
      pointer-events: auto;
    }
    .seekbar-wrap {
      margin: 4px 0 0;
    }
    .seekbar {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 4px;
      border-radius: 3px;
      background: rgba(255,255,255,0.15);
      outline: none;
      cursor: pointer;
    }
    .seekbar::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: #e94560;
      cursor: pointer;
      box-shadow: 0 0 6px rgba(233,69,96,0.6);
    }
    .seekbar::-moz-range-thumb {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: #e94560;
      cursor: pointer;
      border: none;
      box-shadow: 0 0 6px rgba(233,69,96,0.6);
    }
    .file-waveform {
      width: 100%;
      height: 48px;
      display: block;
      border-radius: 5px;
      cursor: pointer;
      background: rgba(255,255,255,0.04);
    }
    .file-wave-stack {
      display: flex;
      flex-direction: column;
      gap: 2px;
      width: 100%;
    }
    .file-wave-stack .file-wave-wrap {
      max-width: 100%;
    }
    .player-waveform {
      width: 100%;
      height: 96px;
      display: block;
      border-radius: 0;
      cursor: pointer;
      margin: 0;
      background: transparent;
    }
    .controls {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-wrap: nowrap;
      margin-top: 0;
    }
    .controls button {
      background: linear-gradient(135deg, #2ecc71, #27ae60);
      border: none;
      color: white;
      padding: 5px 10px;
      border-radius: 6px;
      font-weight: 600;
      cursor: pointer;
      font-size: 0.78rem;
      transition: all 0.2s ease;
    }
    .controls button:hover {
      background: linear-gradient(135deg, #27ae60, #229954);
      transform: scale(1.05);
    }
    .time-display {
      font-weight: 600;
      color: #e2e8f0;
      font-size: 0.78rem;
      min-width: 0;
      text-shadow: 0 1px 2px rgba(0,0,0,0.85);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .player-meta {
      display: none;
    }
    @media (max-width: 768px) {
      .main-grid {
        grid-template-columns: 1fr;
      }
      .header-row {
        flex-direction: column;
        align-items: stretch;
      }
      /* flex: 1 1 200px grows vertically in column layout — keep header player one row tall */
      .global-player-bar,
      .header-session {
        flex: 0 0 auto;
        width: 100%;
      }
      /* Dock wins on Library: hide duplicate header mini-player when dock is active */
      body.list-playing .global-player-bar.active {
        display: none;
      }
      .header-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
      }
      .nav-links {
        margin-left: 0;
        flex-wrap: wrap;
      }
      .system-strip {
        width: 100%;
        margin-left: 0;
      }
      .file-list,
      .file-group-list,
      .staging-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
      }
      .file-item {
        max-width: 100%;
      }
      .file-actions .fav-btn,
      .file-actions .comment-btn,
      .file-actions .edit-btn,
      .file-actions .download-btn,
      .file-actions .delete-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 1rem;
      }
      .player-section h2 {
        max-width: none;
        flex: 1 1 auto;
        min-width: 0;
      }
      .player-chrome {
        flex-wrap: wrap;
        gap: 6px;
      }
      .controls button {
        min-height: 36px;
        padding: 6px 12px;
      }
    }
    ::-webkit-scrollbar {
      width: 8px;
    }
    ::-webkit-scrollbar-track {
      background: rgba(255,255,255,0.05);
      border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(233,69,96,0.4);
      border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: rgba(233,69,96,0.6);
    }

    /* Tailscale / remote view-only: hide mutating chrome (server also blocks POSTs). */
    body.remote-limited #navSettings,
    body.remote-limited #formatSelect,
    body.remote-limited #createProjectBtn,
    body.remote-limited #settingsView,
    body.remote-limited #playerFavBtn,
    body.remote-limited #playerEditBtn,
    body.remote-limited #playerDeleteBtn,
    body.remote-limited .file-actions .fav-btn,
    body.remote-limited .file-actions .edit-btn,
    body.remote-limited .file-actions .delete-btn,
    body.remote-limited .file-actions .comment-btn,
    body.remote-limited .file-item .delete,
    body.remote-limited .file-item .file-edit-btn,
    body.remote-limited .file-item .fav-btn,
    body.remote-limited .file-item .comment-btn,
    body.remote-limited .region-action-btn,
    body.remote-limited #stagingList .delete,
    body.remote-limited #stagingList .promote,
    body.remote-limited .project-tab[data-tab="whiteboard"] {
      display: none !important;
    }
