/* ===== Theme tokens (light / dark). Bootstrap's data-bs-theme on <html> switches
   its own variables; these cover app-specific surfaces and the chat accent. ===== */
:root,
[data-bs-theme="light"] {
  --bb-page-bg: #fafafa;
  --bb-surface: #fff;
  --bb-heading-color: #333;
  --bb-accent: #1a78c2;
  --bb-accent-strong: #0a5096;
  --bb-accent-subtle: #e7f1fd;
  --bb-accent-subtle-hover: #d9eafb;
  --bb-accent-border: #c5dcf5;
  --bb-nav-wave-stroke: #a8c8e8;
  color-scheme: light;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #16181b;
  --bs-body-bg-rgb: 22, 24, 27;
  --bs-tertiary-bg: #22252a;
  --bs-tertiary-bg-rgb: 34, 37, 42;
  --bs-secondary-bg: #2c3036;
  --bs-secondary-bg-rgb: 44, 48, 54;
  --bb-page-bg: #101214;
  --bb-surface: #1c1f23;
  --bb-heading-color: #e9ecef;
  --bb-accent: #5aa9e6;
  --bb-accent-strong: #8cc4f0;
  --bb-accent-subtle: #17324a;
  --bb-accent-subtle-hover: #1d3d5a;
  --bb-accent-border: #24507a;
  --bb-nav-wave-stroke: #3a5a7a;
  color-scheme: dark;
}

[data-bs-theme="dark"] .card {
  --bs-card-bg: var(--bb-surface);
}

/* Light-only Bootstrap utilities used across views: keep them readable in dark */
[data-bs-theme="dark"] .bg-white { background-color: var(--bb-surface) !important; }
[data-bs-theme="dark"] .bg-light { background-color: var(--bs-tertiary-bg) !important; }
[data-bs-theme="dark"] .text-dark:not(.bg-warning):not(.btn-warning):not(.btn-outline-warning) { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .btn-light {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-bg: var(--bs-secondary-bg);
  --bs-btn-border-color: var(--bs-secondary-bg);
  --bs-btn-hover-color: var(--bs-emphasis-color);
  --bs-btn-hover-bg: #3a3f46;
  --bs-btn-hover-border-color: #3a3f46;
  --bs-btn-active-color: var(--bs-emphasis-color);
  --bs-btn-active-bg: #444a52;
  --bs-btn-active-border-color: #444a52;
}
/* Saturated text utilities are too dim on dark surfaces: use Bootstrap's emphasis tones */
[data-bs-theme="dark"] .text-primary { color: var(--bs-primary-text-emphasis) !important; }
[data-bs-theme="dark"] .text-success { color: var(--bs-success-text-emphasis) !important; }
[data-bs-theme="dark"] .text-danger { color: var(--bs-danger-text-emphasis) !important; }
[data-bs-theme="dark"] .text-info { color: var(--bs-info-text-emphasis) !important; }
[data-bs-theme="dark"] {
  --bs-link-color: #6ea8fe;
  --bs-link-color-rgb: 110, 168, 254;
  --bs-link-hover-color: #9ec5fe;
  --bs-link-hover-color-rgb: 158, 197, 254;
}
[data-bs-theme="dark"] .btn-outline-dark {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-hover-color: var(--bs-body-bg);
  --bs-btn-hover-bg: var(--bs-body-color);
  --bs-btn-hover-border-color: var(--bs-body-color);
}


.event-widget-card { width: 150px; flex-shrink: 0; }

.quick-btn { aspect-ratio: 1; }
/* Home screen quick buttons: raised, pressable look */
.card.quick-btn {
  border: 1px solid var(--bs-border-color-translucent);
  border-bottom: 4px solid var(--bs-border-color);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(0, 0, 0, 0.06);
  transition: transform .1s, box-shadow .1s, border-bottom-width .1s;
}
.card.quick-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Home screen CTA: soft yellow with a raised, pressable look */
.card.quick-btn--cta {
  background: linear-gradient(180deg, #ffe58a 0%, #ffd149 100%);
  border: 1px solid #f0c53d;
  border-bottom: 4px solid #d9a915;
  color: #4a3600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(201, 150, 20, 0.25);
  transition: transform .1s, box-shadow .1s, border-bottom-width .1s;
}
/* Diagonal shine sweeping left to right every few seconds */
.card.quick-btn--cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.card.quick-btn--cta::after {
  content: "";
  position: absolute;
  top: -50%;
  left: 0;
  width: 45%;
  height: 200%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.65) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-160%) rotate(20deg);
  animation: quick-btn-shine 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes quick-btn-shine {
  0%   { transform: translateX(-160%) rotate(20deg); }
  35%  { transform: translateX(320%) rotate(20deg); }
  100% { transform: translateX(320%) rotate(20deg); }
}
.card.quick-btn--cta:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 4px rgba(201, 150, 20, 0.15);
}
@media (min-width: 768px) {
  .quick-btn { aspect-ratio: unset; padding: 1rem !important; }
  .rounded-md-3 { border-radius: var(--bs-border-radius-lg) !important; }
}

@media (max-width: 767px) {
  html, body {
    height: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  #page-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.authenticated #page-content {
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
  }

  body.overflow-hidden #page-content {
    overflow: hidden;
  }

  /* Wave show page: video pinned at top, content scrolls below */
  body.wave-page #page-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }

  body.wave-page #wavePageWrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.wave-page #playerContainer {
    flex-shrink: 0;
    background: #000;
    padding-top: env(safe-area-inset-top);
  }

  body.wave-page #waveContent {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.authenticated.wave-page #waveContent {
    padding-bottom: calc(140px + env(safe-area-inset-bottom)) !important;
  }
}

@media (min-width: 768px) {
  body.authenticated #page-content {
    padding-bottom: 90px;
  }

  body.authenticated.wave-page #waveContent {
    padding-bottom: 90px !important;
  }
}

/* ===== Fixed page header (shared/_page_header partial) ===== */
:root {
  --page-header-height: 56px;
  --impersonation-banner-height: 40px;
}

.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  height: var(--impersonation-banner-height);
}

.impersonation-banner-spacer {
  height: var(--impersonation-banner-height);
}

body.impersonating .page-header {
  top: var(--impersonation-banner-height);
}

body.impersonating .page-header-spacer {
  height: calc(var(--page-header-height) + env(safe-area-inset-top) + var(--impersonation-banner-height));
}

.page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1020;
  height: var(--page-header-height);
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  column-gap: 0.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
  background: var(--bb-surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.page-header-back {
  justify-self: start;
}

.page-header-actions {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.page-header h1,
.page-header h2,
.page-header h3,
.page-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--bs-body-color);
  text-align: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header-spacer {
  height: calc(var(--page-header-height) + env(safe-area-inset-top));
}

/* ===== Learning page tabs: fixed strip right under the page header ===== */
:root { --learning-tabs-height: 44px; }
.learning-tabs {
  position: fixed;
  top: calc(var(--page-header-height) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 1019;
  height: var(--learning-tabs-height);
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Теория · Практика · Навыки — равные колонки на всю ширину */
  background: var(--bb-surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
body.impersonating .learning-tabs {
  top: calc(var(--page-header-height) + env(safe-area-inset-top) + var(--impersonation-banner-height));
}
.learning-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.learning-tab.active {
  color: var(--bs-body-color);
  border-bottom-color: #ffc107;
}
.learning-tabs-spacer {
  height: var(--learning-tabs-height);
}

.page-header-icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--bs-body-color);
  line-height: 1;
  text-decoration: none;
}

.page-header-icon-btn:hover,
.page-header-icon-btn:focus {
  color: var(--bs-body-color);
  text-decoration: none;
}

.page-header-icon-btn:active {
  background: var(--bs-secondary-bg);
}

.page-header-icon-btn i {
  font-size: 1.1rem;
}

body {
    background: var(--bb-page-bg);
    touch-action: manipulation;
    overscroll-behavior-x: none;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

hr {
    opacity: 0.1;
}

.spot-map iframe {
    display: block;
    border-radius: 0 !important; /* overflow-hidden на карточке клипает углы */
}

.label-xs {
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.2s ease;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    opacity: 1;
}

.lightbox-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
    /* Hint compositor to promote to its own layer — avoids repaint on every transform */
    will-change: transform;
}

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
    white-space: nowrap;
}

.wave-divider {
    display: block;
    width: 100%;
    height: 20px;
    color: #a8c8e8;
    margin: 0.5rem 0;
    opacity: 0.3;
}

@media (max-width: 767px) {
    .wave-card .video-card {
        aspect-ratio: 4 / 3;
    }
}

.wave-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding-top: 2.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.72));
    pointer-events: none;
}

.wave-controls > * {
    pointer-events: auto;
}

/* Player buttons */
.player-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.player-btn:hover, .player-btn:focus {
    background: rgba(255,255,255,0.28);
    outline: none;
}

.player-btn--play {
    width: 46px;
    height: 46px;
    font-size: 22px;
    background: rgba(255,255,255,0.92);
    color: #111;
}

.player-btn--play:hover {
    background: #fff;
    color: #000;
}

.player-btn--sm {
    width: 32px;
    height: 32px;
    font-size: 15px;
    background: rgba(255,255,255,0.1);
}

.player-btn--sm:hover {
    background: rgba(255,255,255,0.22);
}

.player-speed-btn {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.player-speed-btn:hover {
    background: rgba(255,255,255,0.25);
}

@media (max-width: 767px) {
    .player-btn { width: 30px; height: 30px; font-size: 14px; }
    .player-btn--play { width: 38px; height: 38px; font-size: 17px; }
    .player-btn--sm { width: 26px; height: 26px; font-size: 12px; }
    .player-speed-btn { font-size: 11px; padding: 4px 10px; }
}

#playerContainer:fullscreen .player-btn,
#playerContainer:-webkit-full-screen .player-btn,
#playerContainer.player-fullscreen .player-btn { width: 38px; height: 38px; font-size: 18px; }

#playerContainer:fullscreen .player-btn--play,
#playerContainer:-webkit-full-screen .player-btn--play,
#playerContainer.player-fullscreen .player-btn--play { width: 46px; height: 46px; font-size: 22px; }

#playerContainer:fullscreen .player-btn--sm,
#playerContainer:-webkit-full-screen .player-btn--sm,
#playerContainer.player-fullscreen .player-btn--sm { width: 32px; height: 32px; font-size: 15px; }

#playerContainer:fullscreen .player-speed-btn,
#playerContainer:-webkit-full-screen .player-speed-btn,
#playerContainer.player-fullscreen .player-speed-btn { font-size: 13px; padding: 5px 14px; }

/* Timeline */
.wave-timeline {
    position: relative;
    width: 100%;
    height: 20px;
    cursor: pointer;
}

.wave-timeline::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
}

.wave-timeline__buffered {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    transform: translateY(-50%);
    width: 0;
    background: rgba(255,255,255,0.35);
    border-radius: 2px;
}

.wave-timeline__progress {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    transform: translateY(-50%);
    width: 0;
    background: #fff;
    border-radius: 2px;
}

.wave-timeline__thumb {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    pointer-events: none;
    transition: transform 0.1s;
}

.wave-timeline:active .wave-timeline__thumb {
    transform: translate(-50%, -50%) scale(1.3);
}

.wave-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: stretch;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    overflow: hidden;
    pointer-events: auto;
    z-index: 2;
}

.wave-marker__seek {
    padding: 0 9px;
    height: 28px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.05em;
    min-width: 28px;
}

.wave-marker__delete {
    width: 30px;
    height: 28px;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.wave-marker__seek:active  { background: rgba(255,255,255,0.12); }
.wave-marker__delete:active { background: rgba(255,255,255,0.12); color: #fff; }

.wave-time {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* Drawing tools */
.drawing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
}

.drawing-btn:hover {
    background: rgba(0,0,0,0.6);
    color: #fff;
}

.drawing-btn--active {
    background: rgba(255,255,255,0.92) !important;
    color: #111 !important;
}

.drawing-btn--danger {
    background: rgba(200,40,40,0.45);
}

.drawing-btn--danger:hover {
    background: rgba(200,40,40,0.7);
}

.drawing-tool-group {
    display: flex;
    gap: 2px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 2px;
}

.drawing-color-picker {
    width: 32px;
    height: 32px;
    border: 4px solid #fff;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    outline: none;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
    background: none;

}

.drawing-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.drawing-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.drawing-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.rec-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
    animation: rec-blink 1s step-start infinite;
    flex-shrink: 0;
}

@keyframes rec-blink {
    50% { opacity: 0; }
}

.card {
    background: var(--bb-surface);
}

header a {
    text-decoration: none !important;
}

#brand-name {
    display: block;
    text-decoration: none;
    color: inherit;
}

.path-block {
    margin-top: 40px;
}

.path-title {
    margin-bottom: 8px;
}

.path-subtitle {
    color: var(--bs-secondary-color);
    margin-bottom: 16px;
}

.path-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.path-list li {
    margin: 4px 0;
}

.path-list .arrow {
    color: var(--bs-secondary-color);
}

.path-list .hint {
    margin-left: 8px;
    color: var(--bs-secondary-color);
    font-weight: normal;
}

.path-cta-text {
    margin-top: 24px;
    margin-bottom: 8px;
}

.signup-info {
    opacity: 0.6;
    margin-bottom: 16px;
}

.signup-info ul {
    padding-left: 18px;
}

.signup-footer {
    margin-top: 24px;
}

.login-footer {
    margin-top: 16px;
}

.password-reset-subtitle {
    opacity: 0.6;
    margin-bottom: 16px;
}

.auth-links p {
    margin-bottom: 8px;
}

.auth-links a {
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    color: #fff;
}

.task.done {
    text-decoration: line-through;
    opacity: 0.5;
}

.waiting-block {
    opacity: 0.7;
    font-size: 14px;
}

.done {
    text-decoration: line-through;
    opacity: 0.5;
}

.upload-subtitle {
    opacity: 0.7;
    margin-bottom: 12px;
}

.upload-rules {
    margin-bottom: 16px;
}

.upload-rules ul {
    padding-left: 18px;
}

.review-video {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

h1 {
    font-weight: 700;
    font-size: 36px;
}

h1, h2, h3 {
    color: var(--bb-heading-color);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

p {
    font-weight: 400;
    opacity: 0.85;
}

.btn:active {
    transform: scale(0.97);
}

.btn:hover {
    filter: brightness(1.05);
}

.hero-cta {
    box-shadow: 0 12px 30px rgba(255, 193, 7, 0.5);
}

@media (max-width: 575.98px) {
    #notification-toasts {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
    }

    #notification-toasts .toast {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }
}

.container {
    max-width: 1140px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    overflow: hidden;
}

@media (min-width: 768px) {
    .canvas-wrapper {
        border-radius: var(--bs-border-radius-xxl);
    }
}

#zoomLayer {
    position: absolute;
    inset: 0;
    transform-origin: center center;
    will-change: transform;
}

#videoPoster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.canvas-wrapper canvas,
.canvas-wrapper video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#baseCanvas   { z-index: 3; }
#markerCanvas { z-index: 4; }
#overlayCanvas { z-index: 5; }

#video {
    background: #000;
    border-radius: 0;
}

@media (min-width: 768px) {
    #video {
        border-radius: inherit;
    }
}

.card {
    border: 0;
    box-shadow: 0 2px 10px 0 rgba(0,0,0,.06);
}

.card iframe {
    width: 100% !important;
    border-radius: var(--bs-border-radius-xxl);
    height: 100% !important;
}

.rounded-end {
    --bs-border-radius: 0;
}

.video-card {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--bs-secondary-bg) 25%, var(--bs-tertiary-bg) 50%, var(--bs-secondary-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.video-card:has(img.loaded) {
    animation: none;
    background: #1a1a1a;
}

.video-card--processing {
    animation: none;
    background: var(--bs-secondary-bg);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.video-card .time {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: #fff;
    background: rgba(0,0,0,.6);
    padding: 0px 5px;
    font-size: 80%;
}

.video-card img,
.video-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card img.video-poster {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.video-card img.video-poster.loaded {
    opacity: 1;
}

.play-btn {
    position: absolute;
    color: #fff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.play-btn:hover {
    color: #fff;
    opacity: 0.8;
}

.spinner-border {
    --bs-spinner-border-width: 0.1rem;
    color: #fff;
    position: absolute;
    left: calc(50% - 15px);
    top: calc(50% - 17px);
}

.translation_missing {
    color: red;
}

.mascot-wrapper {
    position: relative;
    display: inline-block;
}

.mascot-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 6px solid #f5a623;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mascot-bubble {
    position: absolute;
    top: 10px;
    right: 120px;
    background: var(--bb-surface);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    min-width: 210px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mascot-bubble::after {
    content: "";
    position: absolute;
    bottom: 0px;
    right: -8px;
    width: 0;
    height: 0;
    transform: rotate(70deg);
    rotate: 70deg;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--bb-surface);
}

.w-fit { width: fit-content !important; }

.wave-card .status {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    width: 100%;
    cursor: default;
}

.text-decoration-none * {
    text-decoration: none !important;
}

.captain {
    position: relative;
}

.captain::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: gold;
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
}

.captain-left {
    position: relative;
}

.captain-left::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    width: 12px;
    height: 12px;
    background: gold;
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
}

/* Native fullscreen — canvas-wrapper gets AR from JS, container centers it */
#playerContainer:fullscreen,
#playerContainer:-webkit-full-screen {
    background: #000;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

#playerContainer:fullscreen .canvas-wrapper,
#playerContainer:-webkit-full-screen .canvas-wrapper {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #000;
}

/* Скрываем мобильную навигацию в кастомном fullscreen */
body.player-fs-active nav.fixed-bottom,
body.player-fs-active nav.fixed-top,
body.player-fs-active .mobile-bottom-wave { display: none !important; }

/* Custom fullscreen (iOS Safari + fallback) */
#playerContainer.player-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9998 !important;
    background: #000 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
}

#playerContainer.player-fullscreen .canvas-wrapper {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #000;
}

/* Shared */
#playerContainer:fullscreen #video,
#playerContainer:-webkit-full-screen #video,
#playerContainer.player-fullscreen #video {
    object-fit: contain !important;
    border-radius: 0 !important;
}

/* Split screen */
#video2 {
    display: none;
    background: #000;
    object-fit: contain;
}

.canvas-wrapper.player-split #video {
    right: auto;
    width: 50%;
    object-fit: contain;
}

.canvas-wrapper.player-split #video2 {
    display: block;
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    height: 100%;
    transform: none;
    object-fit: contain;
}

/* Overlay mode */
.canvas-wrapper.player-overlay #video2 {
    display: block;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    transform: none;
    object-fit: contain;
}

/* Videos inside split wrappers fill their half-width container */
#videoWrap1 > #video {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}
#videoWrap2 > #video2 {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    transform: none;
}

.canvas-wrapper.player-split #videoPoster {
    width: 50%;
    right: auto;
}

#playerContainer:fullscreen .wave-controls,
#playerContainer:-webkit-full-screen .wave-controls,
#playerContainer.player-fullscreen .wave-controls {
    background: rgba(0, 0, 0, 0.75);
    padding-top: 0.5rem;
}

.event-card__badges {
    position: absolute;
    top: -4px;
    left: 0;
    z-index: 5;
    display: flex;
    gap: 6px;
    font-size: 80%;
}

/* Chat */
.chat-layout {
  display: flex;
  height: calc(100vh - 57px);
  height: calc(100dvh - 57px);
  overflow: hidden;
  overscroll-behavior: none;
}

.chat-sidebar {
  width: 240px;
  min-width: 240px;
  border-right: 1px solid var(--bs-border-color);
  background: var(--bb-surface);
}

.chat-sidebar__room {
  color: var(--bs-body-color);
  border-radius: 6px;
  margin: 4px 8px;
  padding: 8px 12px !important;
}
.chat-sidebar__room:hover { background: var(--bs-tertiary-bg); }
.chat-sidebar__room.active { background: var(--bb-accent-subtle); color: var(--bb-accent); }

.chat-main__header {
  position: relative;
  flex-shrink: 0;
  height: 57px;
  background: var(--bb-surface);
  box-shadow: 0 2px 10px 0 rgba(0,0,0,.06);
  z-index: 1;
}

.chat-main {
  min-height: 0;
  background: var(--bb-page-bg);
  position: relative;
}

.chat-messages {
  display: flex;
  flex-direction: column;
}
.chat-messages::after {
  content: "";
  display: block;
  min-height: 90px;
  flex-shrink: 0;
}

.chat-jump-btn {
  position: absolute;
  bottom: 110px;
  right: 20px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--bb-surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--bs-secondary-color);
}
.chat-input {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 16px 32px;
}
.chat-input__bubble {
  background: var(--bb-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* On mobile: fixed positioning avoids dvh reflows when the keyboard opens/closes */
@media (max-width: 767px) {
  .chat-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 70px; /* bottom nav height */
    height: auto;
  }
}

/* Message bubble */
.chat-message__bubble {
  background: var(--bb-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 6px 12px;
  max-width: 75%;
}
.chat-message--own .chat-message__bubble {
  background: var(--bb-accent-subtle);
  border-color: var(--bb-accent-border);
}
.chat-message--own {
  flex-direction: row-reverse;
}
.chat-message--own .chat-message__name {
  display: none;
}
.chat-message--own .chat-message__meta {
  justify-content: flex-end;
}
.chat-message--own .chat-message__body {
  text-align: right;
}
.chat-message__meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}
.chat-message__body {
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chat-message__body a {
  color: var(--bb-accent);
  text-decoration: underline;
  word-break: break-all;
}
.chat-message--own .chat-message__body a {
  color: var(--bb-accent);
}
.chat-message__body--deleted {
  font-style: italic;
  opacity: 0.45;
  white-space: normal;
}
.chat-message__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  min-height: 16px;
}
.chat-message__time {
  font-size: 11px;
  color: var(--bs-tertiary-color);
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Reaction picker popup ───────────────────────────────────────────── */
.reaction-picker {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--bb-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16), 0 1px 4px rgba(0, 0, 0, .08);
  /* Animate in */
  animation: reaction-picker-in 0.15s ease-out;
}
.reaction-picker__row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
}
.reaction-picker__actions {
  border-top: 1px solid var(--bs-border-color);
  padding: 4px 10px;
  justify-content: center;
}
@keyframes reaction-picker-in {
  from { opacity: 0; transform: scale(0.85) translateY(4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
.reaction-picker[hidden] {
  display: none;
}
.reaction-picker__btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 5px;
  border-radius: 10px;
  transition: transform 0.12s, background 0.12s;
}
.reaction-picker__btn:hover,
.reaction-picker__btn:focus-visible {
  background: var(--bs-tertiary-bg);
  transform: scale(1.25);
  outline: none;
}
.reaction-picker__btn:active {
  transform: scale(1.1);
}

/* Long-press visual feedback on the bubble */
.reaction-picker-pressed {
  opacity: 0.65;
  transform: scale(0.97);
  transition: opacity 0.05s, transform 0.05s;
}

/* ── Reaction badges under message ───────────────────────────────────── */
.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bs-tertiary-bg);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 2px 7px 2px 5px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}
.chat-reaction:hover {
  background: var(--bs-secondary-bg);
  transform: scale(1.06);
}
.chat-reaction:active {
  transform: scale(0.96);
}
.chat-reaction--mine {
  background: var(--bb-accent-subtle);
  border-color: var(--bb-accent-border);
}
.chat-reaction--mine:hover {
  background: var(--bb-accent-subtle-hover);
}
.chat-reaction__emoji {
  font-size: 0.95rem;
  line-height: 1;
}
.chat-reaction__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bs-body-color);
  line-height: 1;
}

/* ── Reaction picker: separator + action buttons (reply, edit) ───────── */
.reaction-picker__sep {
  width: 1px;
  background: var(--bs-border-color);
  margin: 4px 4px;
  align-self: stretch;
  flex-shrink: 0;
}
.reaction-picker__action-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--bs-secondary-color);
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
}
.reaction-picker__action-btn:hover,
.reaction-picker__action-btn:focus-visible {
  background: var(--bs-tertiary-bg);
  color: var(--bb-accent);
  outline: none;
}
.reaction-picker__action-btn--danger {
  color: var(--bs-danger-text-emphasis);
}
.reaction-picker__action-btn--danger:hover,
.reaction-picker__action-btn--danger:focus-visible {
  background: var(--bs-danger-bg-subtle);
  color: var(--bs-danger-text-emphasis);
}

/* ── Inline message editor ───────────────────────────────────────────── */

/* ── "ред." edited indicator ─────────────────────────────────────────── */
.chat-message__edited {
  font-size: 10px;
  color: var(--bs-tertiary-color);
  margin-right: 2px;
}

/* ── Reply quote block inside message bubble ─────────────────────────── */
.chat-reply-quote {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: stretch;
  background: rgba(26, 120, 194, 0.09);
  border-radius: 8px;
  padding: 5px 8px 5px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s;
  overflow: hidden;
  text-decoration: none;
}
/* Vertical accent bar */
.chat-reply-quote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--bb-accent);
  border-radius: 3px 0 0 3px;
}
.chat-reply-quote:hover {
  background: rgba(26, 120, 194, 0.16);
}
.chat-reply-quote__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-reply-quote__name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bb-accent);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-reply-quote__text {
  font-size: 0.82rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
/* Own messages: slightly adjusted palette */
.chat-message--own .chat-reply-quote {
  background: rgba(10, 80, 150, 0.12);
}
.chat-message--own .chat-reply-quote::before {
  background: var(--bb-accent-strong);
}
.chat-message--own .chat-reply-quote__name {
  color: var(--bb-accent-strong);
}
.chat-message--own .chat-reply-quote__text {
  color: var(--bs-secondary-color);
}

/* ── Reply bar above the input ───────────────────────────────────────── */
.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 14px;
  background: var(--bb-accent-subtle);
  border-top: 1px solid var(--bb-accent-border);
  border-radius: 16px 16px 0 0;
  margin-bottom: -1px;
}
.chat-reply-bar__icon {
  color: var(--bb-accent);
  font-size: 1rem;
  flex-shrink: 0;
}
.chat-reply-bar__content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-reply-bar__name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bb-accent);
  line-height: 1.2;
}
.chat-reply-bar__text {
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.chat-reply-bar__close {
  background: none;
  border: none;
  color: var(--bs-secondary-color);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}
.chat-reply-bar__close:hover {
  color: var(--bs-body-color);
  background: var(--bb-accent-subtle-hover);
}

/* ── Mention dropdown ─────────────────────────────────────────── */
.mention-dropdown {
  background: var(--bb-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  overflow: hidden;
  margin-bottom: 6px;
}
.mention-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
.mention-item:hover,
.mention-item--focused {
  background: var(--bb-accent-subtle);
}
.mention-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.mention-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mention-avatar--initials {
  background: linear-gradient(135deg, #1a78c2, #00c9ff);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mention-link {
  color: var(--bs-link-color);
  font-weight: 600;
  text-decoration: none;
}
.mention-link:hover {
  text-decoration: underline;
}
.mention-chip {
  display: inline;
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
  font-weight: 600;
  border-radius: 4px;
  padding: 0 3px;
  white-space: nowrap;
  cursor: default;
  user-select: all;
}
.mention-chip--all {
  background: var(--bs-warning-bg-subtle);
  color: var(--bs-warning-text-emphasis);
}
.mention-avatar--all {
  background: var(--bs-warning-bg-subtle);
  color: var(--bs-warning-text-emphasis);
  font-size: 0.85rem;
}
.chat-input__editor {
  flex: 1 1 auto;
  min-height: calc(1.5em + 0.75rem + 2px);
  max-height: 110px;
  overflow-y: auto;
  outline: none;
  line-height: 1.5;
  font-size: 1rem;
  font-family: inherit;
  color: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  padding: 0.375rem 0.75rem;
}
.chat-input__editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: var(--bs-secondary-color);
  pointer-events: none;
  user-select: none;
}

/* ── Highlight animation on scroll-to ───────────────────────────────── */
@keyframes chat-highlight-pulse {
  0%   { background: rgba(255, 220, 60, 0.55); }
  70%  { background: rgba(255, 220, 60, 0.25); }
  100% { background: transparent; }
}
.chat-message--highlighted .chat-message__bubble {
  animation: chat-highlight-pulse 2s ease-out forwards;
  border-radius: 12px;
}

/* ── Chat image grid (in message bubble) ─────────────────────── */
.chat-message__images {
  display: grid;
  gap: 3px;
  margin-bottom: 4px;
  border-radius: 10px;
  overflow: hidden;
}
/* 1 photo — content-sized, up to 260px */
.chat-message__images--1 {
  grid-template-columns: 1fr;
  max-width: 260px;
}
/* 2 photos — side by side, fixed width so grid has definite size */
.chat-message__images--2 {
  grid-template-columns: 1fr 1fr;
  width: 240px;
  max-width: 100%;
}
/* 3 photos */
.chat-message__images--3 {
  grid-template-columns: 1fr 1fr 1fr;
  width: 280px;
  max-width: 100%;
}
/* 4 photos — 2×2 */
.chat-message__images--4 {
  grid-template-columns: 1fr 1fr;
  width: 240px;
  max-width: 100%;
}
/* 5+ — 3 cols.
   Base is 6 virtual columns so fractional last rows can be expressed
   with integer spans: each cell = span 2 (= 1/3 width), last-row
   orphans get span 3 (= 1/2) or span 6 (= full width). */
.chat-message__images--5 {
  grid-template-columns: repeat(6, 1fr);
  width: 280px;
  max-width: 100%;
}
.chat-message__images--5 .chat-message__image-item {
  grid-column: span 2;
}
/* 1 orphan on last row (positions 1, 4, 7, 10 …) → full width */
.chat-message__images--5 .chat-message__image-item:last-child:nth-child(3n+1) {
  grid-column: 1 / -1;
}
/* 2 orphans on last row: the first orphan (positions 4, 7 …) */
.chat-message__images--5 .chat-message__image-item:nth-last-child(2):nth-child(3n+1) {
  grid-column: span 3;
}
/* 2 orphans on last row: the second orphan (positions 5, 8 …) */
.chat-message__images--5 .chat-message__image-item:last-child:nth-child(3n+2) {
  grid-column: span 3;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.chat-message__image-item {
  overflow: hidden;
  line-height: 0;
  /* skeleton by default */
  min-height: 120px;
  background: linear-gradient(90deg,
    var(--bs-secondary-bg, #e8e8e8) 25%,
    var(--bs-tertiary-bg,  #f0f0f0) 50%,
    var(--bs-secondary-bg, #e8e8e8) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
/* single-image: needs explicit min-width so skeleton is visible before dimensions are known */
.chat-message__images--1 .chat-message__image-item:not(.loaded) {
  min-height: 160px;
  min-width: 180px;
}
.chat-message__image-item.loaded {
  background: none;
  animation: none;
  min-height: unset;
  min-width: unset;
}
.chat-img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: zoom-in;
  /* starts invisible; fades in once loaded */
  opacity: 0;
  transition: opacity .2s ease;
}
.chat-message__image-item.loaded .chat-img {
  opacity: 1;
}
.chat-message__images--1 .chat-img {
  height: auto;
  max-height: 320px;
  width: auto;
  max-width: 100%;
}
.chat-img:hover {
  opacity: .9;
}

/* ── Image preview bar (above input) ─────────────────────────── */
.chat-image-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bb-surface);
  border-top: 1px solid var(--bs-border-color-translucent);
}
.chat-image-preview-bar__list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: none;
}
.chat-image-preview-bar__list::-webkit-scrollbar { display: none; }
.chat-image-preview-bar__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.chat-image-preview-bar__remove {
  background: none;
  border: none;
  padding: 4px;
  line-height: 1;
  color: var(--bs-secondary);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
}
.chat-image-preview-bar__remove:hover {
  color: var(--bs-danger);
}

/* Nested items numbering */
.nested-items-list {
  counter-reset: item-num;
}
.nested-items-list [data-nested-item] {
  counter-increment: item-num;
}
[data-item-number]::before {
  content: counter(item-num);
  color: var(--bs-secondary-color);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Wave picker in breakdown edit */
[data-wave-picker-target="item"].active {
  background-color: var(--bs-primary-bg-subtle);
}
[data-wave-picker-target="item"]:hover {
  background-color: var(--bs-secondary-bg);
}

/* Skeleton shimmer */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton-shimmer {
  background: linear-gradient(90deg, #222 25%, #333 50%, #222 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

/* Split/overlay playlist panels */
.split-right-col {
  border-top: 1px solid var(--bs-border-color-translucent);
}
@media (min-width: 768px) {
  .split-right-col {
    border-top: 0;
    border-left: 1px solid var(--bs-border-color-translucent);
  }
}


.user-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sortable-ghost { opacity: 0.4; background: var(--bs-tertiary-bg); border-radius: 12px; }
.drag-handle:active { cursor: grabbing; }

.playlist-item { transition: background 0.15s; }
.playlist-item:hover { background: rgba(var(--bs-emphasis-color-rgb), 0.05); }
.playlist-item.playlist-active { background: rgba(var(--bs-warning-rgb), 0.15); }
.playlist-item.playlist-active .fw-semibold { color: var(--bs-warning-text-emphasis); }


/* ===== Learning: theory path, options, quiz ===== */
.learning-path { position: relative; }
.learning-path__item { position: relative; padding-left: 0; margin-bottom: 0.75rem; }
.learning-path__card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: var(--bb-surface);
  border: 2px solid transparent;
  box-shadow: 0 2px 10px 0 rgba(0,0,0,.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}
/* Every step reacts to the finger, locked and done ones too: a lift on hover (pointer devices only,
   so it doesn't stick after a tap on mobile) and a press-in on tap */
@media (hover: hover) {
  .learning-path__card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px 0 rgba(0,0,0,.1); }
  .learning-path__card:hover .learning-path__icon { transform: scale(1.06); }
}
/* A closed step is a button that opens a popup (learning_offer_controller): looks like the linked cards */
button.learning-path__card { width: 100%; text-align: left; font: inherit; }

/* Duolingo-style hook over the first step of a closed level: a bouncing bubble pointing at the step */
.learning-hook {
  position: absolute;
  top: -1.9rem;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 0.35rem 0.9rem;
  border: 2px solid #ffc107;
  border-radius: 0.75rem;
  background: var(--bb-surface);
  color: var(--bs-body-color);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 0 #e0a800;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  animation: learning-hook-bob 1.6s ease-in-out infinite;
}
.learning-hook::after { /* the tail pointing down at the step */
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--bb-surface);
  border-right: 2px solid #ffc107;
  border-bottom: 2px solid #ffc107;
  transform: translate(-50%, -50%) rotate(45deg);
}
.learning-hook:active { animation: none; transform: translateX(-50%) scale(0.95); }
@keyframes learning-hook-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) { .learning-hook { animation: none; } }

.learning-path__card:active { transform: scale(0.97); box-shadow: 0 1px 4px 0 rgba(0,0,0,.06); transition-duration: .06s; }
.learning-path__card:active .learning-path__icon { transform: scale(0.92); transition-duration: .06s; }
/* A locked step can't open: the lock gives a short shake instead */
.learning-path__card .ph-lock-simple { display: inline-block; } /* transform needs a box */
.learning-path__item--locked .learning-path__card:active .ph-lock-simple { animation: learning-lock-shake .3s ease; }
@keyframes learning-lock-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-8deg); }
  75% { transform: translateX(3px) rotate(8deg); }
}
.learning-path__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--bs-tertiary-bg);
  transition: transform .15s ease;
}
.learning-path__item--done .learning-path__icon { background: var(--bs-success-bg-subtle); color: var(--bs-success); font-size: 1.8rem; }
.learning-path__item--current .learning-path__card { border-color: #ffc107; }
.learning-path__item--locked .learning-path__card { opacity: 0.6; }
.learning-path__item--locked .learning-path__icon { filter: grayscale(1); }

.learning-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 2px solid var(--bs-border-color);
  border-bottom-width: 4px;
  background: var(--bb-surface);
  color: var(--bs-body-color);
  font-weight: 500;
  cursor: pointer;
  /* Only the border colour animates: background / transform transitions put the option on its own compositor
     layer for a moment, and Chrome left stale grey bands on freshly drawn options */
  transition: border-color .12s;
  /* No grey system tap highlight over the whole option on touch screens — our own press feedback instead */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* Responsive like Duolingo: a warm frame on hover (mouse only), pressed down on tap/click */
@media (hover: hover) {
  button.learning-option:not(:disabled):hover { border-color: #ffd65a; background: #fffbea; }
  [data-bs-theme="dark"] button.learning-option:not(:disabled):hover { background: rgba(255, 193, 7, 0.08); }
}
/* Pressed: the thick bottom edge sinks — no transform, the height stays the same */
.learning-option:not(:disabled):active {
  border-bottom-width: 2px;
  margin-top: 2px;
  border-color: #ffc107;
}
.learning-option input { display: none; }
.learning-option:has(input:checked),
.learning-option--selected { border-color: #ffc107; background: var(--bs-warning-bg-subtle); }
.learning-option--scale { justify-content: center; font-size: 1.1rem; font-weight: 700; }
.learning-option--correct { border-color: var(--bs-success) !important; background: var(--bs-success-bg-subtle) !important; }
.learning-option--wrong { border-color: var(--bs-danger) !important; background: var(--bs-danger-bg-subtle) !important; }
.learning-option:disabled { cursor: default; color: var(--bs-body-color); }

.learning-quiz { padding-bottom: 220px; }
/* The global .spinner-border is absolutely positioned (video player); inside the quiz button it must sit
   in the line, otherwise the empty button collapses and the spinner hangs above it */
.learning-quiz__footer .spinner-border { position: static; vertical-align: -0.15em; }
.learning-quiz__footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom));
  background: var(--bb-page-bg);
  border-top: 1px solid var(--bs-border-color-translucent);
  /* Its own compositor layer for good: when the footer shrinks back after «Далее», Chrome repaints the options
     under it instead of leaving stale bands of the old footer over them */
  will-change: transform;
}
.learning-quiz__footer-inner { max-width: 592px; margin: 0 auto; }
.learning-quiz__footer--correct { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.learning-quiz__footer--wrong { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.learning-quiz__feedback { margin-bottom: 0.75rem; }
/* Quiz is a focused full-screen flow: no bottom tab bar */
body.learning-quiz-page nav.fixed-bottom,
body.learning-quiz-page .mobile-bottom-wave { display: none !important; }
body.authenticated.learning-quiz-page #page-content { padding-bottom: 0 !important; }


/* Theory: one plate pinned under the learning tabs (Duolingo-style) shows the section being scrolled.
   Its text and belt colour follow the scroll (section_plate_controller); sections in the feed are split by
   light dividers. Sticky inside the page container = it stays for the whole feed and takes its own room. */
.learning-plate-wrap {
  position: sticky;
  top: calc(var(--page-header-height) + var(--learning-tabs-height) + env(safe-area-inset-top));
  z-index: 10;
  padding: 0.75rem 0;
  /* full-bleed page background (border-image paints outside the box without horizontal scroll),
     so steps scrolling under don't show at the sides */
  border-image: linear-gradient(var(--bb-page-bg) 0 0) fill 0 / / 0 100vmax;
}
body.impersonating .learning-plate-wrap {
  top: calc(var(--page-header-height) + var(--learning-tabs-height) + env(safe-area-inset-top) + var(--impersonation-banner-height));
}
.learning-plate {
  --plate-bg: #eef0f2;
  --plate-fg: #212529;
  --plate-track: rgba(0, 0, 0, 0.12);
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 1rem;
  padding: 0.75rem 1rem 0.85rem;
  background: var(--plate-bg);
  color: var(--plate-fg);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  transition: background-color .3s, color .3s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.learning-plate:active { transform: translateY(1px); box-shadow: none; }
.learning-plate:focus:not(:focus-visible) { outline: none; } /* no focus ring after a tap */
.learning-plate > * { transition: opacity .12s; }
.learning-plate.is-swapping > * { opacity: 0; }
.learning-plate__overline { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }
.learning-plate__count { font-size: 0.8rem; font-weight: 700; opacity: 0.8; }
.learning-plate__text {
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0.15rem;
  min-height: 2.5em; /* always two lines tall: a one-line section must not shrink the plate and shift the feed */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.learning-plate__bar { height: 6px; border-radius: 3px; background: var(--plate-track); margin-top: 0.6rem; overflow: hidden; }
.learning-plate__bar > div { height: 100%; width: 0; border-radius: 3px; background: var(--plate-fg); transition: width .3s; }

/* Belt colours (karate order): intro white, then level 1 yellow … level 8 black, level 9 black with gold */
.learning-plate[data-belt="0"] { --plate-bg: #eef0f2; --plate-fg: #212529; }
.learning-plate[data-belt="1"] { --plate-bg: #ffc800; --plate-fg: #2b2100; }
.learning-plate[data-belt="2"] { --plate-bg: #ff9500; --plate-fg: #2b1700; }
.learning-plate[data-belt="3"] { --plate-bg: #23883f; --plate-fg: #fff; --plate-track: rgba(255, 255, 255, 0.3); }
.learning-plate[data-belt="4"] { --plate-bg: #1f6fd1; --plate-fg: #fff; --plate-track: rgba(255, 255, 255, 0.3); }
.learning-plate[data-belt="5"] { --plate-bg: #7b3fc4; --plate-fg: #fff; --plate-track: rgba(255, 255, 255, 0.3); }
.learning-plate[data-belt="6"] { --plate-bg: #d32f2f; --plate-fg: #fff; --plate-track: rgba(255, 255, 255, 0.3); }
.learning-plate[data-belt="7"] { --plate-bg: #7a4a24; --plate-fg: #fff; --plate-track: rgba(255, 255, 255, 0.3); }
.learning-plate[data-belt="8"] { --plate-bg: #1d1d1f; --plate-fg: #fff; --plate-track: rgba(255, 255, 255, 0.25); }
.learning-plate[data-belt="9"] { --plate-bg: #1d1d1f; --plate-fg: #e8c25a; --plate-track: rgba(232, 194, 90, 0.3); }
[data-bs-theme="dark"] .learning-plate[data-belt="0"] { --plate-bg: #e9ecef; }
[data-bs-theme="dark"] .learning-plate[data-belt="8"],
[data-bs-theme="dark"] .learning-plate[data-belt="9"] { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }

/* ──── Уровень 2 ──── between sections in the feed */
.learning-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 2.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}
.learning-divider::before,
.learning-divider::after { content: ""; flex: 1; border-top: 1px solid var(--bs-border-color); }
.learning-divider > span { text-align: center; }

/* ── Exam passed: riding out of the barrel into the sunrise ─────────────────────────────
   0–1.5s  rings of the wave rush past (inside the barrel), light at the exit grows
   ~1.5s   flash, the sky turns to sunrise, rays start turning, the surfer pops out, confetti
   ~2s     badge, title and hint come up */
.exam-win {
  position: fixed;
  inset: 0;
  z-index: 1029;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #06283d;
}
.exam-win__sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ff9a8b 0%, #ffb56b 38%, #ffd97a 62%, #7fd3e6 100%);
  opacity: 0;
  animation: exam-win-fade-in .6s ease-out 1.45s forwards;
}
.exam-win__rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 220vmax;
  height: 220vmax;
  margin: -110vmax 0 0 -110vmax;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.28) 0deg 8deg, rgba(255, 255, 255, 0) 8deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  opacity: 0;
  animation: exam-win-fade-in .8s ease-out 1.6s forwards, exam-win-spin 30s linear 1.6s infinite;
}
.exam-win__tube {
  position: absolute;
  inset: 0;
  animation: exam-win-fade-out .35s ease-in 1.45s forwards;
}
.exam-win__ring {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 40vmax;
  height: 40vmax;
  margin: -20vmax 0 0 -20vmax;
  border-radius: 50%;
  border: 6vmax solid #0b7285;
  box-shadow: inset 0 0 4vmax rgba(255, 255, 255, 0.35), 0 0 4vmax rgba(0, 0, 0, 0.35);
  border-top-color: #e3fafc;   /* the foaming lip of the wave */
  opacity: 0;
  transform: scale(0.05) rotate(calc(var(--i) * 25deg));
  animation: exam-win-ring 1.1s cubic-bezier(.55, 0, 1, .45) calc(var(--i) * 0.13s) forwards;
}
.exam-win__ring:nth-child(odd) { border-color: #1098ad; border-top-color: #ffffff; }
.exam-win__light {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 30vmax;
  height: 30vmax;
  margin: -15vmax 0 0 -15vmax;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffe8a3 35%, rgba(255, 180, 90, 0) 70%);
  transform: scale(0.1);
  animation: exam-win-light 1.5s ease-in forwards;
}
.exam-win__flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  animation: exam-win-flash .7s ease-out 1.35s forwards;
}
.exam-win__content {
  position: relative;
  z-index: 2;
  max-width: 560px;
  padding: 0 1.5rem 9rem;
  text-align: center;
  color: #3b1d00;
}
.exam-win__surfer {
  font-size: clamp(5rem, 28vw, 9rem);
  line-height: 1;
  filter: drop-shadow(0 10px 18px rgba(120, 50, 0, 0.35));
  opacity: 0;
  transform: scale(0.05);
  animation: exam-win-surfer 1s cubic-bezier(.2, 1.6, .4, 1) 1.5s forwards,
             exam-win-bob 2.4s ease-in-out 2.6s infinite;
}
.exam-win__badge,
.exam-win__title,
.exam-win__hint {
  opacity: 0;
  animation: exam-win-up .6s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.exam-win__badge {
  display: inline-block;
  margin-top: 1.25rem;
  padding: .35rem 1rem;
  border-radius: 999px;
  background: #fff;
  color: #b35c00;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 6px 20px rgba(150, 70, 0, 0.25);
  animation-delay: 2s;
}
.exam-win__title {
  margin: .75rem 0 .5rem;
  font-size: clamp(2.2rem, 10vw, 3.5rem);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.6);
  animation-delay: 2.15s;
}
.exam-win__hint {
  font-size: 1.1rem;
  font-weight: 500;
  animation-delay: 2.3s;
}
.exam-win__confetti { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.exam-win__confetti i {
  position: absolute;
  left: 50%;
  top: 42%;
  opacity: 0;
  animation: exam-win-confetti var(--dur) cubic-bezier(.15, .7, .4, 1) var(--delay) forwards;
}
.learning-quiz__footer--celebrate {
  background: transparent !important;
  border-top: 0 !important;
}

@keyframes exam-win-ring {
  0%   { opacity: 0; transform: scale(0.05) rotate(calc(var(--i) * 25deg)); }
  15%  { opacity: 1; }
  100% { opacity: 1; transform: scale(4) rotate(calc(var(--i) * 25deg + 40deg)); }
}
@keyframes exam-win-light {
  to { transform: scale(6); }
}
@keyframes exam-win-flash {
  0%   { opacity: 0; }
  20%  { opacity: .95; }
  100% { opacity: 0; }
}
@keyframes exam-win-surfer {
  0%   { opacity: 0; transform: scale(0.05) rotate(-20deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes exam-win-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(-4deg); }
}
@keyframes exam-win-up {
  0%   { opacity: 0; transform: translateY(24px) scale(.9); }
  100% { opacity: 1; transform: none; }
}
@keyframes exam-win-confetti {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  35%  { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(calc(var(--rot) * .4)); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 1.15), 75vh) rotate(var(--rot)); }
}
@keyframes exam-win-fade-in  { to { opacity: 1; } }
@keyframes exam-win-fade-out { to { opacity: 0; visibility: hidden; } }
@keyframes exam-win-spin     { to { transform: rotate(360deg); } }
.exam-win__gift {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  border: 2px dashed #ff922b;
  box-shadow: 0 10px 30px rgba(150, 70, 0, 0.25);
  opacity: 0;
  animation: exam-win-up .6s cubic-bezier(.2, 1.4, .4, 1) 2.6s forwards, exam-win-wiggle .6s ease-in-out 3.4s 2;
}
.exam-win__gift-label { font-weight: 700; }
.exam-win__gift-code {
  margin: .35rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: #d9480f;
}
.exam-win__gift-note { font-size: .85rem; opacity: .75; }
@keyframes exam-win-wiggle {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-3deg) scale(1.03); }
  75%      { transform: rotate(3deg) scale(1.03); }
}
.learning-promo {
  padding: .75rem 1rem;
  border-radius: 1rem;
  border: 2px dashed var(--bs-warning);
  background: var(--bs-warning-bg-subtle);
}
.learning-promo__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .06em;
}

/* Event card the viewer can't book yet (level / theory): faded with a lock badge */
/* fade everything but the lock and the reason line */
.event-widget-card--locked > :not(.event-widget-card__lock, .mt-auto),
.event-widget-card--locked > .mt-auto > :not(.event-widget-card__lock-label) { opacity: 0.45; }
.event-widget-card__lock-label > span { font-size: 0.74rem; line-height: 0; color: light-dark(#343a40, #e9ecef); }
.event-widget-card__lock {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}
.event-widget-card__lock-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  background: light-dark(#b2b2b2, #6f747a);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Cancelled event (somebody had booked it): faded, its "cancelled" label stays readable */
.event-widget-card--cancelled > :not(.mt-auto),
.event-widget-card--cancelled > .mt-auto > :not(.text-danger) { opacity: 0.45; }

/* "Not enough cookies" sheet: warm sunset hero, a ticket with the maths, one clear way out */
.topup-modal .modal-content { background: var(--bb-surface, #fff); }
.topup-modal__hero {
  position: relative;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(160deg, #ff8a5b 0%, #ffb547 55%, #ffd36e 100%);
}
.topup-modal__close { position: absolute; top: 1rem; right: 1rem; }
.topup-modal__jar {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(120, 50, 0, 0.3));
  animation: topup-jar 2.4s ease-in-out infinite;
}
.topup-modal__title { margin: 0.75rem 0 0.35rem; font-weight: 800; text-wrap: balance; }
.topup-modal__lead { margin: 0; opacity: 0.95; font-size: 0.95rem; }
.topup-modal__ticket {
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1.5px dashed light-dark(#f2c27d, #6b5330);
  background: light-dark(#fff8ec, #2b2418);
}
.topup-modal__row { display: flex; justify-content: space-between; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.topup-modal__row--missing { font-size: 1.05rem; font-weight: 800; color: light-dark(#c2410c, #fdba74); }
.topup-modal__pick {
  padding: 0.85rem 1.1rem;
  border-radius: 1rem;
  background: light-dark(#f4f6f8, #22262b);
}
.topup-modal__perks { display: grid; gap: 0.45rem; font-size: 0.9rem; }
.topup-modal__perks li { display: flex; gap: 0.6rem; align-items: baseline; }
.topup-modal__perks span { flex-shrink: 0; width: 1.4rem; text-align: center; }
@keyframes topup-jar {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-6px) rotate(-6deg); }
}
@media (prefers-reduced-motion: reduce) { .topup-modal__jar { animation: none; } }
.topup-modal__steps { display: grid; gap: 0.75rem; }
.topup-modal__steps li { display: flex; gap: 0.75rem; align-items: flex-start; }
.topup-modal__step-num {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #7a3b00;
  background: light-dark(#ffe2b3, #f0b65a);
}

/* Primary call to action as a button — same look as the "Обучение" tile on the home screen:
   warm gradient, 3D bottom edge, a shine sweeping across */
.btn.btn-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #ffe58a 0%, #ffd149 100%);
  border: 1px solid #f0c53d;
  border-bottom: 4px solid #d9a915;
  border-radius: 0.75rem;
  color: #4a3600;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px rgba(201, 150, 20, 0.25);
  transition: transform .1s, box-shadow .1s, border-bottom-width .1s;
}
.btn.btn-cta:hover { color: #4a3600; filter: brightness(1.03); }
.btn.btn-cta::after {
  content: "";
  position: absolute;
  top: -50%;
  left: 0;
  width: 45%;
  height: 200%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.65) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-160%) rotate(20deg);
  animation: quick-btn-shine 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.btn.btn-cta:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 4px rgba(201, 150, 20, 0.15);
}
.topup-modal__select {
  margin-top: 0.15rem;
  padding: 0.15rem 2rem 0.15rem 0;
  border: 0;
  background-color: transparent;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: none !important;
  cursor: pointer;
}

/* Celebration on a regular page: above the bottom nav, with its own buttons */
.exam-win--topmost { z-index: 1060; }
.exam-win--topmost .exam-win__content { padding-bottom: 2rem; }
.exam-win__actions {
  margin: 1.5rem auto 0;
  max-width: 340px;
  display: grid;
  gap: 0.5rem;
  opacity: 0;
  animation: exam-win-up .6s cubic-bezier(.2, 1.4, .4, 1) 2.8s forwards;
}
.exam-win__secondary { color: #5a2d00; font-weight: 600; }

/* Receipt of the user's order for this lesson */

/* My lessons: a ticket per screen, swiped with dots (home and schedule) */
/* The tickets scroll edge to edge of the screen: the track bleeds through the container's side padding
   (px-4 / px-md-5) and puts it back as its own padding, so a ticket is cut at the screen edge, not the content's */
.my-lessons { --my-lessons-gutter: 1.5rem; }
@media (min-width: 768px) { .my-lessons { --my-lessons-gutter: 3rem; } }
.my-lessons__track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--my-lessons-gutter);
  scrollbar-width: none;
  /* room for the ticket's shadow inside the scroller */
  padding: 4px var(--my-lessons-gutter) 18px;
  margin: -4px calc(-1 * var(--my-lessons-gutter)) -14px;
}
.my-lessons__track::-webkit-scrollbar { display: none; }
/* min-width: 0 keeps a long badge from widening the ticket past the screen */
.my-lessons__slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; }
.my-lessons__badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-lesson {
  display: flex;
  min-height: 132px;
  border-radius: 1.25rem;
  overflow: hidden;
  background: var(--bb-surface, #fff);
  box-shadow: 0 6px 22px rgba(20, 60, 90, 0.10);
  border: 1px solid light-dark(rgba(13, 110, 253, 0.08), rgba(255, 255, 255, 0.06));
  transition: transform .1s;
}
.my-lesson:active { transform: scale(0.99); }
.my-lesson__date {
  flex: 0 0 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  color: #fff;
  background: linear-gradient(160deg, #1a78c2 0%, #00b4d8 100%);
  border-right: 2px dashed rgba(255, 255, 255, 0.55);
}
.my-lesson__date--live { background: linear-gradient(160deg, #198754 0%, #3ccf8e 100%); }
/* The nearest lesson on the home screen: a gold stub with the same shine as the CTA button */
.my-lesson__date--gold {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #4a3600;
  background: linear-gradient(160deg, #ffe58a 0%, #ffd149 55%, #f2b81f 100%);
  border-right-color: rgba(74, 54, 0, 0.3);
}
.my-lesson__date--gold::after {
  content: "";
  position: absolute;
  top: -50%;
  left: 0;
  width: 60%;
  height: 200%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-160%) rotate(20deg);
  animation: quick-btn-shine 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.my-lesson__day { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; opacity: 0.9; text-align: center; padding: 0 0.25rem; }
.my-lesson__num { font-size: 2rem; font-weight: 800; line-height: 1; }
.my-lesson__month { font-size: 0.75rem; text-transform: lowercase; opacity: 0.9; }
.my-lesson__body { flex: 1; min-width: 0; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.my-lesson__time { white-space: nowrap; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.my-lesson__countdown { background: light-dark(#e7f1ff, #1d2f45); color: light-dark(#0b5ed7, #8bb9fe); }
.my-lesson__title { font-weight: 600; }
.my-lesson__footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.my-lessons__dots { display: flex; justify-content: center; gap: 6px; margin-top: 0.6rem; }
.my-lessons__dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: light-dark(#cfd6dd, #3a4149);
  transition: width .2s, background .2s;
}
.my-lessons__dot.active { width: 20px; background: #1a78c2; }

/* Event page: a coach/operator slot the school is still filling */
.staff-searching__avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed light-dark(#9ec5fe, #3d6ea8);
  background: light-dark(#f3f8ff, #1a2533);
}
.staff-searching__avatar .spinner-border { position: static; margin: 0; --bs-spinner-border-width: 0.15em; }
/* Event page: the "a coach per 4 students" perk under Coaches */
.staff-ratio {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.85rem;
  background: light-dark(#eef6ff, #172434);
  color: light-dark(#2b5a8a, #9cc4ee) !important;
}
.staff-ratio i { font-size: 1.1rem; line-height: 1.2; flex-shrink: 0; }

/* Lesson steps on the event page: coach on the spot → lesson over → videos → review */
.lesson-flow__steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  position: relative;
}
.lesson-flow__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  position: relative;
  color: var(--bs-secondary-color);
}
.lesson-flow__step + .lesson-flow__step::before {
  content: "";
  position: absolute;
  top: 0.875rem;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--bs-border-color);
  z-index: 0;
}
.lesson-flow__step.is-done + .lesson-flow__step::before { background: var(--bs-success); }
.lesson-flow__dot {
  position: relative;
  z-index: 1;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bs-tertiary-bg);
  border: 2px solid var(--bs-border-color);
}
.lesson-flow__step.is-done .lesson-flow__dot { background: var(--bs-success); border-color: var(--bs-success); color: #fff; }
.lesson-flow__step.is-current .lesson-flow__dot { border-color: var(--bs-warning); color: var(--bs-body-color); box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.25); }
.lesson-flow__step.is-done, .lesson-flow__step.is-current { color: var(--bs-body-color); }
.lesson-flow__label { font-size: 0.72rem; line-height: 1.15; }
.lesson-flow__time { font-size: 0.7rem; color: var(--bs-secondary-color); min-height: 0.9rem; }
.lesson-flow__status { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.lesson-flow__status--live { background: var(--bs-success); color: #fff; }
.lesson-flow__status--awaiting_videos,
.lesson-flow__status--awaiting_review { background: var(--bs-info); color: #000; }
.lesson-flow__status--reviewed { background: var(--bs-warning); color: #000; }

/* The coach's lesson review: a card per student with their errors and the level switch */
.lesson-review__level { background: var(--bs-tertiary-bg); }
.lesson-review__level .form-check-input { cursor: pointer; }
.lesson-review__save {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
}

/* Who of the lesson's team is on the spot, and when they finished */
.lesson-flow__team { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; }
.lesson-flow__member { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.lesson-flow__member .fw-semibold { min-width: 0; }
.lesson-flow__presence { margin-left: auto; white-space: nowrap; }
.lesson-flow__role-icon { width: 1.4rem; height: 1.4rem; object-fit: contain; flex-shrink: 0; }
.lesson-flow__check { font-size: 0.95rem; -webkit-text-stroke: 1px currentColor; }

/* Floating learning buttons sit 16px above the bottom navigation: 70px bar + its 20px wave */
:root { --learning-fab-bottom: calc(70px + 20px + 16px + env(safe-area-inset-bottom, 0px)); }

/* Theory: back to the current step, bottom-right above the bottom navigation (section_plate_controller) */
.learning-to-current {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: var(--learning-fab-bottom);
  z-index: 1030;
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  animation: learning-to-current-in .2s ease;
}
.learning-to-current[hidden] { display: none; }
.learning-to-current i { transition: transform .2s; -webkit-text-stroke: 1px currentColor; } /* regular weight, made bolder */
.learning-to-current--down i { transform: rotate(180deg); }
.learning-to-current:active { transform: scale(0.92); }
@keyframes learning-to-current-in { from { opacity: 0; transform: scale(0.6); } }

/* Theory step: "found a mistake?" round floating button, bottom-left above the bottom navigation */
.learning-report-fab {
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  bottom: var(--learning-fab-bottom);
  z-index: 1030;
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.learning-report-fab:active { transform: scale(0.92); }
