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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --text-muted: #8a8a97;
  --accent: #2d8a4e;
  --accent-glow: rgba(45, 138, 78, 0.3);
  --gold: #c9a84c;
  --green: #22c55e;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  padding-inline-start: max(1rem, env(safe-area-inset-left));
  padding-inline-end: max(1rem, env(safe-area-inset-right));
  overscroll-behavior: none;
}

h1 { font-size: 1.5rem; font-weight: 600; margin-block-end: 0.5rem; }
h2 { font-size: 1.1rem; font-weight: 500; color: var(--text-muted); margin-block-end: 2rem; }

.container {
  width: 100%;
  max-width: 480px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-block-end: 1rem;
}

button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  min-height: 44px;
}

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

.btn-live {
  background: var(--accent);
  color: white;
  font-size: 1.1rem;
  padding: 1rem;
}
.btn-live:hover { filter: brightness(1.1); }
.btn-live:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-stop {
  background: var(--border);
  color: var(--text);
}
.btn-stop:hover { background: #3a3d4a; }

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-block-end: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.dot.live {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 1.5s ease-in-out infinite;
}
.dot.connected {
  background: var(--green);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-block-start: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stats span { font-weight: 600; color: var(--text); }

.hidden { display: none; }

audio { width: 100%; margin-block: 1rem; }

.stream-msg {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Subtle Islamic geometric nav accent */
nav[role="navigation"] {
  border-bottom: none !important;
  background-image: linear-gradient(90deg, transparent 0%, var(--accent) 15%, var(--gold) 30%, var(--accent) 50%, var(--gold) 70%, var(--accent) 85%, transparent 100%);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: bottom;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* RTL-aware flexbox gaps */
[dir="rtl"] .stats { direction: rtl; }
[dir="rtl"] .status { direction: rtl; }

/* Touch-friendly mobile */
@media (max-width: 640px) {
  body { padding: 1rem 0.75rem; }
  .card { padding: 1.25rem; }
  button { padding: 0.85rem 1.25rem; }
  .stats { gap: 1.5rem; }
}

@media (max-width: 400px) {
  h1 { font-size: 1.3rem; }
  h2 { font-size: 0.95rem; margin-block-end: 1.25rem; }
}
