@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

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

:root {
  /* ── Brand Colors ── */
  --teal:       #00bebd;
  --teal-dark:  #009a99;
  --teal-darker:#007877;
  --teal-light: #33cbca;
  --teal-glow:  rgba(0,190,189,0.18);
  --dark:       #363636;
  --darker:     #1e1e1e;
  --darkest:    #111111;

  /* ── UI ── */
  --bg:         #ffffff;
  --white:      #ffffff;
  --card:       #ffffff;
  --border:     #e5e7eb;
  --border-teal:#b0e4e4;
  --text:       #1a1a1a;
  --muted:      #6b7280;
  --danger:     #e53935;
  --success:    #00897b;

  /* ── Spacing & Shape ── */
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 6px 32px rgba(0,0,0,0.12);
  --shadow-dark:0 4px 20px rgba(0,0,0,0.25);
}

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
}

/* ══════════════════════════════════
   LAYOUT
══════════════════════════════════ */
.container       { max-width: 900px;  margin: 0 auto; padding: 0 16px; }
.container-wide  { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ══════════════════════════════════
   SITE HEADER
══════════════════════════════════ */
.site-header {
  background: var(--darker);
  border-bottom: 2px solid var(--teal);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 12px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-mark {
  width: 38px;
  height: 38px;
  background: var(--teal);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0,190,189,0.5);
}
.logo-text-wrap { line-height: 1.1; }
.logo-name {
  font-size: 17px;
  font-weight: 900;
  color: white;
  letter-spacing: 0.5px;
}
.logo-name span { color: var(--teal); }
.logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-pill {
  background: rgba(0,190,189,0.12);
  border: 1px solid rgba(0,190,189,0.3);
  color: var(--teal);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
}
.header-pill:hover {
  background: var(--teal);
  color: var(--darker);
}

/* ══════════════════════════════════
   HERO SECTION
══════════════════════════════════ */
.hero-section {
  background: linear-gradient(160deg, var(--darkest) 0%, #1a2b2b 50%, #0d1f1f 100%);
  padding: 56px 20px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0,190,189,0.12) 0%, transparent 70%),
    radial-gradient(circle at 90% 80%, rgba(0,190,189,0.06) 0%, transparent 50%);
  pointer-events: none;
}
.hero-wc-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,190,189,0.12);
  border: 1px solid rgba(0,190,189,0.3);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}
.hero-title {
  font-size: clamp(32px,6vw,52px);
  font-weight: 900;
  color: white;
  line-height: 1.15;
  margin-bottom: 10px;
}
.hero-title .teal { color: var(--teal); }
.hero-subtitle {
  font-size: 17px;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
  margin-bottom: 28px;
}
.hero-flags {
  font-size: 26px;
  letter-spacing: 6px;
  opacity: 0.9;
}
/* Decorative teal line under hero */
.hero-line {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
}

/* ══════════════════════════════════
   CARDS
══════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
}
.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .teal { color: var(--teal); }

/* Teal accent card */
.card-teal {
  border-top: 3px solid var(--teal);
}

/* ══════════════════════════════════
   GRID
══════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
@media(max-width:640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════
   FORMS
══════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: rtl;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,190,189,0.12);
}

/* ══════════════════════════════════
   BUTTONS
══════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.btn-primary {
  background: var(--teal);
  color: var(--darker);
}
.btn-primary:hover {
  background: var(--teal-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,190,189,0.35);
}
.btn-dark {
  background: var(--dark);
  color: white;
}
.btn-dark:hover {
  background: var(--darker);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal);
}
.btn-outline:hover {
  background: var(--teal);
  color: var(--darker);
}
.btn-secondary {
  background: var(--bg);
  color: var(--dark);
  border: 2px solid var(--border);
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ══════════════════════════════════
   TABS
══════════════════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--darker);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  background: none;
  border: none;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.tab-btn.active {
  background: var(--teal);
  color: var(--darker);
  box-shadow: 0 2px 8px rgba(0,190,189,0.4);
}
.tab-btn:not(.active):hover { color: rgba(255,255,255,0.8); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ══════════════════════════════════
   MATCH CARDS
══════════════════════════════════ */
.match-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.match-card:hover { border-color: var(--border-teal); box-shadow: var(--shadow); }
.match-card.finished {
  background: #ffffff;
  border-color: var(--border-teal);
  border-right: 3px solid var(--teal);
}

.match-teams {
  display: flex;
  align-items: center;
  gap: 10px;
}
.match-team {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
}
.match-team.right { flex-direction: row-reverse; }
.team-flag { font-size: 20px; flex-shrink: 0; }

.match-score-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.score-input {
  width: 46px;
  height: 46px;
  border: 2px solid var(--border);
  border-radius: 9px;
  text-align: center;
  font-family: 'Tajawal', sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  background: white;
  transition: all 0.2s;
}
.score-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,190,189,0.15);
}
.score-input:disabled {
  background: #f0f0f0;
  color: var(--muted);
  cursor: not-allowed;
}
.score-sep { font-size: 20px; font-weight: 900; color: var(--muted); }

.match-result-badge {
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
}
.badge-correct-score  { color: var(--teal-darker); background: rgba(0,190,189,0.12); padding: 3px 12px; border-radius: 20px; border: 1px solid rgba(0,190,189,0.3); }
.badge-correct-outcome{ color: #0d5f9e; background: #e3f2fd; padding: 3px 12px; border-radius: 20px; }
.badge-wrong          { color: #b71c1c; background: #ffebee; padding: 3px 12px; border-radius: 20px; }
.badge-no-pred        { color: var(--muted); background: #f5f5f5; padding: 3px 12px; border-radius: 20px; }

.result-display {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--teal-darker);
  padding: 4px 12px;
  background: rgba(0,190,189,0.1);
  border-radius: 9px;
  min-width: 68px;
  border: 1.5px solid rgba(0,190,189,0.25);
}

/* ══════════════════════════════════
   SECTION HEADERS
══════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--darker);
  color: white;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  margin-top: 20px;
  font-weight: 800;
  font-size: 14px;
  border-right: 4px solid var(--teal);
  letter-spacing: 0.5px;
}
.section-header .label-teal { color: var(--teal); }
.section-header:first-child { margin-top: 0; }

/* ══════════════════════════════════
   LEADERBOARD
══════════════════════════════════ */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 24px 0 12px;
}
.podium-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium-item.rank-1 .podium-block { height: 92px; background: linear-gradient(135deg,#00d4d3,var(--teal)); }
.podium-item.rank-2 .podium-block { height: 72px; background: linear-gradient(135deg,#607d8b,#455a64); }
.podium-item.rank-3 .podium-block { height: 56px; background: linear-gradient(135deg,#8d6e63,#6d4c41); }
.podium-block {
  width: 72px;
  border-radius: 7px 7px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.podium-name {
  font-size: 13px; font-weight: 800;
  text-align: center; max-width: 80px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.podium-pts { font-size: 12px; color: var(--muted); font-weight: 700; }

.lb-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.lb-table th {
  background: #f9fafb;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-align: right;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lb-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr:hover td { background: #f9fafb; }
.lb-table tr.me td { background: rgba(0,190,189,0.07); font-weight: 700; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; font-weight: 900; font-size: 13px;
}
.rank-1 { background: var(--teal); color: var(--darker); }
.rank-2 { background: #607d8b; color: white; }
.rank-3 { background: #8d6e63; color: white; }
.rank-other { background: var(--bg); color: var(--muted); }

/* ══════════════════════════════════
   SCORING INFO BOX
══════════════════════════════════ */
.score-info { display: flex; gap: 10px; margin-top: 14px; }
.score-item {
  flex: 1; padding: 16px; border-radius: var(--radius-sm);
  text-align: center;
}
.score-item.outcome {
  background: rgba(0,190,189,0.07);
  border: 1.5px solid rgba(0,190,189,0.25);
}
.score-item.exact {
  background: var(--darker);
  border: 1.5px solid var(--teal);
}
.score-pts { display: block; font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.score-item.outcome .score-pts { color: var(--teal-dark); }
.score-item.exact .score-pts { color: var(--teal); }
.score-item.exact .score-desc { color: rgba(255,255,255,0.7); }
.score-desc { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ══════════════════════════════════
   GROUP BAR
══════════════════════════════════ */
.group-bar {
  background: var(--darker);
  border: 1.5px solid rgba(0,190,189,0.25);
  color: white;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-right: 4px solid var(--teal);
}
.group-bar-name { font-size: 20px; font-weight: 900; color: white; }
.group-bar-meta { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.group-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════
   SHARE BOX
══════════════════════════════════ */
.share-box {
  background: rgba(0,190,189,0.06);
  border: 1.5px solid rgba(0,190,189,0.25);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 14px;
}
.share-box p { font-size: 13px; font-weight: 700; color: var(--teal-dark); margin-bottom: 8px; }
.share-link-row { display: flex; gap: 8px; align-items: center; }
.share-link-input {
  flex: 1; padding: 8px 12px;
  border: 1.5px solid var(--border-teal);
  border-radius: var(--radius-sm);
  font-size: 13px; background: white; direction: ltr;
}

/* ══════════════════════════════════
   SAVE BAR
══════════════════════════════════ */
.save-bar {
  position: sticky; bottom: 16px;
  padding: 12px 16px;
  background: var(--darker);
  border-radius: var(--radius);
  box-shadow: var(--shadow-dark);
  border: 2px solid var(--teal);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; z-index: 50;
}
.save-bar-info { font-size: 13px; color: rgba(255,255,255,0.5); font-weight: 600; }
.save-bar-title { font-weight: 700; font-size: 14px; color: white; }
.save-status { font-size: 14px; font-weight: 700; }
.save-status.saved  { color: var(--teal); }
.save-status.saving { color: #fdd835; }
.save-status.error  { color: #ef9a9a; }

/* ══════════════════════════════════
   ADMIN HEADER
══════════════════════════════════ */
.admin-header {
  background: var(--darkest);
  border-bottom: 2px solid var(--teal);
  padding: 14px 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow-dark);
}
.admin-logo { font-size: 17px; font-weight: 900; color: white; }
.admin-logo span { color: var(--teal); }

.admin-match-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: white; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin-bottom: 8px; transition: all 0.2s; cursor: pointer;
}
.admin-match-row:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.admin-match-row.done { background: #f0fffe; border-color: var(--border-teal); }
.admin-match-teams { flex: 1; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-match-result { font-weight: 900; color: var(--teal-darker); font-size: 16px; padding: 2px 10px; background: rgba(0,190,189,0.1); border-radius: 6px; }
.admin-match-actions { display: flex; gap: 6px; }

/* ══════════════════════════════════
   ALERTS
══════════════════════════════════ */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.alert-success { background: rgba(0,190,189,0.1); color: var(--teal-darker); border: 1.5px solid rgba(0,190,189,0.3); }
.alert-error   { background: #ffebee; color: #b71c1c; border: 1.5px solid #ffcdd2; }
.alert-info    { background: var(--darker); color: rgba(255,255,255,0.8); border: 1.5px solid rgba(0,190,189,0.25); }

/* ══════════════════════════════════
   MODAL
══════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: white; border-radius: var(--radius);
  padding: 24px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-dark);
  border-top: 3px solid var(--teal);
}
.modal-title { font-size: 18px; font-weight: 900; color: var(--dark); margin-bottom: 16px; }

/* ══════════════════════════════════
   FEATURE CARDS
══════════════════════════════════ */
.feature-card {
  background: white; border-radius: var(--radius-sm);
  padding: 18px; text-align: center;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.feature-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 30px; margin-bottom: 10px; }
.feature-text { font-size: 14px; font-weight: 600; color: var(--dark); }

/* ══════════════════════════════════
   STATS PILLS
══════════════════════════════════ */
.stat-pill {
  flex: 1; min-width: 120px;
  background: var(--darker);
  border: 1.5px solid rgba(0,190,189,0.2);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-num { font-size: 28px; font-weight: 900; color: var(--teal); }
.stat-lbl { font-size: 12px; color: rgba(255,255,255,0.5); font-weight: 700; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ══════════════════════════════════
   SUCCESS BOX (after group creation)
══════════════════════════════════ */
.created-box {
  background: var(--darker);
  border: 1.5px solid rgba(0,190,189,0.3);
  border-radius: var(--radius);
  padding: 20px;
}
.created-box-title { color: var(--teal); font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.created-box-name { color: white; font-weight: 900; font-size: 20px; margin-bottom: 14px; }
.code-badge {
  background: rgba(0,190,189,0.15);
  border: 1.5px solid rgba(0,190,189,0.35);
  border-radius: 9px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.code-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--teal);
  font-feature-settings: "tnum";
}

/* ══════════════════════════════════
   FOOTER
══════════════════════════════════ */
.site-footer {
  background: var(--darkest);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 28px 20px;
  margin-top: 48px;
}
.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-left {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
}
.footer-left a { color: var(--teal); text-decoration: none; }
.powered-by {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.powered-label {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.brand-8k {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.brand-8k-logo {
  background: white;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 16px;
  font-weight: 900;
  color: black;
  letter-spacing: -0.5px;
  line-height: 1.3;
}
.brand-8k-logo .eightk-ar {
  font-size: 9px;
  display: block;
  font-weight: 700;
  letter-spacing: 0;
}
.brand-8k-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

/* ══════════════════════════════════
   LOADING / SPINNER
══════════════════════════════════ */
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid rgba(0,190,189,0.2);
  border-radius: 50%;
  border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px;
  color: var(--muted); font-size: 16px; font-weight: 600;
}

/* ══════════════════════════════════
   UTILITIES
══════════════════════════════════ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.text-muted { color: var(--muted); font-size: 13px; }
.fw-bold { font-weight: 800; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.teal { color: var(--teal); }

/* ══════════════════════════════════
   COUNTDOWN TIMER
══════════════════════════════════ */
.match-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  gap: 8px;
  flex-wrap: wrap;
}
.match-date-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.countdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(0,190,189,0.08);
  color: var(--teal-darker);
  border: 1px solid rgba(0,190,189,0.2);
}
.countdown-chip.urgent {
  background: #fff3e0;
  color: #e65100;
  border-color: #ffcc80;
  animation: pulse-urgent 1s ease-in-out infinite;
}
.countdown-chip.locked {
  background: #f5f5f5;
  color: var(--muted);
  border-color: var(--border);
}
@keyframes pulse-urgent {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.7; }
}
.match-card.locked-card {
  opacity: 0.82;
}
.match-card.locked-card .score-input {
  background: #f5f5f5;
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--border);
}

/* ══════════════════════════════════
   GUEST / STANDINGS VIEW
══════════════════════════════════ */
.guest-bar {
  background: var(--darker);
  border: 1.5px solid rgba(0,190,189,0.25);
  color: rgba(255,255,255,0.8);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
}
.guest-bar a { color: var(--teal); text-decoration: none; font-weight: 800; }

/* ══════════════════════════════════════════════════════════════
   THEME SYSTEM — الوضع الفاتح (افتراضي) + الوضع الداكن
   يُفعّل عبر html[data-theme="dark"] (يديره theme.js)
══════════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;
  --surface:   #ffffff;   /* أسطح البطاقات والمدخلات */
  --surface-2: #f9fafb;   /* رؤوس الجداول والتمرير */
  --surface-3: #f0f0f0;   /* العناصر المعطّلة */
  --transition-theme: background-color .25s ease, color .25s ease, border-color .25s ease;
}
body { transition: var(--transition-theme); }

/* زر تبديل الثيم في الهيدر */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(0,190,189,0.12);
  border: 1px solid rgba(0,190,189,0.3);
  color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
  transition: all .2s;
  padding: 0;
}
.theme-toggle:hover { background: var(--teal); color: var(--darker); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .ic-sun  { display: none; }
.theme-toggle .ic-moon { display: block; }
html[data-theme="dark"] .theme-toggle .ic-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

/* أيقونات SVG العامة (inline) */
.ic { display: inline-flex; vertical-align: -0.18em; width: 1.1em; height: 1.1em; flex-shrink: 0; }
.ic svg { width: 100%; height: 100%; }

/* ─────── الوضع الداكن ─────── */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #0f1719;
  --white:       #162023;
  --card:        #162023;
  --border:      #25343a;
  --border-teal: #18605f;
  --text:        #e7eef0;
  --muted:       #93a4a8;
  --dark:        #e7eef0;   /* النصوص التي كانت غامقة تصبح فاتحة */
  --surface:     #162023;
  --surface-2:   #1b282c;
  --surface-3:   #1f2d31;
  --shadow:      0 2px 16px rgba(0,0,0,0.45);
  --shadow-lg:   0 6px 32px rgba(0,0,0,0.55);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }

/* أسطح كانت بيضاء ثابتة */
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .score-input,
html[data-theme="dark"] .share-link-input,
html[data-theme="dark"] .admin-match-row,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .feature-card { background: var(--surface); color: var(--text); }
html[data-theme="dark"] .match-card.finished { background: var(--surface-2); }
html[data-theme="dark"] .admin-match-row.done { background: #122a28; }
html[data-theme="dark"] .lb-table th,
html[data-theme="dark"] .lb-table tr:hover td { background: var(--surface-2); }
html[data-theme="dark"] .score-input:disabled,
html[data-theme="dark"] .countdown-chip.locked,
html[data-theme="dark"] .match-card.locked-card .score-input { background: var(--surface-3); color: var(--muted); }
html[data-theme="dark"] .rank-other { background: var(--surface-3); }

/* الشارات الملوّنة الفاتحة → نسخ داكنة */
html[data-theme="dark"] .badge-correct-outcome { color: #8ec5ff; background: rgba(33,99,160,0.18); }
html[data-theme="dark"] .badge-wrong,
html[data-theme="dark"] .alert-error { color: #ff9a9a; background: rgba(183,28,28,0.18); border-color: rgba(183,28,28,0.35); }
html[data-theme="dark"] .badge-no-pred { color: var(--muted); background: var(--surface-3); }
html[data-theme="dark"] .countdown-chip.urgent { background: rgba(230,81,0,0.2); color: #ffb74d; border-color: rgba(230,81,0,0.4); }

/* الهيدر يصبح أعمق قليلاً */
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .admin-header { background: var(--darkest); }

/* ══════════════════════════════════════════════════════════════
   CHOICE CONTROL — خيارات قابلة للاختيار (نوع الانضمام) مع دعم الثيم
══════════════════════════════════════════════════════════════ */
.choice-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 7px; }
.choice {
  flex: 1; min-width: 140px;
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  transition: border-color .15s, background .15s, color .15s;
  user-select: none;
}
.choice:hover { border-color: var(--border-teal); }
.choice .ic { width: 18px; height: 18px; flex-shrink: 0; }
.choice input[type="radio"] {
  width: 17px; height: 17px; flex-shrink: 0;
  accent-color: var(--teal);
  cursor: pointer; margin: 0;
}
/* حالة الاختيار — إبراز بلون الهوية */
.choice:has(input:checked) {
  border-color: var(--teal);
  background: rgba(0,190,189,0.10);
  color: var(--teal-darker);
}
html[data-theme="dark"] .choice:has(input:checked) { color: var(--teal); }
