/* ============ Nova FC 全局样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1420; font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif; color: #e8ecf4; user-select: none; }

#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- 加载 ---------- */
#loading { position: fixed; inset: 0; background: #0d1420; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 100; gap: 18px; }
#loading .ball-spin { font-size: 52px; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 屏幕面板通用 ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(160deg, rgba(10,16,28,.82), rgba(13,25,46,.9)); backdrop-filter: blur(6px); overflow-y: auto; padding: 24px; }
.panel { width: min(920px, 94vw); max-height: 92vh; display: flex; flex-direction: column; gap: 16px; }

.game-logo { text-align: center; margin-bottom: 8px; }
.game-logo h1 { font-size: clamp(42px, 8vw, 74px); font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(120deg, #ff7a1a 15%, #ffd24a 50%, #2bd9c8 85%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255,122,26,.35)); }
.game-logo p { color: #8b98ad; letter-spacing: 6px; font-size: 14px; margin-top: 4px; }

.menu-stats { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.stat-chip { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); padding: 8px 18px; border-radius: 999px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.stat-chip i { color: #ffd24a; }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 10px; }
.btn { border: none; cursor: pointer; font-family: inherit; font-weight: 700; border-radius: 14px; transition: transform .12s, box-shadow .12s, filter .12s; }
.btn:active { transform: scale(.96); }
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: linear-gradient(120deg, #ff7a1a, #ff9a3c); color: #16181c; font-size: 20px; padding: 16px 64px; box-shadow: 0 8px 28px rgba(255,122,26,.4); }
.btn-secondary { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #e8ecf4; font-size: 16px; padding: 12px 44px; }
.btn-ghost { background: none; color: #6b7688; font-size: 13px; padding: 8px 20px; }
.btn-ghost:hover { color: #d9534f; }

.screen-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.screen-header h2 { font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.screen-header h2 i { color: #ff7a1a; }

/* ---------- 球队管理 ---------- */
.team-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: rgba(255,255,255,.05); padding: 12px 16px; border-radius: 12px; }
.team-toolbar label { color: #8b98ad; font-size: 14px; }
.team-toolbar select { background: #1a2436; color: #e8ecf4; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; padding: 8px 14px; font-size: 15px; font-family: inherit; }
#squad-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; overflow-y: auto; padding: 4px; }
.player-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; padding: 13px 15px; display: flex; flex-direction: column; gap: 9px; }
.player-card.starter { border-color: rgba(255,122,26,.55); background: rgba(255,122,26,.08); }
.pc-head { display: flex; align-items: center; gap: 9px; }
.pc-role { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; color: #fff; }
.pc-name { font-weight: 700; font-size: 16px; flex: 1; }
.pc-rating { font-size: 21px; font-weight: 900; color: #ffd24a; }
.pc-attrs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; font-size: 12px; color: #9aa7bc; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; }
.pc-level { font-size: 12px; color: #2bd9c8; font-weight: 700; }
.pc-max { font-size: 12px; color: #6b7688; }
.btn-upgrade { background: linear-gradient(120deg, #2bd9c8, #3ce8b0); border: none; color: #10261f; font-weight: 700; font-size: 12px; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.btn-upgrade:disabled { background: #2a3446; color: #5b6577; cursor: not-allowed; }

/* ---------- 对手选择 ---------- */
#opponent-list { display: flex; flex-direction: column; gap: 11px; overflow-y: auto; padding: 4px; }
.opp-card { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; padding: 14px 18px; position: relative; }
.opp-card.locked { opacity: .55; }
.opp-badge { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); box-shadow: 0 4px 14px rgba(0,0,0,.35); flex-shrink: 0; }
.opp-info { flex: 1; }
.opp-name { font-size: 18px; font-weight: 800; }
.opp-meta { font-size: 13px; color: #8b98ad; margin-top: 3px; }
.opp-reward { font-size: 13px; color: #ffd24a; margin-top: 3px; }
.btn-play-opp { background: linear-gradient(120deg, #ff7a1a, #ff9a3c); border: none; color: #16181c; font-weight: 800; font-size: 15px; padding: 12px 26px; border-radius: 12px; cursor: pointer; font-family: inherit; }
.opp-lock { display: flex; align-items: center; gap: 8px; color: #6b7688; font-size: 13px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#hud-scoreboard { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: rgba(10,16,28,.78); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 8px 20px; backdrop-filter: blur(8px); }
#hud-home, #hud-away { font-weight: 900; font-size: 16px; }
#hud-home { color: #ff9a3c; } #hud-away { color: #7fb3ff; }
#hud-score { font-size: 24px; font-weight: 900; letter-spacing: 2px; }
#hud-time { font-size: 14px; color: #2bd9c8; font-weight: 700; min-width: 52px; text-align: center; }
#btn-hud-pause { pointer-events: auto; position: absolute; top: 14px; right: 14px; background: rgba(10,16,28,.7); border: 1px solid rgba(255,255,255,.14); color: #e8ecf4; width: 44px; height: 44px; border-radius: 12px; font-size: 16px; cursor: pointer; }

#hud-player-info { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; }
#hud-player-name { font-size: 13px; font-weight: 700; color: #2bd9c8; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
#hud-stamina { width: 130px; height: 6px; background: rgba(0,0,0,.5); border-radius: 3px; overflow: hidden; }
#hud-stamina-fill { height: 100%; background: linear-gradient(90deg, #2bd9c8, #3ce8b0); border-radius: 3px; transition: width .2s; }

#hud-charge { position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); width: 190px; height: 10px; background: rgba(0,0,0,.55); border-radius: 5px; overflow: hidden; border: 1px solid rgba(255,255,255,.22); }
#hud-charge-fill { height: 100%; background: linear-gradient(90deg, #ffd24a, #ff7a1a, #d9534f); width: 0; }

#hud-message { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); font-size: 22px; font-weight: 900; color: #ffd24a; text-shadow: 0 2px 12px rgba(0,0,0,.8); }
#hud-message.pop { animation: msgpop .35s ease-out; }
@keyframes msgpop { 0% { transform: translateX(-50%) scale(.5); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }

#goal-banner { position: absolute; top: 38%; left: 0; right: 0; text-align: center; pointer-events: none; }
#goal-banner .goal-text { font-size: clamp(54px, 11vw, 100px); font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(120deg, #ffd24a, #ff7a1a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 24px rgba(255,122,26,.55)); }
#goal-scorer { font-size: 21px; font-weight: 700; margin-top: 6px; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
#goal-score { font-size: 30px; font-weight: 900; color: #ffd24a; margin-top: 4px; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
#goal-banner.anim .goal-text { animation: goalzoom .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes goalzoom { 0% { transform: scale(.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 键位提示 */
#hud-controls-hint { position: absolute; bottom: 14px; right: 16px; font-size: 12px; color: rgba(200,210,228,.6); text-align: right; line-height: 1.7; background: rgba(10,16,28,.5); padding: 8px 12px; border-radius: 10px; }
.touch-device #hud-controls-hint { display: none; }

/* ---------- 结算 ---------- */
.result-title { font-size: clamp(40px, 8vw, 64px); font-weight: 900; text-align: center; }
.result-title.win { color: #3ce8b0; text-shadow: 0 4px 24px rgba(60,232,176,.4); }
.result-title.draw { color: #ffd24a; }
.result-title.loss { color: #d9534f; }
#result-score { font-size: 52px; font-weight: 900; text-align: center; letter-spacing: 5px; }
#result-teams { text-align: center; color: #8b98ad; font-size: 16px; }
.result-stats { display: flex; justify-content: center; gap: 34px; margin: 8px 0; flex-wrap: wrap; }
.result-stat { text-align: center; }
.result-stat .label { font-size: 12px; color: #6b7688; }
.result-stat .value { font-size: 19px; font-weight: 800; margin-top: 3px; }
#result-coins { font-size: 30px; font-weight: 900; color: #ffd24a; text-align: center; }
#result-unlock { text-align: center; color: #2bd9c8; font-weight: 700; font-size: 16px; min-height: 22px; }
.result-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- 帮助 ---------- */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.help-card { background: rgba(255,255,255,.06); border-radius: 12px; padding: 16px; }
.help-card h3 { font-size: 15px; color: #ff9a3c; margin-bottom: 10px; }
.help-card li { list-style: none; font-size: 14px; color: #b8c4d8; line-height: 2; }
.key { display: inline-block; background: #2a3446; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; padding: 1px 9px; font-size: 12px; font-weight: 700; margin-right: 6px; min-width: 30px; text-align: center; }

/* ---------- 移动端虚拟控制 ---------- */
#touch-controls { display: none; }
.touch-device #touch-controls { display: block; pointer-events: none; }
#joystick { pointer-events: auto; position: fixed; left: 26px; bottom: 30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.18); z-index: 16; }
#joystick-knob { position: absolute; left: 50%; top: 50%; margin: -28px 0 0 -28px; width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.28); border: 2px solid rgba(255,255,255,.4); }
.touch-btn { pointer-events: auto; position: fixed; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.25); color: #fff; font-weight: 800; font-size: 12px; z-index: 16; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 1px; }
.touch-btn i { font-size: 17px; }
.touch-btn.active { background: rgba(255,122,26,.5); }
#btn-shoot { right: 26px; bottom: 108px; background: rgba(217,83,79,.28); }
#btn-pass { right: 108px; bottom: 40px; }
#btn-through { right: 26px; bottom: 26px; }
#btn-switch { right: 118px; bottom: 128px; width: 52px; height: 52px; }

@media (max-width: 760px) {
  .panel { padding: 8px; }
  #squad-list { grid-template-columns: 1fr 1fr; }
  .opp-card { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  #squad-list { grid-template-columns: 1fr; }
}
