/* ملعب النجوم 3D — الأنماط (موبايل أولاً، أفقي) */
:root { --btn-size: 64px; --green: #1e8449; --dark: #0b3d2e; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: linear-gradient(160deg, #0b3d2e, #145a32);
  color: #fff; direction: rtl; user-select: none;
}
#app { height: 100%; }
.screen { display: flex; flex-direction: column; align-items: center; padding: 16px; gap: 12px; height: 100%; overflow-y: auto; }
.logo { font-size: 2.2rem; margin: 8px 0 0; font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
.logo span { color: #f1c40f; }
.subtitle { opacity: .85; margin: 0; }
.nick-btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 20px; padding: 6px 16px; font-size: 1rem; cursor: pointer; }
.modes { display: flex; flex-direction: column; gap: 12px; width: min(480px, 94vw); }
.mode-card { display: flex; flex-direction: column; gap: 2px; background: #fff; color: #123; border: none; border-radius: 16px; padding: 16px; font-size: 1.15rem; font-family: inherit; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.3); text-align: center; }
.mode-card small { opacity: .7; font-size: .85rem; }
.mode-icon { font-size: 1.8rem; }
.btn { background: #f1c40f; color: #123; border: none; border-radius: 12px; padding: 12px 22px; font-size: 1.05rem; font-weight: 700; font-family: inherit; cursor: pointer; }
.btn.primary { background: #e74c3c; color: #fff; }
.btn.big { font-size: 1.25rem; width: min(420px, 90vw); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.menu-row { display: flex; gap: 10px; }
.warn { background: #f39c12; color: #123; border-radius: 12px; padding: 12px; max-width: 480px; text-align: center; font-weight: 700; }
.hint { background: rgba(255,255,255,.12); border: 1px dashed #f1c40f; border-radius: 12px; padding: 12px; max-width: 480px; line-height: 1.8; }
.quality-line { opacity: .8; }
.player-card { background: #fff; color: #123; border-radius: 12px; padding: 10px; margin: 8px 0; width: min(480px, 94vw); }
.player-head { display: flex; gap: 8px; align-items: center; }
.player-num { background: var(--green); color: #fff; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.player-pos { opacity: .6; font-size: .85rem; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.mini-btn { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 4px 10px; font-family: inherit; cursor: pointer; }
.mini-btn:disabled { opacity: .4; cursor: not-allowed; }
.shop-card { background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px; margin: 8px 0; width: min(480px, 94vw); line-height: 1.7; }
.shop-card select { font-family: inherit; margin: 4px; padding: 6px; border-radius: 8px; }
#stadium-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(640px, 96vw); }
.stadium-card { background: #fff; color: #123; border-radius: 12px; padding: 12px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border: 3px solid transparent; }
.stadium-card.selected { border-color: #f1c40f; }
.stadium-card small { opacity: .65; font-size: .8rem; }
.dn-row, .diff-row, .team-pick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { background: rgba(255,255,255,.15); color: #fff; border: 2px solid rgba(255,255,255,.4); border-radius: 20px; padding: 8px 14px; font-family: inherit; font-size: 1rem; cursor: pointer; }
.chip.active { background: #f1c40f; color: #123; border-color: #f1c40f; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-inline-end: 4px; }
#screen-settings label { background: rgba(255,255,255,.1); border-radius: 10px; padding: 12px; width: min(480px, 94vw); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#screen-settings select, #screen-settings input[type=range] { font-family: inherit; padding: 6px; }
/* شاشة إعدادات المباراة */
.setup-grid { display: flex; flex-direction: column; gap: 10px; width: min(560px, 96vw); }
.setup-group { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.setup-note { opacity: .85; font-size: .9rem; max-width: 560px; text-align: center; line-height: 1.7; }
#restart-banner { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); z-index: 30; font-size: 1.8rem; font-weight: 900; color: #fff; background: rgba(0,0,0,.6); padding: 8px 20px; border-radius: 16px; }
#shootout { position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 40; background: rgba(0,0,0,.85); border: 2px solid #f1c40f; border-radius: 16px; padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#shootout h3 { margin: 0; }
#shootout-score { font-size: 1.6rem; font-weight: 900; color: #f1c40f; margin: 0; }
#shootout-msg { margin: 0; line-height: 1.6; }
#rotate-prompt { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 1.6rem; font-weight: 900; text-align: center; padding: 20px; }
@media (orientation: landscape) and (max-height: 500px) {
  .logo { font-size: 1.5rem; }
  .modes { flex-direction: row; }
  .mode-card { flex: 1; font-size: .95rem; padding: 10px; }
  .setup-grid { flex-direction: row; flex-wrap: wrap; }
  .setup-group { flex: 1 1 45%; }
}
/* شاشة المباراة */
.game-screen { padding: 0; gap: 0; overflow: hidden; position: relative; }
#scoreboard { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.65); border-radius: 20px; padding: 6px 14px; font-weight: 700; white-space: nowrap; }
#score-text { font-size: 1.3rem; color: #f1c40f; }
.team-chip { display: flex; gap: 5px; align-items: center; }
.icon-btn { background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; width: 36px; height: 36px; font-size: 1rem; cursor: pointer; }
#game-container { position: absolute; inset: 0; }
#game-container canvas { display: block; touch-action: none; }
#goal-banner { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); z-index: 30; font-size: 3rem; font-weight: 900; color: #f1c40f; text-shadow: 0 4px 12px rgba(0,0,0,.6); animation: pop .4s ease; }
@keyframes pop { from { transform: translate(-50%,-50%) scale(.5); } to { transform: translate(-50%,-50%) scale(1); } }
#joystick-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 65%; z-index: 15; touch-action: none; }
#joystick-base { position: absolute; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.5); }
#joystick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: #27ae60; border: 2px solid #fff; }
#action-buttons { position: absolute; right: 12px; bottom: 14px; z-index: 15; display: grid; grid-template-columns: repeat(2, var(--btn-size)); gap: 10px; }
.action-btn { width: var(--btn-size); height: var(--btn-size); border-radius: 50%; border: 2px solid #fff; background: rgba(39,174,96,.85); color: #fff; font-family: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; touch-action: none; }
.action-btn.shoot { background: rgba(231,76,60,.9); }
.action-btn.dash { background: rgba(243,156,18,.9); }
.action-btn:active { transform: scale(.92); }
#zoom-controls { position: absolute; left: 12px; top: 60px; z-index: 15; display: flex; flex-direction: column; gap: 8px; }
.big-score { font-size: 2.5rem; font-weight: 900; color: #f1c40f; margin: 0; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 100; }
/* وضع اليد اليسرى: تبديل الجانبين */
body.left-handed #joystick-zone { left: auto; right: 0; }
body.left-handed #action-buttons { right: auto; left: 12px; }
body.left-handed #zoom-controls { left: auto; right: 12px; }
@media (orientation: portrait) {
  .logo { font-size: 1.7rem; }
  #stadium-grid { grid-template-columns: repeat(2, 1fr); }
}
