html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #fff;
}

/* הבמה מכסה את כל המסך */
.stage {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 0;
}

/* הווידאו ממלא את כל החלון ושומר יחס */
.player {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #000;
  outline: none;
  z-index: 1;
}

/* Wrapper inside .stage — gets CSS-rotated when orientation lock fails */
.stage-inner {
  position: absolute;
  inset: 0;
}

/* CSS fallback: rotate content to landscape when screen.orientation.lock rejects */
.stage.force-landscape .stage-inner {
  width: 100vh;
  height: 100vw;
  transform-origin: top left;
  transform: rotate(90deg) translateX(-100%);
}

.stage.force-landscape .player {
  width: 100%;
  height: 100%;
}

/* הודעת PLAY באמצע, עם אייקון — גדולה ו-clickable */
.hint {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  padding: 36px 54px;
  border-radius: 36px;
  border: 2px solid #aaa;
  background: rgba(0,0,0,0.65);
  color: #fff;
  backdrop-filter: blur(6px);
  z-index: 50;
  user-select: none;
  gap: 24px;
  align-items: center;
  cursor: pointer;        /* חשוב – ניתן ללחוץ */
  font-size: 3em;
  font-weight: bold;
}
.hint.show { display: inline-flex; }
.hint .hint-ico { width: 84px; height: 84px; }

/* אזור כפתורים – overlay בתחתית, מוסתר עד סוף הקליפ */
.controls {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 0 16px;
  opacity: 0;
  pointer-events: none;
  z-index: 55;
  transition: opacity .2s ease;
}
.controls.controls-debug {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.controls.show {
  opacity: 1;
  pointer-events: auto;
}

/* Download box - for category page "איך לומדים" */
.download-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  margin-bottom: 24px;
  background: rgba(30, 30, 30, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
}
.download-box__icon {
  font-size: 1.5rem;
}
.download-box__text {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
}
.download-box__link {
  padding: 10px 20px;
  background: rgba(0, 128, 0, 0.4);
  border: 1px solid rgba(0, 128, 0, 0.6);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  transition: background 0.2s;
}
.download-box__link:hover {
  background: rgba(0, 128, 0, 0.6);
}

@media (max-width: 767px) {
  .download-box {
    flex-direction: column;
    text-align: center;
    padding: 14px 16px;
  }
  .download-box__text {
    font-size: 0.9rem;
  }
}

/* כפתורים */
.controls .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 28px;
  border: 2px solid #aaa;
  border-radius: 16px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.controls .btn:hover { background: rgba(255,255,255,0.2); }
.controls .btn.disabled { opacity: .45; pointer-events: none; }
.controls .btn img { width: 64px; height: 64px; }
.controls .btn span { font-size: 22px; line-height: 1; }

/* מחלקה ייעודית לערימה אנכית (מוספת גם ע\"י JS) */
.controls.controls-stack {
  grid-template-columns: 1fr;
  width: min(92vw, 900px);
  left: 50%;
  transform: translateX(-50%);
}

/* דסקטופ ורוחב גדול – כפתורים מרווחים יותר כדי שהטקסט לא ידחף החוצה */
@media (min-width: 1200px) {
  .controls {
    width: min(80vw, 1280px);
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
  }
  .controls .btn {
    padding: 26px 32px;
    gap: 18px;
    border-radius: 20px;
  }
  .controls .btn img { width: 72px; height: 72px; }
  .controls .btn span { font-size: 24px; }
}

/* מובייל */
@media (max-width: 767px) {
  .controls {
    grid-template-columns: 1fr;
    bottom: 20px;
    gap: 14px;
    width: 90%;
    left: 50%;
    transform: translateX(-50%);
  }
  .controls .btn { padding: 14px 18px; gap: 10px; border-radius: 14px; }
  .controls .btn img { width: 42px; height: 42px; }
  .controls .btn span { font-size: 18px; }

  .hint {
    font-size: 1.6em;
    padding: 18px 24px;
    border-radius: 18px;
    /* הוסר pointer-events:none כדי לא לחסום קליק! */
  }
  .hint .hint-ico { width: 48px; height: 48px; }
}

/* ביניים: 768–1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .controls {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    bottom: 22px;
    width: min(92vw, 900px);
  }
  .controls .btn { padding: 16px 22px; gap: 12px; border-radius: 14px; }
  .controls .btn img { width: 48px; height: 48px; }
  .controls .btn span { font-size: 20px; }

  .hint {
    font-size: 2.2em;
    padding: 26px 36px;
    border-radius: 26px;
  }
  .hint .hint-ico { width: 64px; height: 64px; }
}

/* טלפונים לרוחב עם גובה קטן */
@media (max-height: 520px) and (orientation: landscape) {
  .controls {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    bottom: 12px;
    width: 94vw;
  }
  .controls .btn { padding: 12px 16px; gap: 10px; border-radius: 12px; }
  .controls .btn img { width: 40px; height: 40px; }
  .controls .btn span { font-size: 18px; }

  .hint {
    font-size: 1.6em;
    padding: 16px 22px;
    border-radius: 18px;
  }
  .hint .hint-ico { width: 40px; height: 40px; }
}

/* מובייל/טאבלט בעמידה: לערום כפתורים כדי שלא ייחתך הטקסט */
@media (max-width: 1200px) and (orientation: portrait) {
  .controls {
    grid-template-columns: 1fr;
    width: min(92vw, 900px);
    left: 50%;
    transform: translateX(-50%);
  }
}

/* אזור ניהול מנוי - פינה ימנית עליונה */
.account-section {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.account-section.show {
  opacity: 1;
  pointer-events: auto;
}

.trial-message {
  background: rgba(220, 53, 69, 0.3);
  border: 1px solid rgba(220, 53, 69, 0.6);
  border-radius: 8px;
  padding: 8px 14px;
  color: #fff;
  font-size: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}

.account-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 28px;
  border: 2px solid #aaa;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
  font-size: 22px;
  line-height: 1;
  min-height: 112px;
  min-width: 180px;
  transition: background 0.2s;
}

.account-btn-inline:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Desktop 1200px+ */
@media (min-width: 1200px) {
  .account-btn-inline {
    padding: 26px 32px;
    gap: 18px;
    border-radius: 20px;
    font-size: 24px;
    min-height: 128px;
    min-width: 220px;
  }
  .trial-message {
    font-size: 18px;
    padding: 10px 16px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .account-section {
    top: 10px;
    right: 10px;
  }
  .account-btn-inline {
    padding: 14px 18px;
    gap: 10px;
    border-radius: 14px;
    font-size: 18px;
    min-height: 74px;
    min-width: 140px;
  }
  .trial-message {
    font-size: 14px;
    padding: 6px 10px;
  }
}

/* Tablet 768-1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .account-btn-inline {
    padding: 16px 22px;
    gap: 12px;
    border-radius: 14px;
    font-size: 20px;
    min-height: 84px;
    min-width: 160px;
  }
}

/* Landscape small height */
@media (max-height: 520px) and (orientation: landscape) {
  .account-btn-inline {
    padding: 12px 16px;
    gap: 10px;
    border-radius: 12px;
    font-size: 18px;
    min-height: 68px;
    min-width: 140px;
  }
  .trial-message {
    font-size: 13px;
    padding: 5px 8px;
  }
}
/* צבעים ייחודיים לכפתורים */
.btn-next {
  background: rgba(0, 128, 0, 0.35);    /* ירוק */
  border-color: rgba(0, 128, 0, 0.6);
}
.btn-next:hover {
  background: rgba(0, 128, 0, 0.5);
}

.btn-prev {
  background: rgba(255, 215, 0, 0.35);  /* צהוב */
  border-color: rgba(255, 215, 0, 0.6);
}
.btn-prev:hover {
  background: rgba(255, 215, 0, 0.5);
}

.btn-replay {
  /* נשאר כמו ברירת המחדל — לא מוסיפים */
}

.btn-exit {
  background: rgba(220, 20, 60, 0.35);  /* אדום (crimson) */
  border-color: rgba(220, 20, 60, 0.6);
}
.btn-exit:hover {
  background: rgba(220, 20, 60, 0.5);
}

/* --- צבעים ייחודיים לכפתורים: ספציפיות גבוהה יותר מהכלל .controls .btn --- */
.controls .btn.btn-next {
  background: rgba(0, 128, 0, 0.35);       /* ירוק */
  border-color: rgba(0, 128, 0, 0.6);
}
.controls .btn.btn-next:hover:not(.disabled) {
  background: rgba(0, 128, 0, 0.5);
}

.controls .btn.btn-prev {
  background: rgba(255, 215, 0, 0.35);     /* צהוב */
  border-color: rgba(255, 215, 0, 0.6);
}
.controls .btn.btn-prev:hover:not(.disabled) {
  background: rgba(255, 215, 0, 0.5);
}

/* נגן שוב – נשאר כברירת מחדל, אין שינוי */

/* יציאה אדום */
.controls .btn.btn-exit {
  background: rgba(220, 20, 60, 0.35);     /* Crimson */
  border-color: rgba(220, 20, 60, 0.6);
}
.controls .btn.btn-exit:hover:not(.disabled) {
  background: rgba(220, 20, 60, 0.5);
}

.controls .btn.btn-note {
  background: rgba(30, 144, 255, 0.35);  /* כחול */
  border-color: rgba(30, 144, 255, 0.6);
  /* Match height of buttons with icons */
  min-height: 112px; /* 22px padding * 2 + 64px icon + 4px border */
}
.controls .btn.btn-note:hover:not(.disabled) {
  background: rgba(30, 144, 255, 0.5);
}

/* Note button height adjustments for responsive */
@media (min-width: 1200px) {
  .controls .btn.btn-note {
    min-height: 128px; /* 26px padding * 2 + 72px icon + 4px border */
  }
}
@media (max-width: 767px) {
  .controls .btn.btn-note {
    min-height: 74px; /* 14px padding * 2 + 42px icon + 4px border */
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .controls .btn.btn-note {
    min-height: 84px; /* 16px padding * 2 + 48px icon + 4px border */
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .controls .btn.btn-note {
    min-height: 68px; /* 12px padding * 2 + 40px icon + 4px border */
  }
}

/* מודאל הערות לדיבאגר */
.note-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 70;
}
.note-modal.show {
  display: flex;
}
.note-modal__dialog {
  width: min(520px, 92vw);
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  direction: rtl;
}
.note-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.note-modal__header h2 {
  margin: 0;
  font-size: 1.4rem;
}
.note-modal__close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
#noteTextarea {
  width: 100%;
  min-height: 140px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 12px;
  font-size: 1rem;
  resize: vertical;
}
.note-modal__actions {
  display: flex;
  justify-content: flex-end;
}
.note-modal__status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.95rem;
  color: #b0e0ff;
}
.note-modal__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.note-modal.force-show {
  display: flex !important;
}
.btn-note.note-btn-clicked {
  outline: 3px solid #fff;
}
.note-modal.force-show {
  display: flex !important;
}

/* ===== Gallery Modal ===== */
.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 70;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gallery-modal.show {
  display: flex;
}

.gallery-modal__dialog {
  width: min(95vw, 1200px);
  max-height: 90vh;
  background: rgba(20, 20, 20, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  direction: rtl;
}

.gallery-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-modal__header h2 {
  margin: 0;
  font-size: 1.8rem;
  color: #fff;
  font-weight: 600;
}

.gallery-modal__close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.2s;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal__close:hover {
  transform: scale(1.2);
}

.gallery-modal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  overflow-y: auto;
  padding: 8px;
  max-height: calc(90vh - 160px);
}

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  display: block;
}

.gallery-item:hover {
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item__label {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Button: בחר (Pick) - Purple/Magenta */
.controls .btn.btn-pick {
  background: rgba(138, 43, 226, 0.35);
  border-color: rgba(138, 43, 226, 0.6);
}

.controls .btn.btn-pick:hover:not(.disabled) {
  background: rgba(138, 43, 226, 0.5);
}


/* Mobile responsive */
@media (max-width: 767px) {
  .gallery-modal__dialog {
    padding: 20px;
    width: 96vw;
  }

  .gallery-modal__header h2 {
    font-size: 1.4rem;
  }

  .gallery-modal__grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .gallery-item__label {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .gallery-modal__grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
}

/* Desktop large screens */
@media (min-width: 1200px) {
  .gallery-modal__grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
  }
}

/* ===== Auto-Advance Countdown Overlay ===== */
.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: none;
  justify-content: center;
  padding-top: 60px;
  z-index: 56;
  pointer-events: none;
}
.countdown-overlay.show {
  display: flex;
  pointer-events: auto;
}
.countdown-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 40px;
  background: rgba(0, 128, 0, 0.45);
  border: 2px solid rgba(0, 128, 0, 0.7);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
}
.countdown-number {
  font-size: 5rem;
  font-weight: bold;
  line-height: 1;
  color: #fff;
}
.countdown-label {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.9);
}
.countdown-stop {
  font-size: 2.2rem;
  font-weight: bold;
  color: #fff;
  margin-top: 0.8rem;
  padding: 0.3rem 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
}

/* Countdown - Mobile */
@media (max-width: 767px) {
  .countdown-overlay {
    padding-top: 40px;
  }
  .countdown-text {
    padding: 18px 30px;
    border-radius: 16px;
  }
  .countdown-number {
    font-size: 3.5rem;
  }
  .countdown-label {
    font-size: 1.1rem;
  }
  .countdown-stop {
    font-size: 1.6rem;
    margin-top: 0.6rem;
  }
}

/* Countdown - Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .countdown-overlay {
    padding-top: 50px;
  }
  .countdown-number {
    font-size: 4rem;
  }
  .countdown-label {
    font-size: 1.2rem;
  }
  .countdown-stop {
    font-size: 1.8rem;
  }
}

/* Countdown - Exit variant (last video) */
.countdown-exit .countdown-text {
  background: rgba(128, 0, 0, 0.45);
  border-color: rgba(128, 0, 0, 0.7);
}

/* Countdown - Landscape phone */
@media (max-height: 520px) and (orientation: landscape) {
  .countdown-overlay {
    padding-top: 20px;
  }
  .countdown-text {
    padding: 12px 24px;
    border-radius: 12px;
  }
  .countdown-number {
    font-size: 3rem;
  }
  .countdown-label {
    font-size: 1rem;
  }
  .countdown-stop {
    font-size: 1.4rem;
    margin-top: 0.4rem;
  }
}

/* ===== PWA Install Banner ===== */
.pwa-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 10px 15px;
  background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.pwa-install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 400px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.pwa-install-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
}
.pwa-install-btn:active {
  transform: scale(0.98);
}
.pwa-install-icon {
  font-size: 1.4rem;
}
.pwa-install-text {
  font-size: 1.1rem;
}

/* Push account section down when banner is visible */
.pwa-install-banner + .account-section {
  top: 60px;
}

/* PWA Install - Mobile */
@media (max-width: 767px) {
  .pwa-install-banner {
    padding: 8px 10px;
  }
  .pwa-install-btn {
    padding: 10px 16px;
    font-size: 1rem;
    border-radius: 10px;
  }
  .pwa-install-icon {
    font-size: 1.2rem;
  }
  .pwa-install-text {
    font-size: 1rem;
  }
  .pwa-install-banner + .account-section {
    top: 52px;
  }
}

/* Hide install banner in fullscreen */
:fullscreen .pwa-install-banner,
:-webkit-full-screen .pwa-install-banner {
  display: none !important;
}

