* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: #e8eef7;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  image-rendering: pixelated;
  /* dokunmatikte sayfa kaydırma / yakınlaştırma olmasın */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body { overscroll-behavior: none; }

/* Çentikli telefonlarda güvenli alanı JS'in okuyabilmesi için ölçüm kutusu */
#safe {
  position: fixed;
  left: 0; top: 0;
  width: 0; height: 0;
  pointer-events: none;
  visibility: hidden;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1c2b4d 0%, #080c17 70%);
  z-index: 10;
}

#intro.hidden { display: none; }

.panel {
  width: min(560px, 92vw);
  padding: 28px 32px 24px;
  background: rgba(14, 20, 36, 0.92);
  border: 3px solid #3b4a6b;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.panel h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 4px;
  color: #7fd06a;
  text-shadow: 0 3px 0 #2c5c22, 0 6px 16px rgba(0, 0, 0, 0.6);
}

.sub {
  margin: 6px 0 4px;
  color: #9fb0cc;
  font-size: 14px;
}

.credits {
  margin: 0 0 20px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #6c7a94;
}

.credits b { color: #ffd166; font-weight: 600; }

.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin-bottom: 22px;
  text-align: left;
  font-size: 13px;
}

.keys div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 5px;
}

.keys b {
  min-width: 104px;
  color: #ffd166;
  font-size: 12px;
}

.keys span { color: #c6d2e4; }

.btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

button {
  padding: 12px 22px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  color: #0d1424;
  background: #7fd06a;
  border: none;
  border-bottom: 4px solid #4a8f3c;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.06s, filter 0.15s;
}

button:hover:not(:disabled) { filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }

button:disabled {
  background: #39435c;
  color: #7c88a0;
  border-bottom-color: #2a3247;
  cursor: not-allowed;
}

.mp {
  margin-top: 22px;
  padding: 14px 16px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #3b4a6b;
  border-radius: 8px;
  text-align: left;
}

.mp-title {
  font-size: 11px;
  letter-spacing: 2px;
  color: #7fd06a;
  font-weight: 700;
  margin-bottom: 10px;
}

.mp-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mp-row input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #e8eef7;
  background: rgba(6, 10, 20, 0.75);
  border: 2px solid #46567a;
  border-radius: 5px;
  outline: none;
}

.mp-row input:focus { border-color: #7fd06a; }
.mp-row input::placeholder { color: #6c7a94; }
.mp-row #mpName { flex: 0 0 110px; }

button.small {
  padding: 9px 18px;
  font-size: 13px;
  border-bottom-width: 3px;
  background: #66c0f4;
  border-bottom-color: #3a86ad;
}

.mp-status {
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.5;
  color: #8595b0;
}

.mp-status b { color: #ffd166; font-weight: 600; }
.mp-status.err { color: #ff9a9a; }
.mp-status.ok { color: #a8f09a; }

.tip {
  margin: 20px 0 0;
  font-size: 12px;
  color: #8595b0;
  font-style: italic;
}

.touch-only { display: none; }
body.touch .touch-only, .coarse .touch-only { display: block; }

/* ---------- küçük ekran / telefon ---------- */

@media (pointer: coarse) {
  .touch-only { display: block; }
}

@media (max-width: 620px), (max-height: 520px) {
  .panel {
    padding: 18px 16px 16px;
    max-height: 92vh;
    overflow-y: auto;
  }

  .panel h1 { font-size: 27px; letter-spacing: 2px; }
  .sub { margin-bottom: 14px; font-size: 12px; }

  .keys {
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 14px;
  }

  .keys div { padding: 4px 7px; }
  .keys b { min-width: 88px; font-size: 11px; }
  .keys span { font-size: 12px; }

  .btns { flex-direction: column; }
  button { width: 100%; padding: 13px 18px; }

  .mp { margin-top: 16px; padding: 12px; }
  .mp-row { flex-direction: column; }
  .mp-row #mpName, .mp-row input { flex: 1 1 auto; width: 100%; }
  button.small { width: 100%; }
  .tip { margin-top: 12px; }
}

/* yatay tutulan telefonlarda menü daha da toplansın */
@media (max-height: 430px) {
  .panel h1 { font-size: 22px; }
  .keys { display: none; }
}
