:root {
  /* Pastel Light Theme */
  --bg-color: #fcefe7; 
  --bg-gradient: linear-gradient(135deg, #fefbfc 0%, #f7f1eb 100%);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px 0 rgba(180, 160, 150, 0.15);
  
  --text-primary: #4a4a5a;
  --text-secondary: #7b8898;
  --accent-color: #8daaf5;
  --accent-glow: rgba(141, 170, 245, 0.3);
  --accent-secondary: #d1b4ee;
  
  --equinox-color: #55c2a0;
  --tekufa-color: #f7a950;
  --leap-color: #f07ea7;
  --wednesday-start: #6997f6;

  --nav-hover: #eaf1fa;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg-color: #0f172a; 
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --glass-bg: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #818cf8;
  --accent-glow: rgba(129, 140, 248, 0.3);
  --accent-secondary: #c084fc;
  
  --equinox-color: #34d399;
  --tekufa-color: #fbbf24;
  --leap-color: #f472b6;
  --wednesday-start: #60a5fa;

  --nav-hover: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] body .header { background: #1e293b; border-bottom: 1px solid var(--glass-border); }
html[data-theme="dark"] body .glass-btn { background: #1e293b; border: 1px solid var(--glass-border); color: var(--text-primary); }
html[data-theme="dark"] body .dropdown-item { background: #1e293b; color: var(--text-primary); }
html[data-theme="dark"] body .dropdown-item:hover { background: var(--nav-hover); color: var(--accent-color); }
html[data-theme="dark"] body .month-section h2 { background: #1e293b; color: var(--text-primary); border-bottom: 1px dashed rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] body .month-tab { color: var(--text-primary); }
html[data-theme="dark"] body .month-tab.active { background: var(--accent-color); color: white; }
html[data-theme="dark"] body .month-tab:not(.active):hover { background: #1e293b; border: 1px solid var(--glass-border); color: var(--accent-color); }
html[data-theme="dark"] body #viewToggleBtn { background: #334155; color: white; }
html[data-theme="dark"] body #viewToggleBtn:hover { background: #475569; }
html[data-theme="dark"] body .day-card { background: #1e293b !important; border: 1px solid rgba(255, 255, 255, 0.05) !important; }
html[data-theme="dark"] body .sidebar-nav { background: rgba(15, 23, 42, 0.95) !important; border-left: 1px solid rgba(255, 255, 255, 0.1) !important; }
html[data-theme="dark"] body .sidebar-header.collapsed i.fa-chevron-up { background: #334155; color: var(--text-secondary); }
html[data-theme="dark"] body .sidebar-header { border-bottom-color: rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] body .legend-item:hover { background: var(--nav-hover); }
html[data-theme="dark"] body .day-card:hover { background: #334155 !important; }
html[data-theme="dark"] body .weekdays-header { background: #1e293b; box-shadow: 0 -30px 0 0 #1e293b, 0 4px 6px rgba(0,0,0,0.4); border-bottom: 1px dashed rgba(255, 255, 255, 0.1); }

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.header {
  position: -webkit-sticky; /* Wsparcie dla starszych i mobilnych Safari */
  position: sticky;
  top: 0; /* Ostro i sztywno do sufitu */
  z-index: 100;
  align-self: stretch; /* Rozciągnij przez cały szeroki tunel na którym osadzone jest padding */
  margin: -2rem -1rem 0 -1rem; /* Przykryj dziury wygenerowane przez padding w contanerze domyślnym */
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff; /* Jednolite pełne tło - zero przebijania */
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 25px rgba(0,0,0,0.06);
  border-radius: 0 0 20px 20px; /* Ostro ścięte na górze by uszczelnić styk z krawędzią ekranu */
  padding: 0.5rem 1.5rem;
  transition: transform 0.3s ease, padding 0.3s ease;
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: font-size 0.3s ease;
  background: linear-gradient(135deg, #6366f1 0%, #d946ef 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo i {
  color: var(--accent-color);
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.year-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.glass-btn {
  background: white;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.glass-btn:hover {
  background: var(--nav-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  color: var(--accent-color);
}

.dropdown-item {
  background: white;
  border: none;
  font-family: inherit;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  width: 100%;
}

.dropdown-item:hover {
  background: var(--nav-hover);
  color: var(--accent-color);
}

.dropdown-divider {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0;
}

.dropdown-header {
  padding: 0.25rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.settings-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-menu {
  position: absolute;
  top: 50px;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  min-width: 200px;
  z-index: 200;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown-menu {
  min-width: 75px !important;
  width: 75px !important;
  left: 50% !important;
  right: auto !important;
  margin-left: -37.5px !important;
}

.lang-dropdown-menu .dropdown-item {
  font-size: 0.8rem;
  padding: 0.5rem 0;
  justify-content: center;
}

.dropdown-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

#viewToggleBtn {
  background: var(--text-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(74, 74, 90, 0.3);
}
#viewToggleBtn i {
  color: var(--accent-color);
}

@media (min-width: 601px) {
  #headerOptionsDropdown .dropdown-trigger {
    display: none;
  }
  #headerOptionsDropdown .dropdown-menu {
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    flex-direction: row;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    min-width: 0;
  }
  #mobileLayoutBtn {
    display: none;
  }
  #viewToggleBtn {
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: 100px;
    box-shadow: 0 4px 12px rgba(74, 74, 90, 0.3);
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    width: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
  }
  #viewToggleBtn i {
    color: var(--accent-color);
    width: auto;
  }
  #viewToggleBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 74, 90, 0.4);
    background: #3a3a4a;
  }
}

.current-year-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 58px;
  min-width: 175px;
  position: relative;
}

.year-input-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.year-prefix {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.year-input {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 2px dashed rgba(0,0,0,0.1);
  width: 75px;
  text-align: center;
  transition: all 0.2s ease;
  padding: 0;
}

.year-input:focus {
  outline: none;
  border-color: var(--accent-color);
}
.year-input::-webkit-outer-spin-button,
.year-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(240, 126, 167, 0.15);
  color: var(--leap-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 800;
  margin-top: 4px;
  display: none;
  position: absolute;
  bottom: -6px;
  white-space: nowrap;
}
.badge.visible {
  display: inline-block;
}

.equinox-info {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
  line-height: 1.4;
}

.equinox-highlight {
  color: var(--equinox-color);
  font-weight: 700;
}

/* Layout Main Content */
.main-content {
  display: flex;
  flex-direction: column;
}

.calendar-sections-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  min-width: 0; /* Prevents flex flex child from expanding beyond viewport due to grid min-width */
}

.sidebar-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 380px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-left: 1px solid rgba(255, 255, 255, 0.8);
  padding: 0.8rem 1.5rem 0;
  box-shadow: -10px 0 40px rgba(100, 100, 110, 0.15);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: right 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-nav.open {
  right: 0;
}

/* Glass Bottom Dock */
.bottom-dock {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid rgba(141, 170, 245, 0.8);
  box-shadow: 0 10px 30px -5px rgba(141, 170, 245, 0.4),
              0 0 15px rgba(255, 255, 255, 0.6),
              inset 0 2px 4px rgba(255, 255, 255, 0.8);
  z-index: 1001;
  transition: transform 0.1s ease-out; /* płynniejszy ruch, ale JS to obsłuży */
}

.bottom-dock.dragging {
  opacity: 0.9;
  box-shadow: 0 15px 40px -5px rgba(141, 170, 245, 0.5),
              0 0 20px rgba(255, 255, 255, 0.8),
              inset 0 2px 4px rgba(255, 255, 255, 0.9);
  cursor: grabbing;
  transition: none !important;
}

.dock-drag-handle {
  width: 24px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--text-secondary);
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 0 0.5rem;
}

.dock-drag-handle:hover {
  opacity: 1;
}

.dock-drag-handle:active {
  cursor: grabbing;
}

[data-theme="dark"] .bottom-dock {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5),
              inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.dock-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  border: none;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-btn:hover {
  background: rgba(141, 170, 245, 0.15);
  color: var(--accent-color);
  transform: scale(1.1);
}

.dock-btn:active {
  transform: scale(0.95);
}

.dock-btn.pulse-target {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}
.dock-btn.pulse-target:hover {
  background: rgba(59, 130, 246, 0.2);
}

.dock-btn.menu-trigger {
  color: white;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  box-shadow: 0 4px 10px rgba(141, 170, 245, 0.4);
}
.dock-btn.menu-trigger:hover {
  box-shadow: 0 6px 15px rgba(141, 170, 245, 0.6);
}

.dock-divider {
  width: 1px;
  height: 24px;
  background: rgba(141, 170, 245, 0.3);
  margin: 0 0.25rem;
}

[data-theme="dark"] .dock-divider {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.legend-item {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.legend-item:hover {
  background: var(--nav-hover);
  transform: translateX(4px);
}

.legend-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--text-secondary), transparent);
  margin: 1rem 0;
  opacity: 0.15;
}

.legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  border-bottom: 2px solid var(--nav-hover);
  transition: border-color 0.3s ease;
}

.sidebar-header:first-of-type {
  margin-top: 0;
  padding-top: 0.5rem;
}

.sidebar-header:hover {
  border-bottom-color: var(--accent-color);
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  letter-spacing: 1.5px;
  margin: 0;
}

.sidebar-header i.fa-chevron-up {
  color: var(--accent-color);
  font-size: 0.9rem;
  background: var(--nav-hover);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  max-height: 2000px;
  flex-shrink: 0;
  opacity: 1;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.sidebar-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.sidebar-header.collapsed i.fa-chevron-up {
  transform: rotate(180deg);
  background: #f1f5f9;
  color: var(--text-secondary);
}

.month-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.month-tab {
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  color: var(--text-primary);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  font-size: 0.8rem;
}

.month-tab:hover {
  background: white;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  transform: translateX(5px);
  color: var(--accent-color);
}

.month-tab.active {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
  font-weight: 600;
}

/* Calendar Section */
.month-section {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--glass-shadow);
}

/* Podstawowe ukrycie animacji podpowiedzi przewijania na dużych ekranach */
.swipe-hint-7 {
  display: none !important;
}

.month-section h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: -2rem -2rem 0 -2rem;
  padding: 0.5rem 2rem 0.5rem 2rem;
  border-bottom: 1px dashed rgba(0,0,0,0.1);
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.1rem;
  transition: padding 0.3s ease, font-size 0.3s ease, gap 0.3s ease;
}

@media screen {
  .month-section h2 {
    position: -webkit-sticky;
    position: sticky;
    top: var(--header-height, 80px);
    z-index: 50;
  }
}



.weekday {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  padding: 0.25rem;
  border: 1px solid transparent;
}

.wd-heb, .wd-pol {
  white-space: nowrap;
}

.wd-num {
  background: var(--glass-border);
  color: var(--text-secondary);
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.2rem;
}

.start-day .wd-num {
  background: var(--wednesday-start);
  color: white;
  box-shadow: 0 0 10px rgba(105, 151, 246, 0.4);
}

.shabbat-day .wd-num {
  background: #eab308;
  color: white;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.3);
}

.wd-heb {
  order: 2;
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wd-heb::before {
  content: "(";
}

.wd-heb::after {
  content: ")";
}

.wd-pol {
  order: 1;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
}

.month-names-secondary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 0;
}

.alt-name {
  font-size: 0.85em;
  opacity: 0.6;
  font-style: italic;
}

.month-subgroup {
  display: inline-flex;
  align-items: center;
}
.calendar-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.calendar-scroll-wrapper::-webkit-scrollbar {
  height: 6px;
}
.calendar-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--glass-border); 
  border-radius: 4px;
}
.calendar-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--text-secondary); 
  border-radius: 4px;
}

.weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0;
  padding-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto;
  grid-auto-rows: minmax(120px, auto);
  gap: 1rem;
}

/* Wyróżnienie całej kolumny Szabatu */
.calendar-grid > div:nth-child(7n) {
  background-color: #fffbeb;
  border-color: #fde68a;
}
.calendar-grid > div.empty:nth-child(7n) {
  background-color: rgba(255, 251, 235, 0.5);
  border: 1px dashed #fde68a;
  border-top: none;
  border-bottom: none;
}
.calendar-grid > div:nth-child(7n):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 20px rgba(234, 179, 8, 0.15);
  border-color: #fcd34d;
}

.weekdays .weekday:nth-child(7) {
  background-color: #fffbeb;
  border-radius: 8px;
  padding: 0.25rem;
  border: 1px solid #fde68a;
}

/* Days */
.day-card {
  min-width: 0;
  background: white;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  padding: 0.5rem;
  display: grid;
  grid-template-rows: auto 1fr;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden; /* Odcina wystający znak wodny by zablokować wyciek na inne kafelki */
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.day-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 20px rgba(0,0,0,0.08);
  border-color: #e2e8f0;
  z-index: 5;
}

.day-card.empty {
  background: rgba(248, 250, 252, 0.4);
  border: 1px dashed rgba(203, 213, 225, 0.8) !important;
  box-shadow: none;
  pointer-events: none;
  opacity: 0.6;
}

[data-theme="dark"] .day-card.empty {
  background: rgba(30, 41, 59, 0.4);
  border: 1px dashed rgba(71, 85, 105, 0.8) !important;
}

.day-card.muted {
  opacity: 0.5;
  background-color: #fafafa;
  border-style: dashed;
}

.day-card.current-today {
  border: 2px solid #3b82f6 !important; /* Wyraźna, niebieska ramka zawsze nadrzędna */
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.12) 100%);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
  transform: scale(1.02);
  z-index: 2;
  position: relative;
  overflow: visible !important; /* Zdejmuje ograniczenie maski dla przypinki DZISIAJ */
}

[data-theme="dark"] .day-card.current-today {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.2) 100%);
}

.day-card.current-today::after {
  content: attr(data-today-text);
  position: absolute;
  top: -10px;
  right: -10px;
  background: #3b82f6;
  color: white;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(59, 130, 246, 0.4);
  letter-spacing: 0.5px;
}

.biblical-day {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}
.biblical-day .center-spacer {
  display: none;
}
.biblical-day .day-number {
  text-align: center;
}
.biblical-day .side-item {
  display: flex;
  justify-content: center;
  align-items: center;
}

.moon-phase {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-left: 0.2rem;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem; /* Zwiększony dystans między ikoną a tekstem fazy */
  line-height: 1.1;
  white-space: normal;
}

.moon-svg-dynamic {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  vertical-align: middle;
}
.moon-svg-dynamic .moon-bg {
  fill: rgba(0, 0, 0, 0.08); /* Lekki cień, sugerujący ukrytą sferę */
  stroke: rgba(0, 0, 0, 0.15); /* Delikatny obrys globusa */
  stroke-width: 2;
}
.moon-svg-dynamic .moon-lit {
  fill: #fbbf24; /* Złote słońce/światło */
}
[data-theme="dark"] .moon-svg-dynamic .moon-bg {
  fill: rgba(255, 255, 255, 0.05); /* Skrzętny półprzezroczysty nów w głębokiej nocy */
  stroke: rgba(255, 255, 255, 0.15); /* Kryształowy, delikatny łuk ułatwiający mapowanie koła */
  stroke-width: 2;
}

.moon-percent-text {
  font-size: 0.45rem;
  letter-spacing: 0.2px;
  font-weight: 600;
  color: #4f46e5; /* Wyróżniający się, głęboki astronomiczny indygo */
  font-family: var(--font-body);
  display: inline-block;
  width: max-content; /* Zabezpiecza szerokość przed cięciem dłużyszych wyrazów (np. Ostatni) przez komórkę flexa */
  vertical-align: middle;
  line-height: 1.1;
  text-align: left; /* Powrót do wyrównania lewostronnego zgodnie z życzeniem */
}

.moon-full-text {
  color: #d97706 !important; /* amber-600: Mocne złoto na jasne szkło */
}

[data-theme="dark"] .moon-full-text {
  color: #ffd60a !important; /* Świecący, neonowy żółty do trybu ciemnego */
}

.moon-waning-text {
  color: var(--text-secondary);
}

[data-theme="dark"] .moon-waning-text {
  color: var(--accent-cyan);
}
[data-theme="dark"] .moon-percent-text,
html[data-theme="dark"] body .moon-percent-text {
  color: #ffffff !important;
}

.gregorian-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  width: 100%;
}

.mobile-weekday {
  display: none;
}

/* Types of Days */
.day-card.tekufa {
  background: #fef3c7;
  border-color: #fde68a;
}
.day-card.tekufa .biblical-day {
  color: var(--tekufa-color);
}

.day-card.leap {
  background: #fce7f3;
  border-color: #fbcfe8;
}
.day-card.leap .biblical-day {
  color: var(--leap-color);
}

.day-card.rosh-hashanah {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.day-card.equinox {
  border: 1px dashed var(--equinox-color);
}

/* Event Labels / Badges */
.events-container {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: auto;
  padding-top: 0.5rem;
  width: 100%;
  min-width: 0;
}

.event-pill {
  font-size: 0.45rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.2rem 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.event-memorial {
  background-color: #fef08a; /* żółty pastel */
  color: #854d0e;
}

.event-sabbath {
  background-color: transparent;
  color: #ca8a04;
  border: 1px dotted #facc15;
}

.event-pesach {
  background-color: #fecaca; /* czerwony pastel */
  color: #7f1d1d;
}

.event-unleavened {
  background-color: #bae6fd; /* jasnoniebieski */
  color: #0369a1;
}

.event-tabernacles {
  background-color: #a7f3d0; /* pastelowy szmaragdowy */
  color: #047857;
}

.event-great-day {
  background-color: #fbcfe8; /* różowy pastel */
  color: #be185d;
}

.event-new-month {
  background-color: #e0e7ff; /* pastelowe indygo */
  color: #4338ca;
}

.event-feast {
  background-color: #bfdbfe; /* generyczny niebieski pastel (zapas) */
  color: #1e3a8a;
}

.event-firstfruits {
  background-color: #c7d2fe; /* fiolet pastel */
  color: #3730a3;
}

.event-shavuot {
  background-color: #dcfce7; /* zielony z omeru */
  color: #166534;
}

.event-trumpet {
  background-color: #fed7aa; /* pomarańczowy pastel */
  color: #9a3412;
}

.event-purim {
  background-color: #fce7f3; /* jasna fuksja pastelowa */
  color: #831843;
}

.event-atonement {
  background-color: #e5e7eb; /* szary pastel */
  color: #374151;
}

.event-wine-feast {
  background-color: #f9a8d4; /* mocniejszy róż uświetniający finał */
  color: #831843;
}

.event-oil-feast {
  background-color: #fde047; /* złoto dla oliwy */
  color: #713f12;
}

.event-rosh {
  background-color: #fcd34d;
  color: #854d0e;
}

.event-wine {
  background-color: #fce7f3;
  color: #9d174d;
}

.event-oil {
  background-color: #fef9c3;
  color: #854d0e;
}

.event-tekufa-pill {
  background-color: #fef08a; /* Soft yellow to match tekufa */
  color: #a16207;
}

.event-leap-pill {
  background-color: #fbcfe8; /* Soft pink to match leap */
  color: #9d174d;
}

.event-omer {
  background-color: #dcfce7; /* jasnozielony - wiosenne zbiory jęczmienia */
  color: #166534;
}


.event-equinox {
  background-color: #bbf7d0; /* zielony pastel */
  color: #166534;
}

.event-moon {
  background-color: #e2e8f0; /* srebrny pastel */
  color: #0f172a;
}

.event-priestly {
  background-color: #f3e8ff; /* jasny fiolet */
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.event-all-priests {
  background: linear-gradient(135deg, #fdf4ff 0%, #fef08a 100%);
  color: #86198f;
  border: 1px solid #facc15;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(134, 25, 143, 0.15);
  text-shadow: 0px 1px 1px rgba(255,255,255,0.8);
}

/* Obwoluty całego tygodnia mostkujące dziury w Gridzie */
.week-wrapper-base {
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
}

.week-wrapper-start {
  border-left-style: solid !important;
  border-left-width: 2px !important;
  border-top-left-radius: 12px !important;
  border-bottom-left-radius: 12px !important;
}

.week-wrapper-end {
  border-right-style: solid !important;
  border-right-width: 2px !important;
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
}

/* Kolorystyka Equinox */
.week-wrapper-equinox {
  border-top: 2px solid #38bdf8 !important;
  border-bottom: 2px solid #38bdf8 !important;
  background: rgba(56,189,248, 0.05) !important;
}
.week-wrapper-equinox.week-wrapper-start { border-left-color: #38bdf8 !important; }
.week-wrapper-equinox.week-wrapper-end { border-right-color: #38bdf8 !important; }

/* Kolorystyka Pełni */
.week-wrapper-fullmoon {
  border-top: 2px solid #fbbf24 !important;
  border-bottom: 2px solid #fbbf24 !important;
  background: rgba(251,191,36, 0.05) !important;
}
.week-wrapper-fullmoon.week-wrapper-start { border-left-color: #fbbf24 !important; }
.week-wrapper-fullmoon.week-wrapper-end { border-right-color: #fbbf24 !important; }

/* Kolorystyka Both - Podwójna obwoluta! */
.week-wrapper-both {
  border-top: 2px solid #38bdf8 !important; /* Wewnętrzna niebieska */
  border-bottom: 2px solid #38bdf8 !important;
  box-shadow: 0 -2px 0 0 #fbbf24, 0 2px 0 0 #fbbf24 !important; /* Zewnętrzna złota */
  background: linear-gradient(to right, rgba(56,189,248,0.05), rgba(251,191,36,0.05)) !important;
}
.week-wrapper-both.week-wrapper-start { 
  border-left-color: #38bdf8 !important; 
  box-shadow: -2px 0 0 0 #fbbf24, 0 -2px 0 0 #fbbf24, 0 2px 0 0 #fbbf24 !important; 
}
.week-wrapper-both.week-wrapper-end { 
  border-right-color: #38bdf8 !important; 
  box-shadow: 2px 0 0 0 #fbbf24, 0 -2px 0 0 #fbbf24, 0 2px 0 0 #fbbf24 !important;
}

/* Mostek nad wgłębieniem Grid-Gap (1rem) */
.week-wrapper-base:not(.week-wrapper-end)::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  right: -1rem;
  width: 1rem;
  z-index: 0;
  pointer-events: none;
}
.week-wrapper-equinox:not(.week-wrapper-end)::after {
  border-top: 2px solid #38bdf8;
  border-bottom: 2px solid #38bdf8;
  background: rgba(56,189,248, 0.05);
}
.week-wrapper-fullmoon:not(.week-wrapper-end)::after {
  border-top: 2px solid #fbbf24;
  border-bottom: 2px solid #fbbf24;
  background: rgba(251,191,36, 0.05);
}
.week-wrapper-both:not(.week-wrapper-end)::after {
  border-top: 2px solid #38bdf8;
  border-bottom: 2px solid #38bdf8;
  box-shadow: 0 -2px 0 0 #fbbf24, 0 2px 0 0 #fbbf24;
  background: linear-gradient(to right, rgba(56,189,248,0.05), rgba(251,191,36,0.05));
}

/* W trybach mobilnych pionowych usuwamy mostki gida bo items spadają pod spód */
body[class*="mobile-layout"]:not(.mobile-layout-7) .week-wrapper-base::after {
  display: none !important;
}
body[class*="mobile-layout"]:not(.mobile-layout-7) .week-wrapper-base {
  border-left-width: 2px !important;
  border-left-style: solid !important;
  border-right-width: 2px !important;
  border-right-style: solid !important;
  border-radius: 12px !important;
}
body[class*="mobile-layout"]:not(.mobile-layout-7) .week-wrapper-equinox { border-left-color: #38bdf8 !important; border-right-color: #38bdf8 !important; }
body[class*="mobile-layout"]:not(.mobile-layout-7) .week-wrapper-fullmoon { border-left-color: #fbbf24 !important; border-right-color: #fbbf24 !important; }
body[class*="mobile-layout"]:not(.mobile-layout-7) .week-wrapper-both { 
  border-left-color: #38bdf8 !important; 
  border-right-color: #38bdf8 !important; 
  box-shadow: 0 0 0 2px #fbbf24 !important; /* Dookoła elementu */
}

/* Specjalne wyróźnienie samych KAFELKÓW poszczególnych DNI */
.day-card.equinox {
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 15px rgba(56,189,248, 0.4) !important;
}
.day-card.fullmoon-100 {
  border: 2px solid #fbbf24 !important;
  box-shadow: 0 0 15px rgba(251,191,36, 0.4) !important;
}
/* RZADKIE ZJAWISKO: Pełnia i Equinox w tym samym DNIU! */
.day-card.equinox.fullmoon-100 {
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 0 2px #fbbf24, 0 0 15px rgba(56,189,248, 0.6), 0 0 25px rgba(251,191,36, 0.6) !important;
}

[data-theme="dark"] .day-card.equinox {
  border: 2px solid #0284c7 !important;
  box-shadow: 0 0 15px rgba(2,132,199, 0.5) !important;
}
[data-theme="dark"] .day-card.fullmoon-100 {
  border: 2px solid #b45309 !important;
  box-shadow: 0 0 15px rgba(180,83,9, 0.5) !important;
}
[data-theme="dark"] .day-card.equinox.fullmoon-100 {
  border: 2px solid #0284c7 !important;
  box-shadow: 0 0 0 2px #b45309, 0 0 15px rgba(2,132,199, 0.7), 0 0 25px rgba(180,83,9, 0.7) !important;
}

@media (max-width: 900px) {
  .month-nav {
    flex-direction: column;
    overflow-x: visible;
  }
  .month-tab {
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 600px) {
  .header {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 0.8rem 1rem !important;
    gap: 0.5rem !important;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }
  .logo-container {
    order: 1;
    flex: 0 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    max-width: 49%;
    overflow: visible;
  }
  .equinox-info {
    order: 2;
    flex: 0 1 auto !important;
    text-align: right !important;
    margin: 0 !important;
    max-width: 49%;
    white-space: nowrap !important;
    overflow: visible;
  }
  .controls {
    order: 3;
    flex: 1 1 100% !important;
    display: flex !important;
    justify-content: center !important; /* Centruje wybieraczkę na dolnym wierszu */
    align-items: center !important;
    margin-top: 0.2rem !important;
    width: 100% !important;
  }
  
  .equinox-info, .equinox-info * {
    font-size: 0.55rem !important;
  }
  
  .logo {
    align-self: flex-start !important;
    height: auto;
    font-size: 1.05rem !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
  #systemModeBadge {
    text-align: left !important;
    font-size: 0.55rem !important;
    line-height: 1.2;
    opacity: 0.7;
    margin-top: 0.2rem !important;
    white-space: nowrap !important;
  }
  
  /* Ukryj systemowy przełącznik desktopowy oraz zmianę języków w głównym nagłówku */
  .desktop-switch-btn,
  #langDropdownDesktopContainer {
    display: none !important;
  }
  
  .year-controls {
    width: auto !important;
    justify-content: center !important;
    gap: 1.3rem !important;
    min-height: 75px !important; /* Sztywna rezerwacja przestrzeni dla etykiety! */
  }
  .current-year-display {
    width: 175px !important; /* Zmniejszony tunel, aby wyeliminować pustą przestrzeń */
    height: auto !important;
  }
  .badge {
    bottom: -18px !important;
  }
  .year-prefix {
    font-size: 0.8rem;
    color: var(--text-primary);
  }
  .year-input {
    font-size: 1.15rem;
    width: 55px;
    padding: 0.1rem;
    text-align: center;
    border-radius: 6px;
  }
  #dockLayoutToggleBtn {
    display: flex !important;
  }
  #headerOptionsDropdown {
    display: none !important;
  }
  .dropdown-menu {
    top: 50px;
    right: 0;
    width: 220px;
  }
  .month-section h2 {
    font-size: 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.2rem;
  }
  .equinox-info {
    text-align: left;
    align-self: flex-start;
  }
  .month-subgroup {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .month-names-secondary {
    margin-left: 0 !important;
    font-size: 0.85rem;
  }
  .pipe-divider {
    display: inline-block; /* Odkrywamy rurkę między nazwami */
  }
  .calendar-sections-container {
    width: 100%;
    min-width: 0;
  }
  .calendar-scroll-wrapper {
    overflow-x: visible !important;
  }
  .weekday, .weekdays-header {
    display: none !important;
  }
  .day-card.empty {
    display: none !important;
  }
  
  /* ========== LAYOUT 7: SCROLLABLE DESKTOP VIEW ON MOBILE ========== */
  body.mobile-layout-7 .calendar-scroll-wrapper {
    overflow-x: auto !important;
  }
  
  .swipe-hint-7 {
    display: none;
    font-size: 0.6rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-top: 0.4rem;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    animation: swipeAnim 2.5s infinite ease-in-out;
    background: rgba(99, 102, 241, 0.08);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    border: 1px dashed rgba(99, 102, 241, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  @keyframes swipeAnim {
    0%, 100% { transform: translateX(0px); opacity: 0.8; }
    50% { transform: translateX(6px); opacity: 1; }
  }
  
  body.mobile-layout-7 .swipe-hint-7 {
    display: flex !important;
  }
  
  body.mobile-layout-7 .calendar-grid {
    grid-template-columns: repeat(7, 95px) !important;
    grid-auto-rows: minmax(85px, auto);
    gap: 1rem !important;
    justify-content: start;
  }
  body.mobile-layout-7 .day-card.empty {
    display: flex !important;
  }
  body.mobile-layout-7 .day-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.3rem;
    box-sizing: border-box !important;
    width: 100%;
    max-width: 95px;
  }
  body.mobile-layout-7 .day-card-header {
    border-right: none;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    padding-right: 0;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  body.mobile-layout-7 .biblical-day {
    font-size: 0.9rem;
  }
  body.mobile-layout-7 .gregorian-date {
    font-size: 0.45rem;
  }
  body.mobile-layout-7 .weekday {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 95px;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box !important;
  }
  body.mobile-layout-7 .weekdays-header {
    display: grid !important;
    grid-template-columns: repeat(7, 95px) !important;
    gap: 1rem !important;
    margin-bottom: 1rem;
    justify-content: start;
  }
  body.mobile-layout-7 .mobile-weekday {
    display: none !important;
  }
  body.mobile-layout-7 .wd-heb {
    order: 2;
    font-size: 0.4rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
  }
  body.mobile-layout-7 .wd-pol {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
  }
  body.mobile-layout-7 .wd-heb::before {
    content: "(";
  }
  body.mobile-layout-7 .wd-heb::after {
    content: ")";
  }
  body.mobile-layout-7 .wd-pol {
    order: 1;
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--text-primary);
  }
  body.mobile-layout-1 .calendar-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* DODANY ZAPAS POD NAGŁÓWKAMI (MARGINES ODDECHOWY DLA LAYOUTÓW Z KAFELKAMI) */
  body.mobile-layout-1 .month-section h2,
  body.mobile-layout-2 .month-section h2,
  body.mobile-layout-3 .month-section h2 {
    margin-bottom: 1rem;
  }

  body.mobile-layout-1 .day-card.empty {
    display: none !important;
  }
  body.mobile-layout-1 .weekday {
    display: none !important;
  }
  body.mobile-layout-1 .event-pill {
    text-align: left;
  }

  body.mobile-layout-1 .day-card {
    display: grid;
    grid-template-columns: 160px 1fr;
    grid-template-rows: auto;
    align-items: center;
    gap: 1rem;
    padding: 0;
    overflow: hidden;
  }
  body.mobile-layout-1 .day-card-header {
    display: grid;
    grid-template-columns: 42px 1fr;
    grid-template-rows: 1fr auto auto 1fr; /* Magiczne wiersze 1 i 4 jako elastyczne bufory powietrza */
    background: transparent;
    height: 100%;
    margin: 0;
    border-bottom: none;
    border-right: 2px solid var(--glass-border);
    padding: 0;
    align-content: stretch;
  }
  body.mobile-layout-1 .mobile-weekday {
    grid-column: 1;
    grid-row: 1 / span 4;
    display: flex !important;
    flex-direction: row; /* row because writing-mode makes it vertical line */
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    background: transparent;
    border-right: 1px dashed var(--glass-border);
    margin: 0;
    padding: 0.8rem 0;
    height: 100%;
    z-index: 2;
    gap: 0.4rem;
    flex-direction: column-reverse; /* Parallel lines under each other when reading vertically */
  }
  body.mobile-layout-1 .mobile-weekday .pol-name {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-primary);
  }
  body.mobile-layout-1 .mobile-weekday .heb-name {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 1px;
  }
  body.mobile-layout-1 .biblical-day {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center; /* twarde matematyczne centrowanie w zastępstwie baseline */
    width: 100%;
    padding-left: 0.7rem;
    margin: 0;
    font-size: 1.1rem;
  }
  body.mobile-layout-1 .biblical-day .center-spacer {
    display: none;
  }
  body.mobile-layout-1 .biblical-day .day-number {
    text-align: center;
  }
  body.mobile-layout-1 .biblical-day .side-item {
    display: flex;
    justify-content: flex-start;
    align-items: center; /* matematyczne centrowanie geometryczne */
    margin-left: 0.1rem; /* Przywrócenie przybliżenia do liczby! */
  }
  body.mobile-layout-1 .gregorian-date {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    padding-left: 0.7rem;
    margin: 0;
  }

  /* ========== LAYOUT 2: TWO COLUMNS ========== */
  body.mobile-layout-2 .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(85px, auto);
  }
  body.mobile-layout-2 .day-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
  }
  body.mobile-layout-2 .day-card-header {
    border-right: none;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    padding-right: 0;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* ========== LAYOUT 3: THREE COLUMNS ========== */
  body.mobile-layout-3 .calendar-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(85px, auto);
  }
  body.mobile-layout-3 .day-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.3rem;
  }
  body.mobile-layout-3 .day-card-header {
    border-right: none;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    padding-right: 0;
    padding-bottom: 0.2rem;
    margin-bottom: 0.2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  body.mobile-layout-3 .biblical-day {
    font-size: 0.9rem;
  }
  body.mobile-layout-3 .gregorian-date {
    font-size: 0.45rem;
  }
  body.mobile-layout-3 .mobile-weekday {
    font-size: 0.45rem;
  }

  /* ========== PILLS TRUNCATION ON NARROW VIEWS ========== */
  body.mobile-layout-2 .event-pill,
  body.mobile-layout-3 .event-pill,
  body.mobile-layout-7 .event-pill {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block; 
    width: auto;
  }
  body.mobile-layout-2 .events-container,
  body.mobile-layout-3 .events-container,
  body.mobile-layout-7 .events-container {
    display: block;
    width: 100%;
  }
  body.mobile-layout-2 .event-pill {
    margin-bottom: 0.2rem;
  }
  body.mobile-layout-3 .event-pill {
    margin-bottom: 0.1rem;
    padding: 0.1rem;
  }
  body.mobile-layout-3 .moon-percent-text {
    font-size: 0.4rem;
  }

  /* Remove default grid logic to rely on the body classes */
  .calendar-grid {
    min-width: 0;
    gap: 0.5rem;
  }
  .day-card {
    border-radius: 8px;
  }
  .events-container {
    margin-top: 0;
    padding-top: 0;
  }
  .mobile-weekday {
    display: block;
    text-align: center;
    margin-bottom: 0.3rem;
    line-height: 1.3;
  }
  .mobile-weekday .pol-name {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
  }
  .mobile-weekday .heb-name {
    display: block;
    font-size: 0.55rem;
    font-weight: 400;
    color: var(--text-secondary);
  }
  #mobileLayoutBtn {
    display: flex !important;
  }
  .biblical-day {
    font-size: 1.1rem;
  }
  .gregorian-date {
    font-size: 0.55rem;
  }
  .event-pill {
    font-size: 0.45rem;
    padding: 0.15rem 0.15rem;
  }
  .bottom-dock {
    max-width: calc(100vw - 12px) !important;
    padding: 0.5rem 0.5rem !important;
    gap: 0.3rem !important;
  }
  .dock-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.05rem !important;
  }
  .dock-drag-handle {
    padding: 0 0.25rem !important;
  }

}

@media screen and (min-width: 601px) {
  .calendar-scroll-wrapper {
    overflow-x: visible !important;
  }
  .weekdays-header {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--header-height, 80px) + var(--h2-height, 100px));
    z-index: 40;
    background: #ffffff;
    box-shadow: 0 -30px 0 0 #ffffff, 0 4px 6px rgba(0,0,0,0.02);
    border-bottom: 1px dashed rgba(0,0,0,0.05);
    padding-bottom: 0.5rem;
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .weekdays-header .wd-heb {
    display: none;
  }
}

/* Modal Wersetów */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(15, 23, 42, 0.6);
}

.modal-overlay.hidden-modal {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    height: 85vh;
    background: #ffffff !important;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

[data-theme="dark"] .modal-content {
    background: #1e293b !important;
    border-color: rgba(255,255,255,0.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.modal-overlay.hidden-modal .modal-content {
    transform: translateY(50px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    background: #f8fafc !important;
}

[data-theme="dark"] .modal-header {
    background: #0f172a !important;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.modal-body.verse-list {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body.verse-list p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.modal-body.verse-list p:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

[data-theme="dark"] .modal-body.verse-list p {
    border-bottom-color: rgba(255,255,255,0.05);
}

.v-green { color: #16a34a; font-weight: 500; }
.v-blue { color: #2563eb; font-weight: 500; }
.v-red { color: #dc2626; font-weight: 600; }
.v-pink { color: #db2777; font-weight: 600; }

[data-theme="dark"] .v-green { color: #4ade80; }
[data-theme="dark"] .v-blue { color: #60a5fa; }
[data-theme="dark"] .v-red { color: #f87171; }
[data-theme="dark"] .v-pink { color: #f472b6; }

#legendContent.collapsed + .sidebar-external-links {
    border-top: none !important;
    padding-top: 0.2rem !important;
    margin-top: 1.2rem !important;
}

/* ==============================================================
   NATIVE PRINT ENGINE (PDF EXPORT via window.print)
   ============================================================== */
@media print {
  /* margin: 0; NA ZAWSZE usunie niechciane nagłówki z adresami plików i stopki przeglądarki (Safari/Chrome)! */
  @page {
    /* Użycie specyfikacji mm wymusza bezpośrednio dla WebKitu orientację, gdy słowo 'landscape' zostaje zignorowane */
    size: 297mm 210mm;
    margin: 0; 
  }
  
  html, body {
    background: #ffffff !important;
    color: #1e293b !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    font-size: 12px !important; /* Globalne zmniejszenie całego fontu! */
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* NUKLEARNE ZAMKNIĘCIE MENU BOCZNEGO I PASKÓW */
  html body .sidebar-nav, html body aside.sidebar-nav, 
  .header, .bottom-nav, .sidebar-overlay, .modal-overlay, .fab, .language-switcher, .swipe-hint, .swipe-hint-7, .pin-verification-container, #viewToggleBtn, #desktopNav, .sidebar-counter, #networkStatusBanner {
    display: none !important;
    visibility: hidden !important;
    transform: none !important;
    position: static !important;
  }

  html body #app, html body .main-content, html body .calendar-sections-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
  
  main#appContent {
    margin-top: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Idealne zamknięcie miesiąca na jednej kartce i uniknięcie rozcięcia ! */
  .month-section {
    padding: 2mm 5mm !important;
    margin: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .month-section:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  h2, .month-section h2 {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    margin: 0 0 6px 0 !important;
    padding: 0 0 4px 0 !important;
    color: #0f172a !important;
    text-shadow: none !important;
    border-bottom: 1px solid #cbd5e1 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    position: static !important;
    transform: none !important;
    display: block !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
    background: none !important;
    clear: both !important;
  }
  
  .swipe-hint-7, .swipe-hint {
    display: none !important;
  }

  .wd-heb { display: none !important; }

  /* MASKI - wyłączenie bocznego wyblaknięcia z mobile */
  .calendar-scroll-wrapper::after, .calendar-scroll-wrapper::before {
    display: none !important;
  }

  /* Ściskanie gabarytów kart by zmieściły się na wysokości A4 ! */
  .calendar-scroll-wrapper {
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* ULTRA WYSOKA SPECYFICZNOŚĆ 'html body' ABY ZABIĆ MEDIA QUERIES Z .mobile-layout-7 I PIONOWYCH EKRANÓW! */
  html body .weekdays-header, html body:not(.mobile-layout-7) .weekdays-header {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 3px !important;
    width: 100% !important;
    position: static !important; 
    padding: 0 0 4px 0 !important;
    margin: 0 0 4px 0 !important;
    box-shadow: none !important;
    border-bottom: 2px solid #94a3b8 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    color: #475569 !important;
    text-align: center !important;
  }

  html body .calendar-grid, html body:not(.mobile-layout-7) .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 3px !important; /* Totalne ściśnięcie szczelin ! */
    width: 100% !important;
  }

  html body .day-card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    min-height: 52px !important;
    padding: 3px !important;
    border-radius: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }
  
  /* Przestrzeń Szabatu */
  html body .calendar-grid > div:nth-child(7n), html body .calendar-grid > div:nth-child(7n) {
    background-color: #fefce8 !important; /* Delikatny ciepły kremowy sabat */
    border-color: #fde047 !important;
  }
  
  html body .day-card.empty, 
  html body .weekday,
  html body:not(.mobile-layout-7) .day-card.empty:nth-child(-n+2),
  html body:not(.mobile-layout-7) .weekday:nth-last-child(-n+2) {
    display: flex !important; 
    opacity: 1 !important;
    visibility: visible !important;
  }

  html body .day-card.empty { border: 1px dashed #e2e8f0 !important; }

  /* Zmniejszenie tekstów wewnętrznych by nie rozpychały kartek */
  .day-num { 
    font-size: 1.15rem !important; 
    font-weight: 800 !important; 
    color: #0f172a !important;
    line-height: 1 !important;
  }
  .gregorian-date { 
    font-size: 0.5rem !important; 
    color: #64748b !important;
    font-style: italic !important;
    margin-top: 1px !important;
    margin-bottom: 2px !important;
  }
  .day-card.sabbath .day-num { color: var(--sabbath-color) !important; }

  .event-tag {
    font-size: 0.45rem !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    margin-top: 2px !important;
    box-shadow: 0 1px 1px rgba(0,0,0,0.02) !important;
  }

  /* LEGENDA (Ostatnia Strona lub pierwsza) - unikanie rozjazdów */
  #legendContent {
    display: block !important;
    padding: 5mm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .legend-list {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* Rozkład 4 kolumnowy dla brutalnej oszczędności pionu */
    gap: 4px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 0.65rem !important;
  }

  .legend-item {
    margin: 0 !important;
    padding: 2px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .legend-color { width: 8px !important; height: 8px !important; }
}

/* WOW BUTTTONS UX/UI */
.wow-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.wow-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-20deg);
  transition: all 0.6s ease;
  z-index: 1;
}

.wow-btn:hover::before {
  left: 150%;
}

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

.wow-text, .wow-icon {
  z-index: 2;
  position: relative;
}

.wow-icon {
  font-size: 1.15rem;
  margin-right: 0.6rem;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wow-btn:hover .wow-icon {
  transform: scale(1.15) rotate(-5deg);
}

/* INSTALL WOW */
.btn-install { 
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.btn-install:hover {
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
  transform: translateY(-2px);
}

/* PDF WOW */
.btn-pdf {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
[data-theme="dark"] .btn-pdf {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #f1f5f9;
  border-color: #334155;
}
.btn-pdf:hover {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  color: #dc2626;
  border-color: #fca5a5;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.2);
  transform: translateY(-2px);
}
[data-theme="dark"] .btn-pdf:hover {
  background: linear-gradient(135deg, #450a0a, #7f1d1d);
  color: #fecaca;
  border-color: #991b1b;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.4);
}
.btn-pdf:hover .wow-icon {
  color: #dc2626;
}
[data-theme="dark"] .btn-pdf:hover .wow-icon {
  color: #fecaca;
}

/* VERSES WOW */
.btn-verses {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
  border-color: #bfdbfe;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15);
}
[data-theme="dark"] .btn-verses {
  background: linear-gradient(135deg, #172554, #1e3a8a);
  color: #bfdbfe;
  border-color: #1e40af;
}
.btn-verses:hover {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}
[data-theme="dark"] .btn-verses:hover {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

/* BARWA DLA DROPDOWN JEZYKA */
.wow-lang-btn {
  width: 75px; 
  height: 32px; 
  font-size: 0.85rem; 
  font-weight: 700; 
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--card-bg), #f1f5f9);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 16px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: all 0.3s;
  cursor: pointer;
}
[data-theme="dark"] .wow-lang-btn {
  background: linear-gradient(135deg, var(--card-bg), #1e293b);
  border: 1px solid rgba(255,255,255,0.05);
}
.wow-lang-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* LINKI ZEWNĘTRZNE */
.wow-ext-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  transition: all 0.3s;
}
.wow-ext-link i {
  opacity: 0.6;
  font-size: 0.75rem;
  transition: all 0.3s;
}
.wow-ext-link:hover {
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
  transform: translateX(4px);
}
.wow-ext-link:hover i {
  opacity: 1;
  color: var(--accent-color);
}

/* SIDEBAR COUNTER WOW */
.wow-counter-box {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin: auto -1.5rem 0 -1.5rem;
  padding: 0.8rem 1.5rem calc(0.8rem + env(safe-area-inset-bottom)) 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  box-shadow: 0 -10px 25px rgba(0,0,0,0.03);
  transition: all 0.3s;
}
[data-theme="dark"] .wow-counter-box {
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 -10px 25px rgba(0,0,0,0.2);
}
.wow-counter-text {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 800;
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.8;
}
.wow-counter-pill {
  font-size: 1.1rem;
  font-weight: 800;
  color: #4f46e5;
  font-family: var(--font-display);
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  min-width: 60px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(255,255,255,0.5);
  transition: all 0.3s;
}
[data-theme="dark"] .wow-counter-pill {
  background: linear-gradient(135deg, #312e81, #3730a3);
  color: #c7d2fe;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.wow-counter-box:hover .wow-counter-pill {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

/* ULEPSZENIE NAGLOWKOW MENU OPCJI WOW */
.sidebar-header {
  transition: all 0.3s;
}
.sidebar-header h3 {
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  transition: color 0.3s;
}
.sidebar-header:hover h3 {
  color: var(--accent-color) !important;
}
.sidebar-header i.fa-chevron-up {
  color: var(--text-tertiary);
  transition: all 0.3s;
}
.sidebar-header:hover i.fa-chevron-up {
  color: var(--accent-color);
  transform: scale(1.1);
}
.sidebar-header.collapsed:hover i.fa-chevron-up {
  transform: rotate(180deg) scale(1.1);
}

/* March Moons Modal */
.march-moon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}
.march-moon-item:last-child {
    border-bottom: none;
}
.mm-date {
    font-weight: 600;
    color: var(--accent-color);
}
.mm-diff {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--nav-hover);
    padding: 3px 8px;
    border-radius: 12px;
}
.mm-diff.highlight {
    background: rgba(251,191,36,0.15);
    color: #f59e0b;
    border: 1px solid rgba(251,191,36,0.4);
    font-weight: 600;
}
[data-theme="dark"] .mm-diff.highlight {
    background: rgba(251,191,36,0.1);
    color: #fbbf24;
}
