* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  padding: 2rem;
  line-height: 1.6;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.2rem;
}

.subtitle {
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 1.75rem;
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  background: #161616;
  padding: 0.25rem;
  border-radius: 8px;
}

.tab {
  padding: 0.4rem 1rem;
  border: none;
  background: transparent;
  color: #555;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tab:hover { color: #aaa; }

.tab.active {
  background: #252525;
  color: #fff;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 300px;
}

@media (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .tabs { width: 100%; }

  .tab {
    flex: 1;
    text-align: center;
  }

  .search-wrap { max-width: 100%; }

  .count { text-align: right; }
}

.search-wrap svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #444;
  pointer-events: none;
}

#search {
  width: 100%;
  background: #161616;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  color: #e0e0e0;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

#search:focus { border-color: #333; }
#search::placeholder { color: #3a3a3a; }

.count {
  font-size: 0.75rem;
  color: #3a3a3a;
  white-space: nowrap;
}

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #1a1a1a;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3a3a3a;
  padding: 0.6rem 0.85rem;
  background: #111;
  border-bottom: 1px solid #1a1a1a;
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid #161616; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #131313; }
tbody tr.hidden { display: none; }

td {
  padding: 0.7rem 0.85rem;
  vertical-align: top;
}

/* Arabic cells */
.ar {
  font-family: 'Geeza Pro', 'Arabic Typesetting', 'Traditional Arabic', 'Amiri', serif;
  font-size: 1.2rem;
  direction: rtl;
  text-align: right;
  color: #c9a96e;
  white-space: nowrap;
}

.ar.muted { color: #5a4a30; }

.same-badge {
  display: inline-block;
  font-size: 0.65rem;
  color: #3a3a3a;
  font-family: -apple-system, sans-serif;
  vertical-align: middle;
  margin-right: 0.3rem;
  font-style: normal;
  direction: ltr;
}

/* Transliteration */
.translit {
  color: #7a9fd4;
  font-style: italic;
  white-space: nowrap;
}

.translit.muted { color: #3a4a60; }

/* Meaning */
.meaning { color: #e0e0e0; }

.root {
  font-size: 0.72rem;
  color: #383838;
  margin-top: 0.3rem;
  font-style: italic;
  line-height: 1.4;
}

/* Notes */
.notes {
  color: #555;
  font-size: 0.8rem;
  min-width: 180px;
}

.warn { color: #c47c5c; }

/* Date */
.date {
  color: #303030;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Register & tags */
.reg {
  display: inline-flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  font-style: normal;
}

.b-msa     { background: #1a1528; color: #8a6cc4; }
.b-hijazi  { background: #2a1e12; color: #c48c4c; }
.b-both    { background: #122018; color: #4c9c6c; }
.b-warn    { background: #2a1510; color: #c46c4c; }
.b-quran   { background: #1a150a; color: #c9a96e; }

.section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #333;
  padding: 0.5rem 0 0.4rem;
  margin-top: 0.5rem;
}

.tab-count {
  display: inline-block;
  background: #2a2a2a;
  color: #666;
  font-size: 0.62rem;
  padding: 0.05rem 0.32rem;
  border-radius: 3px;
  margin-left: 0.3rem;
  vertical-align: middle;
  font-style: normal;
}

.col-divider {
  width: 1px;
  background: #1a1a1a;
  padding: 0;
}

.section-head {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.85rem;
  background: #111;
  color: #2a2a2a;
  border-bottom: 1px solid #1a1a1a;
}

/* Practice tab */
.practice-box { max-width: 580px; }

.practice-label {
  font-size: 0.78rem;
  color: #444;
  margin-bottom: 0.5rem;
}

.practice-input {
  width: 100%;
  background: #161616;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #e0e0e0;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  resize: none;
  line-height: 1.6;
  transition: border-color 0.15s;
}

.practice-input:focus { border-color: #333; }
.practice-input::placeholder { color: #3a3a3a; }

.suggest-btn {
  margin-top: 0.6rem;
  padding: 0.45rem 1.25rem;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #888;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.suggest-btn:hover { background: #252525; color: #ccc; border-color: #333; }

.practice-results { margin-top: 1.5rem; }

.practice-results-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #333;
  margin-bottom: 0.75rem;
}

.practice-empty {
  font-size: 0.82rem;
  color: #383838;
  padding: 0.5rem 0;
}

/* Phrases table: allow Arabic and translit to wrap for long prayer lines */
#phrases-table .ar,
#phrases-table .translit {
  white-space: normal;
  word-break: break-word;
  min-width: 140px;
}
