:root {
  --bg-gradient: linear-gradient(135deg, #2c1810 0%, #1a0f0a 100%);
  --card-bg: rgba(255, 255, 255, 0.07);
  --card-border: rgba(212, 175, 55, 0.3);
  --accent-color: #d4af37;
  --red-letter: #ff6b6b;
  --text-color: #f7f4ea;
  --text-muted: #c2b69d;
}
body.theme-eiker { --bg-gradient: linear-gradient(135deg, #2d1e18 0%, #170d09 100%); --accent-color: #e09f3e; --card-border: rgba(224, 159, 62, 0.35); }
body.theme-gold { --bg-gradient: linear-gradient(135deg, #1f1a0a 0%, #0d0a03 100%); --accent-color: #f3c623; --card-border: rgba(243, 198, 35, 0.4); }
body.theme-forest { --bg-gradient: linear-gradient(135deg, #0f231a 0%, #05100b 100%); --accent-color: #52b788; --card-border: rgba(82, 183, 136, 0.35); }
body.theme-sunset { --bg-gradient: linear-gradient(135deg, #37121c 0%, #180509 100%); --accent-color: #e63946; --card-border: rgba(230, 57, 70, 0.35); }
body.theme-sabbath { --bg-gradient: linear-gradient(135deg, #0f1c2e 0%, #060d17 100%); --accent-color: #64dfdf; --card-border: rgba(100, 223, 223, 0.35); }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg-gradient); color: var(--text-color); min-height: 100vh; padding: 1rem 0.75rem; transition: background 0.5s ease; }
.container { max-width: 1200px; margin: 0 auto; }

/* Tabs */
.nav-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab-btn { background: rgba(255, 255, 255, 0.1); border: 1px solid var(--card-border); color: var(--text-color); padding: 0.6rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.2s ease; }
.tab-btn.active { background: var(--accent-color); color: #000; }
.panel { display: none; } .panel.active { display: block; }

/* UI Inputs & Buttons */
select, input[type="text"], button, textarea { background: rgba(255, 255, 255, 0.12); color: var(--text-color); border: 1px solid var(--card-border); padding: 0.65rem 0.8rem; border-radius: 8px; font-size: 0.95rem; font-family: inherit; }
button { cursor: pointer; font-weight: bold; }
button:active { background: var(--accent-color); color: #000; }
select option, select optgroup { background-color: #1f140e !important; color: #f7f4ea !important; }
textarea { width: 100%; min-height: 150px; resize: vertical; margin-top: 1rem; }

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--card-border); backdrop-filter: blur(12px); border-radius: 14px; padding: 1.25rem; box-shadow: 0 8px 24px 0 rgba(0, 0, 0, 0.35); margin-bottom: 1.25rem; }
.card h2 { color: var(--accent-color); margin-bottom: 0.5rem; }
.card h3 { font-size: 1.3rem; color: var(--accent-color); border-bottom: 1px solid var(--card-border); padding-bottom: 0.4rem; margin-bottom: 0.85rem; }

/* Torah Portion Header */
header { text-align: center; margin-bottom: 2rem; padding: 0 0.5rem; }
.hebrew-word { font-size: clamp(2.8rem, 10vw, 4.2rem); font-weight: bold; color: var(--accent-color); margin-bottom: 0.25rem; direction: rtl; display: inline-block; }
.transliteration { font-size: clamp(1.5rem, 5vw, 2.2rem); font-weight: 600; }
.meanings { font-size: clamp(1rem, 3.5vw, 1.2rem); color: var(--text-muted); margin-top: 0.4rem; font-style: italic; }

/* Grid Layouts */
.grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.side-by-side { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .side-by-side { grid-template-columns: 1fr 1fr; }
}

/* Lexicon Selector Box */
.lexicon-box { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border); border-radius: 10px; padding: 1rem; margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.lexicon-display { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.lex-hebrew { font-size: 2.2rem; font-weight: bold; color: var(--accent-color); direction: rtl; }
.lex-strongs { font-size: 0.95rem; color: var(--text-muted); font-weight: bold; }

/* Reading Label formatting & BLB Links */
.reading-category { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-color); margin-top: 0.4rem; font-weight: bold; }
.reading-item { margin-bottom: 0.6rem; font-size: 0.95rem; border-left: 2px solid var(--card-border); padding-left: 0.5rem; }
.blb-link { color: #ffffff; text-decoration: none; border-bottom: 1px dashed var(--accent-color); font-weight: 500; transition: all 0.2s; display: inline-block; padding: 2px 0; }
.blb-link:hover { color: var(--accent-color); border-bottom: 1px solid var(--accent-color); background: rgba(255,255,255,0.05); }

/* Scripture Scraper UI */
.scraper-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.scraper-bar input { flex: 1; }
.scrape-result { background: rgba(0, 0, 0, 0.4); border: 1px solid var(--card-border); border-radius: 10px; padding: 1.25rem; margin-top: 1rem; white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.6; max-height: 500px; overflow-y: auto;}
.scrape-result.red-text { color: var(--red-letter); font-size: 1.1rem; }

.loading-spinner { font-style: italic; color: var(--accent-color); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

/* Lists & Items */
.interactive-list { list-style: none; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; max-height: 400px; overflow-y: auto; padding-right: 5px;}
.interactive-item { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--card-border); padding: 0.75rem; border-radius: 8px; cursor: pointer; transition: 0.2s; }
.interactive-item:hover { background: rgba(0, 0, 0, 0.5); border-color: var(--accent-color); }
.item-title { font-weight: bold; color: var(--text-color); margin-bottom: 0.2rem; }
.item-sub { font-size: 0.85rem; color: var(--accent-color); }