:root {
  --bg: #1a1a1a;
  --panel: #262626;
  --border: #3a3a3a;
  --text: #f0f0f0;
  --muted: #9a9a9a;
  --accent: #4f8cf2;
  --error: #ff5d5d;
  --c-W: #ffffff;
  --c-Y: #ffd500;
  --c-R: #c41e3a;
  --c-O: #ff8c00;
  --c-G: #009e60;
  --c-B: #0051ba;
}

/* Light theme: pale background, dark text. Cube colors stay the same
   so case diagrams remain accurate. */
:root[data-theme="light"] {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #d8dde3;
  --text: #1a1a1a;
  --muted: #6a7180;
  --accent: #2563eb;
  --error: #dc2626;
}
[data-theme="light"] body { color: var(--text); }
[data-theme="light"] header,
[data-theme="light"] .tabs { background: rgba(255, 255, 255, 0.92); }
[data-theme="light"] .cube-particle { opacity: 0.10; }

/* Minimal theme: same dark palette but no cube-rain decoration. */
[data-theme="minimal"] .cube-rain { display: none !important; }

/* ========== Glass theme (iOS 26 Liquid Glass style) ==========
   Translucent surfaces with backdrop-blur, subtle inset highlights,
   and a colourful background gradient that shines through everything.
   Apple's design language as of iOS 26.                         */
[data-theme="glass"] {
  --panel: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.18);
}
/* Animated colourful gradient behind everything — what the blur lensing
   acts on. The cube-rain stays on top of this but below the glass panels. */
[data-theme="glass"] body {
  background:
    radial-gradient(circle at 18% 22%, rgba(120, 60, 220, 0.55), transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(60, 140, 230, 0.55), transparent 45%),
    radial-gradient(circle at 60% 10%, rgba(230, 80, 160, 0.45), transparent 50%),
    radial-gradient(circle at 30% 90%, rgba(80, 220, 200, 0.40), transparent 50%),
    #0a0a18;
  background-attachment: fixed;
}
[data-theme="glass"] .cube-particle { opacity: 0.12; }

/* Universal glass surface — applied to every panel/card/modal. */
[data-theme="glass"] header,
[data-theme="glass"] .hint,
[data-theme="glass"] .setting,
[data-theme="glass"] .radio-group,
[data-theme="glass"] .case-card,
[data-theme="glass"] .pattern-card,
[data-theme="glass"] .subtabs,
[data-theme="glass"] .cotd,
[data-theme="glass"] .case-modal-card,
[data-theme="glass"] .practice-modal-card,
[data-theme="glass"] .achievements-modal-card,
[data-theme="glass"] .name-modal-card,
[data-theme="glass"] .detector-result,
[data-theme="glass"] .detector-palette,
[data-theme="glass"] .detector-diagram,
[data-theme="glass"] textarea,
[data-theme="glass"] input[type="text"],
[data-theme="glass"] .user-btn,
[data-theme="glass"] .notation-section,
[data-theme="glass"] .notation-last-move,
[data-theme="glass"] #notation-reset,
[data-theme="glass"] .course-progress,
[data-theme="glass"] .course-lesson,
[data-theme="glass"] .quiz-progress-bar,
[data-theme="glass"] .quiz-step-opts .q-opt,
[data-theme="glass"] .quiz-finish-actions button,
[data-theme="glass"] #sandbox-alg,
[data-theme="glass"] .sandbox-row,
[data-theme="glass"] .sandbox-step-info,
[data-theme="glass"] .streak-card,
[data-theme="glass"] .timer-penalty,
[data-theme="glass"] .timer-penalty button,
[data-theme="glass"] .timer-open-btn,
[data-theme="glass"] .timer-stats,
[data-theme="glass"] .timer-stats .stat,
[data-theme="glass"] .timer-chart,
[data-theme="glass"] .timer-log,
[data-theme="glass"] .timer-log li,
[data-theme="glass"] .activity-cal-wrap,
[data-theme="glass"] .streak-row,
[data-theme="glass"] .session-tabs,
[data-theme="glass"] .session-tabs button,
[data-theme="glass"] .session-new,
[data-theme="glass"] .achievements-btn,
[data-theme="glass"] .reset-btn,
[data-theme="glass"] .legend,
[data-theme="glass"] .face-card,
[data-theme="glass"] .pattern-alg {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
/* Mobile bottom nav + the desktop sidebar — slightly thicker blur. */
[data-theme="glass"] .tabs {
  background: rgba(20, 20, 35, 0.55) !important;
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-color: rgba(255, 255, 255, 0.15) !important;
}
/* Buttons get the same treatment plus a brighter highlight on top edge. */
[data-theme="glass"] button {
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: var(--text);
}
[data-theme="glass"] button.primary,
[data-theme="glass"] .cotd-btn,
[data-theme="glass"] .pattern-play {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.85), rgba(80, 140, 240, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  box-shadow:
    0 4px 16px rgba(100, 100, 240, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
/* Floating nav-toggle gets a subtle glass ring. */
[data-theme="glass"] #nav-toggle {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.9), rgba(80, 140, 240, 0.9));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 22px rgba(80, 100, 240, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
/* Tabs: active button glow. */
[data-theme="glass"] .tabs button.active {
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="glass"] .tabs button.active .tab-icon {
  filter: drop-shadow(0 0 10px rgba(140, 130, 255, 0.9));
}
/* Modal backdrops: heavier blur for the iOS-app feel. */
[data-theme="glass"] .case-modal-backdrop,
[data-theme="glass"] .practice-modal-backdrop,
[data-theme="glass"] .achievements-modal-backdrop {
  background: rgba(10, 10, 25, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
/* Settings: iOS toggle on glass — track lighter. */
[data-theme="glass"] .setting.toggle input[type="checkbox"] {
  background: rgba(255, 255, 255, 0.22);
}
[data-theme="glass"] .setting.toggle input[type="checkbox"]:checked {
  background: linear-gradient(135deg, rgba(120, 90, 240, 1), rgba(80, 140, 240, 1));
}
/* Radio-group on glass: highlight is also gradient. */
[data-theme="glass"] .radio-group label:has(input:checked) {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.85), rgba(80, 140, 240, 0.85));
  box-shadow: 0 2px 8px rgba(80, 100, 240, 0.45);
}
/* COTD card: stronger purple-blue tint. */
[data-theme="glass"] .cotd {
  background:
    linear-gradient(135deg, rgba(120, 90, 240, 0.22), rgba(80, 140, 240, 0.12) 60%, transparent),
    rgba(255, 255, 255, 0.06) !important;
}
[data-theme="glass"] code,
[data-theme="glass"] .case-alg,
[data-theme="glass"] .pattern-alg {
  background: rgba(255, 255, 255, 0.10);
}
/* On Android Chrome that doesn't support backdrop-filter, fallback to
   solid but semi-translucent so it's still readable. */
@supports not (backdrop-filter: blur(1px)) {
  [data-theme="glass"] .case-card,
  [data-theme="glass"] .pattern-card,
  [data-theme="glass"] .setting,
  [data-theme="glass"] .hint,
  [data-theme="glass"] .cotd,
  [data-theme="glass"] .case-modal-card {
    background: rgba(40, 40, 60, 0.85) !important;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---------- cube rain background ---------- */
.cube-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.cube-particle {
  position: absolute;
  top: -60px;
  opacity: 0.16;
  will-change: transform;
  animation: cube-fall linear infinite;
}
.cube-particle svg { width: 100%; height: 100%; display: block; }
@keyframes cube-fall {
  from { transform: translateY(-60px) rotate(0deg); }
  to   { transform: translateY(110vh) rotate(360deg); }
}

/* Main content sits above the cube rain background. Header and tabs
   have their own fixed positioning further down. */
main { position: relative; z-index: 1; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
#settings-btn { font-size: 18px; padding: 6px 10px; }
.header-right { display: flex; align-items: center; gap: 6px; }
.user-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-btn.signed { border-color: var(--accent); color: var(--accent); }

/* ---------- splash / loading screen ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0d0d1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  animation: splash-fade-in 0.4s ease-out;
}
.splash[hidden] { display: none !important; }
.splash.fading { animation: splash-fade-out 0.6s ease-in forwards; }
@keyframes splash-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes splash-fade-out { from { opacity: 1; } to { opacity: 0; } }

.splash-text {
  font-size: clamp(28px, 8vw, 56px);
  font-weight: 700;
  text-align: center;
  color: var(--text);
  padding: 0 16px;
  line-height: 1.2;
  animation: splash-text-in 0.6s ease-out 0.15s backwards;
}
.splash-text b { color: var(--accent); }
@keyframes splash-text-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-sub {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  animation: splash-text-in 0.6s ease-out 0.3s backwards;
}

/* CSS-only 3D rotating Rubik's cube — single face elements with a 3x3
   grid of sticker divs. The splash JS sets random sticker colors at
   start and transitions each one to its solved face color, staggered. */
.splash-cube {
  width: 120px;
  height: 120px;
  position: relative;
  transform-style: preserve-3d;
  animation: splash-cube-spin 4s linear infinite;
}
@keyframes splash-cube-spin {
  from { transform: rotateX(-25deg) rotateY(0deg); }
  to   { transform: rotateX(-25deg) rotateY(360deg); }
}
.splash-face {
  position: absolute;
  width: 120px;
  height: 120px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  background: #000;
  border: 2px solid #000;
  box-sizing: border-box;
}
.splash-face-front  { transform: translateZ(60px); }
.splash-face-back   { transform: rotateY(180deg) translateZ(60px); }
.splash-face-right  { transform: rotateY(90deg)  translateZ(60px); }
.splash-face-left   { transform: rotateY(-90deg) translateZ(60px); }
.splash-face-top    { transform: rotateX(90deg)  translateZ(60px); }
.splash-face-bottom { transform: rotateX(-90deg) translateZ(60px); }

.splash-sticker {
  border-radius: 2px;
  background: #333;
  transition: background-color 0.55s ease-out;
}

/* name registration modal */
.name-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.name-modal[hidden] { display: none !important; }
.name-modal-backdrop {
  position: absolute;
  inset: 0;
  background: #000c;
  backdrop-filter: blur(4px);
}
.name-modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  animation: modal-pop-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.name-modal-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.name-modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.4; }
.name-modal #name-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.name-modal #name-input:focus { border-color: var(--accent); }
.name-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.name-modal-actions button { flex: 1; padding: 10px; }
.name-modal-actions button.primary { margin-top: 0; }

/* ========== DESKTOP: vertical sidebar on the left ========== */
.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  background: rgba(26, 26, 26, 0.92);
  backdrop-filter: blur(8px);
  position: fixed;
  top: 49px;
  bottom: 0;
  left: 0;
  width: 130px;
  padding: 14px 8px;
  z-index: 500;
  overflow-y: auto;
}
main {
  padding-left: 140px;
  max-width: none;
}
.tabs button {
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 14px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tabs button.active {
  color: var(--text);
  background: rgba(79, 140, 242, 0.12);
  border-left-color: var(--accent);
}
.tabs button:hover { color: var(--text); }
.tab-icon { font-size: 18px; }

/* Floating bottom-nav toggle. Hidden by default (desktop has a left sidebar);
   the mobile media query below turns it on. */
#nav-toggle { display: none; }

/* ========== MOBILE: horizontal bottom bar ========== */
@media (max-width: 700px) {
  .tabs {
    flex-direction: row;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 64px;
    padding: 4px 4px;
    border-right: 0;
    border-top: 1px solid var(--border);
    z-index: 500;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    height: calc(64px + env(safe-area-inset-bottom));
    /* With many tabs on mobile, allow horizontal scrolling instead of
       squeezing labels too small to read. */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  main {
    padding-left: 0;
    /* bar = 64px + safe-area-inset-bottom; add 24px breathing room so the
       last button isn't tucked right against the bar. */
    padding-bottom: calc(64px + env(safe-area-inset-bottom) + 24px);
  }
  /* Collapsed: bar slides offscreen, main needs less bottom padding because
     only the floating toggle remains. */
  body.nav-collapsed .tabs {
    transform: translateY(110%);
    pointer-events: none;
  }
  body.nav-collapsed main {
    padding-bottom: calc(env(safe-area-inset-bottom) + 80px);
  }
  .tabs { transition: transform 0.22s ease-out; }

  #nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 14px;
    /* Sit above the visible bar by default. */
    bottom: calc(64px + env(safe-area-inset-bottom) + 12px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--accent);
    color: white;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    z-index: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    transition: bottom 0.22s ease-out;
  }
  body.nav-collapsed #nav-toggle {
    bottom: calc(env(safe-area-inset-bottom) + 14px);
  }
  .tabs button {
    flex: 0 0 64px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    text-align: center;
    min-width: 64px;
  }
  .tabs button.active {
    background: transparent;
    border-bottom-color: var(--accent);
    color: var(--accent);
  }
  .tab-icon { font-size: 22px; }
  .tab-label { font-size: 10px; line-height: 1; }
}
/* Tab content uses an iOS-style cubic ease (smooth, no overshoot) so it
   feels relaxed rather than springy on entry. Cards still spring — but the
   page itself glides. */
.tab-content {
  display: block;
  animation: tab-slide-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform, opacity;
}
.tab-content[hidden] { display: none; }
@keyframes tab-slide-in {
  from { opacity: 0; transform: translateY(8px) scale(0.994); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Inner content fade — used when subsection content re-renders inside a tab
   (e.g. switching section tabs inside study, picking a fitness category).
   Lighter than top-level tab slide so it doesn't compete. */
.inner-fade {
  animation: inner-fade-in 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes inner-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .inner-fade { animation: none; }
}

.tabs button { transition: color 0.15s, border-color 0.15s; }
/* Active tab icon gets an accent-colored glow + a one-shot pop animation
   each time it transitions into the active state. The keyframe is replayed
   automatically because the .active class is toggled off/on when switching. */
.tabs button.active .tab-icon {
  filter: drop-shadow(0 0 6px var(--accent));
  animation: tab-icon-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tab-icon-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* PLL arrows on case diagrams — gentle pulse to draw the eye to the
   piece-movement direction. Width + opacity breathe together. */
.pll-arrow {
  animation: pll-arrow-pulse 1.6s ease-in-out infinite;
  transform-box: fill-box;
}
@keyframes pll-arrow-pulse {
  0%, 100% { stroke-width: 2.2; opacity: 0.85; }
  50%      { stroke-width: 3.2; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .pll-arrow { animation: none; opacity: 1; }
}
.subtabs button { transition: background-color 0.15s, color 0.15s; }
.detector-palette button { transition: border-color 0.15s, transform 0.1s; }
.detector-palette button:active { transform: scale(0.95); }
button { transition: background-color 0.12s, opacity 0.1s, transform 0.1s; }
button:active { transform: scale(0.97); }
button.primary:active { transform: scale(0.99); }

/* Case cards: spring entrance with overshoot. The :nth-child rules below
   stagger the first batch so they cascade in instead of all popping at once.
   Cards past ~24 fall back to the longest delay to avoid waiting forever. */
.case-card {
  animation: card-spring 0.5s cubic-bezier(0.34, 1.45, 0.5, 1) backwards;
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.2s;
  cursor: pointer;
}
@media (hover: hover) {
  .case-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
}
.case-card:active { transform: scale(0.97); transition-duration: 0.08s; }
@keyframes card-spring {
  from { opacity: 0; transform: translateY(18px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.case-card:nth-child(1)  { animation-delay: 0.02s; }
.case-card:nth-child(2)  { animation-delay: 0.04s; }
.case-card:nth-child(3)  { animation-delay: 0.06s; }
.case-card:nth-child(4)  { animation-delay: 0.08s; }
.case-card:nth-child(5)  { animation-delay: 0.10s; }
.case-card:nth-child(6)  { animation-delay: 0.12s; }
.case-card:nth-child(7)  { animation-delay: 0.14s; }
.case-card:nth-child(8)  { animation-delay: 0.16s; }
.case-card:nth-child(9)  { animation-delay: 0.18s; }
.case-card:nth-child(10) { animation-delay: 0.20s; }
.case-card:nth-child(11) { animation-delay: 0.22s; }
.case-card:nth-child(12) { animation-delay: 0.24s; }
.case-card:nth-child(13) { animation-delay: 0.26s; }
.case-card:nth-child(14) { animation-delay: 0.28s; }
.case-card:nth-child(15) { animation-delay: 0.30s; }
.case-card:nth-child(16) { animation-delay: 0.32s; }
.case-card:nth-child(17) { animation-delay: 0.34s; }
.case-card:nth-child(18) { animation-delay: 0.36s; }
.case-card:nth-child(19) { animation-delay: 0.38s; }
.case-card:nth-child(20) { animation-delay: 0.40s; }
.case-card:nth-child(n+21) { animation-delay: 0.42s; }

/* Respect prefers-reduced-motion: drop the entrance animations and lift on
   hover. Critical for users who get motion-sick from the cube rain alone. */
@media (prefers-reduced-motion: reduce) {
  .case-card,
  .case-card:hover,
  .case-card:active { animation: none; transform: none; transition: none; }
  .tab-content { animation: none; }
}

.reset-btn {
  display: block;
  width: 100%;
  margin-top: 24px;
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
}

/* detector sub-tabs (inside Детектив) */
.subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.subtabs button {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.subtabs button.active {
  background: var(--accent);
  color: white;
}

.detector-diagram {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}
.detector-diagram svg {
  max-width: 320px;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}
.detector-diagram svg rect.cell, .detector-diagram svg polygon.cell {
  cursor: pointer;
}
.detector-diagram svg rect.cell:hover, .detector-diagram svg polygon.cell:hover {
  filter: brightness(1.3);
}

.detector-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.detector-controls button { flex: 1; padding: 12px; font-size: 14px; }
.detector-controls button.primary { margin-top: 0; }

.detector-result {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.detector-result.no-match {
  border-color: var(--error);
  color: #ffb8b8;
}
.detector-match-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.detector-match-alg {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  word-break: break-word;
  line-height: 1.5;
}
.detector-match-auf {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* color palette for detector */
.detector-palette {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.detector-palette button {
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.1s;
}
.detector-palette button .swatch {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #0006;
}
.detector-palette button .label {
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
}
.detector-palette button.active {
  border-color: var(--accent);
  color: var(--text);
}
.detector-palette button.active .swatch {
  box-shadow: 0 0 0 2px var(--accent);
}
.detector-palette .swatch.sw-W { background: var(--c-W); }
.detector-palette .swatch.sw-Y { background: var(--c-Y); }
.detector-palette .swatch.sw-R { background: var(--c-R); }
.detector-palette .swatch.sw-O { background: var(--c-O); }
.detector-palette .swatch.sw-G { background: var(--c-G); }
.detector-palette .swatch.sw-B { background: var(--c-B); }
.detector-palette .swatch.sw-clear {
  background: #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 18px; line-height: 1;
}

/* notation reference page */
.notation-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.notation-section h3 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notation-table {
  width: 100%;
  border-collapse: collapse;
}
.notation-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
  line-height: 1.4;
}
.notation-table tr:last-child td { border-bottom: 0; }
.notation-table .n-sym {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  width: 1%;
}
.n-sym-btn {
  font: inherit;
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, transform 0.1s;
}
.n-sym-btn:hover  { background: var(--panel); border-color: var(--accent); }
.n-sym-btn:active { transform: scale(0.95); }

.notation-cube-stage {
  width: 100%;
  height: 240px;
  perspective: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d1a;
  border-radius: 10px;
  margin-bottom: 10px;
}
.notation-cube {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-30deg);
}
.notation-cube-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.notation-last-move {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}
.notation-last-move b { color: var(--accent); font-family: monospace; font-size: 16px; }
#notation-reset {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
#notation-reset:hover { border-color: var(--accent); color: var(--accent); }
.notation-table .n-name {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  width: 1%;
}
.notation-table .n-desc { color: var(--muted); }
.notation-section code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}

/* ---------- CFOP course / trainer ---------- */
.course-progress {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.course-progress-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.course-progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.course-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  transition: width 0.3s ease-out;
}

.course-list { display: flex; flex-direction: column; gap: 8px; }
.course-lesson {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s;
}
.course-lesson[data-done="1"] {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}
.course-lesson summary {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.course-lesson summary::-webkit-details-marker { display: none; }
.course-icon { font-size: 22px; text-align: center; }
.course-title { font-weight: 600; font-size: 15px; }
.course-check {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: default;
  user-select: none;
}
.course-check.done {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}
.course-body {
  padding: 4px 16px 16px 60px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.course-body p { margin: 8px 0; }
.course-body ul, .course-body ol { padding-left: 20px; margin: 8px 0; }
.course-body li { margin: 6px 0; }
.course-body code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}
.course-practice {
  margin-top: 14px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- priority cheatsheet ---------- */
.cheatsheet-summary {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
  color: var(--muted);
}
.cheatsheet-summary b { color: var(--accent); font-size: 16px; }

.cheatsheet-tier-intro {
  background: var(--bg);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  margin: 14px 0 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.cheatsheet-group {
  margin-bottom: 12px;
}
.cheatsheet-group-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin: 8px 4px 6px;
}
.cheatsheet-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alg-row {
  display: grid;
  grid-template-columns: 24px 64px 1fr;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
}
.alg-thumb { width: 64px; height: 64px; }
.alg-thumb svg { width: 100%; height: 100%; display: block; }
.alg-thumb-empty {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
  border-radius: 6px;
  color: #555;
  font-size: 22px;
}
.alg-row.done {
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
}
.alg-row .alg-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #22c55e;
  cursor: pointer;
}
.alg-info { min-width: 0; }
.alg-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.alg-row.done .alg-name { text-decoration: line-through; opacity: 0.7; }
.alg-code {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--panel);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--accent);
  word-break: break-word;
  line-height: 1.4;
}

.tier-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tier-badge.tier-1 { background: #22c55e; color: white; }
.tier-badge.tier-2 { background: #ffd500; color: #1a1a1a; }
.tier-badge.tier-3 { background: #c41e3a; color: white; }

/* ---------- per-lesson quiz (modal flow) ---------- */
.quiz-start-btn {
  display: block;
  width: 100%;
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.quiz-start-btn:hover { background: rgba(79, 140, 242, 0.08); }

.quiz-modal {
  position: fixed;
  inset: 0;
  z-index: 230;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 60px 20px 24px;
  overflow-y: auto;
}
.quiz-modal[hidden] { display: none !important; }
.quiz-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 44px; height: 44px;
  font-size: 26px;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}
.quiz-modal-body {
  max-width: 480px;
  width: 100%;
}
.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--panel);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.quiz-progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  transition: width 0.3s ease-out;
}
.quiz-step-num {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.quiz-step-q {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 20px;
}
.quiz-step-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.quiz-step-opts .q-opt {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s, transform 0.05s;
}
.quiz-step-opts .q-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-step-opts .q-opt:active { transform: scale(0.99); }
.quiz-step-opts .q-opt:disabled { cursor: default; }
.quiz-step-opts .q-opt.correct {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #4ade80;
  font-weight: 600;
}
.quiz-step-opts .q-opt.wrong {
  background: rgba(220, 38, 38, 0.15);
  border-color: var(--error);
  color: var(--error);
  text-decoration: line-through;
}
.quiz-step-opts .q-opt.locked { opacity: 0.5; }
.quiz-next-btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  margin-top: 0;
}

.quiz-finish { text-align: center; padding-top: 40px; }
.quiz-finish-emoji { font-size: 64px; margin-bottom: 14px; }
.quiz-finish-score { font-size: 22px; margin-bottom: 6px; }
.quiz-finish-score b { color: var(--accent); font-size: 28px; }
.quiz-finish-msg { color: var(--muted); margin-bottom: 24px; }
.quiz-finish-actions { display: flex; gap: 10px; }
.quiz-finish-actions button {
  flex: 1;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
}
.quiz-finish-actions button.primary { margin-top: 0; background: var(--accent); border-color: var(--accent); color: white; }

/* ---------- algorithm sandbox ---------- */
#sandbox-alg {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 16px;
  color: var(--text);
  resize: vertical;
  outline: none;
  margin-bottom: 14px;
  box-sizing: border-box;
}
#sandbox-alg:focus { border-color: var(--accent); }

.sandbox-stage {
  width: 100%;
  height: 320px;
  perspective: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d1a;
  border-radius: 10px;
  margin-bottom: 14px;
}
.sandbox-cube {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-30deg);
}
.sandbox-cube .case-3d-cubie { width: 50px; height: 50px; top: -25px; left: -25px; }
.sandbox-cube .case-3d-cubie .face { width: 50px; height: 50px; }
.sandbox-cube .case-3d-cubie .face.f-front  { transform: translateZ(25px); }
.sandbox-cube .case-3d-cubie .face.f-back   { transform: rotateY(180deg) translateZ(25px); }
.sandbox-cube .case-3d-cubie .face.f-right  { transform: rotateY(90deg)  translateZ(25px); }
.sandbox-cube .case-3d-cubie .face.f-left   { transform: rotateY(-90deg) translateZ(25px); }
.sandbox-cube .case-3d-cubie .face.f-top    { transform: rotateX(90deg)  translateZ(25px); }
.sandbox-cube .case-3d-cubie .face.f-bottom { transform: rotateX(-90deg) translateZ(25px); }

.sandbox-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.sandbox-controls button { flex: 1; padding: 12px; font-size: 14px; }
.sandbox-controls button.primary { margin-top: 0; }

.sandbox-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.sandbox-speed { display: flex; align-items: center; gap: 10px; }
.sandbox-speed input[type=range] { flex: 1; }
.sandbox-speed span { min-width: 56px; text-align: right; font-family: monospace; color: var(--text); }
.sandbox-prescramble { display: flex; align-items: center; gap: 8px; }
.sandbox-prescramble input { width: 18px; height: 18px; }

.sandbox-step-info {
  text-align: center;
  font-family: monospace;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}
.sandbox-step-info b { color: var(--accent); font-size: 16px; }

/* ---------- speedcubing timer ---------- */
.timer-open-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  margin-bottom: 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.1s;
}
.timer-open-btn:hover { border-color: var(--accent); }
.timer-open-btn:active { transform: scale(0.99); }
.timer-open-icon { font-size: 32px; }
.timer-open-label { flex: 1; font-size: 18px; font-weight: 600; color: var(--text); }
.timer-open-last {
  font-family: ui-monospace, monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Fullscreen timer modal — background captures every tap so the user
   can't miss it. Display fills the viewport. Distinctive purple-tinted
   background so it's obvious the modal opened. */
.timer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.timer-modal.running { background: #0a2a1a !important; color: #4ade80; }
.timer-modal[hidden] { display: none !important; }
.timer-modal.arming  { background: #ffd500 !important; color: #1a1a1a; }
.timer-modal.ready   { background: #22c55e !important; color: #ffffff; }
.timer-modal.inspect-warn { background: #3a2a0a !important; color: #ffd500; }
.timer-modal.inspect-bad  { background: #3a0a0a !important; color: #ff6868; }

.timer-scramble {
  position: absolute;
  top: 56px;
  left: 0; right: 0;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0 24px;
  color: var(--text);
  pointer-events: none;
  line-height: 1.5;
  word-spacing: 4px;
}
.timer-modal.arming .timer-scramble,
.timer-modal.ready .timer-scramble,
.timer-modal.inspect-warn .timer-scramble,
.timer-modal.inspect-bad .timer-scramble { color: inherit; opacity: 0.7; }

.timer-modal .timer-display {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(80px, 22vw, 220px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: inherit;
}

.timer-modal-hint {
  position: absolute;
  bottom: 32px;
  left: 0; right: 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  padding: 0 16px;
}
.timer-modal.arming .timer-modal-hint,
.timer-modal.ready .timer-modal-hint { color: #1a1a1a; opacity: 0.7; }
.timer-modal.running .timer-modal-hint { color: var(--muted); }

.timer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  font-size: 28px;
  line-height: 1;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}

.timer-penalty {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 1;
}
.timer-penalty[hidden] { display: none !important; }
.timer-penalty button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.timer-penalty button[data-pen="+2"]  { border-color: #ffd500; color: #ffd500; }
.timer-penalty button[data-pen="DNF"] { border-color: var(--error); color: var(--error); }
.timer-penalty button.primary { margin-top: 0; background: var(--accent); border-color: var(--accent); color: white; }

/* ---------- new-record celebration overlay ---------- */
.celebration {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}
.celebration[hidden] { display: none !important; }
.celebration-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.celebration-text {
  position: relative;
  text-align: center;
  background: rgba(26, 26, 46, 0.92);
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 32px 40px;
  animation: celebrate-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 60px #000c, 0 0 60px var(--accent);
}
.celebration-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
}
.celebration-time {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 56px;
  font-weight: 700;
  color: #ffd500;
  font-variant-numeric: tabular-nums;
}
.celebration-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}
@keyframes celebrate-pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.confetti-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  will-change: transform, opacity;
  animation: confetti-fly 2.4s ease-out forwards;
}
@keyframes confetti-fly {
  0%   { transform: translate(-50%, -50%) rotate(0deg);                                opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot, 360deg));        opacity: 0; }
}

/* sessions row */
.timer-sessions {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  align-items: stretch;
}
.session-tabs {
  flex: 1;
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  overflow-x: auto;
}
.session-tabs button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.session-tabs button.active { background: var(--accent); color: white; font-weight: 600; }
.session-tabs button .sess-del {
  margin-left: 6px;
  opacity: 0.5;
  cursor: pointer;
}
.session-tabs button .sess-del:hover { opacity: 1; color: var(--error); }
.session-new {
  width: 38px;
  height: 38px;
  align-self: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 22px;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}
.session-new:hover { color: var(--accent); border-color: var(--accent); }

/* streak counters + activity calendar */
.streak-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.streak-card {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.streak-card .streak-num   { font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.streak-card .streak-icon  { font-size: 22px; }
.streak-card .streak-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.streak-card.fire .streak-num { color: #ff8c00; }

.activity-cal-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.activity-cal-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.activity-cal {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 14px;
  gap: 3px;
}
.activity-cal .day {
  width: 100%;
  height: 14px;
  border-radius: 2px;
  background: #2a2a2a;
}
.activity-cal .day.lvl1 { background: rgba(34, 197, 94, 0.30); }
.activity-cal .day.lvl2 { background: rgba(34, 197, 94, 0.55); }
.activity-cal .day.lvl3 { background: rgba(34, 197, 94, 0.80); }
.activity-cal .day.lvl4 { background: #22c55e; }
.activity-cal .day.today { box-shadow: 0 0 0 1px var(--accent); }

/* progress chart */
.timer-chart {
  width: 100%;
  height: 100px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
}
.timer-chart:empty { display: none; }
.timer-chart .chart-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.timer-chart .chart-avg  { fill: none; stroke: #ffd500;     stroke-width: 1.5; stroke-dasharray: 4 3; }
.timer-chart .chart-best { stroke: #22c55e; stroke-dasharray: 2 4; }
.timer-chart .chart-axis { stroke: var(--border); stroke-width: 1; }
.timer-chart .chart-label { fill: var(--muted); font-family: monospace; font-size: 9px; }

.timer-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.timer-stats .stat {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  min-width: 80px;
}
.timer-stats .stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.timer-stats .stat-value { font-family: ui-monospace, monospace; font-weight: 600; font-size: 16px; margin-top: 2px; }

.timer-log {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.timer-log li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, monospace;
  font-size: 14px;
  cursor: pointer;
  display: block;
}
.timer-log li .t-row {
  display: grid;
  grid-template-columns: 40px 1fr auto 32px;
  align-items: center;
  gap: 12px;
}
.timer-log li .t-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: none;
  font-size: 12px;
}
.timer-log li.expanded .t-details { display: block; }
.timer-log li .t-date { color: var(--muted); margin-bottom: 4px; font-family: -apple-system, sans-serif; }
.timer-log li .t-scramble {
  color: var(--text);
  word-break: break-word;
  letter-spacing: 0.04em;
}
.timer-log li .t-num { color: var(--muted); font-size: 12px; }
.timer-log li .t-time { font-weight: 700; font-size: 16px; color: var(--text); }
.timer-log li .t-avg { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.timer-log li .t-del {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.timer-log li .t-del:hover { background: #4a1f1f; color: var(--error); }
.timer-log:empty { display: none; }
.timer-log li.best { border-color: var(--accent); }

/* achievements button + toast + modal */
.achievements-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  color: var(--text);
}
.achievements-btn:hover { border-color: var(--accent); color: var(--accent); }

.achievement-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 500;
  box-shadow: 0 10px 40px #000a, 0 0 30px var(--accent);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
}
.achievement-toast.show { transform: translateX(-50%) translateY(0); }
.achievement-toast .ach-icon { font-size: 32px; }
.achievement-toast .ach-text .ach-title { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.achievement-toast .ach-text .ach-name  { font-size: 16px; font-weight: 700; }

.achievements-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
}
.achievements-modal[hidden] { display: none !important; }
.achievements-backdrop {
  position: absolute;
  inset: 0;
  background: #000c;
  backdrop-filter: blur(4px);
}
.achievements-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  max-width: 460px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.achievements-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 0;
  font-size: 22px;
  width: 36px;
  height: 36px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.achievements-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.achievements-progress { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.achievements-list { display: flex; flex-direction: column; gap: 8px; }
.achievements-reset {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.achievements-reset:hover { color: var(--text); }
.achievements-reset.confirming {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--error);
  color: var(--error);
  font-weight: 600;
}
.ach-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.ach-row.done { border-color: var(--accent); }
.ach-row.locked { opacity: 0.55; }
.ach-row .ach-icon { font-size: 26px; min-width: 32px; text-align: center; }
.ach-row .ach-name { font-weight: 600; font-size: 14px; }
.ach-row .ach-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* practice mode */
.practice-btn {
  display: block;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}
.practice-btn:hover { border-color: var(--accent); color: var(--accent); }

.practice-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px 24px;
  cursor: default;
}
.practice-modal[hidden] { display: none !important; }
.practice-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  font-size: 26px;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.practice-stats {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}
.practice-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}
.practice-svg {
  margin-bottom: 16px;
}
.practice-svg svg { width: 220px; height: 220px; display: block; }
.practice-alg {
  font-family: ui-monospace, monospace;
  font-size: 18px;
  font-weight: 600;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  min-height: 24px;
  text-align: center;
  word-break: break-word;
  color: var(--accent);
}
.practice-alg:empty::before { content: "?"; color: var(--muted); font-weight: 400; }
.practice-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  flex-wrap: wrap;
}
.practice-actions button { flex: 1; padding: 14px; font-size: 14px; min-width: 110px; }
.practice-actions .practice-correct { background: #1a3a1a; border-color: #22c55e; color: #4ade80; }
.practice-actions .practice-wrong   { background: #3a1a1a; border-color: var(--error); color: var(--error); }
.practice-actions .primary { margin-top: 0; }

.practice-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.practice-row .practice-btn { margin-bottom: 0; }

/* recognition trainer */
.recognition-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px 24px;
  overflow-y: auto;
}
.recognition-modal[hidden] { display: none !important; }
.recognition-stats { color: var(--muted); font-size: 13px; margin-bottom: 12px; text-align: center; }
.recognition-stats b { color: var(--accent); }
.recognition-svg svg { width: 200px; height: 200px; display: block; margin: 0 auto 14px; }
.recognition-feedback {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 14px;
  min-height: 24px;
  font-family: monospace;
}
.recognition-feedback.ok    { color: #22c55e; }
.recognition-feedback.fail  { color: var(--error); }
.recognition-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 420px;
}
@media (max-width: 480px) { .recognition-grid { grid-template-columns: repeat(5, 1fr); } }
.recognition-grid button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.recognition-grid button.flash-ok    { background: #1a3a1a; border-color: #22c55e; }
.recognition-grid button.flash-fail  { background: #3a1a1a; border-color: var(--error); }
.recognition-grid button.flash-correct { background: #1a3a1a; border-color: #22c55e; }
.timer-log li.best .t-time { color: var(--accent); }

/* algorithm case cards */
.case-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 600px) { .case-list { grid-template-columns: 1fr 1fr; } }

.case-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.case-card:active { transform: scale(0.98); }
.case-card:hover { border-color: var(--accent); }
.case-card .case-svg { width: 100%; aspect-ratio: 1; }
.case-card .case-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.case-card .case-name { font-weight: 600; font-size: 14px; }
.case-card .case-alg {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
}
.case-card .case-alg + .case-alg {
  color: var(--muted);
  font-size: 12px;
}

/* Russian-language description rendered under each algorithm when the
   "Языковые подсказки" setting is on. */
.case-alg-ru {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin: 4px 0 6px 4px;
  font-style: italic;
}

/* zoomed case modal */
.case-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.case-modal[hidden] { display: none !important; }
[hidden] { display: none !important; }
.case-modal { animation: modal-fade-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1); }
.case-modal-card { animation: modal-pop-in 0.34s cubic-bezier(0.34, 1.42, 0.55, 1); }
.case-modal.case-modal-closing { animation: modal-fade-out 0.24s ease-in forwards; }
.case-modal.case-modal-closing .case-modal-card { animation: modal-pop-out 0.24s ease-in forwards; }
.pattern-modal.pattern-modal-closing { animation: modal-fade-out 0.24s ease-in forwards; }
.pattern-modal.pattern-modal-closing .pattern-modal-card { animation: modal-pop-out 0.24s ease-in forwards; }
@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-pop-in {
  from { transform: scale(0.9) translateY(8px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);   opacity: 1; }
}
@keyframes modal-fade-out { to { opacity: 0; } }
@keyframes modal-pop-out  { to { transform: scale(0.94) translateY(6px); opacity: 0; } }

/* View Transitions API (Safari 18+, Chrome 111+). Browsers without it just
   fall through to the per-tab slide-in animation defined on .tab-content.
   With it, the entire root smoothly cross-fades on every tab switch. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
}
html { scroll-behavior: smooth; }

.detector-result { animation: result-in 0.32s cubic-bezier(0.22, 0.61, 0.36, 1); }
@keyframes result-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.case-modal-backdrop {
  position: absolute;
  inset: 0;
  background: #000c;
  backdrop-filter: blur(4px);
}
.case-modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.case-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.case-modal-svg svg {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 8px auto 16px;
  aspect-ratio: 1;
  height: auto;
}
.case-modal-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}
.case-modal-algs .case-alg {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  word-break: break-word;
  line-height: 1.5;
}
.case-modal-desc {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.case-note-pin {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  font-style: italic;
  word-break: break-word;
  line-height: 1.3;
}
.case-note-input {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 50px;
  outline: none;
  box-sizing: border-box;
}
.case-note-input:focus { border-color: var(--accent); }

/* 3D animated cube inside the case modal */
.case-3d-toggle {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}
.case-3d-section { margin-top: 14px; }
.case-3d-section[hidden] { display: none !important; }
.case-3d-stage {
  width: 100%;
  height: 220px;
  perspective: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d1a;
  border-radius: 10px;
  margin-bottom: 12px;
}
.case-3d-cube {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-30deg);
}
.case-3d-cubie {
  position: absolute;
  width: 36px;
  height: 36px;
  top: -18px;
  left: -18px;
  transform-style: preserve-3d;
}
.case-3d-cubie .face {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 2px solid #000;
  background: #0a0a0a;
  box-sizing: border-box;
}
.case-3d-cubie .face.f-front  { transform: translateZ(18px); }
.case-3d-cubie .face.f-back   { transform: rotateY(180deg) translateZ(18px); }
.case-3d-cubie .face.f-right  { transform: rotateY(90deg)  translateZ(18px); }
.case-3d-cubie .face.f-left   { transform: rotateY(-90deg) translateZ(18px); }
.case-3d-cubie .face.f-top    { transform: rotateX(90deg)  translateZ(18px); }
.case-3d-cubie .face.f-bottom { transform: rotateX(-90deg) translateZ(18px); }
.case-3d-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.case-3d-controls button { flex: 1; padding: 10px; font-size: 14px; }
.case-3d-step {
  text-align: center;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}
.case-3d-step b { color: var(--accent); font-size: 14px; }

h1 { font-size: 20px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }

main { padding: 16px; max-width: 720px; margin: 0 auto; }

button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  padding: 14px;
  width: 100%;
  margin-top: 16px;
  font-size: 16px;
}
button:active { opacity: 0.7; }

.hint {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.4;
}
.hint b { color: var(--text); }

/* ---------- upload ---------- */

.face-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) { .face-grid { grid-template-columns: repeat(3, 1fr); } }

.face-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.face-card.uploaded { border-color: var(--accent); }

.face-card .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.face-card .label .swatch {
  width: 16px; height: 16px;
  border-radius: 3px;
  border: 1px solid #555;
}
.face-card .orient {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}
.face-card label.file-btn {
  display: block;
  background: var(--accent);
  color: white;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.face-card label.file-btn input { display: none; }
.face-card.uploaded label.file-btn { background: var(--panel); border: 1px solid var(--border); }

.preview3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: #000;
  padding: 2px;
  border-radius: 6px;
  aspect-ratio: 1;
}
.preview3x3 div { border-radius: 2px; }

/* ---------- confirm ---------- */

.confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (min-width: 600px) { .confirm-grid { grid-template-columns: repeat(3, 1fr); } }

.confirm-face {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.confirm-face .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
}
.confirm-face .head .swatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid #555; }
.confirm-face .rotate { padding: 4px 8px; font-size: 12px; }
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  aspect-ratio: 1;
}
.sticker {
  border-radius: 4px;
  border: 1px solid #00000044;
  cursor: pointer;
  transition: transform 0.1s;
}
.sticker:active { transform: scale(0.92); }

.color-W { background: var(--c-W); }
.color-Y { background: var(--c-Y); }
.color-R { background: var(--c-R); }
.color-O { background: var(--c-O); }
.color-G { background: var(--c-G); }
.color-B { background: var(--c-B); }

.error {
  background: #4a1f1f;
  border: 1px solid var(--error);
  color: #ffb8b8;
  padding: 10px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 14px;
}

/* ---------- solution ---------- */

.meta { color: var(--muted); margin-bottom: 12px; font-size: 14px; }
.moves {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.moves li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 4px;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 18px;
  font-weight: 600;
}
.moves li .idx { display: block; font-size: 10px; color: var(--muted); font-weight: normal; }
.moves li .arrow { display: block; font-size: 14px; color: var(--muted); }

/* phase-grouped output */
.phase-block { margin-bottom: 16px; }
.phase-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

/* step-by-step mode */
.step-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  margin-bottom: 16px;
}
.step-card .step-move {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
}
.step-card .step-arrow { font-size: 40px; color: var(--muted); margin-top: 8px; }
.step-card .step-counter { color: var(--muted); margin-top: 12px; font-size: 14px; }
.step-controls { display: flex; gap: 8px; }
.step-controls button { flex: 1; padding: 14px; font-size: 16px; }
.step-controls button.primary { margin-top: 0; }
.step-controls button:disabled { opacity: 0.4; }

/* Patterns gallery (Узоры tab). One card per fun cube pattern. */
.patterns-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .patterns-grid { grid-template-columns: 1fr 1fr; }
}
.pattern-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: card-spring 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  transition: transform 0.18s, box-shadow 0.18s;
}
@media (hover: hover) {
  .pattern-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
}
.pattern-preview {
  width: 110px;
  flex-shrink: 0;
}
.pattern-preview svg { width: 100%; height: auto; display: block; }
.pattern-info { flex: 1; min-width: 0; }
.pattern-name { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.pattern-moves { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.pattern-desc { font-size: 13px; color: var(--muted); line-height: 1.4; margin-bottom: 8px; }
.pattern-alg {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
  word-break: break-word;
  line-height: 1.5;
}
.pattern-play {
  width: 100%;
  padding: 8px;
  font-size: 13px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.pattern-card { cursor: pointer; }

/* Zoomed pattern modal — same vibe as case-modal but for decorative patterns. */
.pattern-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modal-fade-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.pattern-modal[hidden] { display: none !important; }
.pattern-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pattern-modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  max-width: 460px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  animation: modal-pop-in 0.34s cubic-bezier(0.34, 1.42, 0.55, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.pattern-modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.pattern-modal-preview { display: flex; justify-content: center; margin: 8px 0 16px; }
.pattern-modal-preview svg { width: 100%; max-width: 340px; height: auto; }
.pattern-modal-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; text-align: center; }
.pattern-modal-moves { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 12px; }
.pattern-modal-desc { font-size: 14px; line-height: 1.5; color: var(--muted); margin-bottom: 14px; text-align: center; }
.pattern-modal-alg {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  word-break: break-word;
  line-height: 1.6;
  text-align: center;
}
.pattern-modal-play { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }

/* Training schedule in Settings + reminder banner shown on app open. */
.setting-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.4;
}
.schedule-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.schedule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.schedule-day {
  width: 30px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
}
.schedule-time {
  flex: 1;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
}
.schedule-time:disabled { opacity: 0.4; }
.schedule-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 24px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  border: 0;
  margin: 0;
}
.schedule-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  top: 2px; left: 2px;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.schedule-toggle input[type="checkbox"]:checked { background: var(--accent); }
.schedule-toggle input[type="checkbox"]:checked::before { transform: translateX(18px); }

.reminder-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 12px;
  right: 12px;
  z-index: 800;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #8b5cf6));
  color: white;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  animation: reminder-in 0.45s cubic-bezier(0.34, 1.42, 0.55, 1);
}
.reminder-banner[hidden] { display: none !important; }
.reminder-icon { font-size: 22px; flex-shrink: 0; }
.reminder-text { flex: 1; line-height: 1.3; }
#reminder-dismiss {
  background: rgba(255, 255, 255, 0.2);
  border: 0;
  color: white;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px;
  padding: 0;
}
@keyframes reminder-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.reminder-out { animation: reminder-out 0.32s ease-in forwards; }
@keyframes reminder-out {
  to { opacity: 0; transform: translateY(-12px); }
}

/* CFOP demo banner: fixed at top while the demo runs, shows phase label
   and a Stop button. Layered above tab content but below modals. */
.demo-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 12px; right: 12px;
  z-index: 700;
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.95), rgba(80, 140, 240, 0.95));
  color: white;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title btn" "sub btn";
  gap: 2px 12px;
  align-items: center;
  animation: reminder-in 0.4s cubic-bezier(0.34, 1.42, 0.55, 1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.demo-banner[hidden] { display: none !important; }
.demo-banner-title { grid-area: title; font-weight: 700; font-size: 15px; }
.demo-banner-sub   { grid-area: sub; font-size: 12px; opacity: 0.85; }
#demo-banner-stop {
  grid-area: btn;
  background: rgba(255, 255, 255, 0.22);
  color: white;
  border: 0;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.demo-banner-out { animation: reminder-out 0.32s ease-in forwards; }

.demo-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* Case of the Day card — sits at the very top of the Детектив tab. */
.cotd {
  background:
    linear-gradient(135deg, rgba(79, 140, 242, 0.16), rgba(140, 79, 242, 0.10) 60%, transparent),
    var(--panel);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  animation: cotd-glow-in 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
}
@keyframes cotd-glow-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.cotd-leaving {
  animation: cotd-glow-out 0.42s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}
@keyframes cotd-glow-out {
  from { opacity: 1; transform: translateY(0)     scale(1);    max-height: 400px; margin-bottom: 16px; }
  to   { opacity: 0; transform: translateY(-12px) scale(0.95); max-height: 0;     margin-bottom: 0;    padding-top: 0; padding-bottom: 0; border-width: 0; }
}
.cotd::before {
  /* Decorative top-right glow blob. */
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(79, 140, 242, 0.45), transparent 70%);
  pointer-events: none;
}
.cotd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.cotd-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.cotd-date {
  font-size: 12px;
  color: var(--muted);
}
.cotd-body {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.cotd-diagram {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.cotd-diagram svg {
  width: 100%;
  height: 100%;
}
.cotd-info { flex: 1; min-width: 0; }
.cotd-mode {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 2px;
}
.cotd-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}
.cotd-alg {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}
.cotd-btn {
  width: 100%;
  padding: 10px;
  position: relative;
  z-index: 1;
}
.cotd-status {
  margin-top: 10px;
  text-align: center;
  color: #4ade80;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* settings */
.setting {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
/* iOS-style toggle switch. Native checkbox is hidden under appearance:none
   and the track + knob are drawn with ::before. Knob springs on toggle. */
.setting.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.setting.toggle span { flex: 1; }
.setting.toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 50px;
  height: 30px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.22s;
  border: 0;
  margin: 0;
  padding: 0;
}
.setting.toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.26s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.setting.toggle input[type="checkbox"]:checked { background: var(--accent); }
.setting.toggle input[type="checkbox"]:checked::before { transform: translateX(20px); }
[data-theme="light"] .setting.toggle input[type="checkbox"] { background: rgba(0, 0, 0, 0.18); }
[data-theme="light"] .setting.toggle input[type="checkbox"]:checked { background: var(--accent); }

.setting-label { font-weight: 600; margin-bottom: 10px; }

/* iOS-style segmented control for radio groups. Native radio is hidden;
   the parent label paints the segment. Uses :has() (iOS 15.4+, Chrome 105+). */
.radio-group {
  display: flex;
  flex-direction: row;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.radio-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  transition: background 0.22s, color 0.22s, box-shadow 0.22s;
}
.radio-group label:has(input:checked) {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.radio-group input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
[data-theme="light"] .radio-group { background: rgba(0, 0, 0, 0.05); }
@media (max-width: 480px) {
  .radio-group label { font-size: 12px; padding: 8px 4px; }
}
#settings-back-btn { width: 100%; padding: 14px; margin-top: 8px; }

.check-update-btn {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
}
.check-update-status { text-align: center; font-size: 13px; margin-top: 8px; color: var(--muted); }
.check-update-status.ok { color: #4ade80; }
.check-update-status.warn { color: var(--error); }

/* ===== Export/import buttons in Settings ===== */
.data-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.data-btn {
  width: 100%;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}
.data-btn-import { display: block; }

/* ===== Goals ===== */
.goals-empty { background: var(--panel); border: 1px dashed var(--border); border-radius: 12px; padding: 20px; text-align: center; color: var(--muted); margin-bottom: 16px; font-size: 13px; }
.goals-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.goal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.goal-reached {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(80, 200, 80, 0.06));
  border-color: #22c55e;
}
.goal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.goal-title { font-weight: 600; font-size: 15px; flex: 1; }
.goal-del { background: rgba(255,255,255,0.05); border: 0; color: var(--muted); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 11px; padding: 0; }
.goal-progress { margin-bottom: 8px; }
.goal-bar { height: 10px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.goal-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1); }
.goal-reached .goal-bar-fill { background: linear-gradient(90deg, #22c55e, #16a34a); }
.goal-stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.goal-bump { width: 100%; padding: 8px; margin-top: 8px; font-size: 13px; }

.goals-section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 18px 0 10px; }
.goals-presets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 600px) { .goals-presets { grid-template-columns: 1fr 1fr; } }
.goal-preset {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}
.goal-preset-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.goal-preset-sub { font-size: 11px; color: var(--muted); }

.goals-custom { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px 14px; }
.goals-custom summary { cursor: pointer; padding: 6px 0; font-weight: 600; font-size: 13px; }
.goals-custom-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 12px; }
.goals-custom-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.goals-custom-form input[type="text"], .goals-custom-form input[type="number"] {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 14px;
}
.goals-custom-row { flex-direction: row !important; align-items: center; gap: 8px !important; }
.goals-custom-form button { padding: 10px; margin-top: 4px; }
.kubik-version {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  opacity: 0.6;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.update-banner { background: linear-gradient(135deg, #22c55e, #16a34a) !important; }
.update-now-btn {
  background: rgba(255, 255, 255, 0.95);
  color: #16a34a;
  border: 0;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Per-section tab filtering. Each tab is tagged with data-section
   (cube / fitness / progress / study / games); body[data-section] controls
   which are shown. */
body[data-section="cube"]     .tabs button:not([data-section="cube"])     { display: none !important; }
body[data-section="fitness"]  .tabs button:not([data-section="fitness"])  { display: none !important; }
body[data-section="progress"] .tabs button:not([data-section="progress"]) { display: none !important; }
body[data-section="study"]    .tabs button:not([data-section="study"])    { display: none !important; }
body[data-section="games"]    .tabs button:not([data-section="games"])    { display: none !important; }
body[data-section="editor"]   .tabs button:not([data-section="editor"])   { display: none !important; }
body[data-section="streak"]   .tabs button:not([data-section="streak"])   { display: none !important; }

/* Desktop: show ALL tabs regardless of section. Filter is mobile-only,
   where bottom-bar is space-constrained. On big screens horizontal scroll
   handles many tabs fine. */
@media (min-width: 760px) {
  body[data-section] .tabs button[data-section] { display: inline-flex !important; }
}

/* Монтаж — desktop-only: ffmpeg.wasm + video preview не для телефона. */
@media (max-width: 699px) {
  .tabs button[data-section="editor"] { display: none !important; }
}

/* ===== Hub start screen ===== */
.hub-screen {
  position: fixed;
  inset: 0;
  z-index: 950;
  background:
    radial-gradient(circle at 20% 30%, rgba(120, 90, 240, 0.35), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(60, 140, 230, 0.3), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(230, 80, 160, 0.25), transparent 60%),
    #0a0a18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  transition: opacity 0.5s, transform 0.5s;
}
.hub-screen[hidden] { display: none !important; }
.hub-screen.hub-leaving { opacity: 0; transform: scale(1.06); pointer-events: none; }

.hub-intro {
  text-align: center;
  animation: hub-intro-in 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.hub-intro-leaving { animation: hub-intro-out 0.5s ease-in forwards; }
@keyframes hub-intro-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hub-intro-out {
  to { opacity: 0; transform: translateY(-40px); }
}
.hub-title-big {
  font-size: clamp(28px, 8vw, 44px);
  font-weight: 800;
  margin: 0 0 12px;
  color: white;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.hub-subtitle {
  font-size: clamp(14px, 3vw, 18px);
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.hub-main {
  width: 100%;
  max-width: 480px;
  text-align: center;
  animation: hub-main-in 0.6s 0.1s cubic-bezier(0.34, 1.4, 0.55, 1) backwards;
}
.hub-main[hidden] { display: none; }
@keyframes hub-main-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hub-title-small {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 30px;
}

.hub-cube-stage {
  perspective: 900px;
  width: 100%;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  margin-bottom: 24px;
}
.hub-cube-stage:active { cursor: grabbing; }

.hub-cube {
  position: relative;
  width: 240px;
  height: 240px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.55, 1);
}

.hub-face {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: filter 0.4s, box-shadow 0.4s, transform 0.4s;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.hub-face-active {
  box-shadow:
    0 20px 50px rgba(120, 90, 240, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.hub-face:not(.hub-face-active) { filter: brightness(0.55); }

.hub-face-icon {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}
.hub-face-name {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin-bottom: 6px;
}
.hub-face-tags {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 18px;
  letter-spacing: 0.3px;
}
.hub-face-go {
  background: linear-gradient(135deg, #8b5cf6, #4f8cf2);
  color: white;
  border: 0;
  padding: 10px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(120, 90, 240, 0.45);
}

.hub-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
}
.hub-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.3s, transform 0.3s;
}
.hub-dot.active { background: white; transform: scale(1.3); }

.hub-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.3px;
}

#hub-home-btn {
  background: transparent;
  border: 0;
  font-size: 18px;
  padding: 6px 10px;
  color: var(--text);
}

/* ===== Fitness module ===== */
.fitness-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: center;
  color: var(--muted);
}

.fitness-dacha {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.04));
  border: 1px solid #22c55e;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 4px 14px;
}
.fitness-dacha summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
}
.fitness-dacha summary::-webkit-details-marker { display: none; }
.fitness-dacha-body { padding: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.fitness-dacha-body p { margin: 8px 0; }
.fitness-dacha-body b { color: var(--text); }
.fitness-dacha-body ul { margin: 4px 0; padding-left: 18px; }
.fitness-dacha-body li { margin: 6px 0; }
.fitness-cat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.fitness-cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.fitness-cat-icon { font-size: 28px; }
.fitness-cat-name { font-size: 18px; font-weight: 700; }
.fitness-cat-tagline { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fitness-workouts { display: flex; flex-direction: column; gap: 10px; }
.fitness-workout {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.fitness-workout-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.fitness-workout-name { font-weight: 600; font-size: 15px; }
.fitness-workout-time { font-size: 12px; color: var(--muted); }
.fitness-workout-desc { font-size: 13px; color: var(--muted); line-height: 1.4; margin-bottom: 10px; }
.fitness-start { width: 100%; padding: 10px; }

.fitness-player-overlay {
  position: fixed;
  inset: 0;
  z-index: 940;
  background: #0a0a18;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modal-fade-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.fitness-player-overlay[hidden] { display: none !important; }
.fitness-player {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(120, 90, 240, 0.18));
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 32px 16px;
  text-align: center;
  width: 100%;
  max-width: 480px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: card-spring 0.5s cubic-bezier(0.34, 1.45, 0.5, 1);
}

/* Weekly rhythm grid */
.fitness-weekplan {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.fitness-weekplan-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.fitness-weekplan-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.fitness-weekday {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
}
.fitness-weekday-today {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.4), rgba(80, 140, 240, 0.3));
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(120, 90, 240, 0.3);
}
.wd-name { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.fitness-weekday-today .wd-name { color: white; }
.wd-task { font-size: 11px; font-weight: 600; }

/* ===== Step counter widget ===== */
.steps-card {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(79, 140, 242, 0.1));
  border: 1px solid #22c55e;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.steps-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.steps-card-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.steps-card-value { font-size: 28px; font-weight: 800; }
.steps-card-value span { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.steps-controls { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.steps-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.steps-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden; }
.steps-bar-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #4f8cf2); transition: width 0.4s; }

/* ===== Cold shower card ===== */
.cold-card {
  background: linear-gradient(135deg, rgba(80, 140, 240, 0.22), rgba(40, 180, 220, 0.12));
  border: 1px solid #4f8cf2;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.cold-card-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.cold-card-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.cold-card-current { font-size: 28px; font-weight: 800; }
.cold-card-current span { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.cold-card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cold-btn {
  background: linear-gradient(135deg, #4f8cf2, #2563eb);
  color: white; border: 0;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}
.cold-btn.cold-done { background: rgba(34, 197, 94, 0.6); cursor: default; }

/* ===== Fitness section title ===== */
.fit-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 10px;
}

/* ===== Fitness badges ===== */
.fit-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.fit-badge {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  opacity: 0.5;
}
.fit-badge-on { opacity: 1; border-color: var(--accent); background: linear-gradient(135deg, rgba(120, 90, 240, 0.15), rgba(80, 140, 240, 0.05)); }
.fit-badge-icon { font-size: 28px; margin-bottom: 4px; }
.fit-badge-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.fit-badge-desc { font-size: 11px; color: var(--muted); line-height: 1.3; }

/* ===== Fitness history ===== */
.fit-history {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
}
.fit-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.fit-history-row:last-child { border-bottom: 0; }
.fit-history-name { font-weight: 500; }
.fit-history-date { font-family: ui-monospace, monospace; color: var(--muted); font-size: 12px; }

/* ===== Food diary ===== */
.food-today {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.food-total {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--muted);
  padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.food-total b { font-size: 22px; color: var(--text); }
.food-empty { font-size: 13px; color: var(--muted); padding: 12px 0; text-align: center; }
.food-list { display: flex; flex-direction: column; gap: 6px; }
.food-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 8px 10px;
}
.food-name { flex: 1; font-size: 13px; }
.food-cal { font-size: 12px; color: var(--muted); }
.food-del {
  width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.08); color: var(--muted);
  cursor: pointer; font-size: 11px;
}
.food-section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 14px 0 8px; }
.food-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.food-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.food-preset span { color: var(--muted); font-size: 11px; }
.food-custom { display: grid; grid-template-columns: 2fr 1fr auto; gap: 6px; }
.food-custom input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.food-custom button { padding: 8px 14px; }

/* ===== Theory articles ===== */
.theory-list { display: flex; flex-direction: column; gap: 10px; }
.theory-article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.theory-article summary {
  cursor: pointer;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
}
.theory-article summary::-webkit-details-marker { display: none; }
.theory-icon { font-size: 28px; flex-shrink: 0; }
.theory-summary { flex: 1; }
.theory-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.theory-tagline { font-size: 12px; color: var(--muted); line-height: 1.3; }
.theory-body {
  padding: 0 14px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.theory-body p { margin: 8px 0; }
.theory-body b { color: var(--accent); }
.theory-body ul, .theory-body ol { margin: 6px 0; padding-left: 22px; }
.theory-body li { margin: 4px 0; }
.theory-body h4 { margin: 14px 0 4px; font-size: 14px; }

/* ===== Study tutor ===== */
.study-pomo-btn {
  width: 100%;
  padding: 14px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.study-topics { display: flex; flex-direction: column; gap: 10px; }
.study-topic {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.study-topic.study-done { border-color: #22c55e; }
.study-topic summary {
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  font-weight: 600;
}
.study-topic summary::-webkit-details-marker { display: none; }
.study-check { font-size: 16px; width: 18px; color: var(--muted); }
.study-done .study-check { color: #22c55e; }
.study-tname { flex: 1; }
.study-explain {
  padding: 0 14px 14px;
  font-size: 14px;
  line-height: 1.6;
}
.study-explain p { margin: 8px 0; }
.study-explain h4 { margin: 12px 0 4px; font-size: 14px; }
.study-explain ul, .study-explain ol { margin: 6px 0; padding-left: 22px; }
.study-explain li { margin: 4px 0; }
.study-explain code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}
.study-explain b { color: var(--accent); }
.study-ex-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 14px 8px;
}
.study-ex-list { display: flex; flex-direction: column; gap: 8px; padding: 0 14px; }
.study-ex {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.study-ex-q { font-size: 14px; margin-bottom: 8px; }
.study-ex-show {
  background: rgba(120, 90, 240, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.study-ex-a { font-size: 13px; margin-top: 8px; color: #4ade80; }
.study-mark-done { margin: 14px; width: calc(100% - 28px); padding: 10px; }

.study-toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.study-toolbar button {
  flex: 1;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  border: 0;
  color: white;
}
.study-pomo-btn {
  background: linear-gradient(135deg, #ef4444, #f97316);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  margin-bottom: 0 !important;
}
.study-test-btn {
  background: linear-gradient(135deg, #4f8cf2, #8b5cf6);
  box-shadow: 0 4px 12px rgba(80, 140, 240, 0.35);
}

.study-fresh-tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #4ade80;
  font-weight: 600;
}
.study-new-tag {
  display: inline-block;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.study-topic.study-remote { border-color: #22c55e; }

/* ===== Study test modal ===== */
.study-test-modal {
  position: fixed;
  inset: 0;
  z-index: 925;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modal-fade-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.study-test-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.study-test-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px;
  max-width: 480px;
  width: 100%;
  animation: modal-pop-in 0.32s cubic-bezier(0.34, 1.42, 0.55, 1);
}
.study-test-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.study-test-topic { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.study-test-q { font-size: 17px; font-weight: 600; margin-bottom: 20px; line-height: 1.5; }
.study-test-a {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid #22c55e;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.study-test-actions { display: flex; gap: 8px; }
.study-test-actions button { flex: 1; padding: 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.05); color: var(--text); }
.study-test-actions button.study-test-right { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; border: 0; }
.study-test-actions button.study-test-wrong { background: rgba(239, 68, 68, 0.18); color: var(--error); border-color: var(--error); }
.study-test-close {
  position: absolute; top: 10px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
}

.study-test-finish { text-align: center; padding: 36px 22px; }
.study-test-finish-icon { font-size: 64px; margin-bottom: 14px; }
.study-test-finish-score { font-size: 48px; font-weight: 900; background: linear-gradient(135deg, var(--accent), #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.study-test-finish-text { font-size: 15px; color: var(--muted); margin: 12px 0 22px; }
.study-test-close-btn { width: 100%; padding: 12px; }

/* ===== Today's plan banner ===== */
.study-today-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.study-today-mine {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(80, 200, 80, 0.06));
  border-color: #22c55e;
}
.study-today-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.study-today-mine .study-today-tag { color: #22c55e; }
.study-today-next { font-size: 14px; }
.study-today-next b { color: var(--accent); }
.study-jump { padding: 8px 16px; font-size: 13px; margin-top: 8px; }

/* ===== Study achievements in Progress ===== */
.study-ach-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.study-ach-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.study-ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.study-ach {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  opacity: 0.5;
}
.study-ach-on { opacity: 1; border-color: #4f8cf2; background: linear-gradient(135deg, rgba(120, 90, 240, 0.18), rgba(80, 140, 240, 0.06)); }
.study-ach-icon { font-size: 22px; margin-bottom: 2px; }
.study-ach-name { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.study-ach-desc { font-size: 10px; color: var(--muted); line-height: 1.2; }

/* ===== Study: sections, locks, cooldown, spaced repetition ===== */
.study-section-tabs {
  display: flex;
  gap: 6px;
  margin: 12px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.study-section-tabs::-webkit-scrollbar { display: none; }
.study-sec-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s;
}
.study-sec-tab:active { transform: scale(0.97); }
.study-sec-tab.active {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-color: transparent;
  color: white;
}
.study-sec-icon { font-size: 14px; }
.study-sec-progress {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.75;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}
.study-sec-tab.active .study-sec-progress { background: rgba(255, 255, 255, 0.2); }

/* Locked topic — flat card, no expand */
.study-topic.study-locked {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(120, 120, 120, 0.18);
  opacity: 0.62;
  cursor: not-allowed;
}
.study-locked-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}
.study-locked .study-check { color: #9a9a9a; font-size: 16px; padding-top: 2px; }
.study-locked-text { flex: 1; min-width: 0; }
.study-locked .study-tname { color: var(--muted); font-weight: 600; }
.study-locked-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
  opacity: 0.78;
}
.study-locked-hint b {
  color: var(--accent);
  font-weight: 700;
}

/* Due-for-review topic — highlighted */
.study-topic.study-due {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10), rgba(245, 158, 11, 0.02));
}
.study-due .study-check { color: #f59e0b; }
.study-due-tag {
  font-size: 10px;
  font-weight: 800;
  background: #f59e0b;
  color: #1a1a1a;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.4px;
  margin-left: 4px;
}

/* "Повторить сегодня" section block */
.study-review-section {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), transparent);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px;
  padding: 12px 12px 14px;
  margin-bottom: 14px;
}
.study-review-head {
  font-size: 14px;
  font-weight: 700;
  color: #f59e0b;
  margin-bottom: 10px;
  padding: 0 4px;
}
.study-review-section .study-topics { gap: 8px; }

/* Review buttons (Помню / Забыл) */
.study-mark-row {
  display: flex;
  gap: 8px;
  margin: 14px;
  width: calc(100% - 28px);
}
.study-mark-row button {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.study-mark-easy {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  border: 0 !important;
  color: white !important;
}
.study-mark-good {
  background: rgba(80, 140, 240, 0.15) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.study-mark-again {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--error) !important;
  color: var(--error) !important;
}
.study-mark-row-3 button {
  font-size: 13px;
  padding: 10px 6px;
}

.study-review-hint {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin: -8px 14px 12px;
  line-height: 1.4;
  opacity: 0.75;
}

.study-done-footer {
  margin: 14px;
  padding: 10px 14px;
  text-align: center;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.study-done-footer b { color: #22c55e; }

/* Test mode chooser */
.study-test-modes {
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.study-test-mode {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s, background 0.15s;
}
.study-test-mode:active { transform: scale(0.98); }
.study-test-mode:hover { background: rgba(255, 255, 255, 0.08); }
.study-test-mode[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.study-test-mode.primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: 0;
  color: white;
}
.study-mode-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 3px;
}
.study-mode-sub {
  font-size: 12px;
  opacity: 0.75;
}

/* Wrong answers list on test finish */
.study-wrong-list {
  margin: 16px 0 8px;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
}
.study-wrong-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.study-wrong-item {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.study-wrong-topic {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.study-wrong-q {
  font-size: 13px;
  margin-bottom: 4px;
}
.study-wrong-a {
  font-size: 13px;
  font-weight: 600;
  color: #4ade80;
}
.study-test-perfect {
  margin: 14px 0;
  font-size: 14px;
  color: #4ade80;
  font-weight: 600;
}

/* ===== Ranks block (progress page) ===== */
.ranks-block {
  margin: 16px 0 18px;
}
.ranks-block-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 4px;
}
.ranks-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rank-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--rank-color, var(--accent));
  border-radius: 14px;
  padding: 12px 14px;
  overflow: hidden;
}
.rank-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.rank-icon { font-size: 20px; }
.rank-area {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.rank-pos {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
}
.rank-current {
  font-size: 20px;
  font-weight: 800;
  color: var(--rank-color, var(--accent));
  margin-bottom: 4px;
  line-height: 1.1;
}
.rank-stats {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.rank-next {
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  color: var(--text);
}
.rank-next b { color: var(--text); font-weight: 700; }
.rank-next-cond {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.rank-max {
  font-size: 12px;
  color: #ffd700;
  font-weight: 700;
  text-align: center;
  padding: 6px;
  background: rgba(255, 215, 0, 0.08);
  border-radius: 8px;
}

/* ===== Today (Главная) ===== */
.today-greet {
  margin: 4px 0 18px;
  text-align: left;
}
.today-hello {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}
.today-date {
  font-size: 13px;
  color: var(--muted);
  text-transform: capitalize;
}
.today-streak {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 5px 11px;
  border-radius: 999px;
}
.today-streak b { color: #f59e0b; font-weight: 800; }

.today-xp-card {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.18), rgba(80, 140, 240, 0.06));
  border: 1px solid rgba(120, 90, 240, 0.35);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.today-xp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.today-xp-level {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
.today-xp-level b {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent);
  margin-left: 4px;
}
.today-xp-total {
  font-size: 14px;
  font-weight: 700;
  color: #8b5cf6;
}
.today-xp-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.today-xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.today-xp-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  text-align: right;
}

.today-quest-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.today-quest-card.today-quest-done {
  border-color: #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.10), rgba(34, 197, 94, 0.02));
}
.today-quest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.today-quest-title {
  font-size: 16px;
  font-weight: 800;
}
.today-quest-pos {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
.today-quest-badge {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  text-align: center;
  margin-bottom: 12px;
}
.today-quest-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.today-quest-hint b { color: var(--accent); }
.today-quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.today-task {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: opacity 0.2s, background 0.2s;
}
.today-task.today-task-done {
  opacity: 0.6;
  background: rgba(34, 197, 94, 0.05);
  border-color: rgba(34, 197, 94, 0.3);
}
.today-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.today-task-check {
  font-size: 18px;
  width: 22px;
  text-align: center;
}
.today-task-icon { font-size: 20px; }
.today-task-text { flex: 1; min-width: 0; }
.today-task-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.today-task-goal {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.today-task-prog {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  font-weight: 700;
  color: var(--text);
  font-size: 11px;
}
.today-task-done .today-task-prog {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.today-task-jump {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.today-task-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.today-task-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.today-task-done .today-task-bar-fill {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.today-tip {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  line-height: 1.5;
}

/* Assistant tip */
.today-assistant {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(80, 140, 240, 0.12), rgba(80, 140, 240, 0.02));
  border: 1px solid rgba(80, 140, 240, 0.30);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.today-assistant-icon { font-size: 26px; }
.today-assistant-text { flex: 1; min-width: 0; }
.today-assistant-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
}
.today-assistant-msg { font-size: 13px; line-height: 1.4; }
.today-assistant-meta { color: var(--muted); font-size: 11px; }
.today-assistant-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent);
  border: 0;
  color: white;
  white-space: nowrap;
  cursor: pointer;
}

/* Random task card */
.today-random-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.today-random-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.today-random-title { font-size: 14px; font-weight: 700; }
.today-random-reroll {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.today-random-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  margin-bottom: 10px;
}
.today-random-icon { font-size: 26px; }
.today-random-text { font-size: 14px; font-weight: 600; }
.today-random-pick,
.today-random-go {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}

/* Evening report */
.today-evening-card {
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.today-evening-good {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(34, 197, 94, 0.02));
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.today-evening-mid {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10), rgba(245, 158, 11, 0.02));
  border: 1px solid rgba(245, 158, 11, 0.32);
}
.today-evening-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.today-evening-title { font-size: 15px; font-weight: 800; }
.today-evening-score {
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.today-evening-good .today-evening-score {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.today-evening-verdict {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
  font-style: italic;
  opacity: 0.85;
}
.today-evening-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.today-evening-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}
.today-evening-item span:nth-child(2) { flex: 1; }
.today-evening-prog {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}
.today-evening-no { opacity: 0.7; }
.today-evening-diary {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* ===== Records ===== */
.records-block {
  margin-bottom: 18px;
}
.records-block-head {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 10px;
}
.records-subhead {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.records-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.record-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.record-card.record-hl {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.15), rgba(80, 140, 240, 0.04));
  border-color: rgba(120, 90, 240, 0.35);
  grid-column: span 2;
}
.record-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
  font-weight: 600;
}
.record-value {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}
.record-hl .record-value {
  font-size: 30px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.records-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  font-size: 13px;
}
.record-row-label { color: var(--muted); font-weight: 600; }
.record-row-value { font-weight: 700; }
.record-delta {
  font-size: 11px;
  color: #22c55e;
  font-weight: 600;
  margin-left: 4px;
}
.records-empty {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  font-style: italic;
}

/* Posture of the day */
.posture-of-day {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.02));
  border: 1px solid rgba(34, 197, 94, 0.32);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.posture-of-day-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.posture-of-day-icon { font-size: 22px; }
.posture-of-day-name {
  font-size: 16px;
  font-weight: 800;
  color: #22c55e;
}
.posture-of-day-desc {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}
.posture-of-day-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* Photos: thumbnail click + lightbox */
.photo-thumb { cursor: pointer; }
.photos-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photos-lightbox[hidden] { display: none; }
.photos-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(6px);
}
.photos-lightbox-inner {
  position: relative;
  z-index: 1;
  width: 96%;
  max-width: 720px;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.photos-lightbox-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: white;
  font-size: 18px;
  cursor: pointer;
}
.photos-lightbox-date {
  color: white;
  font-size: 13px;
  opacity: 0.85;
  font-weight: 600;
}
.photos-lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.photos-lightbox-nav {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.photos-lightbox-nav button {
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.photos-lightbox-nav button[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== Mini-games ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.game-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: transform 0.1s, background 0.15s;
}
.game-card:active { transform: scale(0.97); }
.game-card:hover { background: rgba(255, 255, 255, 0.04); }
.game-card-icon { font-size: 36px; margin-bottom: 6px; }
.game-card-name { font-size: 15px; font-weight: 800; margin-bottom: 3px; }
.game-card-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.3; }
.game-card-best {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 7px;
  display: inline-block;
}
.game-card-best b { color: var(--accent); }

.game-back {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 14px;
}
.game-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.game-instr {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Reaction game */
.react-stage {
  width: 100%;
  height: 280px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  font-size: 22px;
  font-weight: 800;
  color: white;
  text-align: center;
  padding: 20px;
  white-space: pre-line;
  background: rgba(80, 140, 240, 0.18);
  border: 2px solid rgba(80, 140, 240, 0.4);
  transition: background 0.1s;
}
.react-stage.react-wait {
  background: #ef4444;
  border-color: #ef4444;
}
.react-stage.react-ready {
  background: #22c55e;
  border-color: #22c55e;
}
.react-stage.react-fail {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}
.react-stage.react-done {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
}
.react-stats {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Memory game */
.memo-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}
.memo-stats b { color: var(--accent); }
.memo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.memo-card {
  aspect-ratio: 1;
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: 0;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: transform 0.15s;
}
.memo-card:active { transform: scale(0.96); }
.memo-card.memo-opened {
  background: rgba(255, 255, 255, 0.08);
}
.memo-card.memo-matched {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.45);
  cursor: default;
}

/* Stroop */
.stroop-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}
.stroop-stats b { color: var(--accent); }
.stroop-word {
  font-size: 60px;
  font-weight: 900;
  text-align: center;
  margin: 24px 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
}
.stroop-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stroop-btn {
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

/* Odd one out */
.odd-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}
.odd-stats b { color: var(--accent); }
.odd-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 4px;
}
.odd-cell {
  aspect-ratio: 1;
  font-size: clamp(18px, 6vw, 32px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-family: monospace;
}
.odd-cell:active { transform: scale(0.93); }
.odd-cell.odd-wrong {
  background: rgba(239, 68, 68, 0.4);
}

/* Common game action button */
.game-action {
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* Numbers game */
.numbers-stats, .simon-stats, .math-stats, .eng-stats, .logic-stats, .rot-stats, .pairs-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}
.numbers-stats b, .simon-stats b, .math-stats b, .eng-stats b,
.logic-stats b, .rot-stats b, .pairs-stats b { color: var(--accent); }

.numbers-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  min-height: 180px;
  justify-content: center;
}
.num-display {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: 6px;
  font-family: monospace;
  color: var(--accent);
  text-align: center;
}
.num-input {
  width: 80%;
  max-width: 320px;
  padding: 14px;
  font-size: 24px;
  font-family: monospace;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.num-result {
  font-size: 18px;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  width: 100%;
}
.num-result.num-ok { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.num-result.num-fail { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* Simon */
.simon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.simon-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 18px;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.simon-cell:not(:disabled):active { transform: scale(0.95); }
.simon-cell.simon-on { opacity: 1; box-shadow: 0 0 30px currentColor; }
.simon-action { text-align: center; }

/* Math / English / Logic sprint */
.math-question, .eng-question, .logic-question {
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  margin: 24px 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  line-height: 1.3;
}
.eng-question, .logic-question { font-size: 20px; font-weight: 600; }
.math-options, .eng-options, .logic-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.math-opt, .eng-opt, .logic-opt {
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.math-opt:active, .eng-opt:active, .logic-opt:active { transform: scale(0.97); }

/* Rotate game */
.rot-question {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0;
}
.rot-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rot-svg {
  color: var(--accent);
}
.rot-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.rot-opt {
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
}
.rot-opt:active { transform: scale(0.97); }

/* Pairs */
.pairs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.pair-cell {
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  min-height: 50px;
}
.pair-cell:active { transform: scale(0.97); }
.pair-cell.pair-picked {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: 0;
  color: white;
}
.pair-cell.pair-matched {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.45);
  color: #22c55e;
  cursor: default;
}

/* ===== Video editor ===== */
.editor-page {
  max-width: 920px;
  margin: 0 auto;
}
.editor-mobile-warn {
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
}
.editor-load {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  margin: 16px 0 8px;
}
.editor-tip {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.editor-fileinfo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}
.editor-fileinfo b { color: var(--accent); }
.editor-clear {
  margin-left: auto;
  font-size: 11px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.editor-video {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: 12px;
  margin-bottom: 14px;
  display: block;
}
.editor-marks {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}
.editor-mark-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.editor-mark-row:last-child { margin-bottom: 0; }
.editor-mark-btn {
  font-size: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.editor-mark-val {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  padding: 4px 10px;
  background: rgba(80, 140, 240, 0.10);
  border-radius: 6px;
  min-width: 60px;
  text-align: center;
}
.editor-mark-dash {
  color: var(--muted);
  font-size: 18px;
}
.editor-add-clip {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
}
.editor-clips {
  margin-bottom: 14px;
}
.editor-clips-head {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.editor-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  font-style: italic;
}
.editor-clips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.editor-clip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.editor-clip-n {
  font-weight: 700;
  color: var(--accent);
  min-width: 22px;
}
.editor-clip-time {
  flex: 1;
  font-family: monospace;
}
.editor-clip-dur {
  color: var(--muted);
  font-size: 11px;
  margin-left: 4px;
}
.editor-clip-jump,
.editor-clip-del {
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.editor-clip-del {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.30);
  color: #ef4444;
}
.editor-export {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.12), rgba(80, 140, 240, 0.04));
  border: 1px solid rgba(120, 90, 240, 0.30);
  border-radius: 14px;
  padding: 16px;
}
.editor-export-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
}
.editor-export-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.editor-export-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}
.editor-progress {
  margin-top: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.editor-progress-text {
  font-size: 12px;
  margin-bottom: 8px;
}
.editor-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.editor-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  width: 0%;
  transition: width 0.3s;
}

/* Intro button & clip */
.editor-intro-btn {
  background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
  border: 0 !important;
}
.editor-clip.editor-clip-intro {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10), rgba(245, 158, 11, 0.02));
  border-color: rgba(245, 158, 11, 0.40);
}
.editor-clip-icon { font-size: 18px; }
.editor-clip-up, .editor-clip-down {
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.editor-clip-up[disabled], .editor-clip-down[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Intro chooser dialog */
.editor-dialog {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.editor-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.editor-dialog-card {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: 92%;
  max-width: 420px;
}
.editor-dialog-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
}
.editor-dialog-row {
  margin-bottom: 14px;
}
.editor-dialog-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}
.editor-dialog-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
}
.editor-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.editor-dialog-btn {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.editor-dialog-btn.primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: 0;
  color: white;
}

.study-mark-done[disabled] {
  opacity: 0.6;
  cursor: default;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.4);
  font-size: 12px;
}

.study-empty-section {
  padding: 30px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

/* Mobile tweaks */
@media (max-width: 700px) {
  .study-sec-tab { padding: 7px 12px; font-size: 12px; }
  .study-sec-progress { font-size: 10px; }
  .study-locked-row { padding: 12px 10px; gap: 8px; }
  .study-cooldown { font-size: 11px; padding: 3px 8px; }
}

/* ===== Weather widget ===== */
.weather-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(80, 140, 240, 0.18), rgba(140, 80, 240, 0.1));
  border: 1px solid rgba(80, 140, 240, 0.4);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
}
.weather-icon { font-size: 44px; line-height: 1; }
.weather-info { flex: 1; }
.weather-temp { font-size: 26px; font-weight: 800; line-height: 1; }
.weather-label { font-size: 13px; color: var(--text); margin-top: 2px; }
.weather-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.weather-locate {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
}
.weather-loading, .weather-offline {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ===== Quick tools row ===== */
.quick-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.quick-tool {
  flex: 1;
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.18), rgba(80, 140, 240, 0.08));
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== Schulte modal ===== */
.schulte-modal {
  position: fixed; inset: 0; z-index: 930;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  animation: modal-fade-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.schulte-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.schulte-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 18px;
  max-width: 460px;
  width: 100%;
  animation: modal-pop-in 0.32s cubic-bezier(0.34, 1.42, 0.55, 1);
}
.schulte-close {
  position: absolute; top: 10px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
}
.schulte-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.schulte-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.4; }
.schulte-stats {
  display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}
.schulte-stats b { color: var(--accent); font-size: 16px; }
.schulte-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.schulte-cell {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.schulte-cell:active { transform: scale(0.95); }
.schulte-cell.schulte-done { background: rgba(34, 197, 94, 0.4); color: white; }
.schulte-cell.schulte-wrong { background: rgba(239, 68, 68, 0.5); }
.schulte-restart, .schulte-close-btn {
  width: 100%;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
}
.schulte-finish { text-align: center; padding: 36px 18px; }
.schulte-finish-icon { font-size: 64px; margin-bottom: 12px; }
.schulte-finish-time {
  font-size: 56px; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.schulte-finish-text { font-size: 14px; color: var(--muted); margin-bottom: 22px; }
.schulte-finish-actions { display: flex; gap: 8px; }

/* ===== Surprise card ===== */
.surprise-card {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 70px);
  left: 12px; right: 12px;
  z-index: 850;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.95), rgba(120, 90, 240, 0.95));
  color: white;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: reminder-in 0.45s cubic-bezier(0.34, 1.42, 0.55, 1);
  backdrop-filter: blur(14px);
}
.surprise-out { animation: reminder-out 0.32s ease-in forwards; }
.surprise-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.surprise-emoji { font-size: 22px; }
.surprise-title { font-weight: 700; font-size: 14px; flex: 1; }
.surprise-close {
  background: rgba(255, 255, 255, 0.2);
  border: 0; color: white;
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
}
.surprise-body { font-size: 14px; line-height: 1.5; }

/* ===== Diary ===== */
.diary-write {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}
.diary-write textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.diary-write button { width: 100%; padding: 12px; }
.diary-empty { background: var(--panel); border: 1px dashed var(--border); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.diary-list { display: flex; flex-direction: column; gap: 6px; }
.diary-entry {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.diary-entry summary {
  cursor: pointer;
  list-style: none;
  display: flex; flex-direction: column; gap: 2px;
}
.diary-entry summary::-webkit-details-marker { display: none; }
.diary-date { font-size: 11px; color: var(--muted); }
.diary-preview { font-size: 14px; }
.diary-text { margin-top: 10px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

.diary-mood-row {
  margin-bottom: 12px;
}
.diary-mood-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 700;
}
.diary-mood-buttons {
  display: flex;
  gap: 6px;
}
.diary-mood {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 4px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.diary-mood:active { transform: scale(0.96); }
.diary-mood-icon { font-size: 24px; line-height: 1; }
.diary-mood-name { font-size: 10px; color: var(--muted); }
.diary-mood-on {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: 0;
  color: white;
}
.diary-mood-on .diary-mood-name { color: white; opacity: 0.85; }

.diary-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.diary-prompt {
  font-size: 11px;
  background: rgba(80, 140, 240, 0.08);
  border: 1px solid rgba(80, 140, 240, 0.3);
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  width: auto;
}
.diary-prompt:active { transform: scale(0.97); }

.diary-entry-mood {
  font-size: 14px;
  margin-right: 6px;
}
.diary-entry summary {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  flex-wrap: wrap;
}
.diary-date { white-space: nowrap; }
.diary-preview { flex: 1; min-width: 0; }
/* ===== Weekly competition card ===== */
.weekly-card {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.18), rgba(80, 140, 240, 0.06));
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.weekly-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; gap: 6px; }
.weekly-title { font-size: 15px; font-weight: 700; }
.weekly-sub { font-size: 11px; color: var(--muted); }
.weekly-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}
.weekly-row-icon { font-size: 18px; }
.weekly-row-label { color: var(--text); }
.weekly-row-this { font-weight: 700; font-size: 17px; }
.weekly-row-delta { font-size: 12px; }
.weekly-delta { padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 11px; }
.weekly-up { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.weekly-down { background: rgba(239, 68, 68, 0.2); color: var(--error); }

.weekly-spark-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 14px 0 6px; }
.weekly-spark { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; height: 70px; align-items: end; padding: 4px; background: rgba(255, 255, 255, 0.04); border-radius: 8px; }
.weekly-bar-wrap { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.weekly-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), #8b5cf6);
  border-radius: 4px 4px 0 0;
  transition: height 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.weekly-bar-label { font-size: 9px; color: var(--muted); margin-top: 2px; height: 10px; }
.weekly-footer { font-size: 11px; color: var(--muted); margin-top: 8px; font-style: italic; }
.weekly-empty { text-align: center; padding: 14px; color: var(--muted); font-size: 13px; }

.diary-del {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  margin-top: 8px;
  cursor: pointer;
}

/* ===== Pomodoro overlay ===== */
.pomodoro-overlay {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 80px);
  right: 14px;
  z-index: 920;
  animation: card-spring 0.5s cubic-bezier(0.34, 1.45, 0.5, 1);
}
.pomo-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(249, 115, 22, 0.95));
  color: white;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  text-align: center;
  min-width: 160px;
}
.pomo-card.pomo-rest { background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(80, 200, 80, 0.95)); }
.pomo-label { font-size: 11px; opacity: 0.85; margin-bottom: 4px; }
.pomo-time { font-size: 36px; font-weight: 800; font-family: ui-monospace, monospace; line-height: 1; margin-bottom: 8px; }
.pomo-stop {
  background: rgba(255, 255, 255, 0.25);
  border: 0;
  color: white;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

/* ===== Science (article of the day) ===== */
.sci-today {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.2), rgba(80, 140, 240, 0.1));
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.sci-today-label { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; }
.sci-today-cat { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sci-today-title { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.sci-today-body { font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.sci-today-body p { margin: 8px 0; }
.sci-today-body h4 { margin: 12px 0 4px; font-size: 14px; }
.sci-today-body ul, .sci-today-body ol { margin: 6px 0; padding-left: 22px; }
.sci-today-body li { margin: 4px 0; }
.sci-today-body b { color: var(--accent); }
.sci-mark-read { width: 100%; padding: 10px; }

.sci-section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 18px 0 10px; }
.sci-archive { display: flex; flex-direction: column; gap: 6px; }
.sci-article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sci-article.sci-read { opacity: 0.7; }
.sci-article summary {
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}
.sci-article summary::-webkit-details-marker { display: none; }
.sci-check { font-size: 14px; width: 18px; text-align: center; color: var(--muted); }
.sci-read .sci-check { color: #22c55e; }
.sci-summary { flex: 1; }
.sci-cat { font-size: 10px; color: var(--muted); }
.sci-title { font-size: 14px; font-weight: 600; }
.sci-body { padding: 0 12px 12px; font-size: 13px; line-height: 1.6; }
.sci-body p { margin: 6px 0; }
.sci-body h4 { margin: 10px 0 4px; font-size: 13px; }
.sci-body ul, .sci-body ol { margin: 4px 0; padding-left: 20px; }
.sci-body b { color: var(--accent); }
.sci-body li { margin: 3px 0; }
.fitness-player.fitness-rest {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(80, 140, 240, 0.15));
}
.fitness-step-num { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.fitness-step-name { font-size: clamp(28px, 7vw, 40px); font-weight: 800; margin-bottom: 18px; }
.fitness-step-time { font-size: clamp(80px, 22vw, 140px); font-weight: 900; line-height: 1; font-family: ui-monospace, monospace; margin-bottom: 24px; color: var(--accent); }
.fitness-rest .fitness-step-time { color: #22c55e; }
.fitness-step-next { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.fitness-controls { display: flex; gap: 8px; width: 100%; max-width: 340px; }
.fitness-controls button { flex: 1; padding: 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.fitness-pause { background: var(--accent); color: white; border: 0; }
.fitness-skip { background: rgba(255, 255, 255, 0.08); color: var(--text); border: 1px solid var(--border); }
.fitness-stop { background: rgba(239, 68, 68, 0.15); color: var(--error); border: 1px solid var(--error); }

/* ===== Progress dashboard ===== */
.progress-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .progress-grid { grid-template-columns: 1fr 1fr; }
}
.progress-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  animation: card-spring 0.42s cubic-bezier(0.34, 1.45, 0.5, 1) backwards;
}
.progress-card-icon { font-size: 28px; margin-bottom: 6px; }
.progress-card-name { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.progress-card-value { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.progress-card-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  margin: 6px 0;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ===== Section splashes (Steve / Book / Flame) ===== */
.splash-section {
  position: fixed;
  inset: 0;
  z-index: 930;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(15, 10, 35, 0.95), rgba(0, 0, 0, 0.95));
  animation: splash-fade-in 0.3s ease-out;
  pointer-events: none;
}
.splash-section.splash-out { animation: splash-fade-out 0.4s ease-in forwards; }
.splash-greeting {
  margin-top: 32px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  animation: splash-text-in 0.5s 0.2s cubic-bezier(0.34, 1.4, 0.55, 1) backwards;
}
.splash-caption {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  animation: splash-text-in 0.5s 0.35s cubic-bezier(0.34, 1.4, 0.55, 1) backwards;
}

/* ----- Running figure (fitness splash) ----- */
.splash-runner-wrap {
  position: relative;
  width: 280px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
}
.splash-runner {
  font-size: 140px;
  line-height: 1;
  z-index: 2;
  animation: runner-bounce 0.5s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(255, 100, 50, 0.5));
}
@keyframes runner-bounce {
  0%, 100% { transform: translateY(0)    rotate(-3deg) scaleX(1); }
  50%      { transform: translateY(-12px) rotate(3deg) scaleX(1); }
}

/* Speed lines streaking past behind the runner. Three layers for depth. */
.splash-speedlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(90deg, transparent 0%, rgba(255, 180, 80, 0.4) 50%, transparent 100%),
    linear-gradient(90deg, transparent 0%, rgba(255, 220, 120, 0.3) 50%, transparent 100%),
    linear-gradient(90deg, transparent 0%, rgba(255, 200, 100, 0.5) 50%, transparent 100%),
    linear-gradient(90deg, transparent 0%, rgba(255, 180, 80, 0.35) 50%, transparent 100%),
    linear-gradient(90deg, transparent 0%, rgba(255, 240, 160, 0.25) 50%, transparent 100%);
  background-size: 120px 5px, 80px 3px, 100px 4px, 140px 5px, 90px 2px;
  background-repeat: no-repeat;
  background-position:
    100% 25%,
    100% 40%,
    100% 60%,
    100% 75%,
    100% 90%;
  animation: speedlines 0.5s linear infinite;
}
@keyframes speedlines {
  from {
    background-position:
      100% 25%,
      100% 40%,
      100% 60%,
      100% 75%,
      100% 90%;
  }
  to {
    background-position:
      -50% 25%,
      -40% 40%,
      -60% 60%,
      -55% 75%,
      -45% 90%;
  }
}

/* ----- Progress / streak flame ----- */
.splash-flame-wrap {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-flame {
  font-size: 150px;
  line-height: 1;
  animation: flame-flicker 0.9s ease-in-out infinite;
  filter: drop-shadow(0 8px 32px rgba(255, 140, 0, 0.7));
  transform-origin: 50% 90%;
}
.splash-stats {
  display: flex;
  gap: 24px;
  margin-top: 22px;
  animation: splash-text-in 0.6s 0.5s cubic-bezier(0.34, 1.4, 0.55, 1) backwards;
}
.splash-stat { text-align: center; }
.splash-stat-n {
  font-size: 38px;
  font-weight: 900;
  background: linear-gradient(135deg, #ff8c00, #ffd700);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.splash-stat-l {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ----- Book opening ----- */
.splash-book { perspective: 1100px; }
.book {
  width: 220px;
  height: 160px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(28deg) rotateY(-8deg);
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.55));
}
.book-cover, .book-page {
  position: absolute;
  inset: 0;
  border-radius: 4px 10px 10px 4px;
  transform-origin: left center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.book-cover {
  background: linear-gradient(135deg, #8b4513 0%, #5a2a0a 60%, #3a1b05 100%);
  border-left: 5px solid #1f0d03;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}
.book-cover.book-front {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: book-cover 1.1s 0.2s cubic-bezier(0.5, 0, 0.5, 1) forwards;
}
.book-title {
  color: #d4a050;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  font-family: serif;
}
/* Deep page (visible while flipping, stays put). */
.book-page-deep {
  background: linear-gradient(180deg, #d8c8a0, #b8a878);
}
.book-page-left {
  background: linear-gradient(180deg, #faf3e0, #ead8b8);
  border-left: 1px solid #c0b090;
  padding: 16px 14px;
  box-sizing: border-box;
}
.book-page-right {
  background: linear-gradient(180deg, #faf3e0, #ead8b8);
  border-left: 1px solid #c0b090;
  padding: 16px 14px;
  box-sizing: border-box;
  animation: book-page-flip 1.1s 0.6s cubic-bezier(0.5, 0, 0.5, 1) forwards;
}
.book-line {
  height: 4px;
  background: #8a7050;
  border-radius: 2px;
  margin-bottom: 14px;
  opacity: 0;
  animation: book-line-in 0.4s forwards;
}
.book-line.short { width: 60%; }
.book-line:nth-child(1) { animation-delay: 1.3s; }
.book-line:nth-child(2) { animation-delay: 1.4s; }
.book-line:nth-child(3) { animation-delay: 1.5s; }
.book-line:nth-child(4) { animation-delay: 1.6s; }
@keyframes book-line-in { to { opacity: 0.8; } }
@keyframes book-cover { to { transform: rotateY(-170deg); } }
@keyframes book-page-flip { to { transform: rotateY(-175deg); } }

@keyframes splash-fade-out { to { opacity: 0; } }

/* ===== Streak hero (current streak + best) ===== */
.streak-hero {
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.22), rgba(220, 60, 80, 0.12));
  border: 1px solid #ff8c00;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 6px 22px rgba(255, 140, 0, 0.18);
}
.streak-hero-left { display: flex; gap: 14px; align-items: center; }
.streak-icon {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(255, 140, 0, 0.5));
  animation: flame-flicker 1.2s ease-in-out infinite;
  display: inline-block;
  transform-origin: 50% 90%;
}
@keyframes flame-flicker {
  0%, 100% { transform: scale(1, 1) rotate(-2deg); filter: drop-shadow(0 2px 8px rgba(255, 140, 0, 0.5)); }
  25%      { transform: scale(1.08, 1.12) rotate(3deg); filter: drop-shadow(0 2px 14px rgba(255, 170, 50, 0.8)); }
  50%      { transform: scale(0.96, 1.05) rotate(-3deg); filter: drop-shadow(0 2px 10px rgba(255, 120, 40, 0.6)); }
  75%      { transform: scale(1.05, 1.1) rotate(2deg); filter: drop-shadow(0 2px 16px rgba(255, 200, 80, 0.85)); }
}
.streak-current { font-size: 40px; font-weight: 900; line-height: 1; }
.streak-current-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.streak-hero-right { text-align: right; }
.streak-best-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.streak-best { font-size: 28px; font-weight: 800; color: #ff8c00; }

/* ===== Level ===== */
.level-hero {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.22), rgba(80, 140, 240, 0.1));
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.level-hero-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.level-num { font-size: 18px; font-weight: 800; }
.level-points { font-size: 13px; color: var(--muted); font-family: ui-monospace, monospace; }
.level-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.level-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1); }
.level-bar-sub { font-size: 11px; color: var(--muted); }

.open-growth-btn,
.open-photos-btn {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 0;
  border-radius: 14px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.open-growth-btn { background: linear-gradient(135deg, rgba(34, 197, 94, 0.85), rgba(80, 200, 80, 0.85)); box-shadow: 0 6px 18px rgba(34, 197, 94, 0.35); }
.open-photos-btn { background: linear-gradient(135deg, rgba(236, 72, 153, 0.85), rgba(180, 80, 220, 0.85)); box-shadow: 0 6px 18px rgba(236, 72, 153, 0.35); }
.open-growth-arrow { font-size: 18px; }

/* ===== Sleep tracker in Growth ===== */
.growth-sleep {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.growth-sleep-row { display: flex; gap: 12px; margin-bottom: 12px; }
.growth-sleep-row label { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.growth-sleep-row span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.growth-sleep-row input[type="time"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, monospace;
  font-size: 16px;
}
.growth-sleep-stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.growth-sleep-stats b { color: var(--text); }
.sleep-good { color: #22c55e; font-weight: 600; }
.sleep-low { color: #ff8c00; font-weight: 600; }

/* ===== Measurements + Charts ===== */
.growth-measure {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.growth-measure summary { cursor: pointer; padding: 6px 0; font-weight: 600; font-size: 14px; }
.growth-measure-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 10px 0; }
.growth-measure-form label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.growth-measure-form input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
}
.growth-measure-form button { grid-column: 1 / -1; padding: 10px; margin-top: 4px; }
.growth-howto {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.growth-howto p { margin: 4px 0; }
.growth-howto b { color: var(--text); }
.growth-howto ul { margin: 6px 0; padding-left: 18px; }
.growth-howto li { margin: 4px 0; }
.growth-charts { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.growth-chart { background: rgba(255, 255, 255, 0.03); border-radius: 10px; padding: 10px 12px; }
.growth-chart-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.chart-svg { width: 100%; height: 60px; }
.chart-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 18px; opacity: 0.5; }
.chart-stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-stats b { color: var(--text); }
.chart-delta.pos { color: #22c55e; }
.chart-delta.neg { color: #ef4444; }

/* ===== Today's fitness recommendation ===== */
.fitness-today {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.18), rgba(80, 140, 240, 0.08));
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.fitness-today-label { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.fitness-today-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.fitness-today-desc { font-size: 13px; color: var(--muted); line-height: 1.4; margin-bottom: 12px; }
.fitness-today-start { width: 100%; padding: 12px; font-size: 14px; }

/* ===== Photo diary modal ===== */
.photos-modal {
  position: fixed; inset: 0;
  z-index: 920;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: modal-fade-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.photos-modal[hidden] { display: none !important; }
.photos-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(8px); }
.photos-modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 18px;
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  animation: modal-pop-in 0.34s cubic-bezier(0.34, 1.42, 0.55, 1);
}
.photos-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.1); color: var(--text); cursor: pointer;
}
.photos-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.photos-sub { font-size: 13px; color: var(--muted); line-height: 1.4; margin-bottom: 14px; }
.photos-add {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #ec4899, #b450dc);
  color: white;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 14px;
}
.photos-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 18px; }
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.photo-item { position: relative; }
.photo-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; display: block; }
.photo-date { font-size: 11px; text-align: center; color: var(--muted); margin-top: 4px; }
.photo-delete {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, 0.6); color: white; cursor: pointer;
  font-size: 12px; padding: 0; line-height: 1;
}

/* ===== Growth tracker ===== */
.growth-today {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(80, 200, 80, 0.06));
  border: 1px solid #22c55e;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.growth-today-head { display: flex; gap: 16px; align-items: center; }
.growth-today-label { font-size: 12px; color: var(--muted); }
.growth-today-pct {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.growth-today-bar {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.growth-today-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.growth-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 18px 0 10px;
}
.growth-list { display: flex; flex-direction: column; gap: 6px; }
.growth-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.growth-item-row { display: flex; align-items: center; gap: 10px; }
.growth-item-done { border-color: #22c55e; background: rgba(34, 197, 94, 0.08); }
.growth-check { font-size: 18px; width: 22px; text-align: center; color: var(--muted); }
.growth-item-done .growth-check { color: #22c55e; }
.growth-time {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  width: 44px;
  flex-shrink: 0;
}
.growth-icon { font-size: 18px; flex-shrink: 0; }
.growth-title { flex: 1; font-size: 14px; font-weight: 500; }
.growth-item-done .growth-title { text-decoration: line-through; opacity: 0.65; }
.growth-why {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  margin-left: 32px;
  line-height: 1.4;
}

.growth-week {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}
.growth-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.growth-week-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.growth-week-today .growth-week-cell { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4); }
.growth-week-label { font-size: 9px; color: var(--muted); }

.growth-rules {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 14px;
  margin-bottom: 16px;
}
.growth-rules summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; }
.growth-rules-body { font-size: 13px; line-height: 1.55; color: var(--muted); padding-bottom: 12px; }
.growth-rules-body p { margin: 8px 0; }
.growth-rules-body b { color: var(--text); }

/* Version toast — shown bottom-center on first load after an update. */
.version-toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.32s, transform 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
  z-index: 900;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.version-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Tutor tab — 12-week guided curriculum ===== */
.tutor-hero {
  background: linear-gradient(135deg, rgba(120, 90, 240, 0.18), rgba(80, 140, 240, 0.1));
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.tutor-week { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.tutor-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.tutor-progress { margin-bottom: 12px; }
.tutor-progress-bar { height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; overflow: hidden; }
.tutor-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width 0.45s cubic-bezier(0.22, 0.61, 0.36, 1); }
.tutor-progress-text { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tutor-week-nav { display: flex; gap: 6px; margin-top: 6px; }
.tutor-week-nav button {
  flex: 1; padding: 8px; font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}
.tutor-week-nav button:disabled { opacity: 0.4; cursor: not-allowed; }

.tutor-today {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  animation: card-spring 0.5s cubic-bezier(0.34, 1.45, 0.5, 1);
}
.tutor-today-label { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.tutor-today-name { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.tutor-today-diagram { display: flex; justify-content: center; margin: 8px 0 14px; }
.tutor-today-diagram svg { width: 140px; height: 140px; }
.tutor-today-alg {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  text-align: center;
  word-break: break-word;
  line-height: 1.6;
}
.tutor-today-desc { font-size: 14px; line-height: 1.5; color: var(--muted); margin-bottom: 14px; }
.tutor-today-actions { display: flex; gap: 8px; }
.tutor-today-actions button {
  flex: 1; padding: 12px; font-size: 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 600;
}
.tutor-today-actions .primary { background: var(--accent); color: white; border-color: var(--accent); }

.tutor-done-week {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.06));
  border: 1px solid #22c55e;
  border-radius: 14px;
  padding: 22px 18px;
  margin-bottom: 16px;
  text-align: center;
}
.tutor-done-icon { font-size: 38px; margin-bottom: 8px; }
.tutor-done-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.tutor-done-sub { font-size: 13px; color: var(--muted); line-height: 1.5; }

.tutor-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.tutor-list-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.tutor-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s;
}
.tutor-item:hover { background: rgba(255, 255, 255, 0.04); }
.tutor-item-check { font-size: 16px; width: 20px; text-align: center; color: var(--muted); }
.tutor-item-done .tutor-item-check { color: #22c55e; }
.tutor-item-done .tutor-item-name { text-decoration: line-through; opacity: 0.6; }
.tutor-item-name { flex: 1; font-weight: 500; font-size: 14px; }
.tutor-item-alg {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 6px;
  border-radius: 4px;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tutor-all-weeks {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.tutor-all-weeks summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; }
.tutor-week-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--border);
  cursor: pointer; font-size: 13px;
}
.tutor-week-row:hover { color: var(--accent); }
.tutor-week-num { width: 50px; color: var(--muted); font-size: 11px; }
.tutor-week-name { flex: 1; }
.tutor-week-status { color: var(--muted); font-size: 12px; }

/* legend */
.legend {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.legend summary { cursor: pointer; font-weight: 600; }
.legend table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.legend th { text-align: left; padding: 4px 8px; font-family: ui-monospace, monospace; color: var(--accent); width: 60px; }
.legend td { padding: 4px 8px; color: var(--muted); }
.legend-note { font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.4; }

/* ===== Серия (streak + дачные напоминания) ===== */
.streak-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.18), rgba(255, 80, 80, 0.10));
  border: 1px solid rgba(255, 140, 0, 0.4);
  border-radius: 16px;
  padding: 18px 18px;
  margin-bottom: 18px;
}
.streak-hero-flame { font-size: 44px; line-height: 1; filter: drop-shadow(0 2px 8px rgba(255, 140, 0, 0.5)); }
.streak-hero-main  { flex: 1; }
.streak-hero-n     { font-size: 32px; font-weight: 800; line-height: 1; }
.streak-hero-l     { font-size: 13px; color: var(--muted); margin-top: 2px; }
.streak-hero-best  { text-align: right; }
.streak-hero-best-n { font-size: 20px; font-weight: 700; color: #ffb84d; }
.streak-hero-best-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.streak-rem-title-row {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}

.streak-rem-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: background 0.2s, border-color 0.2s;
}
.streak-rem-card.streak-rem-due {
  background: linear-gradient(135deg, rgba(255, 80, 80, 0.16), rgba(255, 100, 50, 0.06));
  border-color: rgba(255, 80, 80, 0.5);
}
.streak-rem-card.streak-rem-ok {
  border-color: rgba(34, 197, 94, 0.4);
}
.streak-rem-card.streak-rem-done {
  background: linear-gradient(135deg, rgba(255, 80, 80, 0.22), rgba(255, 200, 80, 0.10));
  border-color: rgba(255, 80, 80, 0.7);
  animation: streak-pulse 1.2s ease-in-out infinite;
}
@keyframes streak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 80, 80, 0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 80, 80, 0); }
}
.streak-rem-card.streak-rem-water { cursor: pointer; }
.streak-rem-card.streak-rem-running { background: linear-gradient(135deg, rgba(80, 140, 240, 0.18), rgba(80, 200, 240, 0.06)); border-color: rgba(80, 140, 240, 0.5); }

.streak-rem-icon { font-size: 30px; line-height: 1; flex-shrink: 0; }
.streak-rem-body { flex: 1; min-width: 0; }
.streak-rem-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.streak-rem-sub   { font-size: 13px; color: var(--muted); }
.streak-rem-chev  { font-size: 22px; color: var(--muted); flex-shrink: 0; }

.streak-rem-btn {
  background: linear-gradient(135deg, #ffb84d, #ff6b6b);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.35);
}
.streak-rem-card.streak-rem-ok .streak-rem-btn {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
  box-shadow: none;
}
.streak-rem-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
}

.streak-water-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: -4px 0 12px;
}
.streak-water-times[hidden] { display: none; }
.streak-water-times button {
  background: linear-gradient(135deg, rgba(80, 140, 240, 0.25), rgba(80, 200, 240, 0.15));
  border: 1px solid rgba(80, 140, 240, 0.5);
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.streak-water-times button:hover { background: rgba(80, 140, 240, 0.35); }

.streak-water-remaining {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  font-weight: 800;
  color: #5ac8ff;
  letter-spacing: 1px;
  margin-top: 4px;
}
.streak-water-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.streak-water-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5ac8ff, #4f8cf2);
  transition: width 0.5s linear;
}

.streak-water-extra { margin-bottom: 10px; }
.streak-water-snooze {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
}
