/* ============================================================
   Sanaa Striker — styles
   ============================================================ */
:root {
  --bg:            #0f172a;
  --bg-deep:       #080d18;
  --panel:         #111a2c;
  --text:          #f5f7fb;
  --text-muted:    #93a1bd;
  --border:        rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .18);
  --primary:       #dc2626;
  --secondary:     #2563eb;
  --accent:        #22c55e;
  --accent-soft:   rgba(34, 197, 94, .16);
  --amber:         #fbbf24;
  --radius-sm:     10px;
  --radius:        16px;
  --radius-lg:     22px;
  --shadow:        0 10px 34px rgba(0, 0, 0, .45);
  --shadow-lg:     0 26px 70px rgba(0, 0, 0, .6);
  --font-head:     'Barlow Condensed', 'Segoe UI', system-ui, sans-serif;
  --font-body:     'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgba(37, 99, 235, .30), transparent 65%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(220, 38, 38, .18), transparent 60%),
    var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, strong, b {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: .01em;
}

button { font-family: inherit; cursor: pointer; }

.glow {
  position: fixed;
  inset: -30% -20% auto -20%;
  height: 60vh;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(34, 197, 94, .14), transparent 62%);
  z-index: 0;
}

/* ---------------- topbar ---------------- */
.topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem clamp(.8rem, 2.4vw, 1.6rem);
}
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--accent), #0f8f45);
  color: #04140a;
  box-shadow: 0 8px 24px rgba(34, 197, 94, .34);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 1.22rem; }
.brand-text small { color: var(--text-muted); font-size: .76rem; letter-spacing: .06em; }

.topbar-actions { display: flex; gap: .5rem; }
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .11); border-color: var(--border-strong); }
.icon-btn:active { transform: translateY(0) scale(.96); }

/* ---------------- stage / pitch ---------------- */
.stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  place-items: center;
  padding: .35rem clamp(.5rem, 2vw, 1.4rem) .6rem;
}

.screen {
  position: relative;
  width: 100%;
  max-width: min(1160px, calc((100dvh - 200px) * 1.543));
  aspect-ratio: 1080 / 700;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #060a13;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, .6) inset;
  touch-action: none;
}
#game { display: block; width: 100%; height: 100%; }

/* ---------------- scoreboard ---------------- */
.scoreboard {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .45rem clamp(.5rem, 1.6vw, 1rem);
  background: linear-gradient(180deg, rgba(3, 7, 15, .88), rgba(3, 7, 15, 0));
  pointer-events: none;
  z-index: 3;
}
.team { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.chip {
  width: 13px; height: 13px; border-radius: 4px; flex: none;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(220, 38, 38, .8);
}
.chip.blue { background: var(--secondary); box-shadow: 0 0 12px rgba(37, 99, 235, .8); }
.tname {
  font-family: var(--font-head);
  font-size: clamp(.85rem, 1.6vw, 1.15rem);
  max-width: 24vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .1rem .7rem .2rem;
  border-radius: 12px;
  background: rgba(6, 11, 22, .62);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.score {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .06em;
}
.clock {
  font-family: var(--font-head);
  font-size: clamp(.72rem, 1.4vw, .95rem);
  color: var(--accent);
  letter-spacing: .1em;
}
.clock.warn { color: var(--amber); animation: blink 1s steps(2, end) infinite; }

.possbar {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  display: flex;
  z-index: 3;
}
.possbar span { display: block; height: 100%; transition: width .5s ease; }
.ph { background: var(--primary); }
.pa { background: var(--secondary); }

/* ---------------- banner ---------------- */
.banner {
  position: absolute;
  left: 50%; top: 26%;
  transform: translate(-50%, -14px) scale(.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .6rem 1.6rem;
  border-radius: 18px;
  background: rgba(4, 9, 18, .78);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 5;
  text-align: center;
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); animation: pop .35s ease; }
.banner strong {
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: .02em;
}
.banner small { color: var(--text-muted); font-size: clamp(.8rem, 1.8vw, 1rem); }
.banner.is-goal strong { color: var(--accent); text-shadow: 0 0 26px rgba(34, 197, 94, .55); }
.banner.is-goal { border-color: rgba(34, 197, 94, .45); }

/* ---------------- overlays ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(.6rem, 2vw, 1.4rem);
  background: radial-gradient(ellipse at 50% 40%, rgba(9, 16, 32, .72), rgba(2, 5, 11, .9));
  backdrop-filter: blur(7px);
  overflow: auto;
}
.overlay.show { display: flex; animation: fadeIn .22s ease both; }

.panel {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding: clamp(1rem, 2.6vw, 1.8rem);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(20, 30, 50, .96), rgba(9, 14, 26, .98));
  box-shadow: var(--shadow-lg);
}
.panel.small { width: min(430px, 100%); }
.panel-head { text-align: center; }
.panel-head h1 {
  margin: .35rem 0 .25rem;
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 1;
  letter-spacing: .01em;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 65%, var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.panel-head h2 {
  margin: .3rem 0 .2rem;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}
.panel-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(.84rem, 1.9vw, .96rem);
}
.panel h2 { margin: 0; font-size: 1.6rem; text-align: center; }
.muted { color: var(--text-muted); text-align: center; margin: 0; }
.bigscore {
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  letter-spacing: .08em;
  margin: .2rem 0 0;
  color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  padding: .24rem .7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(34, 197, 94, .3);
}
.badge svg { width: 13px; height: 13px; }

/* ---------------- form bits ---------------- */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field > span {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
input[type="text"] {
  width: 100%;
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
}
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip-btn {
  flex: 1 1 0;
  min-width: 92px;
  padding: .55rem .5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text-muted);
  font-family: var(--font-head);
  font-size: .98rem;
  letter-spacing: .04em;
  transition: all .18s ease;
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.chip-btn.active {
  background: linear-gradient(160deg, rgba(34, 197, 94, .22), rgba(34, 197, 94, .08));
  border-color: rgba(34, 197, 94, .55);
  color: #d7ffe6;
  box-shadow: 0 6px 20px rgba(34, 197, 94, .18);
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .78rem 1.3rem;
  border: none;
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: 1.06rem;
  letter-spacing: .05em;
  color: var(--text);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0e9b48);
  color: #04140a;
  box-shadow: 0 12px 34px rgba(34, 197, 94, .3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 44px rgba(34, 197, 94, .42); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-lg { padding: .95rem 1.4rem; font-size: 1.2rem; }
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .07); color: var(--text); transform: translateY(-1px); }

.fine { margin: 0; font-size: .78rem; color: #6f7d99; text-align: center; line-height: 1.6; }

/* ---------------- end stats ---------------- */
.stats {
  list-style: none;
  margin: 0;
  padding: .3rem 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.stats li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .45rem .2rem;
  border-bottom: 1px dashed rgba(255, 255, 255, .08);
  font-size: .92rem;
}
.stats li:last-child { border-bottom: none; }
.stats span { color: var(--text-muted); }
.stats b { font-size: 1.02rem; letter-spacing: .03em; }

/* ---------------- touch controls ---------------- */
.touch { position: absolute; inset: 0; z-index: 4; pointer-events: none; display: none; }
body.touch-on .touch { display: block; }

.joy {
  position: absolute;
  right: 3.5%;
  bottom: 7%;
  width: clamp(104px, 22vw, 140px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03));
  border: 1.5px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  touch-action: none;
}
.knob {
  position: absolute;
  top: 50%; left: 50%;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(150deg, rgba(34, 197, 94, .95), rgba(14, 155, 72, .95));
  box-shadow: 0 0 22px rgba(34, 197, 94, .55);
  transition: transform .06s linear;
}
.tbtns {
  position: absolute;
  left: 3.5%;
  bottom: 7%;
  display: flex;
  align-items: flex-end;
  gap: .7rem;
  pointer-events: auto;
}
.tbtn {
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font-family: var(--font-head);
  font-size: .92rem;
  letter-spacing: .04em;
  backdrop-filter: blur(6px);
  touch-action: none;
  transition: transform .1s ease, background .1s ease;
}
.tbtn:active, .tbtn.press { transform: scale(.94); background: rgba(255, 255, 255, .2); }
.tbtn.kick {
  width: clamp(76px, 17vw, 96px);
  aspect-ratio: 1;
  background: linear-gradient(150deg, rgba(220, 38, 38, .9), rgba(140, 18, 30, .95));
  box-shadow: 0 0 24px rgba(220, 38, 38, .4);
  font-size: 1.05rem;
}
.tbtn.sprint { width: clamp(56px, 12vw, 68px); aspect-ratio: 1; }

/* ---------------- footer hint ---------------- */
.hint {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .3rem 1.1rem;
  padding: .35rem 1rem 1rem;
  color: #6f7d99;
  font-size: .8rem;
  text-align: center;
}
.hint span { white-space: nowrap; }
.hint b {
  color: var(--text);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .1rem .42rem;
  margin-left: .28rem;
  font-size: .78rem;
  letter-spacing: .06em;
}

/* ---------------- animations ---------------- */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop {
  0% { transform: translate(-50%, 0) scale(.86) }
  60% { transform: translate(-50%, 0) scale(1.06) }
  100% { transform: translate(-50%, 0) scale(1) }
}
@keyframes blink { 50% { opacity: .35 } }

/* ---------------- responsive ---------------- */
@media (max-width: 860px) {
  .hint { font-size: .72rem; gap: .25rem .7rem; padding-bottom: .7rem; }
  .screen { max-width: 100%; border-radius: 16px; }
  .tname { max-width: 28vw; font-size: .82rem; }
  .panel { gap: .65rem; }
  .chip-btn { min-width: 78px; }
}

@media (max-width: 520px) {
  .brand-text small { display: none; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .hint span:nth-child(n+4) { display: none; }
  .fine { display: none; }
}

@media (orientation: portrait) and (pointer: coarse) {
  .stage::after {
    content: "أدر الجهاز أفقياً لتجربة أفضل";
    position: absolute;
    bottom: .2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: .72rem;
    color: #7f8db0;
    background: rgba(4, 9, 18, .7);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .18rem .7rem;
    pointer-events: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
