@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

:root {
  /* Cyberpunk Color Palette */
  --primary-bg: #0a0e27;
  --secondary-bg: #1a1f3a;
  --accent-purple: #9d4edd;
  --accent-pink: #ff006e;
  --accent-cyan: #00f5ff;
  --accent-green: #06ffa5;
  --accent-yellow: #ffd60a;
  --text-primary: #e0e0e0;
  --text-glow: #00f5ff;

  /* Shadows & Glows */
  --glow-purple: rgba(157, 78, 221, 0.8);
  --glow-cyan: rgba(0, 245, 255, 0.8);
  --glow-pink: rgba(255, 0, 110, 0.8);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%;
}

body {
  font-family: 'Orbitron', sans-serif;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Animated Grid Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-move 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes grid-move {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(50px);
  }
}

/* Game Container */
.game-container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  width: 90%;
  perspective: 1000px;
}

/* Cabinet Top */
.cabinet-top {
  background: linear-gradient(180deg, #2a2d5a 0%, #1a1f3a 100%);
  padding: 1.5rem;
  border-radius: 20px 20px 0 0;
  border: 2px solid var(--accent-purple);
  border-bottom: none;
  box-shadow:
    0 -5px 20px rgba(157, 78, 221, 0.3),
    inset 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.led-strip {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-cyan), #0066ff);
  box-shadow:
    0 0 10px var(--glow-cyan),
    0 0 20px var(--glow-cyan),
    inset 0 2px 5px rgba(255, 255, 255, 0.3);
  animation: led-pulse 2s ease-in-out infinite;
}

.led:nth-child(2) {
  animation-delay: 0.4s;
}

.led:nth-child(3) {
  animation-delay: 0.8s;
}

.led:nth-child(4) {
  animation-delay: 1.2s;
}

.led:nth-child(5) {
  animation-delay: 1.6s;
}

@keyframes led-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* Screen Bezel */
.screen-bezel {
  background: linear-gradient(145deg, #2a2d5a 0%, #1a1f3a 100%);
  padding: 2rem;
  border-left: 2px solid var(--accent-purple);
  border-right: 2px solid var(--accent-purple);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(157, 78, 221, 0.3);
  position: relative;
}

/* Screen */
.screen {
  background: radial-gradient(circle at top, #0f1428 0%, #0a0e27 100%);
  border: 3px solid var(--accent-cyan);
  border-radius: 10px;
  padding: 3rem 2.5rem;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.8),
    0 0 30px var(--glow-cyan);
  position: relative;
}

/* Scanline Effect */
.screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 245, 255, 0.02) 2px,
    rgba(0, 245, 255, 0.02) 4px
  );
  pointer-events: none;
  border-radius: 10px;
}

/* Title Zone */
.title-zone {
  text-align: center;
  margin-bottom: 3rem;
}

.glitch-text {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 0.5rem;
  color: var(--accent-cyan);
  text-shadow:
    0 0 10px var(--glow-cyan),
    0 0 20px var(--glow-cyan),
    0 0 30px var(--glow-cyan),
    2px 2px 0 var(--accent-purple),
    -2px -2px 0 var(--accent-pink);
  position: relative;
  display: inline-block;
  animation: title-glow 3s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% {
    text-shadow:
      0 0 10px var(--glow-cyan),
      0 0 20px var(--glow-cyan),
      0 0 30px var(--glow-cyan),
      2px 2px 0 var(--accent-purple),
      -2px -2px 0 var(--accent-pink);
  }
  50% {
    text-shadow:
      0 0 20px var(--glow-cyan),
      0 0 40px var(--glow-cyan),
      0 0 60px var(--glow-cyan),
      2px 2px 0 var(--accent-purple),
      -2px -2px 0 var(--accent-pink);
  }
}

.subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.4rem;
  color: var(--accent-yellow);
  letter-spacing: 0.3rem;
  margin-top: 1.5rem;
  opacity: 0.8;
}

/* Display Panel */
.display-panel {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.mystery-box {
  flex: 1;
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.1) 0%, rgba(255, 0, 110, 0.1) 100%);
  border: 2px solid var(--accent-purple);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  box-shadow:
    0 0 20px rgba(157, 78, 221, 0.3),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.mystery-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(157, 78, 221, 0.1) 50%,
    transparent 70%
  );
  animation: mystery-shine 3s linear infinite;
}

@keyframes mystery-shine {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.box-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.2rem;
  color: var(--accent-purple);
  margin-bottom: 1rem;
  letter-spacing: 0.2rem;
}

.mystery-number {
  font-size: 6rem;
  font-weight: 900;
  color: var(--text-primary);
  text-shadow:
    0 0 20px var(--glow-purple),
    0 0 40px var(--glow-purple);
  position: relative;
  z-index: 1;
}

/* Stats Grid */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.stat-box {
  background: rgba(0, 245, 255, 0.05);
  border: 2px solid var(--accent-cyan);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  box-shadow:
    0 0 15px rgba(0, 245, 255, 0.2),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.stat-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  color: var(--accent-cyan);
  margin-bottom: 0.8rem;
  letter-spacing: 0.15rem;
}

.stat-value {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 10px var(--glow-cyan);
}

/* Message Display */
.message-display {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--accent-green);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  text-align: center;
  min-height: 6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 20px rgba(6, 255, 165, 0.3),
    inset 0 0 15px rgba(0, 0, 0, 0.7);
}

.message-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.8rem;
  color: var(--accent-green);
  letter-spacing: 0.2rem;
  text-shadow: 0 0 10px rgba(6, 255, 165, 0.8);
  animation: message-blink 1.5s ease-in-out infinite;
}

@keyframes message-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Input Zone */
.input-zone {
  margin-bottom: 2.5rem;
}

.input-wrapper {
  text-align: center;
}

.input-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.2rem;
  color: var(--accent-yellow);
  display: block;
  margin-bottom: 1rem;
  letter-spacing: 0.2rem;
}

.code-input {
  background: rgba(0, 0, 0, 0.7);
  border: 3px solid var(--accent-cyan);
  border-radius: 8px;
  padding: 2rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-align: center;
  width: 100%;
  max-width: 20rem;
  box-shadow:
    0 0 20px var(--glow-cyan),
    inset 0 2px 10px rgba(0, 0, 0, 0.8);
  transition: all 0.3s ease;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.code-input::-webkit-outer-spin-button,
.code-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.code-input::placeholder {
  color: rgba(0, 245, 255, 0.3);
}

.code-input:focus {
  outline: none;
  border-color: var(--accent-pink);
  box-shadow:
    0 0 30px var(--glow-pink),
    inset 0 2px 10px rgba(0, 0, 0, 0.8);
  animation: input-pulse 1s ease-in-out infinite;
}

@keyframes input-pulse {
  0%, 100% {
    box-shadow:
      0 0 30px var(--glow-pink),
      inset 0 2px 10px rgba(0, 0, 0, 0.8);
  }
  50% {
    box-shadow:
      0 0 50px var(--glow-pink),
      inset 0 2px 10px rgba(0, 0, 0, 0.8);
  }
}

/* Controls */
.controls {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.arcade-btn {
  position: relative;
  background: linear-gradient(180deg, var(--accent-purple) 0%, #6a3ba6 100%);
  border: 3px solid var(--accent-cyan);
  border-radius: 10px;
  padding: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 14rem;
  min-height: 5.5rem;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow:
    0 6px 0 #4a2376,
    0 10px 20px rgba(0, 0, 0, 0.5),
    0 0 20px var(--glow-cyan);
}

.arcade-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.arcade-btn:hover::before {
  left: 100%;
}

.btn-inner {
  display: block;
  padding: 1.6rem 3rem;
  letter-spacing: 0.2rem;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.arcade-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 0 #4a2376,
    0 12px 25px rgba(0, 0, 0, 0.6),
    0 0 30px var(--glow-cyan);
}

.arcade-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 #4a2376,
    0 4px 10px rgba(0, 0, 0, 0.5),
    0 0 15px var(--glow-cyan);
}

.btn-secondary {
  background: linear-gradient(180deg, #2a2d5a 0%, #1a1f3a 100%);
  box-shadow:
    0 6px 0 #0a0e27,
    0 10px 20px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(0, 245, 255, 0.3);
}

.btn-secondary:hover {
  box-shadow:
    0 8px 0 #0a0e27,
    0 12px 25px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(0, 245, 255, 0.5);
}

.btn-secondary:active {
  box-shadow:
    0 2px 0 #0a0e27,
    0 4px 10px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(0, 245, 255, 0.3);
}

/* Cabinet Bottom */
.cabinet-bottom {
  background: linear-gradient(180deg, #1a1f3a 0%, #0a0e27 100%);
  padding: 2rem;
  border-radius: 0 0 20px 20px;
  border: 2px solid var(--accent-purple);
  border-top: none;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(157, 78, 221, 0.3);
}

.speaker-grill {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  border: 1px solid rgba(157, 78, 221, 0.3);
}

.grill-line {
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-purple) 20%,
    var(--accent-purple) 80%,
    transparent 100%
  );
  opacity: 0.6;
}

/* Win State */
.screen.win-state {
  animation: win-flash 1s ease-in-out;
}

@keyframes win-flash {
  0%, 100% {
    box-shadow:
      inset 0 0 50px rgba(0, 0, 0, 0.8),
      0 0 30px var(--glow-cyan);
  }
  50% {
    box-shadow:
      inset 0 0 50px rgba(6, 255, 165, 0.5),
      0 0 60px var(--glow-cyan),
      0 0 100px rgba(6, 255, 165, 0.8);
  }
}

.mystery-number.revealed {
  animation: number-reveal 0.6s ease-out;
  color: var(--accent-green);
  text-shadow:
    0 0 30px rgba(6, 255, 165, 1),
    0 0 60px rgba(6, 255, 165, 0.8);
}

@keyframes number-reveal {
  0% {
    transform: rotateY(90deg) scale(0.5);
    opacity: 0;
  }
  100% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

/* Error State */
.message-text.error {
  color: var(--accent-pink);
  text-shadow: 0 0 20px var(--glow-pink);
  animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Success State */
.message-text.success {
  color: var(--accent-green);
  text-shadow:
    0 0 20px rgba(6, 255, 165, 1),
    0 0 40px rgba(6, 255, 165, 0.8);
  animation: success-pulse 0.8s ease-in-out;
}

@keyframes success-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Stat Value Animations */
.stat-value.bump {
  animation: stat-bump 0.3s ease-out;
  color: var(--accent-yellow);
  text-shadow:
    0 0 20px rgba(255, 214, 10, 1),
    0 0 40px rgba(255, 214, 10, 0.8);
}

@keyframes stat-bump {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  html {
    font-size: 55%;
  }

  body {
    padding: 1rem;
  }

  .game-container {
    width: 100%;
  }

  .glitch-text {
    font-size: 3rem;
    letter-spacing: 0.3rem;
  }

  .display-panel {
    flex-direction: column;
    gap: 1.5rem;
  }

  .mystery-box {
    padding: 1.5rem;
  }

  .mystery-number {
    font-size: 5rem;
  }

  .stat-box {
    padding: 1.2rem;
  }

  .stat-value {
    font-size: 3rem;
  }

  .controls {
    flex-direction: column;
    gap: 1rem;
  }

  .arcade-btn {
    width: 100%;
    min-height: 55px;
  }

  .message-display {
    min-height: 7rem;
    padding: 1.2rem;
  }

  .message-text {
    font-size: 1.6rem;
  }

  .code-input {
    max-width: 100%;
    font-size: 3.5rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 50%;
  }

  body {
    padding: 0.5rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .cabinet-top {
    padding: 1rem;
  }

  .led-strip {
    gap: 1rem;
  }

  .led {
    width: 10px;
    height: 10px;
  }

  .screen-bezel {
    padding: 1.5rem;
  }

  .screen {
    padding: 2rem 1.5rem;
  }

  .title-zone {
    margin-bottom: 2rem;
  }

  .glitch-text {
    font-size: 2.5rem;
    letter-spacing: 0.2rem;
  }

  .subtitle {
    font-size: 1.2rem;
  }

  .display-panel {
    gap: 1.2rem;
    margin-bottom: 2rem;
  }

  .mystery-box {
    padding: 1.2rem;
  }

  .mystery-number {
    font-size: 4.5rem;
  }

  .box-label,
  .stat-label {
    font-size: 1rem;
  }

  .stat-value {
    font-size: 2.8rem;
  }

  .message-display {
    padding: 1rem;
    margin-bottom: 2rem;
    min-height: 6rem;
  }

  .message-text {
    font-size: 1.4rem;
    letter-spacing: 0.1rem;
  }

  .input-zone {
    margin-bottom: 2rem;
  }

  .input-label {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
  }

  .code-input {
    font-size: 3rem;
    padding: 1.5rem;
    max-width: 100%;
  }

  .arcade-btn {
    min-height: 50px;
    font-size: 1.6rem;
  }

  .btn-inner {
    padding: 1.4rem 2rem;
  }

  .cabinet-bottom {
    padding: 1.5rem;
  }

  .speaker-grill {
    gap: 0.6rem;
    padding: 0.8rem;
  }

  .grill-line {
    height: 2px;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 45%;
  }

  .glitch-text {
    font-size: 2.2rem;
  }

  .mystery-number {
    font-size: 4rem;
  }

  .code-input {
    font-size: 2.5rem;
  }
}

/* Landscape Mode on Mobile */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    padding: 0.5rem;
  }

  .cabinet-top,
  .cabinet-bottom {
    padding: 0.8rem;
  }

  .screen-bezel {
    padding: 1rem;
  }

  .screen {
    padding: 1.5rem;
  }

  .title-zone {
    margin-bottom: 1.5rem;
  }

  .glitch-text {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
    margin-top: 0.3rem;
  }

  .display-panel {
    flex-direction: row;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .mystery-box,
  .stats-grid {
    flex: 1;
  }

  .mystery-number {
    font-size: 3.5rem;
  }

  .stat-value {
    font-size: 2.5rem;
  }

  .message-display {
    min-height: 5rem;
    margin-bottom: 1.5rem;
    padding: 0.8rem;
  }

  .message-text {
    font-size: 1.2rem;
  }

  .input-zone {
    margin-bottom: 1.5rem;
  }

  .code-input {
    padding: 1.2rem;
    font-size: 2.5rem;
  }

  .controls {
    flex-direction: row;
    gap: 1rem;
  }

  .arcade-btn {
    min-height: 45px;
    font-size: 1.4rem;
  }

  .led-strip {
    gap: 0.8rem;
  }

  .led {
    width: 8px;
    height: 8px;
  }
}

/* Fix for very small screens */
@media (max-height: 700px) {
  body {
    align-items: flex-start;
    padding-top: 1rem;
  }
}

/* Accessibility */

/* Screen reader only content */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Indicators */
.arcade-btn:focus-visible,
.code-input:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 4px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .screen {
    border-width: 4px;
  }

  .arcade-btn {
    border-width: 4px;
  }

  .code-input {
    border-width: 4px;
  }

  .mystery-box,
  .stat-box {
    border-width: 3px;
  }
}
