body {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--font-serif);
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

section {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: none !important;
    border: 1px solid var(--border);
}

h1, h2 {
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.2px;
}

input, select, button {
  padding: 8px;
  margin: 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-400);
  outline-offset: 2px;
}

.search-button {
  position: fixed;
  bottom: calc(20px + 50px + 12px);
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-700);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 1.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1100;
}
.search-button:hover {
  background: rgba(255, 255, 255, 0.88);
  transform: translateY(-2px);
}
.search-button:focus-visible {
  outline: 2px solid var(--accent-400);
  outline-offset: 2px;
}

/* make form controls responsive so they don't force horizontal overflow */
input, select, button, textarea {
  max-width: 100%;
  box-sizing: border-box;
}

button {
  background: var(--accent-600);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--accent-700);
}
button:focus-visible {
  outline: 2px solid var(--accent-400);
  outline-offset: 2px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

/* Main table styling with consistent borders */
#links-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid var(--border);
    word-break: break-word;
}

/* Consistent borders for ALL cells */
#links-table th,
#links-table td {
    border: 1px solid var(--border);
    padding: 8px;
    text-align: left;
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 260px;
}

/* Header styling */
#links-table th {
    background: var(--surface-2);
    font-weight: bold;
}

/* Link styling within table cells */
#links-table td a {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-decoration: underline;
    color: var(--accent-700);
}

/* Verse column styling */
.col-verse {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clickable-verse {
    cursor: pointer;
    color: var(--accent-700);
    text-decoration: underline;
}

/* header sizing + fixed behavior on wide screens */
:root {
  --site-header-height: 92px;
  --logo-size: 80px;

  /* Palette */
  --bg: #FFF8F1;
  --surface: #F7EFE7;
  --surface-2: #F1E6DA;
  --text: #2A1E1A;
  --muted: #6E5A50;

  --accent-700: #B35C1E;
  --accent-600: #C76A28;
  --accent-500: #D77B3A;
  --accent-400: #E89B5C;
  --accent-300: #F1B784;
  --accent-100: #FBE7D3;

  --border: #E6D7C7;
  /* Fonts */
  --font-serif: 'Gentium Plus', Georgia, 'Times New Roman', serif;
  --font-display: 'Fraunces', 'Gentium Plus', Georgia, serif;
}

/* keep header normal by default (mobile/small screens) */
.site-header {
  max-width: 900px;
  margin: 18px auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.search-panel {
  position: fixed;
  bottom: calc(20px + 50px + 12px + 48px + 12px);
  right: 20px;
  width: min(360px, calc(100% - 40px));
  max-height: 70vh;
  display: none;
  z-index: 1095;
}
.search-panel.open {
  display: block;
}
.search-panel-inner {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  backdrop-filter: blur(8px);
}
.search-panel-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
#search-input {
  flex: 1;
  margin: 0;
  padding: 8px 10px;
}
.search-close {
  border: none;
  background: rgba(0,0,0,0.05);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}
.search-close:hover {
  background: rgba(0,0,0,0.15);
}
.search-close:focus-visible {
  outline: 2px solid var(--accent-400);
  outline-offset: 2px;
}
.search-status {
  min-height: 20px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 45vh;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}
.search-results li {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.92);
}
.search-results button {
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.search-results button:hover {
  text-decoration: none;
}
.search-result-title {
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text);
}
.search-result-meta {
  font-size: 0.85rem;
  color: var(--muted);
}
.search-result-verse {
  font-size: 0.85rem;
  color: var(--accent-700);
}
.search-result-link {
  font-size: 0.78rem;
  color: var(--accent-700);
  word-break: break-word;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .search-button {
    bottom: calc(20px + 50px + 12px);
    right: 20px;
    width: 50px;
    height: 50px;
  }
  .search-panel {
    bottom: calc(20px + 50px + 12px + 50px + 12px);
    right: 20px;
    left: 20px;
    width: auto;
  }
}

.site-title .main-title {
  margin: 0;
  font-size: 1.75rem; /* increased size */
  line-height: 1.05;
  letter-spacing: -0.4px;
  font-family: var(--font-display);
}

/* keep title readable on small screens */
@media (max-width: 420px) {
  .site-title .main-title {
    font-size: 1rem;
  }
}

/* logo default */
.site-logo {
  width: var(--logo-size);
  height: var(--logo-size);
  object-fit: contain;
  border-radius: 8px;
}

/* Fixed header for wide screens and push content down so "1." is visible */
@media (min-width: 720px) {
  .site-header {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    /* Make header flat: remove shadow, use very light border instead */
    box-shadow: none !important;
    /* keep subtle separation from page content */
    border: 1px solid var(--border);
    background: rgba(255, 248, 241, 0.98); /* var(--bg) mit leichter Transparenz */
    border-radius: 8px;
    padding: 14px 24px;
    height: var(--site-header-height);
    align-items: center;
    width: min(900px, calc(100% - 48px));
    overflow: visible;
  }

  /* logo sits inside the header (absolute) so it doesn't overlap the page content */
  .site-logo {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: var(--logo-size);
    height: var(--logo-size);
  }

  /* give the title right padding so text never sits under the logo */
  .site-title {
    padding-right: calc(var(--logo-size) + 24px);
    max-width: calc(100% - (var(--logo-size) + 56px));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* push page content down so the fixed header doesn't cover it */
  body {
    padding-top: calc(var(--site-header-height) + 36px);
  }
}

/* On small screens revert padding and fixed positioning so layout stays as before */
@media (max-width: 719px) {
  .site-header {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 8px 16px;
    height: auto;
  }

  .site-logo {
    position: static;
    width: 56px;
    height: 56px;
  }

  body {
    padding-top: 0;
  }
}

/* optional smaller tweaks */
@media (max-width: 420px) {
  .site-logo { width: 44px; height: 44px; }
  .site-title .main-title { font-size: 1rem; }
}

/* hide "add" controls in viewing songs area (covers common class/attribute names) */
#links-table .add-cell,
#links-table .add-btn,
#links-table .add-column,
#links-table .add,
#links-table [data-role="add"],
.links-add {
  display: none !important;
}

/* clickable verse cell */
.col-verse {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clickable-verse {
  cursor: pointer;
  color: var(--accent-700);
  text-decoration: underline;
}

/* verse modal */
.modal {
  position: fixed;
  inset: 0;
  display: none; /* shown via JS */
  align-items: center;
  justify-content: center;
  /* Make modal background and content flatter */
  background: rgba(0,0,0,0.20); /* slightly lighter overlay */
  z-index: 1200;
  padding: 20px;
}
.modal-content {
  background: #fff;
  max-width: 800px;
  width: min(95%, 800px);
  max-height: 80vh;
  overflow: auto;
  border-radius: 8px;
  padding: 16px 20px;
  /* remove any heavy visual depth */
  box-shadow: none !important;
  border: 1px solid rgba(0,0,0,0.06);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: rgba(255, 0, 0, 0.194);
  font-size: 1.25rem;
  cursor: pointer;
}
#verse-modal-text {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.4;
}

/* keep modal usable on very small screens */
@media (max-width: 420px) {
  .modal-content { padding: 12px; }
  .modal-close { font-size: 1rem; top: 6px; right: 8px; }
}

html, body {
  overflow-x: hidden;
}

/* Reduce paddings on very small screens so columns fit */
@media (max-width: 520px) {
  #links-table th, #links-table td {
    padding: 6px;
    font-size: 0.95rem;
  }
}

.songs-count {
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 4px;
}

/* Song column styling - completely inherit all styling from parent */
#links-table td.col-song,
#links-table th.col-song {
    /* Only keep the essential text overflow properties */
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: clamp(0.78rem, 1.6vw, 1rem);
    line-height: 1.12;
    
    /* Remove all display properties that might create visual boxes */
    display: table-cell; /* Force it to behave like a normal table cell */
    white-space: normal;
}

/* Links inside song cells */
#links-table td.col-song a {
    display: inline;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-decoration: underline;
    color: var(--accent-700);
}

/* Mobile responsive adjustments */
@media (max-width: 420px) {
    #links-table td.col-song,
    #links-table th.col-song {
    line-clamp: 3;
        -webkit-line-clamp: 3;
        max-width: 160px;
        font-size: clamp(0.78rem, 2.6vw, 0.95rem);
    }
}

/* bump up the mobile title size (placed at end so it overrides earlier rules) */
@media (max-width: 420px) {
  .site-title .main-title {
    font-size: 1.4rem !important;
  }
}

/* floating help button */
.help-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-600);
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: all 0.2s ease;
}

.help-button:hover {
    background: var(--accent-700);
    transform: scale(1.05);
}

.help-button:active {
    transform: scale(0.95);
}

/* help modal content */
.help-modal-content {
    max-width: 600px;
    max-height: 80vh;
}

.help-content {
    line-height: 1.6;
    color: var(--text);
    font-family: var(--font-serif);
}

.help-content h2 {
    margin-top: 0;
    color: var(--accent-700);
    font-family: var(--font-display);
}

.help-content p {
    margin: 1em 0;
}

.help-content ul, .help-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.help-content li {
    margin: 0.3em 0;
}

.help-content strong {
    color: var(--accent-700);
}

.verse-hebrew {
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--accent-700);
  margin-bottom: 4px;
  direction: rtl;
}
.verse-english {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 2px;
}
.verse-source {
  font-size: 0.75rem;
  color: #8f7f73;
  font-weight: normal;
  font-family: 'Gentium Plus', Georgia, serif;
}

/* responsive: stack on smaller screens */
@media (max-width: 600px) {
    .help-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .help-verse {
        text-align: center;
        max-width: none;
    }
}

/* make logo bigger on mobile */
@media (max-width: 768px) {
  .site-logo {
    width: 65px;
    height: 65px;
  }
}

@media (max-width: 480px) {
  .site-logo {
    width:65px;
    height: 65px;
  }
}

/* Current parasha section spacing */
.current-parasha-section {
  margin-top: 3.5rem;
}

@media (max-width: 450px) {
  .current-parasha-section {
    margin-top: 1rem;
  }
}