/* Duck Strike — oyun sayfası stilleri */

:root {
  --bg: #0b0a10;
  --panel: #16141f;
  --panel-2: #211e2d;
  --line: #3a3550;
  --text: #f4f1e8;
  --muted: #a9a3bd;
  --yellow: #ffd23f;
  --orange: #ff9a1f;
  --red: #ff4d5e;
  --green: #48e0a0;
  --ice: #5ad7ff;
  --font: "Pixelify Sans", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}
body.playing:not(.touch) #game { cursor: none; }

.touch-only { display: none; }
body.touch .touch-only { display: revert; }
body.touch .desk-only { display: none; }
body:not(.touch) .touch-only { display: none !important; }

/* ---------- Piksel butonlar ---------- */
.pbtn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 -3px 0 0 var(--line) inset,
    3px 0 0 0 var(--line), -3px 0 0 0 var(--line), 0 3px 0 0 var(--line), 0 -3px 0 0 var(--line);
  transition: transform 0.08s, background 0.15s;
}
.pbtn:hover { background: #2b2740; }
.pbtn:active { transform: translateY(2px); }
.pbtn:focus-visible { outline: 3px solid var(--ice); outline-offset: 5px; }
.pbtn.primary {
  background: var(--yellow);
  color: #2a1d00;
  box-shadow:
    0 -4px 0 0 #c79a12 inset,
    3px 0 0 0 #2a1d00, -3px 0 0 0 #2a1d00, 0 3px 0 0 #2a1d00, 0 -3px 0 0 #2a1d00;
}
.pbtn.primary:hover { background: #ffdc66; }
.pbtn.ghost { background: transparent; }
.pbtn.small { min-height: 34px; padding: 4px 12px; font-size: 0.9rem; }
.pbtn.big { padding: 14px 18px; font-size: 1.4rem; }
.pbtn.big small { font-size: 0.8rem; font-weight: 400; opacity: 0.75; }
.pbtn.icon { width: 44px; height: 44px; padding: 0; font-size: 1.2rem; }

.link {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.link:hover { color: var(--text); }
.link.danger:hover { color: var(--red); }

/* ---------- Menü ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  touch-action: pan-y;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, rgba(11, 10, 16, 0.55), rgba(11, 10, 16, 0.92) 70%);
}

.menu-top {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-box {
  width: 100%;
  max-width: 420px;
  margin: auto 0;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.logo {
  margin: 0;
  text-align: center;
  font-size: clamp(2.8rem, 12vw, 4.4rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: var(--yellow);
  text-shadow: 4px 4px 0 #8a5a00, 8px 8px 0 rgba(0, 0, 0, 0.5);
  animation: bob 2.4s steps(4) infinite;
}
.logo span { display: block; color: var(--text); text-shadow: 4px 4px 0 #6b2530, 8px 8px 0 rgba(0, 0, 0, 0.5); }
@keyframes bob { 50% { transform: translateY(-4px); } }

.tagline { margin: 0; text-align: center; color: var(--muted); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.tab {
  padding: 10px;
  border: 0;
  border-bottom: 4px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
}
.tab.active { color: var(--yellow); border-color: var(--yellow); }

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: rgba(22, 20, 31, 0.92);
  box-shadow: 4px 0 0 var(--line), -4px 0 0 var(--line), 0 4px 0 var(--line), 0 -4px 0 var(--line);
}

.join { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.join input,
.field input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  background: #0e0d14;
  box-shadow: 0 0 0 3px var(--line);
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  user-select: text;
  -webkit-user-select: text;
}
.field input { letter-spacing: 0.02em; text-transform: none; }
.join input:focus, .field input:focus { outline: none; box-shadow: 0 0 0 3px var(--ice); }

.controls { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.controls strong { color: var(--text); }
.controls p { margin: 4px 0 0; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span:first-child { color: var(--muted); font-size: 0.9rem; }
.field .row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button {
  width: 36px;
  height: 36px;
  border: 0;
  cursor: pointer;
  box-shadow: 0 0 0 3px #000;
}
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--text); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  background: #0e0d14;
}
.stats b { font-size: 1.6rem; color: var(--yellow); }
.stats small { color: var(--muted); font-size: 0.8rem; }

.credit { margin: 0; color: #5d5873; font-size: 0.8rem; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud button, #hud .overlay { pointer-events: auto; }
body:not(.touch) #scoreboard { pointer-events: none; }

.hud-tl, .hud-tr, .hud-bl, .hud-br, .hud-bc {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hud-tl { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); flex-wrap: wrap; max-width: 60vw; }
.hud-tr { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.hud-bl { bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); }
.hud-br { bottom: max(14px, env(safe-area-inset-bottom)); right: max(14px, env(safe-area-inset-right)); }
.hud-bc { bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); gap: 6px; }

.chip {
  padding: 6px 12px;
  background: rgba(11, 10, 16, 0.75);
  box-shadow: 0 0 0 3px var(--line);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.chip b { color: var(--yellow); }

.bots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(11, 10, 16, 0.75);
  pointer-events: auto;
}
.bots .pbtn.small { min-height: 28px; width: 28px; padding: 0; }
.bots b { min-width: 1.2em; text-align: center; }

.hp {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 150px;
  padding: 6px 12px 12px;
  background: rgba(11, 10, 16, 0.75);
  font-size: 1.8rem;
  font-weight: 700;
}
.hp span { color: var(--red); font-size: 1.4rem; }
.hp i {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 4px;
  background: var(--green);
  transform-origin: left;
  transition: transform 0.15s steps(4);
}
.hp.low b { color: var(--red); animation: blink 0.5s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

.ammo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(11, 10, 16, 0.75);
  font-size: 1.8rem;
  font-weight: 700;
}
.ammo small { color: var(--muted); font-size: 1rem; }
.ammo em { font-style: normal; font-size: 0.9rem; color: var(--orange); }
.ammo.empty b { color: var(--red); }

.slot {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 12px;
  border: 0;
  background: rgba(11, 10, 16, 0.7);
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--line);
}
.slot kbd { font: inherit; color: var(--yellow); }
.slot.active { color: var(--text); background: rgba(255, 210, 63, 0.18); box-shadow: 0 0 0 2px var(--yellow); }

#killfeed {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 56px);
  right: max(12px, env(safe-area-inset-right));
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 0.95rem;
}
#killfeed li {
  padding: 4px 10px;
  background: rgba(11, 10, 16, 0.75);
  animation: feedIn 0.25s steps(3);
  white-space: nowrap;
}
#killfeed li.me { box-shadow: 0 0 0 2px var(--yellow); }
#killfeed li.fade { opacity: 0; transition: opacity 0.6s; }
#killfeed .w { margin: 0 6px; }
@keyframes feedIn { from { transform: translateX(20px); opacity: 0; } }

.center-msg {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 28px;
  background: rgba(11, 10, 16, 0.8);
  box-shadow: 0 0 0 4px var(--red);
  text-align: center;
}
.center-msg strong { font-size: 2.2rem; color: var(--red); }
.center-msg small { color: var(--muted); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 4, 8, 0.6);
}
.sheet {
  width: min(460px, 100%);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  box-shadow: 4px 0 0 var(--line), -4px 0 0 var(--line), 0 4px 0 var(--line), 0 -4px 0 var(--line);
}
.sheet.narrow { width: min(300px, 100%); align-items: stretch; text-align: center; }
.sheet h2 { margin: 0; color: var(--yellow); }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th { color: var(--muted); font-weight: 400; text-align: right; padding: 4px 6px; }
.sheet th:first-child, .sheet td:first-child { text-align: left; }
.sheet td { padding: 6px; text-align: right; border-top: 2px solid var(--panel-2); }
.sheet tr.me td { color: var(--yellow); }
.sheet .dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; }

.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  background: var(--yellow);
  animation: spin 0.8s steps(4) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 30;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--yellow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Dokunmatik joystickler ---------- */
#touch { position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
.stick {
  position: absolute;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: opacity 0.15s;
}
.stick.on { opacity: 1; }
.stick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
#stickR { border-color: rgba(255, 77, 94, 0.45); }
#stickR i { background: rgba(255, 77, 94, 0.55); }

body.touch .slot kbd { display: none; }
body.touch .hud-bc { bottom: auto; top: max(12px, env(safe-area-inset-top)); }

@media (max-width: 640px) {
  .hp, .ammo { font-size: 1.4rem; min-width: 0; }
  .hp { min-width: 110px; }
  .slot { padding: 4px 8px; font-size: 0.85rem; }
  .hud-tl { max-width: 50vw; }
  #killfeed { font-size: 0.8rem; }
}
@media (max-height: 460px) {
  body.touch .hud-bc { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); }
  .hud-tl .pbtn.small#btnCopy { display: none; }
}

/* ---------- Oyun modları ---------- */
.mode-pick { display: flex; flex-direction: column; gap: 8px; }
.mode-pick .lbl { color: var(--muted); font-size: 0.9rem; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modes button {
  min-height: 38px;
  padding: 4px 8px;
  border: 0;
  background: #0e0d14;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--line);
}
.modes button:hover { color: var(--text); }
.modes button[aria-pressed="true"] { color: #2a1d00; background: var(--yellow); box-shadow: 0 0 0 2px #2a1d00; }
.mode-desc { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.4; min-height: 2.8em; }
.dark-toggle { display: flex; align-items: flex-start; gap: 8px; font-size: 0.88rem; color: var(--text); cursor: pointer; line-height: 1.35; }
.dark-toggle input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--yellow); flex: none; }

.hud-tl .chip small { color: var(--muted); font-weight: 400; letter-spacing: 0; margin-left: 4px; }

.obj-bar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 0;
  background: rgba(11, 10, 16, 0.8);
  box-shadow: 0 0 0 3px var(--line);
  font-weight: 700;
}
.obj-bar > span { display: flex; align-items: center; gap: 8px; padding: 4px 12px; position: relative; }
.obj-bar .t0 { color: #ff8a3d; box-shadow: inset 0 -3px 0 #ff8a3d; }
.obj-bar .t1 { color: #5ad7ff; box-shadow: inset 0 -3px 0 #5ad7ff; }
.obj-bar .mine { background: rgba(255, 255, 255, 0.07); }
.obj-bar i { font-style: normal; font-size: 0.85rem; }
.obj-bar b { font-size: 1.5rem; color: var(--text); }
.obj-bar small { position: absolute; left: 0; right: 0; top: 100%; margin-top: 5px; font-size: 0.72rem; font-weight: 600; text-align: center; white-space: nowrap; text-shadow: 1px 1px 0 #000; }
.obj-bar em { font-style: normal; display: grid; place-items: center; padding: 0 10px; color: var(--muted); font-size: 0.85rem; border-left: 2px solid var(--line); border-right: 2px solid var(--line); }
.obj-bar em.zone { color: var(--zc); font-size: 1.3rem; }
body.touch .obj-bar { top: calc(max(12px, env(safe-area-inset-top)) + 46px); }

.announce {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 66px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.announce div {
  padding: 4px 12px;
  background: rgba(11, 10, 16, 0.78);
  box-shadow: 0 0 0 2px var(--ac);
  color: var(--ac);
  font-weight: 700;
  white-space: nowrap;
  animation: feedIn 0.25s steps(3);
}
.announce div.fade { opacity: 0; transition: opacity 0.6s; }

.round-msg {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 28px;
  background: rgba(11, 10, 16, 0.85);
  box-shadow: 0 0 0 4px var(--wc);
  text-align: center;
}
.round-msg strong { font-size: clamp(1.6rem, 6vw, 2.6rem); color: var(--wc); text-shadow: 3px 3px 0 #000; }
.round-msg small { color: var(--muted); }

#killfeed li { position: relative; }
#killfeed li b { font-weight: 600; }
#killfeed .streak {
  position: absolute;
  top: -9px;
  left: -10px;
  padding: 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  color: #2a1d00;
  background: var(--yellow);
  box-shadow: 0 0 0 2px #2a1d00;
  transform: rotate(-8deg);
}
#killfeed .streak.s3 { background: #ff8a3d; }
#killfeed .streak.s4 { background: #ff4d5e; color: #fff; }
#killfeed .streak.s5 { background: #a98bff; color: #fff; animation: blink 0.5s steps(1) infinite; }
#killfeed { gap: 9px; }

.sheet tr.team td { color: var(--tc); font-weight: 700; border-top: 3px solid var(--tc); padding-top: 8px; }

@media (max-width: 640px) {
  .obj-bar b { font-size: 1.15rem; }
  .obj-bar > span { padding: 3px 8px; }
  .announce div { font-size: 0.8rem; }
}
body.touch .announce { top: calc(max(12px, env(safe-area-inset-top)) + 112px); }
