/* ==========================================================================
   CALIDAPACK · STRAFE TESTİ
   Sıralı WASD testi — tuşlar gösterilen dizideki gibi basılmalı.
   ========================================================================== */

/* ------------------------------- giriş butonu ----------------------------- */

.strafe-fab {
  position: fixed;
  right: 24px;
  bottom: 78px;
  z-index: 91;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: rgba(5, 13, 24, 0.82);
  color: var(--ice);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.25s,
    transform 0.25s var(--ease);
}

.strafe-fab .icon {
  font-size: 14px;
  color: var(--cyan);
}

.strafe-fab:hover {
  transform: translateY(-2px);
  border-color: rgba(111, 227, 255, 0.5);
  background: rgba(111, 227, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.strafe-fab:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
}

body.is-locked .strafe-fab {
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------- kabuk --------------------------------- */

body.strafe-open {
  overflow: hidden;
}

.strafe {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  padding: clamp(12px, 3vw, 34px);
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(37, 104, 184, 0.22), transparent 60%),
    rgba(2, 5, 11, 0.94);
  backdrop-filter: blur(6px);
  overflow: auto;
}

.strafe[hidden] {
  display: none;
}

.strafe-shell {
  position: relative;
  z-index: 2;
  margin: auto;
  width: min(1120px, 100%);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(111, 227, 255, 0.06);
  animation: strafe-in 0.32s var(--ease);
}

@keyframes strafe-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
}

/* --------------------------- ekranı ikiye bölen --------------------------- */

.strafe-split {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.strafe-split i {
  position: absolute;
  left: -2%;
  display: block;
  width: 104%;
  height: 51%;
  opacity: 0;
  will-change: transform, opacity;
}

.strafe-split-top {
  top: 0;
  transform-origin: top center;
}

.strafe-split-bottom {
  bottom: 0;
  transform-origin: bottom center;
}

/* Perde: yarılar yukarı ve aşağı çekilerek ekranı açar. */
.strafe-split.is-open .strafe-split-top {
  background:
    linear-gradient(180deg, rgba(2, 5, 11, 0.98) 60%, rgba(111, 227, 255, 0.22) 92%, rgba(111, 227, 255, 0.75));
  animation: strafe-curtain 0.68s var(--ease) both;
}

.strafe-split.is-open .strafe-split-bottom {
  background:
    linear-gradient(0deg, rgba(2, 5, 11, 0.98) 60%, rgba(111, 227, 255, 0.22) 92%, rgba(111, 227, 255, 0.75));
  animation: strafe-curtain 0.68s var(--ease) both;
}

/* Vuruş: iki ışık yarfı orta çizgiden doğup dışa akar. */
.strafe-split.is-hit .strafe-split-top,
.strafe-split.is-level .strafe-split-top,
.strafe-split.is-bad .strafe-split-top,
.strafe-split.is-hit .strafe-split-bottom,
.strafe-split.is-level .strafe-split-bottom,
.strafe-split.is-bad .strafe-split-bottom {
  transform-origin: center bottom;
  animation-duration: 0.3s;
  animation-timing-function: var(--ease);
  animation-fill-mode: both;
}

.strafe-split.is-hit .strafe-split-bottom,
.strafe-split.is-level .strafe-split-bottom,
.strafe-split.is-bad .strafe-split-bottom {
  transform-origin: center top;
}

.strafe-split.is-hit .strafe-split-top,
.strafe-split.is-hit .strafe-split-bottom {
  background: linear-gradient(180deg, rgba(111, 227, 255, 0.05), rgba(111, 227, 255, 0.34));
  animation-name: strafe-flare;
}

.strafe-split.is-level .strafe-split-top,
.strafe-split.is-level .strafe-split-bottom {
  background: linear-gradient(180deg, rgba(111, 227, 196, 0.08), rgba(111, 227, 255, 0.6));
  animation-name: strafe-flare;
  animation-duration: 0.52s;
}

.strafe-split.is-bad .strafe-split-top,
.strafe-split.is-bad .strafe-split-bottom {
  background: linear-gradient(180deg, rgba(255, 143, 163, 0.08), rgba(255, 92, 122, 0.55));
  animation-name: strafe-flare;
  animation-duration: 0.42s;
}

@keyframes strafe-curtain {
  0% {
    opacity: 1;
    transform: scaleY(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scaleY(0.012);
  }
}

@keyframes strafe-flare {
  0% {
    opacity: 0;
    transform: scaleY(0.02);
  }
  28% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: scaleY(1);
  }
}

/* ----------------------------- mouse yıldızı ----------------------------- */

.strafe-star {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 0.3s;
}

.strafe-star.is-on {
  opacity: 1;
}

.strafe-star::before,
.strafe-star::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(111, 227, 255, 0.7) 42%, transparent 72%);
  clip-path: polygon(
    50% 0,
    61% 39%,
    100% 50%,
    61% 61%,
    50% 100%,
    39% 61%,
    0 50%,
    39% 39%
  );
  filter: drop-shadow(0 0 10px rgba(111, 227, 255, 0.85));
}

.strafe-star::after {
  transform: rotate(45deg) scale(0.62);
  opacity: 0.75;
}

.strafe-star.is-hot::before {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 1), rgba(111, 227, 196, 0.8) 42%, transparent 72%);
}

/* --------------------------------- skor ---------------------------------- */

.strafe-stats div.is-pop strong {
  animation: strafe-pop 0.26s var(--ease);
}

@keyframes strafe-pop {
  40% {
    transform: scale(1.22);
    color: var(--cyan);
  }
}

.strafe-fab {
  animation: strafe-fab-pulse 3.4s ease-in-out infinite;
}

@keyframes strafe-fab-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(111, 227, 255, 0);
  }
  50% {
    box-shadow: 0 0 26px rgba(111, 227, 255, 0.28);
  }
}

.strafe-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid var(--line);
}

.strafe-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 29, 0.7);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.strafe-back:hover {
  color: var(--ice);
  border-color: rgba(111, 227, 255, 0.5);
  background: rgba(111, 227, 255, 0.1);
}

.strafe-back .icon {
  font-size: 13px;
  transform: rotate(180deg);
}

.strafe-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.strafe-brand img {
  width: 26px;
  height: 26px;
}

.strafe-brand span {
  color: var(--cyan);
}

/* --------------------------------- gövde --------------------------------- */

.strafe-body {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(14px, 2.4vw, 26px);
  padding: clamp(16px, 3vw, 30px);
}

.strafe-side {
  display: grid;
  align-content: start;
  gap: 12px;
}

.strafe-card {
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  background: rgba(5, 11, 21, 0.6);
}

.strafe-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.strafe-stat + .strafe-stat {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.strafe-stat span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.strafe-stat strong {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ice);
}

.strafe-card-label {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.strafe-history {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
}

.strafe-history li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.strafe-history li.empty {
  color: var(--faint);
}

.strafe-history b {
  color: var(--ice);
}

.strafe-guide {
  display: grid;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.strafe-guide b {
  color: var(--cyan);
}

/* -------------------------------- sıralama -------------------------------- */

.strafe-card-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.strafe-board-state {
  font-size: 7.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.strafe-board-state.is-live {
  color: var(--mint);
}

.strafe-board-state.is-off {
  color: #ff8fa3;
}

.strafe-board {
  display: grid;
  gap: 5px;
  max-height: 232px;
  margin: 0;
  padding: 0;
  overflow: hidden auto;
  list-style: none;
}

.strafe-board li {
  display: grid;
  grid-template-columns: 18px 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
}

.strafe-board li:last-child {
  border-bottom: 0;
}

.strafe-board li.is-me {
  border-bottom-color: rgba(111, 227, 255, 0.4);
  background: rgba(111, 227, 255, 0.07);
}

.strafe-board li.empty {
  display: block;
  border: 0;
  color: var(--faint);
}

.strafe-board-rank {
  color: var(--faint);
  text-align: right;
}

.strafe-board li:nth-child(1) .strafe-board-rank {
  color: var(--cyan);
}

.strafe-board-avatar {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  background: rgba(126, 178, 255, 0.1);
  font-size: 9px;
  line-height: 21px;
  text-align: center;
  color: var(--ice);
}

.strafe-board-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.strafe-board-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink);
}

.strafe-board-score {
  color: var(--ice);
}

.strafe-board-score b {
  color: var(--cyan);
}

.strafe-board-score small {
  display: block;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--faint);
  text-align: right;
}

.strafe-board-foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.strafe-board-foot:empty {
  display: none;
}

.strafe-board-foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(111, 227, 255, 0.45);
  background: rgba(111, 227, 255, 0.1);
  color: var(--cyan);
  text-decoration: none;
  font-size: 9px;
  letter-spacing: 0.12em;
  transition: background 0.18s, color 0.18s;
}

.strafe-board-foot a:hover {
  background: var(--cyan);
  color: #03121c;
}

.strafe-board-foot span + span {
  display: block;
  margin-top: 5px;
}

.strafe-board-foot b {
  color: var(--mint);
}

/* --------------------------------- oyun ---------------------------------- */

.strafe-main {
  min-width: 0;
}

.strafe-main h2 {
  margin: 12px 0 0;
  font-family: var(--display);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.strafe-main h2 span {
  color: var(--cyan);
}

.strafe-rule {
  margin: 10px 0 0;
  max-width: 62ch;
  font-size: 13px;
  color: var(--muted);
}

.strafe-rule b {
  color: var(--ice);
}

.strafe-pick {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.strafe-pick-label {
  margin-right: 4px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.strafe-pick-box {
  min-width: 104px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 29, 0.8);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--faint);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.strafe-pick-box:hover:not(:disabled) {
  color: var(--ice);
  border-color: rgba(111, 227, 255, 0.45);
}

.strafe-pick-box.is-active {
  color: #03121c;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(111, 227, 255, 0.45);
}

.strafe-pick-box:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.strafe-pick-box:disabled.is-active {
  color: var(--ice);
  background: rgba(111, 227, 255, 0.14);
  border-color: rgba(111, 227, 255, 0.4);
  box-shadow: none;
}

.strafe-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.strafe-stats div {
  flex: 1 1 96px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(5, 11, 21, 0.55);
}

.strafe-stats span {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.strafe-stats strong {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--ink);
}

.strafe-stats div.is-hot {
  border-color: rgba(111, 227, 255, 0.45);
}

.strafe-stats div.is-hot strong {
  color: var(--cyan);
}

.strafe-track {
  position: relative;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(126, 178, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 26px,
    rgba(3, 8, 16, 0.72);
}

.strafe-track.is-shake {
  animation: strafe-shake 0.28s;
}

@keyframes strafe-shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.strafe-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.strafe-seq-label,
.strafe-combo {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.strafe-keys {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 18px;
}

.strafe-keys b {
  min-width: 54px;
  padding: 12px 10px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 29, 0.8);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--faint);
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.strafe-keys b.is-done {
  color: var(--mint);
  border-color: rgba(111, 227, 196, 0.4);
  background: rgba(111, 227, 196, 0.07);
}

.strafe-keys b.is-next {
  color: #03121c;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(111, 227, 255, 0.55);
}

.strafe-combo b {
  margin-left: 5px;
  color: var(--ice);
}

.strafe-combo .mult {
  margin-left: 10px;
  color: var(--mint);
}

.strafe-flag {
  min-height: 15px;
  margin: 0 0 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ice);
}

.strafe-flag.is-bad {
  color: #ff8fa3;
}

.strafe-flag.is-good {
  color: var(--mint);
}

.strafe-note {
  margin: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* --------------------------------- tuşlar -------------------------------- */

/* Klavyedeki WASD kümesi: W üstte, A solda, D sağda, S altta — ortada daire. */
.strafe-pad {
  display: grid;
  grid-template-columns: repeat(3, 62px);
  grid-template-rows: repeat(3, 46px);
  grid-template-areas:
    ". w ."
    "a h d"
    ". s .";
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.strafe-pad button {
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 29, 0.85);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.1s,
    color 0.15s,
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.strafe-pad button[data-key="W"] {
  grid-area: w;
}

.strafe-pad button[data-key="A"] {
  grid-area: a;
}

.strafe-pad button[data-key="S"] {
  grid-area: s;
}

.strafe-pad button[data-key="D"] {
  grid-area: d;
}

.strafe-pad button:active,
.strafe-pad button.is-pressed {
  transform: translateY(2px);
  background: rgba(111, 227, 255, 0.16);
}

.strafe-pad button.is-next {
  color: #03121c;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 26px rgba(111, 227, 255, 0.5);
}

.strafe-hub {
  grid-area: h;
  display: grid;
  place-content: center;
  place-self: center;
  gap: 1px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(111, 227, 255, 0.14), rgba(3, 8, 16, 0.9) 68%),
    rgba(3, 8, 16, 0.8);
  pointer-events: none;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

.strafe-hub b {
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
  color: var(--faint);
}

.strafe-hub i {
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  line-height: 1;
  color: var(--faint);
}

.strafe-hub.is-live {
  border-color: rgba(111, 227, 255, 0.6);
  box-shadow: 0 0 26px rgba(111, 227, 255, 0.28) inset, 0 0 18px rgba(111, 227, 255, 0.22);
}

.strafe-hub.is-live b {
  color: var(--cyan);
}

.strafe-hub.is-live i {
  color: var(--ice);
}

.strafe-hub.is-bump b {
  animation: strafe-hub-bump 0.24s var(--ease);
}

@keyframes strafe-hub-bump {
  40% { transform: scale(1.34); text-shadow: 0 0 18px rgba(111, 227, 255, 0.9); }
}

.strafe-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.strafe-reset {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  padding: 0 0 2px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  cursor: pointer;
}

.strafe-reset:hover {
  color: var(--ice);
}

.strafe-hint {
  margin: 14px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

/* --------------------------------- mobil --------------------------------- */

@media (max-width: 860px) {
  .strafe-body {
    grid-template-columns: 1fr;
  }

  .strafe-side {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    display: grid;
  }

  .strafe-keys {
    gap: 6px;
    margin: 18px 0 14px;
  }

  .strafe-keys b {
    min-width: 38px;
    padding: 9px 6px;
    font-size: 16px;
  }

  .strafe-pick-box {
    min-width: 84px;
    padding: 8px 10px;
    font-size: 11.5px;
  }

  .strafe-pad {
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 40px);
    gap: 6px;
  }

  .strafe-hub b {
    font-size: 15px;
  }

  .strafe-board {
    max-height: 176px;
  }

  .strafe-fab span {
    display: none;
  }

  .strafe-fab {
    padding: 0 11px;
  }
}

/* ------------------------- hareket azaltma tercihi ------------------------ */

@media (prefers-reduced-motion: reduce) {
  .strafe-shell,
  .strafe-fab,
  .strafe-pad button,
  .strafe-hub,
  .strafe-stats div.is-pop strong,
  .strafe-track.is-shake {
    animation: none;
    transition-duration: 0.01ms;
  }

  .strafe-split {
    display: none;
  }

  .strafe-star {
    display: none;
  }
}
