:root {
  --bg: #07130d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #eaf5ee;
  --muted: #8fa89a;
  --accent: #b6ff3b;
  --accent-ink: #0b1a08;
  --danger: #ff5c6c;
  --team-a: #facc15;
  --team-b: #38bdf8;
  --radius: 18px;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(182, 255, 59, 0.13), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(20, 120, 60, 0.35), transparent 60%);
}

/* Üst bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px 8px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-ball {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1b4d2e, #0d2a1a);
  border: 1px solid var(--panel-border);
  box-shadow: 0 0 24px rgba(182, 255, 59, 0.25);
}
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.08em;
  line-height: 1;
  background: linear-gradient(90deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.steps { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.steps li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--panel-border);
  background: var(--panel);
}
.steps li span {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
}
.steps li.active { color: var(--text); border-color: rgba(182, 255, 59, 0.5); }
.steps li.active span { background: var(--accent); color: var(--accent-ink); }

main { max-width: 1280px; margin: 0 auto; padding: 8px 24px 24px; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 18px 0 20px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 40px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Butonlar */
.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #6fe03a);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(182, 255, 59, 0.28);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #cbff62, #86ee4f); box-shadow: 0 8px 28px rgba(182, 255, 59, 0.42); }
.btn.big { font-size: 16px; padding: 14px 28px; }
.btn.danger:hover:not(:disabled) { color: var(--danger); border-color: rgba(255, 92, 108, 0.5); }

/* Oyuncu kartları */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.pcard {
  position: relative;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pcard:focus-within { border-color: rgba(182, 255, 59, 0.45); }
.pcard.gk {
  border-color: rgba(250, 204, 21, 0.55);
  background: linear-gradient(160deg, rgba(250, 204, 21, 0.10), var(--panel) 55%);
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.08);
}
.pcard-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.num {
  font-family: var(--display);
  font-size: 26px; font-weight: 700;
  color: var(--muted);
  min-width: 30px;
}
.pcard .name {
  flex: 1; min-width: 0;
  font: inherit; font-weight: 600; font-size: 15px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}
.pcard .name:focus { border-color: var(--accent); }
.pcard .name::placeholder { color: #5d7568; font-weight: 400; }
.gk-btn {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.gk-btn:hover { color: var(--text); border-color: rgba(250, 204, 21, 0.6); }
.pcard.gk .gk-btn { background: #facc15; color: #2a2100; border-color: #facc15; }

.stat-row {
  display: grid;
  grid-template-columns: 82px 1fr 26px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.stat-row output {
  font-weight: 700; text-align: center; font-size: 13px;
  border-radius: 6px; padding: 2px 0;
  color: var(--accent-ink);
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}
.pcard.gk input[type="range"]::-webkit-slider-thumb { border-color: #facc15; }
.pcard.gk input[type="range"]::-moz-range-thumb { border-color: #facc15; }

.pcard-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--panel-border);
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.pcard-foot strong { font-family: var(--display); font-size: 24px; color: var(--text); letter-spacing: 0; }

/* Alt aksiyon çubuğu */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(24px, calc((100vw - 1232px) / 2));
  background: rgba(7, 19, 13, 0.88);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--panel-border);
}
.chips { display: flex; gap: 8px; margin-bottom: 4px; }
.chip {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.chip.ok { background: rgba(182, 255, 59, 0.16); color: var(--accent); }
#status-hint { margin: 0; font-size: 13px; color: var(--muted); min-height: 18px; }

/* Sonuç */
.balance {
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  margin-bottom: 20px;
}
.balance-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; }
.balance-label strong { font-family: var(--display); font-size: 34px; color: var(--accent); letter-spacing: 0; }
.balance-track { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
#balance-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #6fe03a, var(--accent)); transition: width 0.9s cubic-bezier(.2, .8, .2, 1); }

.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.team {
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 18px;
  --tc: var(--team-a);
}
.team.b { --tc: var(--team-b); }
.team-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.team-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 30px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--tc);
}
.team-power { text-align: right; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.team-power strong { display: block; font-family: var(--display); font-size: 28px; color: var(--text); letter-spacing: 0; line-height: 1; }

.pitch {
  position: relative;
  aspect-ratio: 4 / 4.4;
  border-radius: 14px;
  overflow: hidden;
  background: repeating-linear-gradient(0deg, #1c6b36 0 12.5%, #197a3b 12.5% 25%);
  border: 2px solid rgba(255, 255, 255, 0.55);
}
.pitch .line { position: absolute; border: 2px solid rgba(255, 255, 255, 0.55); }
.pitch .box { left: 25%; right: 25%; bottom: -2px; height: 24%; border-bottom: none; }
.pitch .small-box { left: 38%; right: 38%; bottom: -2px; height: 10%; border-bottom: none; }
.pitch .arc { left: 32%; right: 32%; top: -22%; aspect-ratio: 1; border-radius: 50%; }

.pp {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 30%;
  opacity: 0;
  animation: pop 0.5s forwards cubic-bezier(.2, 1.4, .4, 1);
}
.pp .disc {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 19px;
  background: var(--tc); color: #111;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.pp.gk .disc { background: #1f2937; color: var(--tc); border-color: var(--tc); }
.pp .pname {
  max-width: 100%;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.62);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.roster { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.roster li {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 14px;
}
.roster .role { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--tc); }
.roster .ov { font-family: var(--display); font-size: 18px; color: var(--muted); }

.panel {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.panel h3 { margin: 0 0 14px; font-family: var(--display); font-size: 24px; letter-spacing: 0.06em; text-transform: uppercase; }

.cmp-row { display: grid; grid-template-columns: 44px 1fr 110px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.cmp-row .val { font-weight: 700; }
.cmp-row .val.a { text-align: right; color: var(--team-a); }
.cmp-row .val.b { text-align: left; color: var(--team-b); }
.cmp-row .lbl { text-align: center; color: var(--muted); }
.cmp-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); display: flex; }
.cmp-bar.a { justify-content: flex-end; }
.cmp-bar i { display: block; height: 100%; border-radius: 99px; width: 0; transition: width 0.8s cubic-bezier(.2, .8, .2, 1); }
.cmp-bar.a i { background: var(--team-a); }
.cmp-bar.b i { background: var(--team-b); }

#insights { margin: 0; padding-left: 18px; color: #cfe3d6; font-size: 14px; line-height: 1.7; }
#insights li::marker { color: var(--accent); }

/* Yükleniyor / bildirim */
.loading {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(4, 12, 8, 0.85);
  backdrop-filter: blur(6px);
}
.spinner {
  width: 64px; height: 64px; border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { margin: 0; font-weight: 600; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 60;
  padding: 12px 20px; border-radius: 12px;
  background: #1b2a22; border: 1px solid var(--panel-border);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@media (max-width: 860px) {
  .teams { grid-template-columns: 1fr; }
  .cmp-row { grid-template-columns: 32px 1fr 76px 1fr 32px; gap: 6px; font-size: 12px; }
  .section-head h2 { font-size: 32px; }
}
@media (max-width: 560px) {
  .topbar, main { padding-left: 14px; padding-right: 14px; }
  .action-bar { padding: 12px 14px; }
  .btn.big { padding: 12px 16px; font-size: 14px; }
  .steps { display: none; }
}

/* Alt imza */
.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 120px;
  text-align: center;
}
.footer-line {
  height: 1px;
  margin-bottom: 20px;
  background: linear-gradient(90deg, transparent, rgba(182, 255, 59, 0.5), transparent);
}
.footer p {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}
.footer strong {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.footer-ball { filter: drop-shadow(0 0 6px rgba(182, 255, 59, 0.6)); }

/* Elle kadro düzenleme */
.edit-hint { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.roster li[data-p], .pp[data-p] { cursor: pointer; }
.roster li[data-p] { border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; }
.roster li[data-p]:hover { background: rgba(255, 255, 255, 0.08); }
.roster li.sel { border-color: var(--tc); background: rgba(255, 255, 255, 0.1); }
.pp.sel .disc { box-shadow: 0 0 0 4px var(--tc), 0 0 22px var(--tc); }
.pending { color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* Mobil uyum */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
.bg-glow, .loading { top: 0; left: 0; right: 0; bottom: 0; }
.action-bar, .loading, .pcard { -webkit-backdrop-filter: blur(10px); }
.action-bar { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.footer { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
.toast { max-width: calc(100vw - 32px); text-align: center; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.status { min-width: 0; }
.btn.big { white-space: nowrap; }

@media (max-width: 860px) {
  .section-head { align-items: stretch; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .topbar { padding-top: 16px; }
  .brand { gap: 10px; }
  .brand-ball { width: 40px; height: 40px; font-size: 22px; }
  .brand h1 { font-size: 24px; }
  .brand p { font-size: 12px; }
  .section-head { margin: 10px 0 16px; }
  .section-head h2 { font-size: 30px; }
  .section-head p { font-size: 13px; }
  .head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .head-actions .btn { padding: 11px 8px; font-size: 13px; }

  .players-grid { grid-template-columns: 1fr; gap: 12px; }
  .pcard { padding: 14px; }
  .pcard .name { font-size: 16px; }
  .stat-row { grid-template-columns: 78px 1fr 28px; gap: 10px; margin-bottom: 12px; }
  input[type="range"] { height: 8px; }
  input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; }
  input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; }

  .action-bar { gap: 10px; padding-top: 10px; }
  #status-hint { font-size: 12px; line-height: 1.3; }
  .btn.big { padding: 12px 16px; font-size: 14px; }

  .balance { padding: 14px 16px; }
  .balance-label { font-size: 12px; }
  .balance-label strong { font-size: 28px; }
  .team { padding: 14px; }
  .team-head h3 { font-size: 26px; }
  .team-power strong { font-size: 24px; }
  .pitch { aspect-ratio: 4 / 4.3; }
  .pp { width: 34%; }
  .pp .disc { width: 38px; height: 38px; font-size: 16px; border-width: 2px; }
  .pp .pname { font-size: 11px; padding: 2px 6px; }
  .roster li { padding: 11px 12px; grid-template-columns: 52px 1fr auto; }
  .panel { padding: 16px; margin-top: 16px; }
  .panel h3 { font-size: 22px; }
  #insights { font-size: 13px; }
  .edit-hint { font-size: 12px; }
}
