﻿* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: #1f2a33;
  background: radial-gradient(circle at 15% 10%, #bcc9d4 0, transparent 36%),
    radial-gradient(circle at 85% 0%, #b3c2cf 0, transparent 32%),
    #b7c5d2;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: 14px 18px;
  background: rgba(7, 13, 26, 0.78);
  border-bottom: 1px solid rgba(255, 191, 45, 0.32);
  backdrop-filter: blur(6px);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Arial Black", "Franklin Gothic Medium", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: #ffca45;
  text-transform: uppercase;
  text-decoration: none;
}

.site-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.game-body {
  overflow: hidden;
}

.menu-page {
  min-height: 100vh;
  padding: 44px 22px;
  padding-top: 72px;
  display: grid;
  gap: 26px;
  justify-items: center;
  align-content: start;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 60, 160, 0.16) 0%, rgba(255, 60, 160, 0) 34%),
    radial-gradient(circle at 82% 0%, rgba(255, 166, 33, 0.2) 0%, rgba(255, 166, 33, 0) 38%),
    linear-gradient(160deg, #060d1a 0%, #0b1428 56%, #0f1730 100%);
}

.menu-page::before,
.menu-page::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  pointer-events: none;
}

.menu-page::before {
  width: 340px;
  height: 340px;
  top: -100px;
  left: -80px;
  background: radial-gradient(circle, rgba(255, 56, 152, 0.32) 0%, rgba(255, 56, 152, 0) 72%);
}

.menu-page::after {
  width: 360px;
  height: 360px;
  right: -120px;
  bottom: -130px;
  background: radial-gradient(circle, rgba(255, 184, 38, 0.32) 0%, rgba(255, 184, 38, 0) 72%);
}

.menu-hero {
  width: min(980px, 100%);
  text-align: center;
  display: grid;
  gap: 10px;
  margin-top: 0;
  z-index: 1;
}

.menu-eyebrow {
  margin: 0;
  color: #1e5870;
  font-family: "Arial Black", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.menu-hero h1 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-size: clamp(1.9rem, 5vw, 3.05rem);
  line-height: 1.1;
  color: #f7f9ff;
}

.menu-hero p {
  margin: 0;
  color: #c8d2ea;
  font-size: clamp(0.98rem, 2vw, 1.08rem);
}

.menu-grid {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  z-index: 1;
}

.menu-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(11, 20, 40, 0.84);
  backdrop-filter: blur(2px);
  padding: 24px 22px;
  box-shadow: 0 14px 28px rgba(5, 10, 22, 0.42);
  display: grid;
  gap: 14px;
  transform: translateY(0);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 36px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 191, 45, 0.44);
}

.menu-card-tag {
  margin: 0;
  width: fit-content;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
}

.snake-card .menu-card-tag {
  background: rgba(255, 58, 154, 0.2);
  color: #ff8fc6;
}

.dash-card .menu-card-tag {
  background: rgba(255, 188, 44, 0.2);
  color: #ffd988;
}

.menu-card h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.62rem);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: #f8fbff;
}

.menu-card p {
  margin: 0;
  color: #bdcbe6;
  line-height: 1.5;
}

.menu-card-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #ffffff;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, rgba(255, 58, 154, 0.34) 0%, rgba(255, 162, 33, 0.34) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.menu-card:hover .menu-card-play,
.menu-card:focus-within .menu-card-play {
  opacity: 1;
  pointer-events: auto;
}

.menu-card-play:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: -3px;
}

@media (max-width: 760px) {
  .menu-page {
    align-content: start;
    padding-top: 74px;
  }

  .menu-grid {
    grid-template-columns: 1fr;
  }

  .menu-card {
    padding: 20px 18px;
  }
}

@media (hover: none) {
  .menu-card-play {
    opacity: 0;
    pointer-events: auto;
    background: transparent;
  }

  .menu-card:hover .menu-card-play,
  .menu-card:focus-within .menu-card-play,
  .menu-card-play:focus-visible {
    opacity: 0;
    background: transparent;
    outline: none;
  }
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 36px;
}

.page-home {
  display: grid;
  gap: 14px;
  position: relative;
}

.has-site-header {
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 60, 160, 0.16) 0%, rgba(255, 60, 160, 0) 36%),
    radial-gradient(circle at 88% 4%, rgba(255, 166, 33, 0.2) 0%, rgba(255, 166, 33, 0) 40%),
    linear-gradient(160deg, #060d1a 0%, #0b1428 56%, #0f1730 100%);
  color: #eaf0ff;
}

.has-site-header .page {
  padding-top: 92px;
}

.page-home .home-panel {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  animation: homeFadeUp 0.55s ease forwards;
}

.page-home .home-panel:nth-child(2) {
  animation-delay: 0.12s;
}

@keyframes homeFadeUp {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.home-panel {
  background: rgba(11, 20, 40, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
}

.home-panel h1,
.home-panel h2 {
  margin: 0 0 10px;
  color: #f8fbff;
}

.home-form {
  display: grid;
  gap: 10px;
  max-width: 360px;
}

.home-form input,
.home-form button,
.overlay-actions button,
.overlay-actions a {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
  padding: 10px 12px;
  font: inherit;
}

.home-form input {
  background: rgba(8, 15, 31, 0.84);
  color: #eef4ff;
}

.home-form input::placeholder {
  color: #a8b8db;
}

.home-form button,
.overlay-actions button {
  cursor: pointer;
  color: #fff;
  border-color: rgba(255, 191, 45, 0.6);
  background: linear-gradient(135deg, #ff3a9a 0%, #ffa221 100%);
  font-weight: 700;
}

.menu-back-link {
  margin-top: 6px;
  display: inline-block;
  color: #ffca45;
  text-decoration: none;
}

.leaderboard-list {
  margin: 0;
  padding-left: 20px;
  max-height: 390px;
  overflow-y: auto;
  padding-right: 8px;
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  color: #dbe6ff;
}

.leaderboard-list li:last-child {
  border-bottom: none;
}

.page-game {
  max-width: none;
  padding: 0;
  height: 100vh;
}

.game-panel {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #0f1724;
  display: grid;
  place-items: center;
}

.game-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: rgba(8, 14, 23, 0.75);
  color: #e8f0f7;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
}

.game-title {
  font-weight: 700;
}

.game-player,
.game-score {
  font-size: 0.92rem;
}

#snake-canvas {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  display: block;
  background: #0f1724;
}

#dash-canvas {
  width: 100vw;
  height: 100vh;
  display: block;
}


.snake-overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(90%, 360px);
  height: fit-content;
  background: rgba(12, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.dash-touch-hint {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  z-index: 18;
  width: min(92%, 460px);
  text-align: center;
  color: #f7f9ff;
  background: rgba(8, 14, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.dash-touch-hint.is-hidden {
  opacity: 0;
}

.dash-overlay p {
  margin: 7px 0 0;
}

.snake-overlay h2 {
  margin: 0;
}

.snake-overlay p {
  margin: 8px 0 0;
}

.overlay-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.overlay-actions a {
  text-decoration: none;
  color: #1f2a33;
  background: #edf2f6;
}

.snake-touch-controls {
  display: none;
}

.game-body.is-touch .snake-touch-controls {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: auto;
}

.game-body.is-touch .snake-touch-row {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 8px;
  width: auto;
}

.game-body.is-touch .snake-touch-controls button {
  width: 52px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(10, 18, 29, 0.82);
  color: #eef5fb;
  font: inherit;
  font-weight: 700;
  padding: 6px 8px;
  touch-action: manipulation;
}

@media (pointer: coarse) and (orientation: portrait) {
  .game-panel {
    padding-top: 96px;
    padding-bottom: 124px;
  }

  .game-body.is-touch .game-hud {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 8px;
    right: 8px;
    width: auto;
    padding: 6px 8px;
    z-index: 20;
  }

  .game-title {
    font-size: 0.95rem;
  }

  .game-player,
  .game-score {
    font-size: 0.84rem;
  }

  #snake-canvas {
    position: absolute;
    left: 0;
    top: 96px;
    width: 100vw;
    height: calc(100vh - 220px);
    max-height: calc(100vh - 220px);
  }

  .dash-game-panel .game-hud {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 8px;
    right: 8px;
    width: auto;
    padding: 6px 8px;
    z-index: 20;
  }

  .dash-game-panel .game-player,
  .dash-game-panel .game-score {
    font-size: 0.84rem;
  }

  .dash-game-panel {
    padding-bottom: 0;
  }

  #dash-canvas {
    position: absolute;
    left: 0;
    top: 96px;
    width: 100vw;
    height: calc(100vh - 106px);
    max-height: calc(100vh - 106px);
  }

}

.admin-page {
  max-width: 1080px;
  display: grid;
  gap: 14px;
}

.admin-login-page {
  max-width: 520px;
}

.admin-login-panel h1 {
  margin: 0 0 12px;
}

.admin-login-error {
  margin: 10px 0 0;
  color: #ff9aaa;
  font-weight: 700;
}

.admin-panel h1,
.admin-panel h2 {
  margin: 0 0 12px;
}

.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-filter-btn {
  text-decoration: none;
  color: #eaf0ff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(8, 15, 31, 0.76);
  font-weight: 700;
}

.admin-filter-btn.is-active {
  border-color: rgba(255, 191, 45, 0.8);
  background: linear-gradient(135deg, rgba(255, 58, 154, 0.38) 0%, rgba(255, 162, 33, 0.34) 100%);
}

.admin-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-card {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(8, 15, 31, 0.8);
  padding: 12px;
}

.admin-card h2 {
  margin: 0 0 8px;
  font-size: 0.96rem;
  color: #cdd9f7;
}

.admin-count {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
}

.admin-meta {
  margin: 4px 0 0;
  color: #a8b8db;
  font-size: 0.9rem;
}

.admin-terminal {
  background: #04070f;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px;
  max-height: 380px;
  overflow: auto;
}

.admin-terminal p {
  margin: 0;
  color: #93f3b0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  padding: 5px 0;
}

.admin-terminal p:last-child {
  border-bottom: none;
}

@media (max-width: 920px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}
