:root {
  --paper: #fcfbf8;
  --panel: rgba(255, 255, 255, 0.76);
  --ink: #454545;
  --line: rgba(97, 97, 97, 0.58);
  --shadow: 0 30px 60px rgba(84, 84, 84, 0.14);
  --glow: 0 0 0 9px rgba(255, 255, 255, 0.86);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.98), rgba(247, 245, 241, 0.92)),
    linear-gradient(180deg, #faf9f6 0%, #efebe5 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

.game-shell {
  width: min(100%, 920px);
}

.game-board {
  position: relative;
  overflow: hidden;
  min-height: min(92vh, 980px);
  padding: clamp(20px, 4vw, 36px);
  border-radius: 36px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92) 0%, rgba(250, 249, 245, 0.98) 60%, rgba(240, 238, 233, 1) 100%);
  box-shadow: var(--shadow);
}

.top-panel {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.sequence-tray {
  width: min(100%, 300px);
  min-height: 38px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 9px;
  border: 1.5px solid rgba(90, 90, 90, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}

.slot {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(180, 180, 180, 0.16);
  box-shadow: inset 0 0 0 1px rgba(180, 180, 180, 0.2);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.slot.filled {
  transform: scale(1.04);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.7);
}

.status-stack {
  display: grid;
  gap: 6px;
  justify-content: center;
  width: min(100%, 620px);
}

.status-row {
  display: flex;
  gap: 7px;
  flex-wrap: nowrap;
  justify-content: center;
}

.badge {
  min-width: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 24px rgba(73, 73, 73, 0.08);
  font-size: 0.94rem;
  font-weight: 800;
  white-space: nowrap;
}

.player-badge {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: rgba(69, 69, 69, 0.82);
  font-weight: 900;
}

.level-progress {
  display: flex;
  justify-content: center;
  gap: 9px;
  width: min(100%, 320px);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
}

.game-message {
  width: min(100%, 560px);
  height: 54px;
  margin: 0;
  padding: 11px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 24px rgba(73, 73, 73, 0.06);
  text-align: center;
  font-weight: 800;
  line-height: 1.35;
  display: grid;
  place-items: center;
}

.input-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: 8px;
}

.progress-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(150, 150, 150, 0.18);
  box-shadow: inset 0 0 0 1px rgba(100, 100, 100, 0.14);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.progress-dot.filled {
  transform: scale(1.08);
  background: linear-gradient(135deg, #35b86b, #b9db32);
  box-shadow: 0 0 0 5px rgba(185, 219, 50, 0.14);
}

.arena {
  position: relative;
  min-height: 590px;
  margin-top: 18px;
}

.hexagon-area {
  position: absolute;
  inset: 50%;
  width: min(62vw, 440px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.arena > .sequence-tray {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  z-index: 2;
}

.ring-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(42px, 6vw, 58px);
  height: clamp(42px, 6vw, 58px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--glow), 0 12px 22px rgba(70, 70, 70, 0.14);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.node:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.node.active {
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 0 0 14px rgba(255, 255, 255, 0.98), 0 0 0 28px rgba(255, 255, 255, 0.48);
  filter: brightness(1.2) saturate(1.18);
}

.node.demo {
  transform: translate(-50%, -50%) scale(1.55);
  box-shadow: 0 0 0 16px rgba(255, 255, 255, 0.98), 0 0 0 32px rgba(255, 255, 255, 0.5);
  filter: brightness(1.24) saturate(1.22);
}

.countdown {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%) scale(0.88);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 44px rgba(80, 80, 80, 0.14);
  color: #454545;
  font-size: 4.2rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.countdown.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.submit-orb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  color: #4a321f;
  background: linear-gradient(135deg, #ffd66b, #ff9a3d);
  box-shadow: 0 18px 36px rgba(255, 154, 61, 0.24);
  z-index: 2;
}

.submit-orb svg {
  width: 46px;
  height: 46px;
}

.submit-orb:disabled {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.88);
}

.submit-orb:hover {
  transform: translate(-50%, -50%) scale(1.04);
}

.submit-orb:disabled:hover {
  transform: translate(-50%, -50%) scale(0.88);
}

.node.correct {
  animation: correct-pop 480ms ease;
}

.node.wrong {
  animation: wrong-shake 360ms ease;
}

.game-board.success {
  animation: board-success 620ms ease;
}

.game-board.error {
  animation: board-error 520ms ease;
}

.red {
  background: #ef2c2c;
}

.lime {
  background: #b9db32;
}

.purple {
  background: #be65ff;
}

.orange {
  background: #ff9a3d;
}

.brown {
  background: #9c6b55;
}

.green {
  background: #14a944;
}

.yellow {
  background: #ffd400;
}

.blue {
  background: #2fa4ea;
}

.center-card {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 3;
  width: min(100%, 340px);
  transform: translate(-50%, -50%);
  padding: 24px 24px 20px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(84, 84, 84, 0.08);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.center-card.hidden {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -52%) scale(0.96);
}

.center-card h1 {
  margin: 0 0 10px;
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 3.6vw, 2.7rem);
  line-height: 0.95;
  font-weight: 900;
}

.center-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}

.login-form.hidden,
.resume-choice.hidden {
  display: none;
}

.resume-choice {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.resume-choice p {
  margin: 0;
  font-weight: 900;
}

.login-form label {
  font-weight: 900;
}

.login-form input[type="text"] {
  width: 100%;
  border: 2px solid rgba(90, 90, 90, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.login-form input[type="text"]:focus {
  border-color: rgba(53, 184, 107, 0.62);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #ff7f50, #ff5087);
  box-shadow: 0 14px 24px rgba(255, 105, 135, 0.24);
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
}

button:hover {
  transform: translateY(-2px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 20px rgba(84, 84, 84, 0.08);
}

.cobweb {
  position: absolute;
  pointer-events: none;
  opacity: 0.38;
}

.cobweb::before,
.cobweb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(156, 156, 156, 0.3);
  border-right: 0;
  border-bottom: 0;
  border-radius: 100% 0 0 0;
}

.cobweb::after {
  inset: 18px;
}

.web-a {
  top: -24px;
  left: -18px;
  width: 190px;
  height: 170px;
  transform: rotate(4deg);
}

.web-b {
  top: -10px;
  right: -24px;
  width: 220px;
  height: 190px;
  transform: rotate(92deg);
}

.web-c {
  bottom: -30px;
  left: -22px;
  width: 210px;
  height: 210px;
  transform: rotate(-86deg);
}

@keyframes correct-pop {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.28) saturate(1.2);
  }
}

@keyframes wrong-shake {
  0%,
  100% {
    margin-left: 0;
  }

  25% {
    margin-left: -8px;
  }

  75% {
    margin-left: 8px;
  }
}

@keyframes board-success {
  0%,
  100% {
    box-shadow: var(--shadow);
  }

  45% {
    box-shadow: 0 30px 70px rgba(53, 184, 107, 0.28);
  }
}

@keyframes board-error {
  0%,
  100% {
    box-shadow: var(--shadow);
  }

  45% {
    box-shadow: 0 30px 70px rgba(239, 44, 44, 0.26);
  }
}

@media (max-width: 720px) {
  body {
    padding: 10px;
  }

  .status-stack {
    gap: 4px;
    width: 100%;
  }

  .status-row {
    gap: 4px;
  }

  .badge {
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  .input-actions {
    gap: 4px;
  }

  .input-actions button {
    padding-inline: 8px;
    font-size: 0.76rem;
  }

  .game-board {
    min-height: auto;
    padding: 18px 14px 24px;
    border-radius: 28px;
  }

  .sequence-tray {
    width: min(100%, 260px);
    min-height: 36px;
    padding: 7px 9px;
    gap: 6px;
  }

  .arena {
    min-height: 520px;
  }

  .hexagon-area {
    width: min(78vw, 380px);
  }

  .center-card {
    width: min(100%, 300px);
    padding-inline: 18px;
  }

  .game-message {
    height: 64px;
  }

  .countdown {
    width: 92px;
    height: 92px;
    font-size: 3.2rem;
  }

  .submit-orb {
    width: 76px;
    height: 76px;
  }

  .submit-orb svg {
    width: 38px;
    height: 38px;
  }
}
