/* ============================================================
   تحديات نواس — web component kit. Ports of the mobile Nw kit
   (mobile/lib/widgets/nw.dart): NwButton, NwIconButton, NwCard,
   NwPill, NwSegmented, NwChoiceChip, NwModeTile, NwIconSquare,
   NwPageTitle, NwSectionHeader, NwEmptyState, NwSunBanner,
   NwAvatar, NwHex, NwTiltTile + the catalogue game tiles/covers.
   Older class names (btn-gold, btn-green, panel, tabs, badge…)
   are kept and restyled so every page adopts the new look.
   Consumes tokens.css only. RTL-safe: logical properties.

   Rendering note: hairlines on rounded surfaces are drawn with
   `box-shadow: inset 0 0 0 1px <color>` instead of `border`.
   Chromium's software rasterizer paints diagonal seam artifacts
   for translucent borders on translucent rounded surfaces, and
   inset *blurred* shadows show banding; the inset 1px ring renders
   identically and is artifact-free. `drop-shadow()` filters are safe.
   ============================================================ */

/* ---------------- Buttons (NwButton) ---------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-ring: var(--line);
  --btn-lip: var(--handle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 45px;
  padding: 9px 18px;
  border: 0;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: 0 3px 0 var(--btn-lip), inset 0 0 0 1px var(--btn-ring);
  transition: transform .12s ease, box-shadow .12s ease, background-color .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { color: var(--btn-fg); filter: brightness(1.03); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-lip), inset 0 0 0 1px var(--btn-ring); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* primary — action orange */
.btn-primary, .btn-gold {
  --btn-bg: var(--action); --btn-fg: #fff; --btn-ring: var(--action); --btn-lip: var(--action-pressed);
  min-height: 48px;
  font-size: 15px;
}
/* secondary — mint / teal text */
.btn-secondary {
  --btn-bg: var(--mint); --btn-fg: var(--teal); --btn-ring: var(--mint); --btn-lip: var(--mint-line);
}
/* teal — filled team-two / positive */
.btn-teal, .btn-green {
  --btn-bg: var(--teal); --btn-fg: #fff; --btn-ring: var(--teal); --btn-lip: var(--teal-deep);
}
/* danger — peach / orange text */
.btn-danger, .btn-red {
  --btn-bg: var(--peach); --btn-fg: var(--action-text); --btn-ring: var(--peach); --btn-lip: #F6CDB8;
}
/* ghost — white with hairline */
.btn-ghost { --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-ring: var(--line); --btn-lip: var(--handle); }
/* ink — dark */
.btn-ink { --btn-bg: var(--ink); --btn-fg: #fff; --btn-ring: var(--ink); --btn-lip: #1F1C29; }
/* plain link button */
.btn-link {
  --btn-bg: transparent; --btn-fg: var(--action); --btn-ring: transparent; --btn-lip: transparent;
  min-height: 0; padding: 6px 4px; font-size: 13px;
}
.btn-link:active { transform: none; }

.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 16px; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { display: flex; width: 100%; }

/* NwIconButton — 40×40 white square with hairline */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--ring-line);
  cursor: pointer;
  position: relative;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--action); box-shadow: inset 0 0 0 1px var(--tangerine); }

/* Inline orange text link with arrow (NwLinkButton) */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 13px;
  color: var(--action);
}
.link-arrow svg { width: 15px; height: 15px; }

/* ---------------- Surfaces (NwCard) ---------------- */
.card, .panel {
  background: var(--surface);
  box-shadow: var(--ring-line);
  border-radius: 21px;
  padding: 18px;
}
.panel { border-radius: 18px; padding: 16px; }
.card--lg { padding: 24px; border-radius: var(--radius-lg); }
.card--raised { box-shadow: var(--shadow-card), var(--ring-line); }
.card--peach { background: var(--peach); box-shadow: none; }
.card--mint { background: var(--mint); box-shadow: none; }
.card--lilac { background: var(--lilac); box-shadow: none; }
.card--sun { background: var(--sun-soft); box-shadow: none; }
.card--sunk { background: var(--bg-sunk); box-shadow: none; }
a.card { display: block; color: inherit; }
a.card:hover { box-shadow: inset 0 0 0 1px var(--tangerine); }

.card--fade { animation: fadeInUp 0.4s ease both; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-h3);
}
.panel-title svg { width: 21px; height: 21px; color: var(--purple); flex: none; }

/* ---------------- Page scaffolding ---------------- */
/* NwPageTitle: 25px bold title, muted subtitle, back square at the end */
.page-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-block-end: 18px;
}
.page-title__text { flex: 1; min-width: 0; }
.page-title h1 {
  font-size: 25px;
  line-height: 1.4;
  margin: 0;
}
.page-title__sub { margin: 2px 0 0; font-size: var(--fs-small); color: var(--muted); }

/* NwSectionHeader: «اختَر تحدّيك» … «كل الألعاب ←» */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block: 26px 12px;
}
.section-head h2 { flex: 1; margin: 0; font-size: 20px; }

.page-narrow { max-width: 460px; margin-inline: auto; }
.page-medium { max-width: 760px; margin-inline: auto; }

/* ---------------- Pills & tags (NwPill / NwInfoTag / NwSoonTag) ---------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--mint);
  color: var(--teal);
}
.pill svg { width: 13px; height: 13px; }
.pill--bold { font-weight: 700; }
.pill--mint { background: var(--mint); color: var(--teal); }
.pill--orange { background: var(--peach); color: var(--action-text); }
.pill--purple { background: var(--lilac); color: var(--purple-text); }
.pill--grey { background: var(--segment); color: var(--muted); }
.pill--yellow { background: var(--sun-soft); color: var(--sun-text); }
.pill--new { background: var(--action); color: #fff; font-weight: 800; border-radius: 15px; font-size: 10.5px; }

.soon-tag {
  display: inline-flex;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--sun-soft);
  color: var(--sun-text);
  font-size: 10.5px;
  font-weight: 700;
}

.info-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--ring-line);
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}
.info-tag svg { width: 15px; height: 15px; }
.info-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------- Badges (legacy) ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: var(--fs-tiny);
  font-weight: 700;
  line-height: 1.7;
  background: var(--segment);
  color: var(--muted);
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge--green { background: var(--mint); color: var(--teal); }
.badge--red, .badge--danger { background: var(--peach); color: var(--action-text); }
.badge--gold, .badge--warning { background: var(--sun-soft); color: var(--sun-text); }
.badge--purple { background: var(--lilac); color: var(--purple-text); }
.badge--counter {
  position: absolute;
  inset-block-start: -6px;
  inset-inline-end: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  justify-content: center;
  background: var(--action);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  border-radius: 9px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Live-voice: this player is talking right now (roster indicator). */
.badge__speaker { font-size: 11px; line-height: 1; }
.badge__speaker.is-speaking { animation: speakerPulse 0.9s ease-in-out infinite; }
.badge.is-talking { box-shadow: inset 0 0 0 1px var(--tangerine); }
@keyframes speakerPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.12); }
}

/* Coins / tickets pill in the header (app WalletPill) */
.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--ring-line);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.coin-pill:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--tangerine); }
.coin-pill__icon { display: inline-flex; color: #AC7020; }
.coin-pill__icon svg { width: 17px; height: 17px; }
.coin-pill--premium { background: var(--sun-soft); box-shadow: none; color: var(--sun-text); }

/* ---------------- Chips ---------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--ring-line);
  font-size: var(--fs-small);
  color: var(--ink);
}

/* NwChoiceChip — ink when selected, white otherwise */
.choice-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  padding: 7px 15px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--ring-line);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12.5px;
  cursor: pointer;
}
.choice-chip.is-selected, .choice-chip[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
  font-weight: 700;
}

/* ---------------- Segmented tabs (NwSegmented) + legacy .tabs ---------------- */
.segmented, .tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: var(--segment);
  margin-block-end: 18px;
}
.segmented__item, .tabs__tab {
  appearance: none;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 37px;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .18s ease, color .18s ease;
}
.segmented__item svg, .tabs__tab svg { width: 15px; height: 15px; }
.segmented__item:hover, .tabs__tab:hover { color: var(--ink); }
.segmented__item.is-active, .tabs__tab.is-active {
  background: var(--surface);
  color: var(--action);
  font-weight: 700;
  box-shadow: 0 2px 5px #56412A10;
}
.tabs__tab .badge { padding: 0 6px; }
.tab-panel[hidden] { display: none; }

/* ---------------- Mode tiles (NwModeTile) ---------------- */
.mode-list { display: flex; flex-direction: column; gap: 9px; }
.mode-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--ring-line);
  color: inherit;
  text-align: start;
}
a.mode-tile:hover, label.mode-tile:hover { box-shadow: inset 0 0 0 1px var(--tangerine); color: inherit; }
.mode-tile.is-selected {
  background: var(--peach-soft);
  box-shadow: inset 0 0 0 2px var(--tangerine);
}
.mode-tile__body { flex: 1; min-width: 0; }
.mode-tile__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
}
.mode-tile__desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.mode-tile__end { flex: none; color: var(--action); display: inline-flex; }
.mode-tile__end svg { width: 18px; height: 18px; }

/* NwIconSquare — rounded icon square (43×43, radius 13) */
.icon-sq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: var(--lilac);
  color: var(--purple);
}
.icon-sq svg { width: 21px; height: 21px; }
.icon-sq--mint { background: var(--mint); color: var(--teal); }
.icon-sq--peach { background: var(--peach); color: var(--action); }
.icon-sq--sun { background: var(--sun-icon); color: var(--sun-deep); }
.icon-sq--ink { background: var(--ink); color: #fff; }
.icon-sq--lg { width: 78px; height: 78px; border-radius: 24px; }
.icon-sq--lg svg { width: 38px; height: 38px; }
.icon-sq--xl { width: 101px; height: 101px; border-radius: 28px; }
.icon-sq--xl svg { width: 50px; height: 50px; }
.icon-sq--tilt { transform: rotate(-7deg); }
.icon-sq--tilt-r { transform: rotate(6deg); }

/* ---------------- Empty state (NwEmptyState) ---------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 14px 12px;
}
.empty-state .icon-sq { margin-block-end: 20px; }
.empty-state__title { font-size: 21px; font-weight: 700; margin: 0; }
.empty-state__text { margin: 8px 0 0; font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 380px; }
.empty-state__action { margin-block-start: 18px; }

/* ---------------- Sun banner (NwSunBanner) ---------------- */
.sun-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border-radius: 20px;
  background: var(--sun-soft);
  color: var(--ink);
}
a.sun-banner:hover { color: var(--ink); box-shadow: inset 0 0 0 1px #F2D58C; }
.sun-banner__body { flex: 1; min-width: 0; }
.sun-banner__title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; line-height: 1.4; }
.sun-banner__sub { font-size: 12px; color: var(--sun-text); }
.sun-banner__arrow { color: #947037; display: inline-flex; }
.sun-banner__arrow svg { width: 19px; height: 19px; }

/* ---------------- Alerts & toasts ---------------- */
.alert {
  border-radius: 16px;
  background: var(--bg-sunk);
  padding: 12px 15px;
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--ink);
  margin-block-end: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert svg { width: 18px; height: 18px; flex: none; }
.alert--success { background: var(--mint); color: var(--teal); }
.alert--danger, .alert--error { background: var(--peach); color: var(--action-text); }
.alert--warning { background: var(--sun-soft); color: var(--sun-text); }
.alert--info { background: var(--lilac); color: var(--purple-text); }

.toast-stack {
  position: fixed;
  inset-block-end: 20px;
  inset-inline: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-inline: 16px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: min(420px, 100%);
  border-radius: 16px;
  background: var(--ink);
  box-shadow: var(--shadow-pop);
  padding: 12px 16px;
  font-size: var(--fs-small);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInUp 0.3s ease both;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--purple); flex: none; }
.toast--success::before { background: #5CD3A5; }
.toast--danger::before, .toast--error::before { background: var(--tangerine); }
.toast--warning::before { background: var(--honey); }
.toast__close {
  appearance: none;
  background: none;
  border: 0;
  color: #fff;
  opacity: .7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  margin-inline-start: auto;
  padding: 2px;
}
.toast__close:hover { opacity: 1; }
@media (max-width: 760px) {
  .has-bottom-nav .toast-stack { inset-block-end: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------------- Modal (native <dialog>, NwDialog) ---------------- */
.modal {
  background: var(--bg);
  color: var(--ink);
  border: 0;
  border-radius: 26px;
  padding: 22px;
  width: min(440px, calc(100vw - 32px));
  max-width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop);
}
.modal::backdrop { background: #38344966; }
.modal h2 { font-size: 23px; }
.modal__icon { display: flex; justify-content: center; margin-block: 4px 14px; }
.modal__actions { display: flex; gap: 9px; margin-block-start: 16px; }
.modal__actions > * { flex: 1; }

/* ---------------- Avatars (NwAvatar) ---------------- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--lilac);
  flex: none;
}
.avatar--lg { width: 104px; height: 104px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line); }
.avatar--sm { width: 30px; height: 30px; }
.avatar--initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--purple);
  background: var(--lilac);
}
.avatar--sm.avatar--initial { font-size: 13px; }
.avatar--initial.avatar--green { background: var(--mint); color: var(--teal); }
.avatar--initial.avatar--red { background: var(--peach); color: var(--action); }
.avatar--initial.avatar--lg { font-size: 42px; }

/* ---------------- Form fields ---------------- */
.field { margin-block-end: 16px; }

.field label,
.form-panel label {
  display: block;
  font-weight: 700;
  font-size: var(--fs-small);
  color: var(--ink);
  margin-block-end: 6px;
}

.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field textarea,
.form-panel input[type="text"],
.form-panel input[type="email"],
.form-panel input[type="password"],
.form-panel input[type="number"],
.form-panel input[type="search"],
.form-panel input[type="file"],
.form-panel select,
.form-panel textarea,
.input {
  width: 100%;
  min-height: 46px;
  background: var(--surface);
  border: 0;
  box-shadow: var(--ring-line);
  border-radius: 13px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  padding: 10px 13px;
  transition: box-shadow .15s ease;
}
.field textarea, .form-panel textarea { min-height: 96px; line-height: 1.7; }
.field input[type="file"], .form-panel input[type="file"] { padding: 9px 10px; font-size: 13px; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.form-panel input:focus,
.form-panel select:focus,
.form-panel textarea:focus,
.input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--purple);
}
.field input::placeholder,
.form-panel input::placeholder,
.form-panel textarea::placeholder,
.input::placeholder { color: var(--faint); }

.field-hint {
  display: block;
  font-size: var(--fs-tiny);
  color: var(--muted);
  margin-block-start: 5px;
}
.field-error {
  display: block;
  font-size: var(--fs-tiny);
  font-weight: 700;
  color: var(--action);
  margin-block-start: 5px;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 9px;
}
.field-check label { margin: 0; font-weight: 400; }
.field-check input[type="checkbox"],
.field-check input[type="radio"] { accent-color: var(--action); width: 18px; height: 18px; flex: none; }

.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: var(--fs-small);
  margin-block: 4px;
}
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Radio cards (legacy: create game) */
.radio-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-card { position: relative; display: block; cursor: pointer; }
.radio-card__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--ring-line);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-small);
  text-align: center;
  transition: var(--transition-fast);
}
.radio-card__body svg { width: 22px; height: 22px; color: var(--purple); }
.radio-card:hover .radio-card__body { box-shadow: inset 0 0 0 1px var(--tangerine); }
.radio-card input[type="radio"]:checked + .radio-card__body {
  background: var(--peach-soft);
  color: var(--action);
  box-shadow: inset 0 0 0 2px var(--tangerine);
}
.radio-card input[type="radio"]:focus-visible + .radio-card__body { box-shadow: inset 0 0 0 2px var(--purple); }
.radio-card input[type="radio"]:disabled + .radio-card__body { opacity: 0.4; cursor: not-allowed; }
.radio-card--green input[type="radio"]:checked + .radio-card__body {
  background: var(--team-b-soft); color: var(--team-b-text); box-shadow: inset 0 0 0 2px var(--team-b);
}
.radio-card--red input[type="radio"]:checked + .radio-card__body {
  background: var(--team-a-soft); color: var(--team-a-text); box-shadow: inset 0 0 0 2px var(--team-a);
}

/* ---------------- Score pills / team panels (legacy, game pages) ---------------- */
.score-pill {
  min-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 20px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--ring-line);
}
.score-pill__label { font-size: 13px; font-weight: 700; }
.score-pill__value { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-score); line-height: 1.1; }
.score-pill--green { background: var(--team-b-soft); box-shadow: none; }
.score-pill--green .score-pill__label, .score-pill--green .score-pill__value { color: var(--team-b-text); }
.score-pill--red { background: var(--team-a-soft); box-shadow: none; }
.score-pill--red .score-pill__label, .score-pill--red .score-pill__value { color: var(--team-a-text); }

.team-panel { border-radius: 21px; padding: 18px; }
.team-panel--green { background: var(--team-b-soft); }
.team-panel--green .team-panel__title { color: var(--team-b-text); }
.team-panel--red { background: var(--team-a-soft); }
.team-panel--red .team-panel__title { color: var(--team-a-text); }
.team-panel__title { font-weight: 700; font-size: var(--fs-h3); text-align: center; margin-block-end: 12px; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
.table-dark, .table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}
.table-dark th, .table th {
  text-align: start;
  font-weight: 700;
  font-size: var(--fs-tiny);
  color: var(--muted);
  padding: 9px 10px;
  border-block-end: 1px solid var(--line);
  white-space: nowrap;
}
.table-dark td, .table td {
  padding: 11px 10px;
  border-block-end: 1px solid var(--line);
  vertical-align: middle;
}
.table-dark tbody tr:last-child td, .table tbody tr:last-child td { border-block-end: 0; }
.table-dark tbody tr:hover, .table tbody tr:hover { background: var(--peach-soft); }

/* ---------------- Lists ---------------- */
.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
  border-block-end: 1px solid var(--line);
}
.list-row:last-child { border-block-end: 0; }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-weight: 700; }
.list-row__meta { font-size: var(--fs-tiny); color: var(--muted); }

/* Player list (legacy, team selection) */
.player-list { list-style: none; padding: 0; margin: 0; }
.player-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-block: 10px;
  border-block-end: 1px solid var(--line);
}
.player-list__item:last-child { border-block-end: 0; }
.player-list__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-list__name { font-weight: 700; font-size: var(--fs-small); }
.player-list__meta { font-size: var(--fs-tiny); color: var(--muted); }
.player-list__item.is-inactive { opacity: 0.5; }

/* ---------------- Layout helpers ---------------- */
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--center { justify-content: center; }
.row--between { justify-content: space-between; }

.narrow { max-width: 460px; margin-inline: auto; }
.medium { max-width: 760px; margin-inline: auto; }

/* Stat tile (profile) */
.stat-tile {
  text-align: center;
  padding: 14px 8px;
  border-radius: 18px;
  background: var(--bg-sunk);
}
.stat-tile__value { font-weight: 700; font-size: 28px; line-height: 1.3; color: var(--ink); }
.stat-tile__label { font-size: var(--fs-tiny); color: var(--muted); }
.stat-tile--green { background: var(--mint); }
.stat-tile--green .stat-tile__value { color: var(--teal); }
.stat-tile--red { background: var(--peach); }
.stat-tile--red .stat-tile__value { color: var(--action); }
.stat-tile--purple { background: var(--lilac); }
.stat-tile--purple .stat-tile__value { color: var(--purple-text); }
.stat-tile--sun { background: var(--sun-soft); }
.stat-tile--sun .stat-tile__value { color: var(--sun-deep); }

/* Stars */
.stars { color: #E9A72C; letter-spacing: 3px; font-size: 18px; }
.stars .star--off { color: var(--handle); }

/* Hero (legacy name) */
.hero { text-align: center; padding-block: 24px 8px; }
.hero__title { font-weight: 700; font-size: var(--fs-h1); line-height: 1.3; color: var(--deep); margin-block-end: 8px; }
.hero__sub { font-size: 14px; color: var(--muted); }

/* ---------------- Hexagons & tilt tiles (NwHex / NwTiltTile) ---------------- */
.nw-hex {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 57px;
  flex: none;
  background: var(--honey);
  color: var(--honey-text);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0% 50%);
}
.nw-hex--purple { background: var(--hex-purple); color: #fff; }
.nw-hex--white { background: #fff; color: var(--purple-text); }
.nw-hex--orange { background: var(--tangerine); color: #fff; }
.nw-hex--teal { background: var(--teal); color: #fff; }

.tilt-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 67px;
  height: 69px;
  border-radius: 19px;
  font-weight: 700;
  font-size: 38px;
  line-height: 1;
  box-shadow: 0 5px 0 #0000000B;
}

/* Decorative mini hexagons (legacy markup) */
.hex-mini { position: relative; width: 52px; height: 57px; flex: none; }
.hex-mini__rim, .hex-mini__fill, .hex-mini__gloss {
  position: absolute; inset: 0;
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0% 50%);
}
.hex-mini__rim { background: var(--honey); }
.hex-mini__fill { background: var(--honey); }
.hex-mini__gloss { display: none; }
.hex-mini__letter {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 24px; color: var(--honey-text);
}
.hex-mini--green .hex-mini__rim, .hex-mini--green .hex-mini__fill { background: var(--teal); }
.hex-mini--green .hex-mini__letter { color: #fff; }
.hex-mini--red .hex-mini__rim, .hex-mini--red .hex-mini__fill { background: var(--tangerine); }
.hex-mini--red .hex-mini__letter { color: #fff; }

/* Sparkle (four-point star) */
.sparkle {
  display: inline-block;
  width: 22px;
  height: 22px;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

/* ---------------- Game catalogue tiles (GameTile) ---------------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1060px) { .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

.game-tile {
  display: flex;
  flex-direction: column;
  padding: 9px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--ring-line);
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.game-tile:hover { color: var(--ink); transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--tangerine), var(--shadow-soft); }
.game-tile--featured { box-shadow: inset 0 0 0 2px var(--tangerine), 0 8px 24px #F56B4326; }
.game-tile--featured:hover { box-shadow: inset 0 0 0 2px var(--tangerine), 0 12px 28px #F56B4333; }
.game-tile__art { height: 112px; border-radius: var(--radius-md); overflow: hidden; }
.game-tile__name { margin: 6px 5px 0; font-size: 18px; font-weight: 700; line-height: 1.4; }
.game-tile__desc {
  margin: 0 5px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-tile__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 8px 5px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--action);
}
.game-tile__foot svg { width: 16px; height: 16px; }
.game-tile__where { font-weight: 400; color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }
.game-tile__where svg { width: 13px; height: 13px; }

/* ---------------- Covers (covers.dart) ---------------- */
.cover {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
}
.cover > * { position: absolute; }
.cover__new {
  inset-block-start: 7px;
  inset-inline-start: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 15px;
  background: var(--action);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  z-index: 3;
}
.cover__new svg { width: 11px; height: 11px; }

/* حروف — three tilted hexagons on lilac */
.cover--huroof { background: var(--lilac); }
.cover--huroof .nw-hex { transform: rotate(-7deg); }
.cover--huroof .h1 { left: calc(50% - 26px); top: 9px; }
.cover--huroof .h2 { left: calc(50% - 53px); top: 48px; }
.cover--huroof .h3 { left: calc(50% + 1px); top: 47px; }

/* خمّن الشخصية — portrait card + «؟» card on mint */
.cover--person { background: var(--mint); }
.portrait-card {
  width: 59px;
  height: 72px;
  border-radius: 12px;
  /* White frame as padding, not a border: a rotated rounded box with a border +
     overflow:hidden glitches in Chromium's software raster (diagonal seams). */
  padding: 4px;
  background-clip: content-box;
  box-shadow: inset 0 0 0 4px #fff, 0 4px 0 #187A6312;
  display: flex;
  align-items: center;
  justify-content: center;
}
.portrait-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.cover--person .p1 { left: calc(50% - 48px); top: 22px; background: #D6EAF1; transform: rotate(-11deg); }
.cover--person .p2 {
  left: calc(50% - 5px); top: 17px; background: #FFDDA4; transform: rotate(11deg);
  color: #A36329; font-size: 41px; font-weight: 900;
}

/* خمّن المكان — city photo + tilted «؟» */
.cover--place { background: var(--peach); }
.cover--place img { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 67% 50%; }
.cover--place .q {
  left: 8px; bottom: 8px;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: #fff;
  color: var(--tangerine);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900;
  transform: rotate(-8deg);
}

/* NUNO — three fanned cards on pale sky */
.cover--nuno { background: var(--sky); }
.cover--nuno .c1 { left: calc(50% - 60px); top: 26px; transform: rotate(-16deg); }
.cover--nuno .c2 { left: calc(50% - 21px); top: 12px; }
.cover--nuno .c3 { left: calc(50% + 18px); top: 26px; transform: rotate(16deg); }

/* NUNO card (nuno_card.dart): white frame, coloured face, white hex centre */
.nuno-card {
  --em: 4.3px;
  --face: #F56B43;
  --deep: #A13F25;
  width: calc(10 * var(--em));
  height: calc(15 * var(--em));
  padding: calc(.42 * var(--em));
  border-radius: calc(1.25 * var(--em));
  background: #fff;
  box-shadow: 0 calc(.25 * var(--em)) 0 #00000014, 0 calc(.6 * var(--em)) calc(1.3 * var(--em)) #3834492E;
  transform-origin: 50% 80%;
}
.nuno-card__face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(.95 * var(--em));
  background: var(--face);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nuno-card__face::before {
  content: "";
  position: absolute;
  width: calc(8.2 * var(--em));
  height: calc(9.4 * var(--em));
  background: #FFFFFF29;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.nuno-card__hex {
  position: relative;
  width: calc(7.4 * var(--em));
  height: calc(6.5 * var(--em));
  background: #fff;
  color: var(--deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: calc(4.4 * var(--em));
  line-height: 1;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.nuno-card__hex--sm { font-size: calc(3.2 * var(--em)); direction: ltr; }
.nuno-card__corner {
  position: absolute;
  inset-block-start: calc(.4 * var(--em));
  right: calc(.7 * var(--em));
  color: #fff;
  font-weight: 900;
  font-size: calc(1.7 * var(--em));
  line-height: 1;
  direction: ltr;
}
.nuno-card--sky { --face: #3F8ED4; --deep: #1D5690; }
.nuno-card--orange { --face: #F56B43; --deep: #A13F25; }
.nuno-card--sun { --face: #F5B73B; --deep: #6E4A0C; }
.nuno-card--sun .nuno-card__corner { color: #5A3D08; }
.nuno-card--mint { --face: #1E9384; --deep: #0E5A52; }

.nuno-wordmark { font-weight: 900; letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; }
.nuno-wordmark__nu { color: #F56B43; }
.nuno-wordmark__no { color: var(--ink); }

/* لغز الكلمة — picture card + «+» chip + «ار» letters card on butter */
.cover--lughz {
  background: var(--sun-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  direction: rtl;
}
.cover--lughz > * { position: static; }
.lughz-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 58px;
  height: 58px;
  padding: 4px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 3px 0 #00000012, 0 6px 14px #38344918;
}
.lughz-card__inner {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  background: var(--peach);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.lughz-card__inner svg { width: 32px; height: 32px; }
.lughz-card--letters { width: 50px; height: 50px; padding: 0; color: #C54427; font-weight: 900; font-size: 22px; }
.lughz-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 3px 0 #00000022;
}
.lughz-chip svg { width: 13px; height: 13px; }
.lughz-chip--minus { background: #C54427; }
.lughz-chip--equal { background: var(--muted); }

/* لعبة الأمثال — picture card + written words + a blank, on lilac */
.cover--amthal {
  background: var(--lilac);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  direction: rtl;
}
.cover--amthal > * { position: static; }
.amthal-words { width: auto; padding: 0 10px; font-size: 15px; white-space: nowrap; }
.amthal-blank { width: 46px; height: 46px; color: #7962C8; font-weight: 900; font-size: 22px; }

/* لعبة الأسماء — «اسمي أحمد» name tag + honey hex letter, on lilac */
.cover--names { background: var(--lilac); display: flex; align-items: center; justify-content: center; gap: 10px; direction: rtl; }
.cover--names > * { position: static; }
.names-tag { display: inline-flex; flex-direction: column; width: 84px; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 3px 0 #E3D9CF; transform: rotate(4deg); }
.names-tag__head { background: #7962C8; color: #fff; font-size: 11px; font-weight: 900; text-align: center; padding: 3px 0; }
.names-tag__name { font-size: 20px; font-weight: 900; text-align: center; padding: 8px 0; color: var(--ink); }
.names-hex { display: grid; place-items: center; width: 52px; height: 46px; clip-path: polygon(25% 4%,75% 4%,100% 50%,75% 96%,25% 96%,0 50%); background: #FFD16F; color: #704C20; font-weight: 900; font-size: 26px; transform: rotate(10deg); }

/* Big covers (detail-page hero art) */
.cover--hero { border-radius: var(--radius-xl); }
.game-hero__art { height: 190px; border-radius: var(--radius-xl); overflow: hidden; }
.game-hero__art .cover { transform-origin: center; }
.game-hero__art .cover--huroof,
.game-hero__art .cover--person,
.game-hero__art .cover--nuno,
.game-hero__art .cover--lughz { zoom: 1.55; }

/* ---------------- Search result rows (injected by invitation.js) ---------------- */
.result-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 700;
  cursor: pointer;
  text-align: start;
  transition: var(--transition-fast);
}
.result-item:hover { background: var(--peach-soft); }

.text-green { color: var(--team-b-text); }
.text-red { color: var(--team-a-text); }
.text-action { color: var(--action); }
.text-teal { color: var(--teal); }

/* Spinner (NwSpinner) */
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #C5442733;
  border-block-start-color: var(--action);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Store badges ---------------- */
/* Official artwork, never restyled. The Google Play PNG ships with ~33%
   built-in clear space, so it needs a larger box to match Apple's art. */
.store-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.store-badges a { display: inline-flex; transition: transform 0.15s ease; }
.store-badges a:hover { transform: scale(1.04); }
.store-badges img { display: block; width: auto; }
.store-badges .badge-appstore { height: 52px; }
.store-badges .badge-gplay { height: 77px; }
.store-badges--small .badge-appstore { height: 38px; }
.store-badges--small .badge-gplay { height: 57px; }
.store-badges--start { justify-content: flex-start; }

/* ---------------- Keyframes ---------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  .card--fade, .toast { animation: none; }
  .badge__speaker.is-speaking { animation: none; }
  .game-tile:hover { transform: none; }
}

/* ---------------- Auth pages ---------------- */
.auth-logo { display: block; height: 66px; width: auto; margin-inline: auto; }
.password-login > summary,
.password-login__toggle {
  list-style: none;
  cursor: pointer;
  text-align: center;
  color: var(--action);
  font-weight: 700;
  font-size: var(--fs-small);
  margin-block-end: 14px;
}
.password-login > summary::-webkit-details-marker { display: none; }
.google-signin { min-height: 44px; }
