/* ═══════════════════════════════════════════════════════════════
   DOWN RIBBON · World Cup 2026 Module
   Append to web/styles.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Ribbon container ── */
#wc-ribbon {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 500;
  max-height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.45);
  transition: max-height .38s cubic-bezier(.32,1.02,.52,.98);
  overflow: hidden;
  /* native-app feel: extend to bottom safe area */
  padding-bottom: env(safe-area-inset-bottom);
}

#wc-ribbon.rb-open {
  max-height: 72vh;
}

/* push main content up when ribbon is open */
main.rb-main-pushed {
  padding-bottom: calc(72vh + 8px);
  transition: padding-bottom .38s cubic-bezier(.32,1.02,.52,.98);
}

/* ── Handle bar (always visible) ── */
.rb-handle {
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.rb-handle-pill {
  width: 36px; height: 4px;
  border-radius: 99px;
  background: var(--border-2);
  transition: background .2s, width .2s;
}
#wc-ribbon.rb-open .rb-handle-pill {
  background: var(--accent);
  width: 28px;
}

.rb-peek {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--text-2);
  padding: 0 16px;
  width: 100%;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
}

.rb-team-flag, .rb-wc-badge { font-size: 1rem; line-height: 1 }

.rb-wc-badge {
  color: var(--accent);
  font-weight: 700;
  font-size: .72rem;
  background: rgba(var(--accent-rgb), .1);
  border: 1px solid rgba(var(--accent-rgb), .2);
  padding: 2px 8px;
  border-radius: 99px;
}

.rb-team-name {
  font-weight: 700;
  color: var(--text);
  font-size: .82rem;
}

.rb-pick-cta {
  color: var(--accent);
  font-weight: 600;
  font-size: .78rem;
  animation: rbPulse 2.5s ease-in-out infinite;
}
@keyframes rbPulse {
  0%,100% { opacity: 1 }
  50% { opacity: .55 }
}

.rb-sep { color: var(--muted) }

.rb-expand-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: .9rem;
  transition: transform .3s;
  flex-shrink: 0;
}
#wc-ribbon.rb-open .rb-expand-arrow { transform: rotate(180deg) }

/* ── Expanded panel ── */
.rb-panel {
  display: flex;
  flex-direction: column;
  height: calc(72vh - 56px);
  overflow: hidden;
}

/* ── Panel header ── */
.rb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rb-wc-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rb-trophy { font-size: 1.4rem; line-height: 1 }

.rb-wc-name {
  font-size: .82rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}
html[lang="ar"] .rb-wc-name { font-family: var(--font-ar-display) }

.rb-wc-venue {
  font-size: .65rem;
  color: var(--text-2);
  margin-top: 1px;
}

.rb-selected-team {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: border-color .15s;
}
.rb-selected-team:hover { border-color: var(--accent) }

.rb-sel-flag { font-size: 1.1rem }
.rb-sel-name { font-size: .72rem; font-weight: 700; color: var(--text) }
.rb-change { font-size: .62rem; color: var(--accent); margin-left: 2px }

/* ── Tabs ── */
.rb-tabs {
  display: flex;
  gap: 0;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.rb-tabs::-webkit-scrollbar { display: none }

.rb-tab {
  flex: 1;
  min-width: 60px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: .72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.rb-tab.rb-tab-on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.rb-tab:hover { color: var(--text) }
html[lang="ar"] .rb-tab { font-family: var(--font-ar-body) }

/* ── Scrollable body ── */
.rb-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Team picker ── */
.rb-picker { padding: 14px 14px 20px }

.rb-picker-title {
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
html[lang="ar"] .rb-picker-title { font-family: var(--font-ar-body) }

.rb-search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.rb-search {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  outline: none;
  transition: border-color .15s;
}
.rb-search:focus { border-color: var(--accent) }
.rb-search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .85rem;
  pointer-events: none;
}
html[lang="ar"] .rb-search { padding: 9px 36px 9px 14px }
html[lang="ar"] .rb-search-wrap::before { left: auto; right: 10px }

.rb-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
  padding: 0 2px;
}
html[lang="ar"] .rb-section-label { font-family: var(--font-ar-body); text-transform: none; letter-spacing: 0 }

.rb-team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 7px;
}

.rb-team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  font-family: inherit;
}
.rb-team-card:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  transform: translateY(-2px);
}
.rb-team-card.rb-team-selected {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .08);
}

.rb-tc-flag { font-size: 1.6rem; line-height: 1 }
.rb-tc-name {
  font-size: .62rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  line-height: 1.3;
  max-width: 80px;
}
html[lang="ar"] .rb-tc-name { font-family: var(--font-ar-body) }

/* ── My Team ── */
.rb-myteam { padding: 14px }

.rb-team-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.rb-hero-flag { font-size: 2.8rem; line-height: 1; flex-shrink: 0 }

.rb-hero-info { flex: 1; min-width: 0 }

.rb-hero-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
html[lang="ar"] .rb-hero-name { font-family: var(--font-ar-display) }

.rb-hero-group {
  font-size: .68rem;
  color: var(--text-2);
  margin-top: 3px;
}

.rb-hero-pts { text-align: center; flex-shrink: 0 }
.rb-pts-num {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.rb-pts-label { font-size: .6rem; color: var(--text-2); margin-top: 2px }

/* ── Next match card ── */
.rb-next-match {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),.06), transparent);
  border: 1px solid rgba(var(--accent-rgb), .2);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.rb-nm-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
html[lang="ar"] .rb-nm-label { text-transform: none; letter-spacing: 0; font-family: var(--font-ar-body) }

.rb-nm-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.rb-nm-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.rb-nm-flag { font-size: 1.6rem; line-height: 1 }
.rb-nm-tname {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
html[lang="ar"] .rb-nm-tname { font-family: var(--font-ar-body) }

.rb-nm-vs { text-align: center; flex-shrink: 0 }
.rb-nm-vs-text {
  font-size: .75rem;
  font-weight: 900;
  color: var(--muted);
}
.rb-nm-date { font-size: .62rem; color: var(--text-2); margin-top: 3px }
.rb-nm-time { font-size: .68rem; font-weight: 700; color: var(--accent) }

.rb-countdown {
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent-2);
  padding: 4px 0;
}

.rb-nm-venue {
  font-size: .62rem;
  color: var(--text-2);
  text-align: center;
  margin-top: 4px;
}

.rb-no-match {
  text-align: center;
  padding: 20px;
  color: var(--text-2);
  font-size: .75rem;
}

/* ── Group table ── */
.rb-mini-table-wrap { margin-top: 4px }

.rb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .7rem;
}
.rb-table th {
  padding: 5px 8px;
  text-align: center;
  font-size: .6rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.rb-table th:nth-child(2) { text-align: start }
.rb-table td {
  padding: 7px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(28,42,62,.5);
  vertical-align: middle;
}
.rb-table td:nth-child(2) { text-align: start }
.rb-table tr:last-child td { border-bottom: none }

.rb-tr-mine td { background: rgba(var(--accent-rgb), .06) }
.rb-tr-qualify td:first-child::after {
  content: '';
  display: block;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--accent-2);
  margin: 2px auto 0;
}

.rb-td-rank { color: var(--muted); font-weight: 600 }
.rb-td-team { display: flex; align-items: center; gap: 5px; min-width: 80px }
.rb-tf { font-size: .9rem; flex-shrink: 0 }
.rb-tn { font-size: .68rem; font-weight: 600; color: var(--text); white-space: nowrap }
html[lang="ar"] .rb-tn { font-family: var(--font-ar-body) }
.rb-td-pts { font-weight: 800; color: var(--text) }
.rb-pos { color: var(--accent-2) }
.rb-neg { color: var(--accent-hot) }

.rb-qualify-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .6rem;
  color: var(--text-2);
  padding: 8px 4px 2px;
}
.rb-q-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  flex-shrink: 0;
}

/* ── Fixtures ── */
.rb-fixtures-list { padding: 12px 14px 20px }

.rb-fixture-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.rb-fx-date {
  font-size: .6rem;
  color: var(--text-2);
  margin-bottom: 8px;
}

.rb-fx-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rb-fx-team {
  flex: 1;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.rb-fx-team.rb-fx-mine { color: var(--text); font-weight: 800 }
.rb-fx-vs {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
}
.rb-fx-venue { font-size: .6rem; color: var(--text-2) }

/* ── Standings tab ── */
.rb-standings { padding: 12px 14px 20px }

/* ── News ── */
.rb-news-list { padding: 10px 14px 20px }

.rb-news-card {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  border-radius: 8px;
}
.rb-news-card:hover, .rb-news-card:active { background: var(--surface-2) }

.rb-nc-source {
  font-size: .6rem;
  font-weight: 700;
  color: var(--accent-2);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.rb-nc-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html[lang="ar"] .rb-nc-title { font-family: var(--font-ar-body) }
.rb-nc-time { font-size: .6rem; color: var(--muted) }

/* ── Empty state ── */
.rb-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-2);
  font-size: .78rem;
  line-height: 1.5;
}
html[lang="ar"] .rb-empty { font-family: var(--font-ar-body) }

/* ── Push main content up for ribbon ── */
main {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  transition: padding-bottom .38s cubic-bezier(.32,1.02,.52,.98);
}
