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

body {
  background: #F5F2EC;
  color: #1C1C1C;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px; /* Standard upper-bound for mobile portrait app shells */
  margin: 0 auto;
  min-height: 100vh;
  background: #F5F2EC;
  box-shadow: 0 0 32px rgba(0,0,0,0.05);
}

/* ── HEADER ── */
#header {
  flex-shrink: 0;
  text-align: center;
  padding: 24px 20px;
  background: #1C1C1C;
  color: #F5F2EC;
  position: relative;
}
#header-accent-line {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: #C8A84E;
}
#mosque-name {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}
#mosque-address {
  font-size: 0.9rem;
  font-weight: 400;
  color: #A0A0A0;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

/* ── MAIN ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 20px;
  width: 100%;
}

/* BISMILLAH */
#bismillah {
  font-family: 'Amiri', 'Traditional Arabic', 'Times New Roman', serif;
  font-size: 1.8rem;
  color: #777777;
  text-align: center;
}

/* CLOCK */
#clock-block { text-align: center; }
#clock {
  font-size: 4.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
#date-gregorian {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333333;
  margin-top: 8px;
  letter-spacing: 0.02em;
}
#date-hijri {
  font-family: 'Amiri', serif;
  font-size: 1.3rem;
  color: #555555;
  margin-top: 2px;
}

/* DIVIDER */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.divider svg { width: 16px; height: 16px; flex-shrink: 0; }
.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #C8A84E, transparent);
}

/* NEXT PANEL */
#next-panel {
  width: 100%;
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1C1C1C;
  color: #F5F2EC;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
#next-left { flex: 1; }
#next-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #C8A84E;
}
#next-name {
  font-size: 2.8rem;
  font-weight: 900;
  margin-top: 2px;
  line-height: 1.1;
}
#next-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.6rem;
  color: #E5E5E5;
  margin-top: 2px;
}
#next-jamaah-row {
  font-size: 1.05rem;
  font-weight: 400;
  color: #CCCCCC;
  margin-top: 8px;
}
#next-jamaah-time {
  font-weight: 800;
  font-size: 1.25rem;
  color: #C8A84E;
}
#next-right { text-align: right; padding-left: 16px; }
#countdown-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #A0A0A0;
  margin-bottom: 4px;
}
#countdown {
  font-size: 2.4rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #C8A84E;
  letter-spacing: -0.01em;
}

/* SUN ROW */
#sun-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  background: #FFFFFF;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #D1CFC9;
}
.sun-item { text-align: center; flex: 1; }
.sun-label {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #222222;
}
.sun-ar {
  font-family: 'Amiri', serif;
  font-size: 0.95rem;
  color: #444444;
  margin-top: 1px;
}
.sun-time {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  color: #1C1C1C;
}
.t-suffix { font-size: 0.8rem; font-weight: 400; color: #555555; }

/* TILES GRID */
#tiles-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tile {
  border-radius: 16px;
  padding: 16px 20px;
  background: #FFFFFF;
  color: #1C1C1C;
  border: 1px solid #D1CFC9;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.tile.is-next {
  background: #1C1C1C;
  color: #F5F2EC;
  border: 2px solid #C8A84E;
  box-shadow: 0 4px 20px rgba(200,168,78,0.15);
}
.tile.is-passed { opacity: 0.4; }
.tile.is-friday-jumuah {
  background: #1C1C1C;
  color: #F5F2EC;
  border: 2px solid #C8A84E;
  box-shadow: 0 4px 20px rgba(200,168,78,0.15);
  flex-direction: column;
  align-items: stretch;
}
.tile.not-friday { display: none; } /* Hide Jumu'ah tile when it's not Friday on mobile */

.tile-name {
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.tile.is-next .tile-name,
.tile.is-friday-jumuah .tile-name { color: #C8A84E; }

.tile-pipe { display: none; } /* Pipe layout modified for stacked mobile typography */

.tile-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: #777777;
  text-transform: none;
  letter-spacing: normal;
}
.tile.is-next .tile-arabic,
.tile.is-friday-jumuah .tile-arabic { color: #E5E5E5; }

/* Horizontal times configuration for mobile standard prayers */
.tile-times-wrapper {
  display: flex;
  gap: 24px;
  text-align: right;
}
.tile-time-block { margin-top: 0; }
.tile-row-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #777777;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tile.is-next .tile-row-label,
.tile.is-friday-jumuah .tile-row-label { color: #A0A0A0; }

.tile-adhan, .tile-iqamah {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.tile-iqamah { font-weight: 800; }
.tile.is-next .tile-iqamah,
.tile.is-friday-jumuah .tile-iqamah { color: #C8A84E; }
.tile.is-next .t-suffix,
.tile.is-friday-jumuah .t-suffix { color: #A0A0A0; }

/* Dual Jumu'ah Mobile Layout Transformation */
.tile-jumuah-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #333333;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.jumuah-split-container {
  display: flex;
  gap: 16px;
}
.jumuah-service {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jumuah-split-container .jumuah-service + .jumuah-service {
  border-left: 1px solid #333;
  padding-left: 16px;
}
.jumuah-service-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #C8A84E;
}
.jumuah-service .tile-time-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#next-name.long-name { font-size: 2.0rem; }

/* ── ACTIVE BADGES ── */
.tile::before {
  position: absolute;
  top: -8px;
  left: 16px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 10px;
  display: none;
  z-index: 2;
}
.tile.is-next::before {
  content: 'Next';
  display: inline-block;
  background: #C8A84E;
  color: #1C1C1C;
}
.tile.is-current::before {
  content: 'Current';
  display: inline-block;
  background: #2E7D32;
  color: #F5F2EC;
}
.tile.is-current {
  border: 2px solid #2E7D32;
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.1);
}
.tile.is-current .tile-name { color: #2E7D32; }

/* ── FOOTER ── */
#footer {
  flex-shrink: 0;
  text-align: center;
  padding: 20px;
  background: #1C1C1C;
  color: #A0A0A0;
  position: relative;
  margin-top: auto;
  width: 100%;
}
#footer-accent-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: #C8A84E;
}
#footer-msg {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.4;
}