:root {
    --bg-color: #090014; /* Deep purple/black */
    --grid-color: rgba(255, 0, 255, 0.2);
    --sun-color: #ff00ff;
    --text-color: #fff;
    --accent-color: #0ff;
    --glass-border: rgba(0, 255, 255, 0.2);
    --glass-bg: rgba(10, 10, 30, 0.7);
}

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

body {
    font-family: 'Orbitron', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    perspective: 1000px;
}

/* Retro Sun & Grid Background */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(transparent 0%, var(--bg-color) 100%),
        repeating-linear-gradient(0deg, transparent 0, transparent 1px, var(--grid-color) 1px, var(--grid-color) 2px) 0 0 / 100% 40px,
        repeating-linear-gradient(90deg, transparent 0, transparent 1px, var(--grid-color) 1px, var(--grid-color) 2px) 0 0 / 40px 100%;
    transform: rotateX(60deg) scale(2);
    transform-origin: top center;
    animation: gridMove 20s linear infinite;
    z-index: -2;
}

body::after {
    content: '';
    position: absolute;
    top: 10%;
    width: 200px;
    height: 200px;
    background: linear-gradient(to bottom, #ff00ff, #ffcc00);
    border-radius: 50%;
    box-shadow: 0 0 50px #ff00ff;
    z-index: -3;
    transform: translateX(-50%);
    left: 50%;
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 50%);
    mask-image: linear-gradient(to bottom, black 50%, transparent 50%);
    -webkit-mask-size: 100% 10px;
    mask-size: 100% 10px;
    -webkit-mask-repeat: repeat;
    mask-repeat: repeat;
}

@keyframes gridMove {
    from { background-position: 0 0; }
    to { background-position: 0 1000px; }
}

.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.3;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    overflow-y: auto; /* Allow scrolling on small screens */
}

.main-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

h1 {
    font-weight: 900;
    letter-spacing: 6px;
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 
        3px 3px 0px #ff00ff,
        -3px -3px 0px #00ffff;
    margin: 0;
}

/* Main Layout Grid */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
    width: 100%;
}

@media (min-width: 900px) {
    .app-container {
        justify-content: center; /* Center vertically on large screens */
        overflow-y: hidden; /* No scroll if it fits */
    }
    
    .main-layout {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 50px;
    }
}

/* Game Section */
.game-section {
    position: relative;
}

.game-wrapper {
    position: relative;
    display: inline-block;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--sun-color);
    box-shadow: 
        0 0 30px var(--sun-color), 
        inset 0 0 30px rgba(255, 0, 255, 0.2);
    transition: transform 0.1s;
    backdrop-filter: blur(5px);
}

.game-wrapper.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

canvas {
    background-color: rgba(5, 5, 15, 0.95);
    display: block;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar Section */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}

/* Score Panel */
.score-panel {
    display: flex;
    justify-content: space-around;
    background: var(--glass-bg);
    padding: 20px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color), inset 0 0 20px rgba(0, 255, 255, 0.1);
    transform: skewX(-5deg);
    backdrop-filter: blur(10px);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: skewX(5deg);
}

.label {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 5px;
    text-shadow: 0 0 5px var(--accent-color);
}

#score, #high-score {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px #fff;
}

/* Skin Shop */
.skin-shop {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--grid-color);
    padding: 20px;
    border-top: 4px solid var(--sun-color);
}

.skin-shop h3 {
    color: var(--sun-color);
    margin-bottom: 20px;
    font-size: 1.2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--sun-color);
    border-bottom: 1px solid rgba(255, 0, 255, 0.3);
    padding-bottom: 10px;
}

.skins-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.skin-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    padding: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    color: #aaa;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    position: relative;
    overflow: hidden;
}

.skin-btn:hover:not(.locked) {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

.skin-btn.active {
    border-color: var(--sun-color);
    background: rgba(255, 0, 255, 0.1);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

.skin-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.skin-preview {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Glitch Effect & Overlay (Keep existing) */
.glitch { position: relative; }
.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
}
.glitch::before {
    left: 2px; text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}
.glitch::after {
    left: -2px; text-shadow: -1px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(30px, 9999px, 10px, 0); }
    20% { clip: rect(80px, 9999px, 90px, 0); }
    40% { clip: rect(10px, 9999px, 50px, 0); }
    60% { clip: rect(60px, 9999px, 20px, 0); }
    80% { clip: rect(40px, 9999px, 70px, 0); }
    100% { clip: rect(90px, 9999px, 30px, 0); }
}
@keyframes glitch-anim2 {
    0% { clip: rect(10px, 9999px, 80px, 0); }
    20% { clip: rect(50px, 9999px, 20px, 0); }
    40% { clip: rect(90px, 9999px, 10px, 0); }
    60% { clip: rect(30px, 9999px, 60px, 0); }
    80% { clip: rect(70px, 9999px, 40px, 0); }
    100% { clip: rect(20px, 9999px, 90px, 0); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.overlay {
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    background: rgba(0, 0, 0, 0.85);
    display: flex; justify-content: center; align-items: center;
    border: 1px solid var(--accent-color);
    backdrop-filter: blur(5px);
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.message h2 {
    font-size: 2rem; margin-bottom: 15px;
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-color);
    animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.message p { color: #fff; font-size: 1rem; letter-spacing: 2px; }


/* Game Footer */
.game-footer {
  margin-top: 30px;
  padding-bottom: 20px;
  display: flex;
  gap: 20px;
  justify-content: center;
  width: 100%;
  z-index: 10;
}

@media (min-width: 900px) {
  .game-footer {
    position: absolute;
    bottom: 30px;
    margin: 0;
    padding: 0;
  }
}

/* Cyber Buttons */
.cyber-btn {
  position: relative;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--accent-color);
  padding: 8px 16px; /* Further reduced padding */
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px; /* Further reduced width */
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
}

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

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

.cyber-btn:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
  border-color: #fff;
  transform: translateY(-2px);
}

.btn-text {
  color: #fff;
  font-size: 0.75rem; /* Further reduced text size */
  letter-spacing: 2px;
  z-index: 1;
  font-weight: 700;
}

.btn-glitch {
  font-size: 0.5rem; /* Further reduced glitch text size */
  color: var(--accent-color);
  opacity: 0.8;
  margin-top: 3px;
}

.cyber-btn.danger {
  border-color: #ff0055;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.1);
}

.cyber-btn.danger .btn-glitch {
  color: #ff0055;
}

.cyber-btn.danger:hover {
  background: rgba(255, 0, 85, 0.1);
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
}

.cyber-btn.small {
  min-width: 100px;
  padding: 8px 15px;
}

/* Window Modals */
.window-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(8px);
}

.window-modal.hidden {
  display: none;
}

.window-modal .window-content {
  background: rgba(10, 10, 15, 0.98);
  border: 1px solid var(--accent-color);
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.2), inset 0 0 20px rgba(0, 255, 255, 0.05);
  width: 95%;
  max-width: 500px; /* Reduced from 650px */
  position: relative;
  padding: 0;
  animation: windowOpen 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes windowOpen {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.window-modal.small .window-content {
  max-width: 400px;
}

.window-header {
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.1), transparent);
  border-bottom: 1px solid var(--accent-color);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.window-header.warning {
  background: linear-gradient(90deg, rgba(255, 0, 85, 0.1), transparent);
  border-bottom-color: #ff0055;
}

.window-header.warning .window-title {
  color: #ff0055;
  text-shadow: 0 0 5px rgba(255, 0, 85, 0.5);
}

.window-title {
  color: var(--accent-color);
  font-size: 1rem;
  letter-spacing: 3px;
  font-weight: 700;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.window-close {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  transition: all 0.2s;
  padding: 0 5px;
}

.window-close:hover {
  color: #fff;
  text-shadow: 0 0 8px #fff;
  transform: scale(1.1);
}

.window-content-body {
  padding: 40px; /* Increased padding */
}

/* Data Sections */
.data-section {
  margin-bottom: 30px;
}

.data-section:last-child {
  margin-bottom: 0;
}

.data-section h4 {
  color: var(--accent-color);
  font-size: 0.9rem;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
  padding-bottom: 8px;
  letter-spacing: 2px;
}

/* Key Map */
.key-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.key-row {
  display: flex;
  gap: 8px;
}

.key {
  border: 1px solid #666;
  padding: 8px 12px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  min-width: 36px;
  text-align: center;
  background: linear-gradient(to bottom, #333, #111);
  box-shadow: 0 2px 0 #000;
  font-family: monospace;
}

.key.space {
  width: 120px;
}

.key-action {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.8rem;
  color: #ccc;
}

/* Skin List */
.skin-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.skin-list li {
  display: flex;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #ddd;
  font-size: 0.85rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 12px;
  box-shadow: 0 0 8px currentColor;
}

.status-dot.green { background: #4ade80; color: #4ade80; }
.status-dot.pink { background: #f472b6; color: #f472b6; }
.status-dot.gold { background: #fbbf24; color: #fbbf24; }
.status-dot.glitch { background: #0ff; color: #0ff; }

.req {
  margin-left: auto;
  color: #888;
  font-family: monospace;
  font-size: 0.8rem;
}

/* Warning Text */
.warning-text {
  color: #ff0055;
  font-size: 1.4rem;
  margin-bottom: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

.sub-text {
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 30px;
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.text-center {
  text-align: center;
  padding: 40px 30px;
}

/* Mobile Responsiveness for Modals */
@media (max-width: 600px) {
  .window-modal .window-content {
    width: 90%;
    max-width: 90%;
  }

  .window-content-body {
    padding: 20px; /* Reduced padding */
  }

  .text-center {
    padding: 30px 20px;
  }

  .skin-list {
    grid-template-columns: 1fr; /* Single column for skins */
  }

  .key-map {
    padding: 15px;
  }

  .key.space {
    width: 80px; /* Smaller space bar */
  }

  .key-action {
    flex-direction: column;
    gap: 5px;
    text-align: center;
  }

  .warning-text {
    font-size: 1.1rem;
  }

  .action-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .cyber-btn.small {
    width: 100%;
  }
}
