/* Phone-only glass ribbon. DESIGN_VARIANCE 7 / MOTION_INTENSITY 7 / DENSITY 3.
   Raised artwork is the focal point; motion is finite and input-driven.
   Native dialog owns the modal layer; desktop styling stays in dock.css. */
.tb-dock-mobile-label,
.tb-mobile-apps-toggle,
.tb-dock-sheen { display: none; }
.tb-mobile-apps:not([open]) { display: none; }
html:has(.tb-mobile-apps[open]),
body:has(.tb-mobile-apps[open]) { overflow: hidden; }

@media (max-width: 768px), (max-width: 1024px) and (max-height: 500px) {
  #dock-root.tb-dock-mobile {
    left: 50%;
    right: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: min(368px, calc(100vw - 28px));
    transform: translateX(-50%);
    translate: none !important;
  }
  .tb-dock-mobile .tb-dock,
  .tb-dock-mobile .tb-dock.tb-liquid-ready {
    --tb-liquid-inset-top: 17px;
    --tb-liquid-radius: 28px;
    --tb-liquid-corner-smoothing: 0;
    display: grid;
    position: relative;
    isolation: isolate;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: none;
    padding: 0 12px 12px;
    overflow: visible;
    border: 0;
    border-radius: 30px;
    background: transparent;
    color: #fff;
    text-shadow: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  /* Keep the lifted shelf geometry; share the desktop dock's glass material.
     Blur stays static; only the narrow reflection moves during arrival. */
  .tb-dock-mobile .tb-dock::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 17px 0 0;
    border: 1px solid var(--tb-glass-rim);
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(224, 242, 250, .12), transparent 48%), var(--tb-glass-fallback);
    box-shadow: var(--tb-glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .22);
    -webkit-backdrop-filter: blur(var(--tb-glass-blur, 18px)) saturate(145%);
    backdrop-filter: blur(var(--tb-glass-blur, 18px)) saturate(145%);
    pointer-events: none;
  }
  .tb-dock-mobile .tb-dock::after {
    content: '';
    position: absolute;
    inset: 18px 24px auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / .58), transparent);
    pointer-events: none;
    z-index: -1;
  }
  .tb-dock-mobile .tb-dock-sheen {
    display: block;
    position: absolute;
    top: 17px;
    left: 12%;
    width: 18%;
    height: 1px;
    opacity: 0;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    pointer-events: none;
    z-index: 0;
  }
  .tb-dock-mobile .tb-dock:not(.tb-liquid-ready) > .tb-liquid-canvas { visibility: hidden; }
  /* Replace the fallback only after Liquid DOM has rendered its first frame. */
  .tb-dock-mobile .tb-dock.tb-liquid-ready::before {
    background: transparent;
    border-color: transparent;
    box-shadow: var(--tb-glass-shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .tb-dock-mobile .tb-dock.tb-liquid-ready::after { opacity: 0; }
  .tb-dock-mobile .tb-dock-item {
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: auto;
    transform: none !important;
  }
  .tb-dock-mobile .tb-dock-icon,
  .tb-mobile-apps-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-width: 44px;
    min-height: 83px;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    aspect-ratio: auto;
    cursor: pointer;
    touch-action: manipulation;
    transform: none !important;
    will-change: auto;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 1;
  }
  .tb-dock-mobile .tb-dock-icon-img,
  .tb-mobile-apps-glyph {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    filter: drop-shadow(0 5px 5px rgb(0 10 18 / .28));
    transform-origin: 50% 85%;
    transition: filter .16s;
  }
  .tb-dock-mobile .tb-dock-icon:active .tb-dock-icon-img,
  .tb-mobile-apps-toggle:active .tb-mobile-apps-glyph { filter: brightness(.82); }
  .tb-dock-mobile-label {
    display: block;
    font: 600 11px/14px -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    letter-spacing: .01em;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgb(0 10 18 / .45);
  }
  .tb-mobile-apps-glyph {
    display: grid;
    grid-template-columns: repeat(2, 10px);
    grid-template-rows: repeat(2, 10px);
    align-content: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid rgb(255 255 255 / .56);
    box-sizing: border-box;
    border-radius: 18px;
    background: linear-gradient(145deg, #f9fcff, #c8d9e5);
    box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgb(57 81 101 / .16);
    rotate: -5deg;
  }
  .tb-mobile-apps-glyph i {
    border-radius: 3px;
    background: #334c60;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .16);
  }
  .tb-mobile-apps-glyph i:nth-child(2) { background: #587389; }
  .tb-mobile-apps-glyph i:nth-child(3) { background: #6a8396; }
  .tb-dock-mobile .tb-dock-dot { bottom: -6px; width: 12px; height: 3px; border-radius: 2px; background: #f6f9fa; }
  .tb-dock-mobile .tb-dock-tooltip:not([role='status']):not(.tb-dock-error) { display: none; }
  .tb-dock-mobile .tb-dock-error {
    position: fixed;
    inset: auto 0 calc(100% + 12px);
    width: auto;
    max-width: none;
    transform: none;
  }
  .tb-dock-mobile .tb-dock-icon[aria-busy='true'] { opacity: .55; cursor: progress; }
  .tb-dock-mobile .tb-dock-icon:focus-visible,
  .tb-mobile-apps-toggle:focus-visible { outline: 2px solid #f6f9fa; outline-offset: 4px; }

  .tb-mobile-apps {
    position: fixed;
    inset: auto 0 calc(10px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 20px);
    max-width: 560px;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
    margin: 0 auto;
    box-sizing: border-box;
    padding: 28px 18px 26px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgb(255 255 255 / .26);
    border-radius: 32px;
    background: linear-gradient(145deg, rgb(78 98 112 / .94), rgb(18 31 43 / .97) 65%);
    color: #f6f9fa;
    box-shadow: 0 24px 80px rgb(6 12 17 / .4), inset 0 1px 0 rgb(255 255 255 / .24);
    -webkit-backdrop-filter: blur(28px) saturate(130%);
    backdrop-filter: blur(28px) saturate(130%);
    transform-origin: 50% 100%;
    color-scheme: dark;
  }
  .tb-mobile-apps::before {
    content: '';
    display: block;
    position: absolute;
    top: 9px;
    left: calc(50% - 16px);
    width: 32px;
    height: 3px;
    border-radius: 3px;
    background: rgb(255 255 255 / .28);
    pointer-events: none;
  }
  .tb-mobile-apps::backdrop {
    background: rgb(6 12 17 / .48);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  .tb-mobile-apps-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
  }
  .tb-mobile-apps-heading h2 {
    margin: 0;
    font: 600 23px/1.2 -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    letter-spacing: -.02em;
  }
  .tb-mobile-apps-heading h2:focus { outline: none; }
  .tb-mobile-apps-dismiss {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 16px;
    border: 1px solid rgb(255 255 255 / .32);
    border-radius: 12px;
    background: transparent;
    color: inherit;
    box-shadow: none;
    font: 600 14px/20px -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .tb-mobile-apps-dismiss:focus { outline: none; }
  .tb-mobile-apps-dismiss:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -4px;
  }
  @media (hover: hover) {
    .tb-mobile-apps-dismiss:hover { border-color: rgb(255 255 255 / .6); }
  }
  .tb-mobile-apps-dismiss:active { opacity: .65; }
  .tb-mobile-apps-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 26px 8px;
  }
  .tb-mobile-apps .tb-dock-icon { gap: 10px; min-height: 82px; }
  .tb-mobile-apps .tb-dock-icon-img { width: 60px; height: 60px; flex-basis: 60px; }
  .tb-mobile-apps .tb-dock-mobile-label { font-size: 12px; line-height: 16px; }
  .tb-mobile-apps .tb-dock-dot { bottom: -9px; }
  .tb-mobile-apps .tb-dock-tooltip[role='status'] {
    z-index: 2;
    top: -26px;
    bottom: auto;
    max-width: 80vw;
    font-size: 10px;
    padding: 6px 8px;
  }
  .tb-mobile-apps .tb-dock-error {
    position: fixed;
    inset: auto 20px 12px;
    width: auto;
    max-width: none;
    border-radius: 12px;
    background: #f6f9fa;
    color: #1b252c;
  }
}

@media (min-width: 600px) and (max-width: 1024px) and (max-height: 500px) {
  .tb-mobile-apps { max-width: 640px; padding: 24px 24px 20px; }
  .tb-mobile-apps-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 16px; }
  .tb-mobile-apps-heading { margin-bottom: 20px; }
}
@media (max-width: 374px) {
  .tb-mobile-apps-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-dock-mobile .tb-dock-icon-img,
  .tb-mobile-apps-glyph { width: 56px; height: 56px; flex-basis: 56px; }
  .tb-mobile-apps .tb-dock-icon-img { width: 58px; height: 58px; flex-basis: 58px; }
}
@media (max-width: 768px) and (prefers-reduced-motion: no-preference), (max-width: 1024px) and (max-height: 500px) and (prefers-reduced-motion: no-preference) {
  html:not([data-glass-motion='off']) .tb-mobile-apps[open]::backdrop { animation: tb-apps-backdrop .25s ease-out both; }
  @keyframes tb-apps-backdrop { from { opacity: 0; } to { opacity: 1; } }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce), (max-width: 1024px) and (max-height: 500px) and (prefers-reduced-motion: reduce) {
  .tb-dock-mobile .tb-dock-icon-img,
  .tb-mobile-apps-glyph { transition: none; }
}
@media (max-width: 768px) and (prefers-reduced-transparency: reduce), (max-width: 1024px) and (max-height: 500px) and (prefers-reduced-transparency: reduce) {
  .tb-dock-mobile .tb-dock::before,
  .tb-mobile-apps { background: #263846; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tb-mobile-apps::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
