/* Mobile command dock: thumb-first live navigation for repeat checking. */
.mobile-command-dock {
  display: none;
}

@media (max-width: 820px) {
  body {
    padding-bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-command-dock {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 9997;
    display: block;
    border: 1px solid rgba(255, 107, 53, 0.24);
    border-radius: 18px;
    background:
      linear-gradient(135deg, rgba(0, 230, 118, 0.1), rgba(255, 107, 53, 0.1)),
      rgba(8, 12, 18, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.52), 0 0 28px rgba(255, 107, 53, 0.08);
    backdrop-filter: blur(16px);
    overflow: hidden;
  }

  .mobile-command-dock::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.055) 48%, transparent 62%);
    transform: translateX(-120%);
    animation: mobile-command-sheen 7s ease-in-out infinite;
  }

  .mobile-command-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 900;
  }

  .mobile-command-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #00e676;
    white-space: nowrap;
  }

  .mobile-command-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00e676;
    box-shadow: 0 0 14px rgba(0, 230, 118, 0.65);
    animation: mobile-command-pulse 1.45s ease-in-out infinite;
  }

  .mobile-command-status {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }

  .mobile-command-count {
    color: #ff6b35;
    white-space: nowrap;
  }

  .mobile-command-actions {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 7px;
  }

  .mobile-command-quest {
    position: relative;
    z-index: 1;
    padding: 8px 10px 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background:
      radial-gradient(circle at 10% 10%, rgba(0, 230, 118, 0.1), transparent 34%),
      rgba(0, 0, 0, 0.12);
  }

  .mobile-command-quest-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
  }

  .mobile-command-quest-kicker {
    color: #ff6b35;
    font-size: 0.58rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  .mobile-command-quest-chip {
    border: 1px solid rgba(0, 230, 118, 0.24);
    border-radius: 999px;
    background: rgba(0, 230, 118, 0.07);
    color: #00e676;
    font-size: 0.56rem;
    font-weight: 950;
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .mobile-command-quest-title {
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 950;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-command-quest-sub {
    margin-top: 2px;
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-command-quest-bar {
    height: 5px;
    margin-top: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-command-quest-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00e676, #ff6b35);
    box-shadow: 0 0 16px rgba(0, 230, 118, 0.2);
    transition: width 420ms ease;
  }

  .mobile-command-action {
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-command-action span:first-child {
    font-size: 1rem;
    line-height: 1;
  }

  .mobile-command-action.active,
  .mobile-command-action:active {
    border-color: rgba(0, 230, 118, 0.36);
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
    transform: translateY(-1px);
  }

  .mobile-command-action[data-key="pick"] {
    border-color: rgba(255, 107, 53, 0.28);
  }

  .mobile-command-action[data-key="pick"].active,
  .mobile-command-action[data-key="pick"]:active {
    border-color: rgba(255, 107, 53, 0.5);
    background: rgba(255, 107, 53, 0.12);
    color: #ff6b35;
  }

  body.mobile-command-refresh .mobile-command-dock {
    animation: mobile-command-pop 620ms ease-out;
  }

  body.mobile-command-quest-pop .mobile-command-quest {
    animation: mobile-command-quest-pop 680ms ease-out;
  }
}

@keyframes mobile-command-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.32);
  }
}

@keyframes mobile-command-sheen {
  0%, 18% {
    transform: translateX(-120%);
  }
  48%, 100% {
    transform: translateX(120%);
  }
}

@keyframes mobile-command-pop {
  0%, 100% {
    transform: translateY(0);
  }
  38% {
    transform: translateY(-3px);
  }
}

@keyframes mobile-command-quest-pop {
  0%, 100% {
    box-shadow: inset 0 0 0 rgba(0, 230, 118, 0);
  }
  34% {
    box-shadow: inset 0 0 34px rgba(0, 230, 118, 0.12), 0 0 18px rgba(255, 107, 53, 0.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-command-dock,
  .mobile-command-dock::before,
  .mobile-command-dot,
  .mobile-command-quest {
    animation: none !important;
  }
}
