:root {
  color-scheme: light;
  --shell-bg: #eef2f7;
  --shell-ink: #111827;
  --shell-muted: rgba(17, 24, 39, 0.72);
  --shell-surface: rgba(255, 255, 255, 0.94);
  --shell-border: rgba(17, 24, 39, 0.12);
  --shell-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  --shell-frame-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  --shell-focus: #0f766e;
  --shell-transition: 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.32), transparent 34%),
    radial-gradient(circle at bottom right, rgba(196, 181, 253, 0.18), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, var(--shell-bg) 100%);
  color: var(--shell-ink);
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

.course-shell--busy {
  cursor: progress;
}

#course-shell {
  position: fixed;
  inset: 0;
}

.course-shell__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.course-shell__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  background: #ffffff;
  transition: opacity var(--shell-transition);
  box-shadow: var(--shell-frame-shadow);
}

.course-shell__frame.is-current,
.course-shell__frame.is-incoming.is-visible {
  opacity: 1;
}

.course-shell__frame.is-outgoing {
  opacity: 0;
}

.course-shell__controls {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--shell-border);
  border-radius: 999px;
  background: var(--shell-surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(14px);
}

.course-shell__controls-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.course-shell__controls-options {
  display: inline-flex;
  gap: 6px;
}

.course-shell__controls button {
  min-width: 60px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition:
    background-color 120ms ease,
    color 120ms ease,
    border-color 120ms ease,
    opacity 120ms ease;
}

.course-shell__controls button:hover:not(:disabled) {
  border-color: rgba(17, 24, 39, 0.14);
  background: rgba(17, 24, 39, 0.06);
}

.course-shell__controls button:focus-visible {
  outline: 3px solid var(--shell-focus);
  outline-offset: 2px;
}

.course-shell__controls button[aria-pressed="true"] {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.course-shell__controls button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.course-shell__overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  background: rgba(241, 245, 249, 0.34);
  backdrop-filter: blur(8px);
}

.course-shell__overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.course-shell__overlay-card {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(90vw, 320px);
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shell-shadow);
}

.course-shell__overlay-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid rgba(17, 24, 39, 0.14);
  border-top-color: #111827;
  border-radius: 999px;
  animation: course-shell-spin 0.8s linear infinite;
}

.course-shell__overlay-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--shell-muted);
}

.course-shell__overlay.is-error .course-shell__overlay-spinner {
  border-top-color: #dc2626;
  animation: none;
}

.course-shell__overlay-retry {
  flex: 0 0 auto;
  padding: 4px 12px;
  border: 1px solid rgba(17, 24, 39, 0.22);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--shell-fg);
  transition: background 120ms ease;
}

.course-shell__overlay-retry:hover {
  background: #f1f5f9;
}

.course-shell__overlay-retry:focus-visible {
  outline: 2px solid var(--shell-accent);
  outline-offset: 2px;
}

.course-shell__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes course-shell-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .course-shell__controls {
    top: auto;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    justify-content: space-between;
  }
}
