:root {
  --bg: #0b1220;
  --panel: rgba(16, 27, 47, 0.78);
  --text: #edf2f8;
  --muted: #91a0b6;
  --accent: #79e2c8;
  --accent-dim: rgba(121, 226, 200, 0.12);
  --line: rgba(237, 242, 248, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(74, 101, 170, 0.13), transparent 34rem),
    var(--bg);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

.spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--x, 50%) var(--y, 35%),
    rgba(84, 120, 214, 0.08),
    transparent 54%
  );
}

.site {
  position: relative;
  z-index: 1;
  width: min(92vw, 560px);
  margin: 0 auto;
  padding: 54px 0 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-photo {
  width: 168px;
  height: 168px;
  display: block;
  object-fit: cover;
  object-position: 50% 24%;
  border-radius: 50%;
  border: 1px solid rgba(237, 242, 248, 0.19);
  box-shadow:
    0 20px 46px rgba(0, 0, 0, 0.32),
    0 0 0 7px rgba(255, 255, 255, 0.018);
}

h1 {
  margin: 24px 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(3.1rem, 10vw, 4.75rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.game-shell {
  position: relative;
  width: min(100%, 442px);
  margin: 46px auto 0;
}

.game-frame {
  width: 100%;
  margin: 0 auto;
}

.leaderboard {
  width: 210px;
  margin: 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)),
    rgba(9, 17, 31, 0.78);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.24),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.game-frame {
  padding: 10px;
  border-radius: 24px;
}

.game-toolbar {
  min-height: 48px;
  padding: 2px 6px 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  min-width: 60px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(237, 242, 248, 0.08);
  border-radius: 999px;
  background: rgba(7, 14, 26, 0.45);
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.stat:last-child {
  justify-self: end;
}

.stat svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat:first-child svg path:first-child {
  fill: var(--accent);
  stroke: none;
}

.pause-control {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 242, 248, 0.09);
  border-radius: 50%;
  padding: 0;
  color: var(--muted);
  background: rgba(7, 14, 26, 0.45);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.pause-control:hover,
.pause-control:focus-visible {
  color: var(--accent);
  border-color: rgba(121, 226, 200, 0.38);
  background: var(--accent-dim);
}

.pause-control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pause-control svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

.pause-control .resume-icon {
  display: none;
}

.pause-control.paused .pause-icon {
  display: none;
}

.pause-control.paused .resume-icon {
  display: block;
}

.board-wrap {
  position: relative;
}

#snake {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 17px;
  background: #0d1727;
  outline: none;
  touch-action: none;
}

#snake:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.center-control {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 68px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 242, 248, 0.14);
  border-radius: 50%;
  color: var(--text);
  background: rgba(9, 17, 31, 0.76);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.center-control:hover {
  border-color: rgba(121, 226, 200, 0.5);
  background: rgba(14, 27, 46, 0.92);
  transform: translate(-50%, -50%) scale(1.04);
}

.center-control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.center-control svg {
  width: 28px;
  height: 28px;
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.center-control .restart-icon {
  display: none;
  fill: none;
}

.center-control.game-over .play-icon {
  display: none;
}

.center-control.game-over .restart-icon {
  display: block;
}

.center-control.hidden,
.hidden {
  display: none !important;
}

.name-entry {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 17px;
  background: rgba(5, 11, 21, 0.68);
  backdrop-filter: blur(7px);
}

.arcade-card {
  width: min(92%, 320px);
  padding: 24px 22px 20px;
  border: 1px solid rgba(121, 226, 200, 0.25);
  border-radius: 18px;
  background: rgba(10, 20, 35, 0.95);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.36);
  text-align: center;
}

.trophy-mark {
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.trophy-mark svg,
.leaderboard-title svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.arcade-title {
  margin-bottom: 18px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.name-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.name-slot {
  width: 100%;
  min-width: 0;
  height: 58px;
  border: 1px solid rgba(237, 242, 248, 0.15);
  border-radius: 10px;
  outline: none;
  background: #0c1728;
  color: var(--accent);
  text-align: center;
  font: 700 1.45rem/1 "Inter", sans-serif;
  text-transform: uppercase;
  caret-color: var(--accent);
}

.name-slot:focus {
  border-color: rgba(121, 226, 200, 0.62);
  box-shadow: 0 0 0 2px rgba(121, 226, 200, 0.08);
}

.arcade-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid rgba(121, 226, 200, 0.28);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(121, 226, 200, 0.08);
  font: 700 0.72rem/1 "Inter", sans-serif;
  letter-spacing: 0.18em;
  cursor: pointer;
}

.arcade-submit:hover,
.arcade-submit:focus-visible {
  background: rgba(121, 226, 200, 0.14);
  outline: none;
}

.name-error {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.leaderboard {
  position: absolute;
  top: 0;
  left: calc(100% + 22px);
  margin-top: 0;
  padding: 18px 20px 16px;
  border-radius: 18px;
}

.leaderboard-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.leaderboard-title svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.leaderboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  min-height: 35px;
  border-top: 1px solid rgba(237, 242, 248, 0.065);
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.leaderboard-list li:first-child {
  border-top: 0;
}

.rank {
  color: rgba(145, 160, 182, 0.65);
}

.player {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.18em;
}

.points {
  color: var(--accent);
  font-weight: 600;
}

.contact-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 34px;
}

.contact-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.contact-icon:hover {
  color: var(--accent);
  border-color: rgba(121, 226, 200, 0.42);
  background: var(--accent-dim);
  transform: translateY(-2px);
}

.contact-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.contact-icon svg {
  width: 22px;
  height: 22px;
}

.linkedin svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gmail svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}


@media (max-width: 980px) {
  .leaderboard {
    position: static;
    width: 100%;
    margin-top: 14px;
  }
}

@media (max-width: 520px) {
  .site {
    width: min(93vw, 460px);
    padding-top: 38px;
  }

  .profile-photo {
    width: 142px;
    height: 142px;
  }

  h1 {
    margin-top: 20px;
  }

  .game-shell {
    margin-top: 36px;
  }

  .game-frame {
    border-radius: 20px;
    padding: 8px;
  }

  #snake,
  .name-entry {
    border-radius: 14px;
  }

  .game-toolbar {
    min-height: 44px;
    padding-bottom: 8px;
  }

  .stat {
    min-width: 54px;
    height: 30px;
  }

  .center-control {
    width: 62px;
    height: 62px;
  }

  .leaderboard {
    padding-left: 16px;
    padding-right: 16px;
  }

  .contact-links {
    margin-top: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }

  .spotlight {
    display: none;
  }
}
