:root {
  --bg: #0b1020;
  --panel: #121a33;
  --panel-2: #1a2447;
  --text: #e6ecff;
  --muted: #8b97c0;
  --accent: #4ade80;
  --gold: #fbbf24;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overscroll-behavior: none; }

body {
  background:
    radial-gradient(circle at 15% 0%, #1b2752 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, #13314a 0%, transparent 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 640px;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Üst bar */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img { width: 40px; height: 40px; }

.logo span {
  background: linear-gradient(90deg, #86efac, #4ade80, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hud { display: flex; gap: 8px; }

.stat {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  padding: 6px 12px;
  min-width: 72px;
  text-align: center;
}

.stat .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.stat .value {
  display: inline-block;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat .value.bump { animation: bump .3s ease-out; }

/* Oyun alanı */
.board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 12, 28, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity .25s;
}

.overlay.hidden { opacity: 0; pointer-events: none; }

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  padding: 24px 22px;
  text-align: center;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}

.card.pop { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }

.card h2 { margin: 0 0 6px; font-size: 30px; }

.card p { margin: 0 0 16px; color: var(--muted); line-height: 1.45; }

.card .badge {
  display: inline-block;
  background: var(--gold);
  color: #3b2600;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 14px;
  animation: wiggle 1.2s ease-in-out infinite;
}

.card .badge[hidden] { display: none; }

.hint { font-size: 13px; margin: 14px 0 0 !important; }
.hint .touch { display: none; }

.combo {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 0 #92400e, 0 0 20px rgba(251, 191, 36, .6);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.combo.show { animation: combo 1s ease-out; }

/* Butonlar */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 18px;
  color: #052e16;
  background: linear-gradient(180deg, #86efac, #22c55e);
  padding: 12px 28px;
  border-radius: 999px;
  box-shadow: 0 4px 0 #15803d;
  transition: transform .1s, box-shadow .1s;
  white-space: nowrap;
}

.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #15803d; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn.small { font-size: 14px; padding: 8px 16px; box-shadow: 0 3px 0 #15803d; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); align-self: flex-start; }

/* Mobil yön tuşları */
.dpad {
  display: none;
  grid-template-columns: repeat(3, 68px);
  grid-template-rows: repeat(2, 58px);
  gap: 8px;
  justify-content: center;
}

.dpad button {
  border: 0;
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 22px;
  box-shadow: 0 4px 0 #0a1027;
  touch-action: manipulation;
}

.dpad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #0a1027; }
.dpad [data-dir="up"] { grid-column: 2; grid-row: 1; }
.dpad [data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad [data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad [data-dir="right"] { grid-column: 3; grid-row: 2; }

@media (pointer: coarse) {
  .dpad { display: grid; }
  .hint .keys { display: none; }
  .hint .touch { display: inline; }
}

/* Yönetim paneli */
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel h2 { margin: 0; font-size: 22px; }
.panel > .btn { align-self: flex-start; }
.panel.row { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; color: var(--muted); }
.panel.login { max-width: 380px; width: 100%; align-self: center; margin-top: 8vh; }

.admin-actions { display: flex; gap: 8px; align-items: center; }
.admin-actions form { margin: 0; }
a.btn { text-decoration: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

.field input {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  padding: 10px 12px;
}

.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.notice {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(74, 222, 128, .12);
  border: 1px solid rgba(74, 222, 128, .3);
}

.notice.error { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .35); }

.img-row { display: flex; align-items: center; gap: 12px; }

.img-row img {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--panel-2);
  object-fit: contain;
  padding: 4px;
}

.img-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.img-info span { font-size: 13px; color: var(--muted); }

.toggles { display: flex; gap: 18px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

@media (max-width: 480px) {
  .logo { font-size: 26px; }
  .logo img { width: 32px; height: 32px; }
  .stat { min-width: 0; padding: 6px 10px; }
  .stat .value { font-size: 19px; }
}

/* Animasyonlar */
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); color: var(--gold); }
  100% { transform: scale(1); }
}

@keyframes pop {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg) scale(1.05); }
}

@keyframes combo {
  0% { opacity: 0; transform: translateX(-50%) scale(.6); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.2); }
  30% { transform: translateX(-50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition: none !important; }
}
