* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --gb-screen-light: #9bbc0f;
  --gb-screen-dark: #0f380f;
  --gb-screen-mid: #306230;
}

body {
  font-family: 'VT323', monospace;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.02) 1px, transparent 1px),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 8px 8px;
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  min-height: 100vh;
}

.app-header {
  text-align: center;
  margin-bottom: 20px;
}

.header-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 0 20px rgba(196, 69, 105, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.berry-icon {
  font-size: 1.8rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.header-subtitle {
  color: #8a8aaa;
  font-size: 1rem;
  margin-top: 8px;
  letter-spacing: 1px;
}

.discovered-count {
  color: #9bbc0f;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  margin-top: 8px;
}

.console-wrapper {
  perspective: 1000px;
}

.gameboy-console {
  position: relative;
  width: 280px;
  height: 460px;
  background: linear-gradient(145deg, var(--console-primary), var(--console-secondary));
  border-radius: 20px 20px 60px 20px;
  padding: 15px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2);
  transform: rotateX(2deg);
  transition: transform 0.3s ease;
}

.gameboy-console:hover {
  transform: rotateX(0deg) scale(1.02);
}

.gameboy-console.translucent {
  background: linear-gradient(145deg, var(--console-primary), var(--console-secondary));
}

.circuit-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px 20px 60px 20px;
  overflow: hidden;
  pointer-events: none;
}

.power-led {
  position: absolute;
  top: 12px;
  left: 20px;
  width: 8px;
  height: 8px;
  background: #333;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.power-led.on {
  background: #ff3333;
  box-shadow: 
    inset 0 1px 2px rgba(255,255,255,0.3),
    0 0 10px #ff3333,
    0 0 20px rgba(255, 51, 51, 0.5);
}

.screen-bezel {
  background: linear-gradient(145deg, #4a4a5a, #3a3a4a);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 12px;
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.3),
    0 2px 0 rgba(255,255,255,0.1);
}

.color-label {
  display: block;
  text-align: center;
  font-family: 'Press Start 2P', cursive;
  font-size: 6px;
  color: #1a1a2a;
  background: linear-gradient(90deg, #7b6ba3, #9b8bc3, #7b6ba3);
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.screen-inner {
  background: #2a2a2a;
  border-radius: 4px;
  padding: 8px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}

.lcd-screen {
  position: relative;
  width: 160px;
  height: 144px;
  margin: 0 auto;
  background: var(--gb-screen-light);
  border-radius: 2px;
  overflow: hidden;
  image-rendering: pixelated;
}

.screen-off {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #8b956d;
}

.game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.easter-egg, .shake-message {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 56, 15, 0.95);
  color: var(--gb-screen-light);
  font-family: 'Press Start 2P', cursive;
  font-size: 8px;
  text-align: center;
  line-height: 2;
  animation: flashIn 0.3s ease;
}

@keyframes flashIn {
  0% { opacity: 0; transform: scale(1.5); }
  100% { opacity: 1; transform: scale(1); }
}

.console-logo {
  text-align: center;
  margin: 10px 0 15px;
  font-family: 'Press Start 2P', cursive;
}

.logo-game {
  display: block;
  font-size: 10px;
  color: #1a1a3a;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.2);
  letter-spacing: 2px;
}

.logo-color {
  display: block;
  font-size: 14px;
  background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71, #3498db, #9b59b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 3px;
  font-weight: bold;
}

.controls-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 15px;
}

.dpad-container {
  position: relative;
  width: 80px;
  height: 80px;
}

.dpad-btn {
  position: absolute;
  background: linear-gradient(145deg, #2a2a3a, #1a1a2a);
  border: none;
  cursor: pointer;
  box-shadow: 
    0 3px 0 #0a0a1a,
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.05s ease;
}

.dpad-btn.pressed {
  transform: translateY(2px);
  box-shadow: 
    0 1px 0 #0a0a1a,
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.dpad-up, .dpad-down {
  width: 26px;
  height: 30px;
  left: 27px;
}

.dpad-up {
  top: 0;
  border-radius: 4px 4px 0 0;
}

.dpad-down {
  bottom: 0;
  border-radius: 0 0 4px 4px;
}

.dpad-left, .dpad-right {
  width: 30px;
  height: 26px;
  top: 27px;
}

.dpad-left {
  left: 0;
  border-radius: 4px 0 0 4px;
}

.dpad-right {
  right: 0;
  border-radius: 0 4px 4px 0;
}

.dpad-center {
  position: absolute;
  width: 26px;
  height: 26px;
  top: 27px;
  left: 27px;
  background: linear-gradient(145deg, #2a2a3a, #1a1a2a);
  border-radius: 2px;
}

.action-buttons {
  display: flex;
  gap: 15px;
  transform: rotate(-25deg);
}

.action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #a03050, #801830);
  color: #1a0a10;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  cursor: pointer;
  box-shadow: 
    0 4px 0 #500a20,
    inset 0 2px 0 rgba(255,255,255,0.2);
  transition: all 0.05s ease;
}

.action-btn.pressed {
  transform: translateY(3px);
  box-shadow: 
    0 1px 0 #500a20,
    inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn-a {
  margin-top: 15px;
}

.system-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 15px;
}

.system-btn {
  width: 50px;
  height: 14px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(145deg, #4a4a5a, #3a3a4a);
  color: #8a8a9a;
  font-family: 'Press Start 2P', cursive;
  font-size: 5px;
  cursor: pointer;
  transform: rotate(-25deg);
  box-shadow: 
    0 2px 0 #2a2a3a,
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.05s ease;
}

.system-btn.pressed {
  transform: rotate(-25deg) translateY(1px);
  box-shadow: 
    0 1px 0 #2a2a3a,
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.speaker-grille {
  position: absolute;
  bottom: 30px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.speaker-row {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.speaker-hole {
  width: 5px;
  height: 5px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
}

.power-switch {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 16px;
  background: linear-gradient(145deg, #3a3a4a, #2a2a3a);
  border: none;
  border-radius: 3px;
  color: #8a8a9a;
  font-family: 'Press Start 2P', cursive;
  font-size: 6px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: all 0.1s ease;
}

.power-switch:hover {
  background: linear-gradient(145deg, #4a4a5a, #3a3a4a);
}

.power-switch.on {
  background: linear-gradient(145deg, #2a8a4a, #1a6a3a);
  color: #aaffaa;
}

.seed-display {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: #9bbc0f;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 15px;
  border-radius: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.share-btn {
  background: linear-gradient(145deg, #306230, #0f380f);
  border: none;
  color: #9bbc0f;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background: linear-gradient(145deg, #408240, #1f481f);
  transform: scale(1.05);
}

.controls-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  max-width: 500px;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.control-label {
  color: #aaa;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.color-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.selected {
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255,255,255,0.5);
}

.contrast-slider {
  width: 120px;
  height: 8px;
  -webkit-appearance: none;
  background: linear-gradient(90deg, #333, #9bbc0f);
  border-radius: 4px;
  cursor: pointer;
}

.contrast-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.sound-toggle {
  padding: 10px 20px;
  background: linear-gradient(145deg, #3a3a5a, #2a2a4a);
  border: none;
  border-radius: 8px;
  color: #888;
  font-family: 'VT323', monospace;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sound-toggle:hover {
  background: linear-gradient(145deg, #4a4a6a, #3a3a5a);
}

.sound-toggle.on {
  background: linear-gradient(145deg, #2a6a4a, #1a5a3a);
  color: #aaffaa;
}

.settings-btn {
  padding: 10px 15px;
  background: linear-gradient(145deg, #4a3a6a, #3a2a5a);
  border: none;
  border-radius: 8px;
  color: #ccaaff;
  font-family: 'VT323', monospace;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  background: linear-gradient(145deg, #5a4a7a, #4a3a6a);
  transform: scale(1.05);
}

.clear-cache-btn {
  padding: 10px 15px;
  background: linear-gradient(145deg, #5a3a3a, #4a2a2a);
  border: none;
  border-radius: 8px;
  color: #ffaaaa;
  font-family: 'VT323', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-cache-btn:hover {
  background: linear-gradient(145deg, #6a4a4a, #5a3a3a);
}

.model-display {
  margin-top: 10px;
  color: #8a8aaa;
  font-family: 'VT323', monospace;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tier-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
}

.tier-badge.tier-anonymous {
  background: linear-gradient(145deg, #2a6a4a, #1a5a3a);
  color: #aaffaa;
}

.tier-badge.tier-seed {
  background: linear-gradient(145deg, #4a4a6a, #3a3a5a);
  color: #aaaaff;
}

.tier-badge.tier-flower {
  background: linear-gradient(145deg, #6a4a6a, #5a3a5a);
  color: #ffaaff;
}

.vision-badge {
  font-size: 12px;
  margin-left: 4px;
}

.vision-badge-small {
  font-size: 14px;
}

.model-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.keyboard-hints {
  margin-top: 20px;
  color: #666;
  font-size: 12px;
  text-align: center;
}

.keyboard-hints p {
  margin: 4px 0;
}

.app-footer {
  margin-top: 30px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.app-footer p {
  margin-bottom: 8px;
}

.app-footer .credits {
  color: #888;
  font-size: 12px;
}

.app-footer a {
  color: #c44569;
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-footer a:hover {
  color: #ff6b9d;
}

/* Settings Modal */
.settings-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.settings-modal {
  background: linear-gradient(145deg, #2a2a3e, #1a1a2e);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header h2 {
  color: #fff;
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: #fff;
}

.settings-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.settings-group {
  margin-bottom: 20px;
}

.settings-group label {
  display: block;
  color: #9bbc0f;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  margin-bottom: 8px;
}

.settings-group select {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-family: 'VT323', monospace;
  font-size: 16px;
  cursor: pointer;
}

.settings-group select:focus {
  outline: none;
  border-color: #9bbc0f;
}

.settings-group select option {
  background: #1a1a2e;
  color: #fff;
  padding: 8px;
}

.settings-group select optgroup {
  background: #0f0f1a;
  color: #9bbc0f;
  font-weight: bold;
  font-size: 14px;
}

.template-help {
  color: #666;
  font-size: 11px;
  margin-bottom: 8px;
  font-family: 'VT323', monospace;
}

.settings-group textarea {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-family: 'VT323', monospace;
  font-size: 14px;
  resize: vertical;
  min-height: 200px;
}

.settings-group textarea:focus {
  outline: none;
  border-color: #9bbc0f;
}

.settings-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.reset-btn {
  padding: 10px 20px;
  background: linear-gradient(145deg, #5a3a3a, #4a2a2a);
  border: none;
  border-radius: 8px;
  color: #ffaaaa;
  font-family: 'VT323', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  background: linear-gradient(145deg, #6a4a4a, #5a3a3a);
}

.save-btn {
  padding: 10px 20px;
  background: linear-gradient(145deg, #2a6a4a, #1a5a3a);
  border: none;
  border-radius: 8px;
  color: #aaffaa;
  font-family: 'VT323', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-btn:hover {
  background: linear-gradient(145deg, #3a7a5a, #2a6a4a);
}

@media (max-width: 400px) {
  .gameboy-console {
    width: 260px;
    height: 430px;
    transform: none;
  }
  
  .header-title {
    font-size: 1.2rem;
  }
  
  .controls-panel {
    padding: 15px;
    gap: 15px;
  }
  
  .seed-display {
    flex-direction: column;
    gap: 8px;
  }
  
  .settings-modal {
    max-height: 90vh;
  }
  
  .settings-header h2 {
    font-size: 10px;
  }
}

::selection {
  background: #c44569;
  color: #fff;
}