/* [EDIT] Colors sampled from https://totalenergies.eg/ar
   Page white #ffffff, text #374649, action red #e70000, soft surface #f5f9fb.
   The swirl mark is a stand-in. Drop the official logo on .logo-mark. */

:root {
  --red: #e70000;
  --red-dark: #c40000;
  --ink: #374649;
  --muted: #5d6e72;
  --line: #e3ebef;
  --paper: #ffffff;
  --mist: #f5f9fb;
  --shadow: 0 10px 30px rgba(55, 70, 73, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-family: "Noto Sans", "Segoe UI", sans-serif; }
html[lang="ar"] { font-family: "Cairo", "Segoe UI", Tahoma, sans-serif; }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  text-align: start;
}
html[dir="rtl"] body { line-height: 1.7; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
a { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: rgba(231, 0, 0, 0.16); }
h1, h2, h3, p { margin-top: 0; }
h1, h2 {
  font-family: Nunito, "Noto Sans Arabic", sans-serif;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
html[lang="ar"] h1, html[lang="ar"] h2 {
  font-family: "Cairo", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
}
img { max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-inline-end: auto;
}
.brand strong { display: block; font-size: 18px; letter-spacing: -0.03em; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
html[lang="ar"] .brand strong { letter-spacing: 0; }

.logo-mark { width: 42px; height: 42px; position: relative; flex: none; }
.logo-mark i { position: absolute; border-radius: 50%; border: 3px solid transparent; }
.logo-mark i:nth-child(1) { inset: 0; border-top-color: #e70000; border-right-color: #f39200; transform: rotate(18deg); }
.logo-mark i:nth-child(2) { inset: 7px; border-top-color: #ffe14a; border-left-color: #78be20; transform: rotate(200deg); }
.logo-mark i:nth-child(3) { inset: 14px; border-top-color: #00a3e0; border-right-color: #6e2c91; transform: rotate(70deg); }
.logo-img { width: 42px; height: 42px; object-fit: contain; display: block; }

.site-nav, .subnav { display: flex; align-items: center; gap: 18px; }
.site-nav a, .subnav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.site-nav a[aria-current="page"], .subnav a[aria-current="page"] { color: var(--red); }
.lang { display: flex; gap: 8px; flex: none; }
.lang button {
  border: 0;
  background: transparent;
  padding: 4px 2px;
  font-weight: 700;
  color: var(--ink);
}
.lang button[aria-pressed="true"] { color: var(--red); }

.wrap { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 64px; }
.narrow { width: min(560px, 100%); margin: 0 auto; }

.hero {
  background: var(--mist);
  border-bottom: 1px solid var(--line);
}
.hero-inner { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 46px; }
.kicker { margin: 0 0 8px; color: var(--red); font-weight: 700; font-size: 13px; }
.hero h1 { font-size: clamp(36px, 5vw, 60px); margin: 0 0 12px; max-width: 16ch; }
.lede { max-width: 62ch; color: var(--muted); font-size: 18px; margin: 0; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 28px; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 32px; margin: 6px 0 8px; }
.card p { color: var(--muted); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.btn, .choice, .pick, .chip-pick {
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid transparent;
  line-height: 1.2;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: #fff; color: var(--red); border-color: var(--red); }
.btn-ghost:hover { background: #fff6f6; }
.btn-block { width: 100%; }
.btn-small { padding: 8px 14px; font-size: 14px; }
.text-btn {
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 0;
}

.subnav {
  border-bottom: 1px solid var(--line);
  margin: -8px 0 22px;
  padding-bottom: 0;
}
.subnav a { display: inline-block; padding: 8px 0 12px; }
.subnav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.note, .fine { color: var(--muted); font-size: 14px; }
.fine { font-size: 13px; margin: 8px 0 0; }
.center { text-align: center; }
.callout {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--mist);
  border-radius: 16px;
  border-inline-start: 3px solid var(--red);
}
.callout p:last-child { margin: 0; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
}
html[dir="rtl"] .chip { letter-spacing: 0; text-transform: none; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.prompt { font-size: 26px; margin: 8px 0; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.dots i { width: 8px; height: 8px; border-radius: 99px; background: #d5e0e4; display: block; }
.dots i.done { background: var(--red); }
.dots i.now { background: var(--ink); }

.avatar {
  width: 132px; height: 132px; margin: 12px auto;
  border-radius: 50%; display: grid; place-items: center; position: relative;
  background: var(--mist); color: var(--ink);
  box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--red);
}
.avatar-letters { font-size: 42px; font-weight: 700; letter-spacing: 0.04em; }
.avatar.lg { width: clamp(160px, 22vw, 230px); height: clamp(160px, 22vw, 230px); }
.avatar.lg .avatar-letters { font-size: clamp(52px, 6vw, 78px); }
.sample-tag {
  position: absolute; bottom: 8%; left: 50%; transform: translateX(-50%);
  background: var(--red); color: #fff; font-size: 9px; font-weight: 800;
  letter-spacing: 0.08em; padding: 2px 6px; border-radius: 999px;
}
.choice {
  width: 100%;
  text-align: start;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.choice:hover { border-color: var(--red); color: var(--red); }
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 16px; margin: 8px 0 12px;
  background: var(--mist); border: 1px solid var(--line);
}
.banner.good { border-color: #b7d7c2; background: #f3faf5; }
.banner.bad { border-color: #f0c2c2; background: #fff6f6; }
.bio { color: var(--muted); }
.who-name { font-size: clamp(32px, 4vw, 56px); margin: 4px 0; }
.role-line { color: var(--red); font-size: clamp(20px, 2vw, 30px); font-weight: 700; margin: 0 0 8px; }
.score-num, .progress-num, .count-block b { direction: ltr; unicode-bidi: isolate; }
.score-num { font-size: 84px; line-height: 0.9; margin: 8px 0; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; display: inline-block; }

.stage-page { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 28px; }
.stage-board {
  min-height: calc(100vh - 150px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--mist);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
}
.stage-top, .stage-bot, .perform-top, .transport {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap;
}
.stage-mid {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.count-block { display: flex; align-items: center; gap: 10px; }
.count-block b { font-size: clamp(40px, 5vw, 68px); line-height: 1; font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

.step-label { margin: 16px 0 8px; font-weight: 700; }
.team-select {
  width: 100%;
  margin: 0 0 6px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
}
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick, .chip-pick {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}
.pick { display: flex; align-items: center; gap: 8px; padding: 12px 14px; text-align: start; }
.pick i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); display: block; flex: none; }
.chip-pick { padding: 8px 14px; font-size: 14px; }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: start;
  box-shadow: 0 6px 16px rgba(55, 70, 73, 0.05);
}
.style-ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.style-copy { min-width: 0; }
.style-copy strong, .style-copy small { display: block; }
.style-copy strong { font-size: 14px; line-height: 1.25; }
.style-copy small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.style-card.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.style-card.on small { color: rgba(255, 255, 255, 0.72); }
.styles { display: flex; flex-wrap: wrap; gap: 8px; }
.pick.on, .chip-pick.on { border-color: var(--red); color: var(--red); box-shadow: 0 0 0 1px var(--red); }
textarea {
  width: 100%; min-height: 96px; resize: vertical; border-radius: 16px;
  border: 1px solid var(--line); padding: 12px 14px; background: #fff;
}
.form-error { color: var(--red); font-size: 14px; }
.spinner {
  width: 46px; height: 46px; margin: 8px auto; border-radius: 50%;
  border: 3px solid #f3d0d0; border-top-color: var(--red); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.load-bar, .bar, .line-track {
  height: 4px; border-radius: 99px; background: #e7eef2; overflow: hidden; display: flex;
}
.load-bar { margin-top: 16px; }
.load-bar i, .bar i, .line-track i { display: block; height: 100%; width: 0; background: var(--red); }
.load-bar i { animation: load linear forwards; }
.load-bar.busy { position: relative; }
.load-bar.busy i { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-120%); } to { transform: translateX(280%); } }
.key-row { display: flex; gap: 8px; margin-top: 10px; }
.key-row input { flex: 1; border-radius: 999px; border: 1px solid var(--line); padding: 10px 14px; background: #fff; }
@keyframes load { to { width: 100%; } }
.player {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin-top: 8px;
}
.player-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.player-copy span { color: var(--muted); font-size: 12px; }
.player-btn {
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: var(--red); color: #fff; display: grid; place-items: center;
}
.player-btn .ico-pause, .player-btn.is-on .ico-play { display: none; }
.player-btn.is-on .ico-pause { display: grid; }
.eq { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.eq span { width: 3px; height: 100%; border-radius: 99px; background: var(--red); transform: scaleY(0.2); transform-origin: bottom; }
.player.live .eq span, .eq.on span { animation: eq 0.55s ease-in-out infinite alternate; }
.eq span:nth-child(2) { animation-delay: 0.12s; }
.eq span:nth-child(3) { animation-delay: 0.22s; }
.eq span:nth-child(4) { animation-delay: 0.08s; }
@keyframes eq { to { transform: scaleY(1); } }
.lyrics-read .lyric { margin: 0; padding: 5px 8px; border-radius: 8px; }
.lyrics-read .lyric.on { background: #fff1f1; color: var(--red); font-weight: 700; }

.admin-scroll { max-height: 70vh; overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: start; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 10px; border-bottom: 2px solid var(--red);
}
html[dir="rtl"] .admin-table th { letter-spacing: 0; text-transform: none; font-size: 14px; }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.st { font-weight: 700; font-size: 13px; }
.st.live { color: var(--red); }
.st.ready { color: #1f7a3a; }
.st.writing { color: #9a5b00; }
.st.waiting { color: var(--muted); }

.stage-screen { position: relative; min-height: calc(100vh - 150px); border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: var(--mist); }
#viz { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-overlay {
  position: relative; z-index: 1; min-height: calc(100vh - 150px);
  display: flex; flex-direction: column; padding: 22px 28px 16px;
  background: linear-gradient(#f5f9fbe6, #f5f9fba8 28%, #f5f9fba8 72%, #f5f9fbe6);
}
.stage-overlay.is-empty { align-items: center; justify-content: center; text-align: center; }
.lyrics-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.lyrics-stage .lyric {
  margin: 0; text-align: center; color: rgba(55, 70, 73, 0.38);
  font-size: clamp(15px, 1.8vw, 26px); line-height: 1.28; font-weight: 600;
}
.lyrics-stage .lyric.on { color: var(--red); transform: scale(1.03); }
.mode-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-toggle button {
  border-radius: 999px; border: 1px solid var(--line); background: #fff;
  padding: 8px 12px; font-weight: 700; font-size: 14px;
}
.mode-toggle button[aria-pressed="true"] { border-color: var(--red); color: var(--red); }
.transport-actions { display: flex; align-items: center; gap: 8px; }
.audio-error {
  margin: 12px auto; width: min(720px, calc(100% - 32px));
  border: 1px solid #f0c2c2; background: #fff6f6; color: var(--red);
  border-radius: 12px; padding: 10px 12px; text-align: center;
}
.foot {
  background: var(--mist);
  color: var(--muted);
  text-align: center;
  padding: 18px 16px 26px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}

@media (max-width: 800px) {
  .site-header { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .site-nav { order: 3; width: 100%; gap: 14px; }
  .cards, .picks, .style-grid { grid-template-columns: 1fr; }
  .hero-inner, .wrap { width: min(100% - 28px, 1080px); }
  .stage-board, .stage-overlay { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
