/* Серия дней занятий (docs/streaks.md, public/js/streak.js): огонёк в шапке, окно серии,
   праздник первого занятия дня, календарь в профиле, ячейка в «Мои ученики».
   Цвета фона и текста - переменные темы из common.css (--surface-1, --text-1...). */

/* --- огонёк --- */
.stk-flame { display: inline-block; flex-shrink: 0; overflow: visible; vertical-align: middle; }
.stk-flame .stk-in,
.stk-flame .stk-out { transform-box: fill-box; transform-origin: 50% 92%; }
.stk-flicker .stk-in { animation: stk-flicker 2.2s ease-in-out infinite; }
.stk-flicker .stk-out { animation: stk-sway 3.4s ease-in-out infinite; }
@keyframes stk-flicker {
  0%, 100% { transform: scale(1, 1); }
  30% { transform: scale(0.94, 1.06) translateY(-0.4px); }
  60% { transform: scale(1.03, 0.97); }
}
@keyframes stk-sway {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(-1.6deg) scale(1.02, 1.01); }
}
.stk-ignite { animation: stk-ignite 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }
@keyframes stk-ignite {
  0% { transform: scale(0.35) translateY(20%); opacity: 0; }
  55% { transform: scale(1.22) translateY(-4%); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* --- кнопка в шапке: два места (views/boilerplate_parts/default_nav.ejs) - на узком экране
   рядом с кнопкой меню (правая часть шапки там в свёрнутом меню), на широком (xl, как
   navbar-expand-xl) - левее значка темы --- */
.stk-nav { display: flex; align-items: center; }
.stk-nav-narrow { margin-left: auto; margin-right: .5rem; }
.stk-nav-wide { margin-right: .6rem; }
.stk-nav[hidden] { display: none !important; }
@media (max-width: 1199.98px) { .stk-nav-wide { display: none !important; } }
@media (min-width: 1200px) { .stk-nav-narrow { display: none !important; } }
.stk-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px;
  border: 0; border-radius: 999px; background: transparent; color: #fff; cursor: pointer;
  font: inherit; line-height: 1; transition: background-color .2s;
}
.stk-btn:hover, .stk-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .14); }
.stk-btn:focus { outline: none; }
.stk-btn:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.stk-btn .stk-num { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stk-btn.stk-grey .stk-num { color: rgba(255, 255, 255, .72); }

/* --- окно серии --- */
.stk-pop {
  position: absolute; z-index: 1060; width: 340px; max-width: calc(100vw - 16px);
  background: var(--surface-1, #fff); color: var(--text-1, #1f2328);
  border: 1px solid var(--border, #e5e7eb); border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08);
  font-size: 14px; line-height: 1.45;
}
html[data-theme="dark"] .stk-pop { box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.stk-head { padding: 18px 18px 14px; }
.stk-row { display: flex; align-items: center; gap: 14px; }
.stk-big { font-size: 40px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.stk-big-sub { font-size: 14px; font-weight: 700; color: var(--text-2, #6b7280); margin-top: 3px; }
.stk-msg { margin-top: 12px; }
.stk-left { margin-top: 4px; font-size: 12.5px; font-weight: 700; }
.stk-sec { padding: 0 18px 14px; }
.stk-hr { height: 1px; background: var(--border, #e5e7eb); }
.stk-body { padding: 14px 18px; display: grid; gap: 12px; }
.stk-cap {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2, #6b7280);
}
.stk-today { margin-top: 2px; font-weight: 700; }
.stk-today.stk-empty { font-weight: 400; color: var(--text-2, #6b7280); }
.stk-best { display: flex; justify-content: space-between; align-items: center; }
.stk-best span:first-child { font-size: 13px; color: var(--text-2, #6b7280); }
.stk-best b { font-weight: 800; }
.stk-foot { padding: 6px 10px; }
.stk-foot-row { display: flex; justify-content: space-between; gap: 6px; }
.stk-link {
  border: 0; background: transparent; color: var(--text-2, #6b7280); font: inherit; font-size: 13px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.stk-link:hover { background: var(--surface-2, #f6f7f9); color: var(--text-1, #1f2328); }
.stk-rules { font-size: 13px; color: var(--text-2, #6b7280); padding: 2px 8px 8px; }

/* полоска до цели */
.stk-goal-label { font-size: 12.5px; color: var(--text-2, #6b7280); margin-bottom: 5px; }
.stk-bar { height: 8px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
html[data-theme="dark"] .stk-bar { background: rgba(255, 255, 255, .1); }
.stk-bar i { display: block; height: 100%; border-radius: 999px; transition: width .6s ease; }
.stk-bar i.stk-grow { animation: stk-grow 1.1s cubic-bezier(0.3, 0.8, 0.3, 1) 0.4s both; transform-origin: left center; }
@keyframes stk-grow { 0% { transform: scaleX(var(--from, 0)); } 100% { transform: scaleX(1); } }

/* --- неделя кружками --- */
.stk-week { display: flex; justify-content: space-between; gap: 4px; }
.stk-wd { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 30px; }
.stk-wd-l {
  font-size: 11.5px; line-height: 1; font-weight: 600; text-transform: uppercase;
  color: var(--text-2, #6b7280);
}
.stk-wd-l.stk-now { font-weight: 800; }
.stk-c {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  box-sizing: border-box;
}
.stk-c-missed { border: 2px solid #e3e6eb; }
html[data-theme="dark"] .stk-c-missed { border-color: rgba(255, 255, 255, .14); }
.stk-c-frozen { background: #dbeafe; border: 1.5px solid #93c5fd; }
html[data-theme="dark"] .stk-c-frozen { background: rgba(59, 130, 246, .22); border-color: rgba(96, 165, 250, .6); }
.stk-c-today { border: 2px dashed; background: rgba(255, 146, 43, .07); }
.stk-c-today i { width: 6px; height: 6px; border-radius: 50%; opacity: .8; }
.stk-pop-in { animation: stk-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.35s both; }
@keyframes stk-pop {
  0% { transform: scale(0.2); opacity: 0; }
  70% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.stk-pulse { animation: stk-pulse 1.8s ease-out infinite; }
@keyframes stk-pulse {
  0% { box-shadow: 0 0 0 0 var(--stk-glow); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* --- праздник: карточка в углу под шапкой, доску не закрывает --- */
.stk-cele {
  position: fixed; z-index: 1070; top: 64px; right: 20px; width: 330px; max-width: calc(100vw - 16px);
  background: var(--surface-1, #fff); color: var(--text-1, #1f2328);
  border: 1px solid var(--border, #e5e7eb); border-radius: 14px; overflow: hidden;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .22);
  animation: stk-enter 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
@media (max-width: 575.98px) { .stk-cele { top: 58px; right: 8px; } }
.stk-cele.stk-leave { animation: stk-leave 0.3s ease-in both; }
@keyframes stk-enter {
  0% { transform: translateY(-16px) scale(0.92); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes stk-leave {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-10px) scale(0.96); opacity: 0; }
}
.stk-x {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-2, #6b7280); font-size: 20px; line-height: 1; cursor: pointer;
}
.stk-x:hover { background: var(--surface-2, #f6f7f9); }
.stk-cele-top { display: flex; gap: 16px; align-items: center; padding: 18px 18px 12px; }
.stk-burst { position: relative; width: 64px; height: 76px; flex-shrink: 0; display: grid; place-items: center; }
.stk-glow {
  position: absolute; top: -12px; right: -12px; bottom: -12px; left: -12px; border-radius: 50%;
  background: radial-gradient(circle, var(--stk-glow) 0%, transparent 68%);
  animation: stk-glow 1.6s ease-out 0.2s both; pointer-events: none;
}
@keyframes stk-glow {
  0% { transform: scale(0.4); opacity: 0; }
  40% { transform: scale(1.1); opacity: 0.95; }
  100% { transform: scale(1); opacity: 0.45; }
}
.stk-spark {
  position: absolute; left: 50%; top: 46%; width: 7px; height: 11px; border-radius: 2px; opacity: 0;
  pointer-events: none; animation: stk-burst 1.15s cubic-bezier(0.15, 0.7, 0.35, 1) 0.25s forwards;
}
@keyframes stk-burst {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(0.6); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1); opacity: 0; }
}
.stk-cele-title { font-size: 15px; font-weight: 800; line-height: 1.25; padding-right: 22px; }
.stk-cele-num { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.stk-cele-num b { font-size: 38px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stk-cele-num span { font-size: 14px; font-weight: 700; color: var(--text-2, #6b7280); }
.stk-cele-sub { font-size: 12.5px; color: var(--text-2, #6b7280); margin-top: 2px; }
.stk-cele .stk-sec:last-child { padding-bottom: 16px; }

/* --- профиль: карточка и календарь года --- */
.stk-card {
  margin: 1.25rem 0 .5rem; padding: 18px 20px; border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  background-color: var(--surface-1, #fff); color: var(--text-1, #1f2328);
}
.stk-card-top { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
.stk-card-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2, #6b7280);
}
.stk-card-num { display: flex; align-items: baseline; gap: 6px; }
.stk-card-num b { font-size: 34px; font-weight: 900; line-height: 1.05; }
.stk-card-num span { font-size: 14px; font-weight: 700; color: var(--text-2, #6b7280); }
.stk-card-msg { font-size: 13px; color: var(--text-2, #6b7280); margin-top: 2px; }
.stk-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; min-width: 0; }
.stk-stats > div { min-width: 0; }
.stk-stat-l {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2, #6b7280);
}
.stk-stat-v { font-size: 22px; font-weight: 900; line-height: 1.2; }
.stk-heat { margin-top: 16px; }
.stk-heat-wrap { display: flex; }
.stk-heat-days { position: relative; width: 24px; flex-shrink: 0; }
.stk-heat-days span, .stk-heat-months span {
  position: absolute; font-size: 10px; color: var(--text-2, #6b7280); white-space: nowrap;
}
.stk-heat-months span { top: 0; font-size: 10.5px; }
.stk-heat-scroll { overflow-x: auto; padding-bottom: 4px; flex: 1; min-width: 0; }
.stk-heat-grid { position: relative; padding-top: 16px; }
.stk-heat-cols { display: flex; gap: 3px; }
.stk-heat-col { display: flex; flex-direction: column; gap: 3px; }
.stk-heat-col i { display: block; border-radius: 3px; }
.stk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; font-size: 11.5px; color: var(--text-2, #6b7280); }
.stk-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
.stk-legend .stk-gap { margin-left: 12px; }
.stk-switch { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13.5px; color: var(--text-2, #6b7280); cursor: pointer; }
.stk-switch input { width: 16px; height: 16px; margin: 0; cursor: pointer; }

/* --- «Мои ученики» (на телефоне - только огонёк и число: таблица и так шире экрана) --- */
.stk-col { width: 120px; }
@media (max-width: 575.98px) {
  .stk-col { width: auto; }
  .streak-cell .stk-dots { display: none; }
}
.stk-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stk-cell b { font-size: 13px; font-weight: 800; min-width: 12px; font-variant-numeric: tabular-nums; }
.stk-dots { display: inline-flex; gap: 3px; align-items: center; }
.stk-dots i { width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; display: block; }
.stk-dots .stk-d-missed { border: 1.5px solid #d5d9e0; }
html[data-theme="dark"] .stk-dots .stk-d-missed { border-color: rgba(255, 255, 255, .18); }
.stk-dots .stk-d-frozen { background: #93c5fd; }
html[data-theme="dark"] .stk-dots .stk-d-frozen { background: #3b82f6; }
.stk-dots .stk-d-today { border: 1.5px dashed; }

@media (prefers-reduced-motion: reduce) {
  .stk-flicker .stk-in, .stk-flicker .stk-out, .stk-ignite, .stk-pop-in, .stk-pulse,
  .stk-cele, .stk-cele.stk-leave, .stk-spark, .stk-glow, .stk-bar i.stk-grow {
    animation: none !important;
  }
  .stk-spark { display: none; }
}
