* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0d1f12; color: #eef4ee;
  overflow: hidden;
}

.screen { display: none; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.screen.active { display: flex; }
.hidden { display: none !important; }
.muted { color: #8aa58f; font-size: 0.9rem; }
.error { color: #ff9c9c; text-align: center; display: flex; flex-direction: column; gap: 8px; }

h1 { font-size: 2rem; }
.tagline { color: #8aa58f; }

.btn {
  display: inline-block; padding: 10px 20px; border: none; border-radius: 8px;
  background: #1d3a24; color: #eef4ee; font-size: 1rem; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn:hover { filter: brightness(1.2); }
.btn-primary { background: #2e7d32; }
.btn-danger { background: #b23b3b; }
.btn-discord { background: #5865f2; font-size: 1.2rem; padding: 14px 28px; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }

/* Lobi */
.lobby-header { display: flex; align-items: center; gap: 16px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #2e7d32; object-fit: cover;
}
.balance { background: #1d3a24; padding: 6px 14px; border-radius: 999px; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: min(900px, 100%); }
@media (max-width: 700px) { .lobby-grid { grid-template-columns: 1fr; overflow-y: auto; } .screen { overflow-y: auto; justify-content: flex-start; } }
.panel { background: #142a19; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.panel h2 { font-size: 1.1rem; margin-top: 8px; }
.panel label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.panel label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.panel input[type="number"], .panel input[type="text"] {
  padding: 8px; border-radius: 6px; border: 1px solid #2e5237;
  background: #0d1f12; color: #eef4ee; font-size: 1rem;
}
/* ---------- GİRİŞ EKRANI: kuş bakışı saha ---------- */
#screen-login { position: relative; overflow: hidden; background: #0a1a0e; }
.pitch-bg {
  position: absolute; inset: 5vh 4vw;
  border: 2px solid rgba(255,255,255,0.26);
  border-radius: 12px;
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,0.025) 0 72px, transparent 72px 144px),
    radial-gradient(ellipse at center, #1c5a28 0%, #123f1c 62%, #0d2f15 100%);
}
.pitch-half {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; background: rgba(255,255,255,0.26); transform: translateX(-1px);
}
.pitch-center-ring {
  position: absolute; left: 50%; top: 50%;
  width: min(58vmin, 480px); height: min(58vmin, 480px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.26); border-radius: 50%;
  animation: kickoff-pulse 4s ease-in-out infinite;
}
@keyframes kickoff-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,213,79,0); }
  50% { box-shadow: 0 0 0 16px rgba(255,213,79,0.07); }
}
@media (prefers-reduced-motion: reduce) {
  .pitch-center-ring { animation: none; }
}
.pitch-goalbox {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 9vw; height: 34vh; border: 2px solid rgba(255,255,255,0.2);
}
.pitch-goalbox-left { left: 4vw; border-left: none; }
.pitch-goalbox-right { right: 4vw; border-right: none; }

.login-hero {
  position: relative; z-index: 1; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 24px; max-width: 580px;
}
.login-eyebrow {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.72rem; letter-spacing: 0.35em; color: #8fbf9a;
}
.login-title {
  font-size: clamp(2.6rem, 9vw, 4.4rem); line-height: 0.95;
  font-weight: 900; font-style: italic; letter-spacing: -0.02em;
  display: flex; flex-direction: column;
}
.login-title span { color: #ffd54f; }
.login-tagline { color: #b7d4bd; max-width: 42ch; line-height: 1.55; }
.btn-kickoff {
  display: inline-flex; align-items: center; gap: 10px;
  background: #5865f2; color: #fff; text-decoration: none;
  font-size: 1.15rem; font-weight: 700;
  padding: 15px 34px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-kickoff:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.55);
}
.btn-kickoff:focus-visible { outline: 3px solid #ffd54f; outline-offset: 3px; }
.btn-kickoff-ball { font-size: 1.35rem; }
.login-feats {
  list-style: none; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.78rem;
}
.login-feats li {
  border: 1px solid rgba(255,255,255,0.18); border-radius: 999px;
  padding: 6px 14px; color: #b7d4bd;
}
@media (max-width: 640px) {
  .pitch-goalbox { display: none; }
}

/* Bekleme odası */
#waiting-room { width: min(700px, 100%); }
.format-row { display: flex; align-items: end; gap: 10px; }
.format-row select {
  padding: 8px; border-radius: 6px; border: 1px solid #2e5237;
  background: #0d1f12; color: #eef4ee; font-size: 1rem;
}
.wr-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wr-col { background: #0d1f12; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.wr-col h3 { font-size: 1rem; }
.seat-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.seat-list li {
  background: #142a19; padding: 8px 10px; border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.seat-kick {
  background: #b23b3b; border: none; color: #fff; border-radius: 6px;
  padding: 3px 10px; cursor: pointer; font-size: 0.8rem;
}
.seat-kick:hover { filter: brightness(1.2); }
.wr-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.wr-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.seat-list li.empty { color: #8aa58f; border: 1px dashed #2e5237; background: transparent; }
.seat-list li.self { outline: 2px solid #2e7d32; }

.lobby-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lobby-list li {
  display: flex; justify-content: space-between; align-items: center;
  background: #0d1f12; padding: 10px; border-radius: 8px;
}

/* Oyun */
#screen-game { position: relative; gap: 4px; padding: 8px; }
.btn-forfeit {
  position: absolute; top: 10px; right: 12px; z-index: 30;
  background: rgba(178, 59, 59, 0.85); color: #fff; border: none;
  border-radius: 8px; padding: 7px 12px; font-size: 0.8rem; cursor: pointer;
}
.btn-forfeit:hover { background: #b23b3b; }
.hud { display: flex; gap: 24px; font-size: 1.4rem; font-weight: bold; align-items: baseline; }
#hud-timer { color: #ffd54f; }
.hud-ping { font-size: 0.75rem; color: #8aa58f; font-weight: normal; }
.canvas-wrap { position: relative; width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; }
#game-canvas { background: #1b5e20; border-radius: 8px; touch-action: none; max-width: 100%; max-height: 100%; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 1.3rem; text-align: center;
  border-radius: 8px; z-index: 10;
}

/* Dokunmatik kontroller: yalnızca dokunmatik cihazda görünür */
#touch-controls { display: none; }
@media (hover: none) and (pointer: coarse) {
  #touch-controls { display: block; }
  #joystick-zone {
    position: fixed; left: 12px; bottom: 12px; width: 130px; height: 130px;
    border-radius: 50%; background: rgba(255,255,255,0.08); touch-action: none; z-index: 20;
  }
  #joystick-knob {
    position: absolute; left: 40px; top: 40px; width: 50px; height: 50px;
    border-radius: 50%; background: rgba(255,255,255,0.35);
  }
  #kick-button {
    position: fixed; right: 16px; bottom: 24px; width: 96px; height: 96px;
    border-radius: 50%; border: none; background: rgba(255,82,82,0.75);
    color: #fff; font-size: 1.1rem; font-weight: bold; touch-action: none; z-index: 20;
  }
}

/* Yatay mod uyarısı: yalnızca dikey dokunmatik cihazda oyun ekranında */
#rotate-hint { display: none; }
@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
  #screen-game.active #rotate-hint { display: flex; position: fixed; inset: 0; z-index: 50; }
}

/* Sonuç */
.result-score { font-size: 2.4rem; font-weight: bold; }
.result-coins { font-size: 1.3rem; }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #b23b3b; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100;
}
