:root {
  --bg-dark: #22113f;
  --bg-purple: #43138f;
  --purple-light: #6c24dc;
  --yellow: #ffe13d;
  --pink: #ff4cc4;
  --green: #35e28f;
  --red: #ff6f84;
  --panel: rgba(48, 25, 82, 0.95);
  --panel-soft: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.18);
  --text: #ffffff;
  --muted: #d8cfea;
  --shadow: 0 20px 55px rgba(8, 3, 25, 0.4);
}

.game-embed, .game-embed * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.game-embed {
  margin: 0;
  min-height: 100%;
}

.game-embed {
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);

  background:
    radial-gradient(
      circle at 85% 12%,
      rgba(255, 76, 196, 0.34),
      transparent 25%
    ),
    radial-gradient(
      circle at 8% 88%,
      rgba(255, 225, 61, 0.2),
      transparent 22%
    ),
    linear-gradient(
      135deg,
      var(--bg-dark),
      var(--bg-purple)
    );

  overflow-x: hidden;
  user-select: none;
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6px;
}

.game-card {
  width: min(100%, 780px);
  padding: 12px;

  border: 1px solid var(--line);
  border-radius: 20px;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.035),
      transparent
    ),
    var(--panel);

  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.eyebrow {
  margin: 0 0 3px;

  color: var(--yellow);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.8px;
}

h1 {
  margin: 0;

  font-size: clamp(26px, 4vw, 38px);
  line-height: 0.95;
  letter-spacing: 1px;
}

.subtitle {
  margin: 4px 0 0;

  color: var(--muted);

  font-size: 11px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;

  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;

  color: white;
  background: rgba(255, 255, 255, 0.09);

  cursor: pointer;
  font-weight: 900;
}

.icon-btn:active {
  transform: scale(0.94);
}

.mode-badge {
  width: fit-content;
  margin: 0 auto 6px;
  padding: 4px 10px;

  border: 1px solid rgba(255, 225, 61, 0.38);
  border-radius: 999px;

  color: var(--yellow);
  background: rgba(255, 225, 61, 0.08);

  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.1px;
}

.game-layout {
  display: grid;

  grid-template-columns:
    125px
    minmax(230px, 270px)
    140px;

  gap: 9px;

  justify-content: center;
  align-items: stretch;
}

.panel {
  padding: 9px;

  border: 1px solid var(--line);
  border-radius: 15px;

  background: var(--panel-soft);
}

.stats {
  display: grid;
  gap: 6px;
  align-content: start;
}

.stat {
  padding: 9px 7px;

  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;

  background: rgba(255, 255, 255, 0.05);
}

.stat span,
.next-box > span,
.controls > span {
  display: block;
  margin-bottom: 4px;

  color: var(--muted);

  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
}

.stat strong {
  display: block;

  color: var(--yellow);

  font-size: 19px;
}

.board-wrap {
  position: relative;

  width: 270px;
  margin: auto;

  border: 2px solid rgba(255, 225, 61, 0.48);
  border-radius: 15px;

  overflow: hidden;

  background: #130a22;

  box-shadow:
    0 12px 30px rgba(7, 2, 22, 0.36),
    inset 0 0 25px rgba(0, 0, 0, 0.35);

  touch-action: none;
}

#game {
  display: block;

  width: 100%;
  height: auto;

  background:
    linear-gradient(
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px
    ),
    #150b26;

  background-size: 10% 5%;
}

.overlay {
  position: absolute;
  inset: 0;

  display: grid;
  place-items: center;

  padding: 14px;

  background: rgba(24, 11, 43, 0.86);
  backdrop-filter: blur(5px);

  opacity: 0;
  pointer-events: none;

  transition: 0.2s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-box {
  width: 100%;
  padding: 18px 13px;

  border: 1px solid var(--line);
  border-radius: 15px;

  background: rgba(48, 25, 82, 0.95);

  text-align: center;
}

.overlay-box h2 {
  margin: 0 0 7px;

  font-size: 24px;
}

.overlay-box p {
  margin: 0 0 14px;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.4;
}

.primary-btn,
.secondary-btn {
  border-radius: 999px;

  font-weight: 900;
  cursor: pointer;
}

.primary-btn {
  border: 2px solid rgba(255, 255, 255, 0.82);
  padding: 10px 18px;

  color: white;

  background:
    linear-gradient(
      135deg,
      var(--purple-light),
      #32106f
    );

  box-shadow:
    0 8px 20px rgba(8, 3, 25, 0.3);
}

.primary-btn:active,
.secondary-btn:active {
  transform: scale(0.96);
}

.secondary-btn {
  margin-top: 12px;
  padding: 9px 15px;

  border: 1px solid rgba(255, 255, 255, 0.3);

  color: white;
  background: rgba(255, 255, 255, 0.08);
}

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

.next-box canvas {
  display: block;

  width: 100%;
  height: auto;

  border-radius: 11px;

  background: rgba(255, 255, 255, 0.04);
}

.controls p {
  margin: 5px 0;

  color: #e6def2;

  font-size: 10px;
}

.gesture-hint {
  margin-top: 7px;
  padding: 6px 9px;

  border: 1px dashed rgba(255, 225, 61, 0.42);
  border-radius: 11px;

  background: rgba(255, 225, 61, 0.07);

  color: var(--yellow);

  text-align: center;

  font-size: 9px;
  font-weight: 800;
}

.mobile-controls {
  display: none;

  grid-template-columns: repeat(4, 1fr);

  gap: 6px;
  margin-top: 7px;
}

.mobile-controls button {
  min-height: 42px;

  border: 1px solid var(--line);
  border-radius: 11px;

  color: white;
  background: rgba(255, 255, 255, 0.08);

  font-weight: 900;

  touch-action: manipulation;
}

.mobile-controls button:active {
  transform: scale(0.95);
}

.mobile-controls .wide {
  grid-column: span 4;

  color: var(--yellow);

  border-color: rgba(255, 225, 61, 0.35);

  background: rgba(255, 225, 61, 0.1);
}

footer {
  margin-top: 7px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 10px;

  color: var(--muted);

  font-size: 9px;
}

.text-button {
  border: 0;
  padding: 0;

  color: var(--yellow);
  background: transparent;

  cursor: pointer;
  text-decoration: underline;
}

.full-screen-modal {
  position: fixed;
  inset: 0;
  z-index: 20;

  display: grid;
  place-items: center;

  padding: 14px;

  background: rgba(17, 7, 31, 0.9);
  backdrop-filter: blur(4px);

  opacity: 0;
  pointer-events: none;

  transition: 0.2s ease;
}

.full-screen-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(100%, 580px);
  max-height: 92vh;
  overflow-y: auto;

  padding: 20px;

  border: 1px solid var(--line);
  border-radius: 22px;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.04),
      transparent
    ),
    rgba(48, 25, 82, 0.98);

  box-shadow: var(--shadow);

  text-align: center;
}

.modal-tag {
  display: inline-block;
  margin-bottom: 6px;

  color: var(--yellow);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.modal-card h2 {
  margin: 0 0 15px;

  font-size: clamp(26px, 5vw, 36px);
}

.tutorial-grid,
.mode-grid {
  display: grid;
  gap: 10px;
}

.tutorial-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 15px;
}

.tutorial-box {
  padding: 13px;

  border: 1px solid var(--line);
  border-radius: 15px;

  background: rgba(255, 255, 255, 0.06);

  text-align: left;
}

.tutorial-box strong {
  display: block;
  margin-bottom: 8px;

  color: var(--yellow);

  font-size: 15px;
}

.tutorial-box p {
  margin: 5px 0;

  color: #e8e0f5;

  font-size: 12px;
}

.menu-description {
  margin: -7px 0 15px;

  color: var(--muted);

  font-size: 12px;
}

.mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mode-card {
  min-height: 145px;
  padding: 14px 11px;

  border: 1px solid var(--line);
  border-radius: 16px;

  color: white;
  background: rgba(255, 255, 255, 0.07);

  cursor: pointer;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.mode-card:hover {
  transform: translateY(-3px);

  border-color: rgba(255, 225, 61, 0.55);

  background: rgba(255, 225, 61, 0.09);
}

.mode-card .mode-icon {
  display: block;
  margin-bottom: 8px;

  font-size: 27px;
}

.mode-card strong {
  display: block;
  margin-bottom: 6px;

  color: var(--yellow);

  font-size: 16px;
}

.mode-card small {
  color: var(--muted);

  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .game-layout {
    grid-template-columns:
      105px
      minmax(220px, 255px);
  }

  .side {
    display: none;
  }

  .stats {
    order: 2;
  }

  .board-wrap {
    width: 255px;
  }
}

@media (max-width: 580px) {
  .app {
    padding: 4px;
  }

  .game-card {
    width: min(96%, 350px);
    padding: 7px;

    border-radius: 16px;
  }

  .topbar {
    margin-bottom: 4px;
  }

  h1 {
    font-size: 23px;
  }

  .subtitle {
    display: none;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .game-layout {
    display: flex;
    flex-direction: column;

    gap: 5px;
  }

  .board-wrap {
    width: min(68vw, 250px);
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);

    padding: 5px;
    gap: 3px;
  }

  .stat {
    padding: 6px 2px;

    text-align: center;
  }

  .stat strong {
    font-size: 14px;
  }

  .stat span {
    font-size: 7px;
  }

  .gesture-hint {
    margin-top: 5px;
    padding: 5px;

    font-size: 8px;
  }

  .mobile-controls {
    display: grid;

    gap: 5px;
    margin-top: 6px;
  }

  .mobile-controls button {
    min-height: 38px;

    font-size: 13px;
  }

  footer {
    margin-top: 5px;

    flex-direction: column;

    text-align: center;
  }

  .tutorial-grid,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .modal-card {
    padding: 15px;
  }

  .mode-card {
    min-height: auto;
  }
}

@media (max-height: 750px) and (min-width: 581px) {
  .app {
    padding: 3px;
  }

  .game-card {
    width: min(100%, 720px);
    padding: 8px;
  }

  .game-layout {
    grid-template-columns:
      110px
      230px
      125px;

    gap: 7px;
  }

  .board-wrap {
    width: 230px;
  }

  .topbar {
    margin-bottom: 4px;
  }

  h1 {
    font-size: 29px;
  }

  .subtitle {
    display: none;
  }

  .stat {
    padding: 6px;
  }

  .stat strong {
    font-size: 16px;
  }

  .panel {
    padding: 7px;
  }

  .gesture-hint {
    margin-top: 5px;
    padding: 4px;
  }

  footer {
    margin-top: 4px;
  }
}

.leaderboard {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.leaderboard-header h2 {
  margin: 0;
  font-size: 18px;
}

.leaderboard-clear {
  margin: 0;
  padding: 7px 12px;
  font-size: 10px;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  counter-reset: leaderboard-rank;
}

.leaderboard-list li {
  counter-increment: leaderboard-rank;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
}

.leaderboard-list li::before {
  content: counter(leaderboard-rank) ".";
  color: var(--yellow);
  font-weight: 900;
  text-align: center;
}

.leaderboard-name {
  min-width: 0;
  overflow: hidden;
  color: #f4effb;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
}

.leaderboard-empty {
  display: block !important;
  padding: 12px !important;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.leaderboard-empty::before {
  content: none !important;
}

@media (max-width: 580px) {
  .leaderboard {
    padding: 9px;
  }

  .leaderboard-header {
    align-items: flex-start;
  }

  .leaderboard-header h2 {
    font-size: 15px;
  }

  .leaderboard-clear {
    max-width: 120px;
    padding: 6px 9px;
    font-size: 8px;
  }

  .leaderboard-list li {
    grid-template-columns: 28px 1fr auto;
    min-height: 34px;
    padding: 6px 8px;
  }

  .leaderboard-name,
  .leaderboard-score {
    font-size: 10px;
  }
}


.login-score-popup {
  position: fixed;
  inset: 0;
  z-index: 100;

  display: grid;
  place-items: center;

  padding: 16px;

  background: rgba(18, 8, 34, 0.55);
  backdrop-filter: blur(10px);

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.18s ease;
}

.login-score-popup.active {
  opacity: 1;
  pointer-events: auto;
}

.login-score-card {
  width: min(88vw, 340px);
  padding: 20px 18px 17px;

  border: 1px solid var(--line);
  border-radius: 24px;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.055),
      transparent
    ),
    rgba(48, 25, 82, 0.99);

  box-shadow: 0 24px 70px rgba(10, 4, 28, 0.55);

  text-align: center;
}

.login-score-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;

  display: grid;
  place-items: center;

  border: 2px solid rgba(255, 225, 61, 0.72);
  border-radius: 50%;

  color: var(--yellow);
  background: rgba(255, 225, 61, 0.1);

  font-size: 28px;
  font-weight: 900;
}

.login-score-card h2 {
  margin: 0 0 8px;

  font-size: clamp(25px, 7vw, 34px);
}

.login-score-card p {
  margin: 0 0 18px;

  color: var(--muted);

  font-size: 13px;
  line-height: 1.5;
}


.login-score-result {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 225, 61, 0.42);
  border-radius: 15px;
  background: rgba(255, 225, 61, 0.09);
}

.login-score-result-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.login-score-result-value {
  display: block;
  color: var(--yellow);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.login-score-button {
  width: 100%;
  min-height: 48px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 12px 18px;

  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;

  color: white;

  background:
    linear-gradient(
      135deg,
      var(--purple-light),
      #32106f
    );

  box-shadow: 0 9px 24px rgba(8, 3, 25, 0.32);

  font-size: 14px;
  font-weight: 900;
  text-decoration: none;

  cursor: pointer;
}

.login-score-button:active {
  transform: scale(0.97);
}

.continue-without-score {
  margin-top: 13px;
  padding: 5px 8px;

  border: 0;

  color: rgba(255, 255, 255, 0.56);
  background: transparent;

  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;

  cursor: pointer;
}

.continue-without-score:hover {
  color: rgba(255, 255, 255, 0.82);
}

/* Oynanış ekranı klavye ve kaydırma göstergeleri */
.control-guide {
  display: grid;
  gap: 7px;
}

.control-guide-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
}

.control-guide-row > span:nth-child(2) {
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.control-guide-row small {
  grid-column: 2;
  margin-top: -5px;
  color: var(--muted);
  font-size: 9px;
}

.swipe-icon {
  grid-row: 1 / 3;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 225, 61, 0.42);
  border-radius: 9px;
  color: var(--yellow);
  background: rgba(255, 225, 61, 0.09);
  font-size: 19px;
  font-weight: 900;
}

.keyboard-layout {
  display: grid;
  gap: 12px;
}

.keyboard-arrows {
  width: 146px;
  height: 96px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(2, 42px);
  gap: 6px;
  justify-content: center;
}

.key {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-bottom-width: 4px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.07)
  );
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.22);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.key-up {
  grid-column: 2;
  grid-row: 1;
}

.key-left {
  grid-column: 1;
  grid-row: 2;
}

.key-down {
  grid-column: 2;
  grid-row: 2;
}

.key-right {
  grid-column: 3;
  grid-row: 2;
}

.key-explanations {
  display: grid;
  gap: 5px;
}

.key-explanations p {
  margin: 0;
  color: #e8e0f5;
  font-size: 10px;
}

.mini-key {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-right: 3px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.keyboard-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
}

.keyboard-actions > div {
  display: grid;
  gap: 5px;
  text-align: center;
}

.keyboard-actions small {
  color: var(--muted);
  font-size: 9px;
}

.key-space {
  min-height: 38px;
  padding: 0 18px;
  font-size: 10px;
  letter-spacing: 1px;
}

.key-letter {
  width: 40px;
  min-height: 38px;
  font-size: 15px;
}

