/* ── Dynamic Island ───────────────────────────────────────────────────────── */
/* Floats top-center, only present while a timer is running. Carries the
   session context (chapter) and live metrics (total focus, q-time) plus the
   single action that matters mid-session: ending it. Separated from the
   sidebar entirely - this is "what's happening now", the sidebar is
   "where am I working". */

.dyn-island {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px) scale(0.92);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.dyn-island.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.dyn-island-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #101010;
  color: #FFFFFF;
  padding: 9px 10px 9px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  white-space: nowrap;
  max-width: min(90vw, 480px);
}
[data-dark] .dyn-island-inner {
  background: #FFFFFF;
  color: #101010;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dyn-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #818CF8;
  flex-shrink: 0;
  animation: dynPulse 1.8s ease-in-out infinite;
}
[data-dark] .dyn-pulse { background: #4F46E5; }
@keyframes dynPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(129, 140, 248, 0); }
}

.dyn-chapter {
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dyn-sep {
  opacity: 0.35;
  font-size: 11px;
}

.dyn-metric {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  opacity: 0.9;
}
.dyn-metric i { font-size: 13px; opacity: 0.7; }

.dyn-end-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 12px;
  margin-left: 2px;
  transition: background 0.2s ease, transform 0.15s ease;
}
.dyn-end-btn:hover { background: rgba(239, 68, 68, 0.28); }
.dyn-end-btn:active { transform: scale(0.92); }

/* ── Mobile ── */
@media (max-width: 600px) {
  .dyn-island { top: 10px; }
  .dyn-island-inner {
    padding: 8px 8px 8px 12px;
    gap: 7px;
    font-size: 11px;
  }
  .dyn-chapter { max-width: 70px; }
  #dynQTime { display: none; }
  .dyn-island-inner .dyn-metric:has(#dynQTime) { display: none; }
}