/* Shared session bar. Keep the trackers independent; share the site's Core
   surfaces and a readable system face in both dashboard and standalone views. */
body .study-widget.sw-card {
  --sw-surface: var(--panel, #fcfbf6);
  --sw-text: var(--text, #18211f);
  --sw-muted: var(--text-dim, #526158);
  --sw-border: var(--border, #d6dcd2);
  --sw-accent: var(--accent, #285548);
  --sw-soft: var(--accent-soft, #e6ede2);
  position: fixed;
  inset: auto max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) auto;
  z-index: 72 !important;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 386px;
  max-width: calc(100vw - 40px);
  min-height: 68px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--sw-border);
  border-radius: 12px;
  background: var(--sw-surface);
  color: var(--sw-text);
  box-shadow: 0 6px 24px #18211f12, 0 1px 3px #18211f08;
  font: 400 14px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  letter-spacing: normal;
  text-transform: none;
  text-align: start;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: none;
  transition: opacity .16s ease, border-color .16s ease;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
[data-theme='dark'] body .study-widget.sw-card,
[data-theme='dark'] body .study-widget.sw-card:is(.ssw-visible, .focus-widget--visible):hover { box-shadow: 0 6px 24px #0003, 0 1px 3px #0002; }
body .study-widget.sw-card *, body .study-widget.sw-card *::before { box-sizing: border-box; }
body .study-widget.sw-card:is(.ssw-visible, .focus-widget--visible) { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
body .study-widget.sw-card:is(.ssw-visible, .focus-widget--visible):hover { transform: none; border-color: var(--sw-border); box-shadow: 0 6px 24px #18211f12, 0 1px 3px #18211f08; }
body .study-widget.sw-card.auto-study-widget { cursor: pointer; width: 306px; }
body .study-widget.sw-card.ast-hidden { display: none !important; }
body .study-widget.sw-card .sw-summary { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; text-decoration: none; border-radius: 6px; }
body .study-widget.sw-card .sw-mark { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 42px; color: var(--sw-accent); background: var(--sw-soft); border-radius: 8px; }
/* Independent hands reflect the digital productive duration, including pause.
   The playful shimmy is decorative and respects reduced motion. */
body .study-widget.sw-card .sw-clock { transform-origin: 50% 60%; animation: sw-clock-shimmy 8s ease-in-out infinite paused; }
body .study-widget.sw-card :is(.sw-clock-second, .sw-clock-minute) { transform-box: view-box; transform-origin: 12px 13px; }
body .study-widget.sw-card .sw-clock-second { transform: rotate(var(--sw-second-angle, 0deg)); }
body .study-widget.sw-card .sw-clock-minute { transform: rotate(var(--sw-minute-angle, 0deg)); }
body .study-widget.sw-card.ssw-visible:not(.ssw-paused) .sw-clock,
body .study-widget.sw-card.focus-widget--visible.tracking-active:not(.ast-hidden) .sw-clock { animation-play-state: running; }
@keyframes sw-clock-shimmy {
  0%, 82%, 100% { transform: rotate(0); }
  86% { transform: rotate(-7deg); }
  90% { transform: rotate(5deg); }
  94% { transform: rotate(-2deg); }
}
body .study-widget.sw-card .sw-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
body .study-widget.sw-card .sw-topline { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
body .study-widget.sw-card .sw-time { flex: 0 0 auto; font: 650 20px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.4px; color: var(--sw-text); }
body .study-widget.sw-card .sw-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; line-height: 1.4; color: var(--sw-accent); }
body .study-widget.sw-card .sw-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 1.4; color: var(--sw-muted); }
body .study-widget.sw-card .sw-controls { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding-left: 9px; border-left: 1px solid var(--sw-border); }
body .study-widget.sw-card .sw-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 44px; height: 44px; padding: 0 10px; border: 1px solid var(--sw-border); border-radius: 8px; background: transparent; color: var(--sw-text); font: 600 12px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; letter-spacing: 0; text-transform: none; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
body .study-widget.sw-card .sw-pause { padding: 0; }
body .study-widget.sw-card .sw-pause svg { width: 16px; height: 16px; }
body .study-widget.sw-card .sw-finish { border-color: transparent; color: var(--sw-accent); }
body .study-widget.sw-card .sw-button:disabled { opacity: .45; cursor: wait; }
body .study-widget.sw-card.ssw-paused .sw-mark { color: var(--sw-muted); background: var(--bg-2, #e6ede2); }
body .study-widget.sw-card.ssw-paused .sw-status, body .study-widget.sw-card.auto-study-widget:not(.tracking-active) .sw-status { color: var(--sw-muted); }
body .study-widget.sw-card.ssw-paused .sw-pause { background: #c7f36b; color: #18211f; border-color: #8cac4b; }
body .study-widget.sw-card .sw-arrow { display: grid; place-items: center; width: 32px; min-height: 44px; flex: 0 0 auto; color: var(--sw-accent); }
body .study-widget.sw-card:focus-visible, body .study-widget.sw-card :is(a, button):focus-visible { outline: 2px solid var(--sw-accent); outline-offset: 3px; }
body .study-widget.sw-card .sw-error { position: absolute; bottom: calc(100% + 8px); inset-inline: 0; padding: 10px 12px; background: var(--sw-surface); color: var(--sw-text); border: 1px solid var(--sw-border); border-radius: 8px; box-shadow: 0 4px 16px #0002; font-size: 13px; }
body .study-widget.sw-card [hidden] { display: none !important; }
@media (hover: hover) {
  body .study-widget.sw-card .sw-summary:hover .sw-title { color: var(--sw-accent); }
  body .study-widget.sw-card.auto-study-widget.focus-widget--visible:hover { border-color: var(--sw-accent); }
  body .study-widget.sw-card .sw-button:hover:not(:disabled) { background: var(--sw-soft); border-color: var(--sw-accent); }
}
/* An actual footer slot keeps the controls side by side without overlapping.
   Its measured height also reserves the right amount of room for quiz content. */
.quiz-navigation-inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 24px; row-gap: 8px; }
.quiz-navigation-buttons { width: 100%; grid-column: 1; grid-row: 1; }
.quiz-shortcuts { display: none; }
.quiz-widget-slot { grid-column: 2; grid-row: 1; min-width: 0; display: flex; justify-content: flex-end; }
.quiz-widget-slot:not(:has(.ssw-visible, .focus-widget--visible:not(.ast-hidden))) { display: none; }
body .study-widget.sw-card.sw-docked { position: relative !important; inset: auto !important; width: 386px; max-width: 100%; box-shadow: none; min-height: 60px; padding: 6px 8px; }
body .study-widget.sw-card.sw-docked:not(.ssw-visible):not(.focus-widget--visible) { display: none; }
body .study-widget.sw-card.auto-study-widget.sw-docked { width: 306px; }
body .study-widget.sw-card.sw-docked:is(.ssw-visible, .focus-widget--visible):hover,
[data-theme] body .study-widget.sw-card.sw-docked,
[data-theme] body .study-widget.sw-card.sw-docked:is(.ssw-visible, .focus-widget--visible):hover { box-shadow: none; }
#page-root[data-exam-view='quiz'] { padding-bottom: calc(var(--sw-dock-height, 86px) + 24px); }
@media (min-width: 1000px) {
  .quiz-feedback-panel { max-height: max(180px, calc(100dvh - 204px - var(--sw-dock-height, 86px))); }
  /* Continue the two content columns into one quiet desktop toolbar. */
  .quiz-widget-slot { padding-left: 24px; border-left: 1px solid var(--border); }
  body .study-widget.sw-card.sw-docked,
  body .study-widget.sw-card.auto-study-widget.sw-docked {
    width: 100%; min-height: 44px; padding: 0; gap: 14px;
    border: 0; border-radius: 0; background: transparent;
  }
  body .study-widget.sw-card.sw-docked .sw-summary { gap: 12px; }
  body .study-widget.sw-card.sw-docked .sw-mark { flex-basis: 28px; width: 28px; height: 40px; background: transparent; }
  body .study-widget.sw-card.sw-docked .sw-clock { width: 24px; height: 24px; }
  body .study-widget.sw-card.sw-docked .sw-controls { border: 0; padding-left: 0; gap: 8px; }
  body .study-widget.sw-card.sw-docked:not(.ssw-paused) .sw-pause { border-color: transparent; background: var(--sw-soft); }
}
@media (max-width: 999px) {
  .quiz-navigation-inner { grid-template-columns: minmax(0, 1fr); }
  .quiz-widget-slot { grid-column: 1; grid-row: 1; }
  .quiz-navigation-buttons { grid-row: 2; }
  body .study-widget.sw-card.sw-docked { width: 100%; min-height: 54px; padding: 0; border: 0; border-radius: 0; background: transparent; }
  body .study-widget.sw-card.auto-study-widget.sw-docked { width: 100%; }
}
@media (max-width: 600px) {
  body .study-widget.sw-card { right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important; max-width: calc(100vw - 24px); }
  body:has(.astra-app) .sw-card:not(.sw-docked) { bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important; }
  body .study-widget.sw-card .sw-finish-label { display: none; }
  body .study-widget.sw-card .sw-finish { padding: 0; }
  body .study-widget.sw-card.sw-docked { bottom: auto !important; }
  #page-root[data-exam-view='quiz'] { padding-bottom: calc(var(--sw-dock-height, 134px) + 100px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 359px) {
  body .study-widget.sw-card .sw-mark { display: none; }
  body .study-widget.sw-card .sw-controls { padding-left: 6px; gap: 4px; }
}
/* A short landscape window needs one shallow row, even below tablet width. */
@media (min-width: 680px) and (max-width: 999px) and (max-height: 540px) {
  .quiz-navigation-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  .quiz-navigation-buttons { grid-column: 1; grid-row: 1; }
  .quiz-widget-slot { grid-column: 2; }
  body .study-widget.sw-card.sw-docked .sw-mark, body .study-widget.sw-card.sw-docked .sw-finish-label { display: none; }
  body .study-widget.sw-card.sw-docked .sw-controls { padding-left: 6px; gap: 4px; }
  body .study-widget.sw-card.sw-docked .sw-finish { padding: 0; }
}
body.sw-keyboard-open .study-widget.sw-card { visibility: hidden; pointer-events: none; }
body.sw-keyboard-open .quiz-widget-slot { display: none; }
@media (prefers-reduced-motion: reduce) {
  body .study-widget.sw-card, body .study-widget.sw-card .sw-button { transition: none; }
  body .study-widget.sw-card .sw-clock { animation: none; }
}
