body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f0f0;
  color: #333;
}

#game-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

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

.panel {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

.hidden {
  display: none;
}

.input-group {
  margin-bottom: 15px;
}

.sub-option {
  margin-top: 8px;
  margin-left: 15px;
  padding-left: 10px;
  border-left: 2px solid #eee;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

input, select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 10px;
}

input[type="color"] {
  height: 40px;
  cursor: pointer;
}

input[type="range"] {
  margin-bottom: 8px;
}

.checkbox-label {
  display: inline-block;
  font-size: 14px;
  color: #666;
}

#auto-save-value, #cost-multiplier-value, #multiplier-value, #chance-value {
  display: block;
  text-align: center;
  font-size: 14px;
  color: #666;
}

#sound-volume-value {
  display: block;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: #45a049;
}

.btn-secondary {
  background-color: #999;
}

.btn-warning {
  background-color: #f44336;
}

.btn-warning:hover {
  background-color: #d32f2f;
}

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

#currency-display {
  font-size: 24px;
  font-weight: bold;
  margin: 10px 0;
}

#cps-display {
  font-size: 18px;
  color: #666;
}

.clicker-area {
  text-align: center;
  margin: 20px 0;
}

#click-image {
  width: 150px;
  height: 150px;
  cursor: pointer;
  transition: transform 0.1s;
}

#click-image:active {
  transform: scale(0.95);
}

.upgrades {
  margin-top: 30px;
}

h3 {
  margin-top: 25px;
  margin-bottom: 15px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 5px;
}

.upgrade-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.upgrade-item:hover {
  background-color: #f9f9f9;
}

.upgrade-info {
  display: flex;
  align-items: center;
}

.upgrade-icon {
  width: 40px;
  height: 40px;
  margin-right: 10px;
}

.upgrade-name {
  font-weight: bold;
}

.upgrade-details {
  font-size: 14px;
  color: #666;
}

.upgrade-buy {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.upgrade-buy:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.reset-section {
  margin-top: 30px;
  text-align: center;
}

.custom-image-container {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed #ccc;
  border-radius: 4px;
}

.custom-image-container.hidden {
  display: none;
}

.preview-container {
  margin-top: 10px;
  text-align: center;
}

.image-preview {
  max-width: 100px;
  max-height: 100px;
  border: 1px solid #ddd;
  padding: 5px;
  display: none;
}

.achievements {
  margin-top: 30px;
}

.achievement-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eee;
  opacity: 0.8;
}

.achievement-item.unlocked {
  opacity: 1;
}

.achievement-item:hover {
  background-color: #f9f9f9;
}

.achievement-info {
  display: flex;
  align-items: center;
  width: 100%;
}

.achievement-icon {
  width: 40px;
  height: 40px;
  margin-right: 10px;
  opacity: 0.6;
}

.unlocked .achievement-icon {
  opacity: 1;
}

.achievement-name {
  font-weight: bold;
}

.achievement-progress {
  margin-top: 5px;
}

.progress-bar {
  height: 6px;
  background-color: #eee;
  border-radius: 3px;
  margin-bottom: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: #4CAF50;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: #666;
}

.skin-preview {
  margin-top: 10px;
  text-align: center;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 5px;
  background-color: #f9f9f9;
}

#skin-preview-image {
  max-width: 100%;
  height: 150px;
  object-fit: contain;
}

.skin-applied {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.skin-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
  background-repeat: repeat;
}

.skin-space .panel {
  background-color: rgba(13, 31, 45, 0.85);
  color: #e0e7ff;
  border: 1px solid #4682b4;
}

.skin-fantasy .panel {
  background-color: rgba(50, 30, 70, 0.85);
  color: #f9e8ff;
  border: 1px solid #9370db;
}

.skin-neon .panel {
  background-color: rgba(0, 0, 20, 0.85);
  color: #00ff99;
  border: 1px solid #ff00ff;
  text-shadow: 0 0 5px #00ffff;
}

.skin-retro .panel {
  background-color: rgba(20, 20, 20, 0.9);
  color: #33ff33;
  border: 2px solid #999;
  font-family: 'Courier New', monospace;
}

.skin-nature .panel {
  background-color: rgba(245, 255, 245, 0.9);
  color: #336633;
  border: 1px solid #99cc99;
}

.achievement-reward {
  font-size: 12px;
  color: #ff5722;
  margin-top: 3px;
}

.achievement-bonus {
  text-align: center;
  margin-top: 15px;
  padding: 8px;
  background-color: #f1f8e9;
  border-radius: 4px;
  color: #4CAF50;
  font-weight: bold;
}

.no-achievements {
  text-align: center;
  padding: 15px;
  color: #999;
  font-style: italic;
}

#background-gradient-container {
  margin-top: 10px;
}

.gradient-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gradient-controls input[type="color"] {
  flex: 0 0 80px;
}

.gradient-controls select {
  flex: 1;
}

#theme-preview-panel {
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  margin-top: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.preview-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-title {
  font-size: 18px;
  font-weight: bold;
}

.preview-text {
  font-size: 14px;
}

.preview-button {
  align-self: flex-start;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: #4CAF50;
  color: white;
}

.theme-preview {
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 15px;
}

#music-controls {
  margin-top: 10px;
}

#music-controls audio {
  width: 100%;
  margin-top: 5px;
}

#main-menu {
  max-width: 800px;
  margin: 50px auto;
  text-align: center;
}

.game-options {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
  margin: 40px 0;
}

.game-option {
  flex: 1;
  min-width: 300px;
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.game-option:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.game-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 15px;
}

.game-option h2 {
  margin: 10px 0;
  color: #333;
}

.game-option p {
  color: #666;
  margin-bottom: 20px;
}

.menu-footer {
  margin-top: 30px;
}

.btn-primary {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.btn-primary:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

#back-to-menu {
  display: none;
}

#game-container:not(.hidden) ~ #back-to-menu {
  display: block;
}

.map-editor {
  display: grid;
  gap: 2px;
  margin: 20px 0;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.map-row {
  display: flex;
  gap: 2px;
}

.map-cell {
  width: 40px;
  height: 40px;
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  cursor: pointer;
  transition: background-color 0.2s;
}

.map-cell:hover {
  opacity: 0.8;
}

.map-cell.path {
  background-color: #a97c50;
}

.map-cell.tower-spot {
  background-color: #8bc34a;
}

.map-cell.start {
  background-color: #f44336;
}

.map-cell.end {
  background-color: #3f51b5;
}

.map-cell.water {
  background-color: #4fc3f7;
}

.map-cell.obstacle {
  background-color: #78909c;
}

.tile-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.tile-option {
  width: 40px;
  height: 40px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.tile-option.selected {
  border-color: #ff5722;
}

.tab-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-button {
  padding: 10px 15px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
}

.tab-button.active {
  background-color: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.tab-content {
  display: none;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 0 4px 4px 4px;
  margin-bottom: 20px;
}

.tab-content.active {
  display: block;
}

.tower-preview, .enemy-preview {
  display: flex;
  align-items: center;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 10px;
}

.preview-image {
  width: 50px;
  height: 50px;
  margin-right: 15px;
}

.preview-details {
  flex: 1;
}

.tower-list, .enemy-list, .resource-list {
  margin-top: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.empty-list-message {
  text-align: center;
  padding: 20px;
  color: #777;
  font-style: italic;
}

.color-preview {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 10px;
  border: 1px solid #ccc;
}

.map-editor-controls {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

.map-size-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.map-size-controls input {
  width: 60px;
}

.map-actions {
  display: flex;
  gap: 10px;
}

.enemy-waves-container {
  margin-top: 20px;
}

.wave-item {
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 10px;
}

.wave-item h4 {
  margin-top: 0;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wave-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: bold;
}

.wave-content {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.wave-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wave-controls label {
  margin-bottom: 0;
}

.wave-controls input[type="number"] {
  width: 70px;
}

.wave-content.open {
  display: block;
}

.enemy-in-wave {
  display: flex;
  align-items: center;
  padding: 5px 0;
}

.enemy-in-wave img {
  width: 30px;
  height: 30px;
  margin-right: 10px;
}

.remove-enemy, .remove-wave {
  color: #f44336;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.2em;
  padding: 0 5px;
}

.game-preview-wrapper {
  display: flex;
  gap: 20px;
}

.game-preview-container {
  flex: 3;
  width: 100%;
  min-width: 400px;
  height: 450px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.game-controls-panel {
  flex: 1;
  min-width: 200px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
}

.game-controls-panel h4 {
  margin-top: 0;
  text-align: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

#build-tower-list {
  max-height: 280px;
}

.build-tower-option {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.build-tower-option.selected {
  background-color: #e8f5e9;
  border-color: #4CAF50;
}

.build-tower-option.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

.build-tower-option img {
  width: 40px;
  height: 40px;
  margin-right: 10px;
}

.build-tower-info .name {
  font-weight: bold;
}

.build-tower-info .cost {
  font-size: 0.9em;
  color: #666;
}

.wave-info {
  margin-top: 15px;
  text-align: center;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

#wave-display {
  font-weight: bold;
  margin-bottom: 10px;
}

#start-wave-btn {
  width: 100%;
}

.canvas-container {
  width: 100%;
  height: 100%;
}

#game-canvas {
  width: 100%;
  height: 100%;
  cursor: default;
}

#game-canvas.can-place {
    cursor: pointer;
}

.preview-controls {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 8px 15px;
  border-radius: 20px;
}

.preview-controls button {
  background-color: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  padding: 5px 10px;
}

.preview-controls button:hover {
  color: #4CAF50;
}

.preview-info {
  margin-top: 15px;
  font-style: italic;
  color: #777;
  text-align: center;
}

.two-column-layout {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.column {
  flex: 1;
  min-width: 300px;
}

.resource-option {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.resource-option:hover {
  background-color: #f0f0f0;
}

.resource-option img {
  width: 40px;
  height: 40px;
  margin-right: 15px;
}

.resource-option.selected {
  background-color: #e8f5e9;
  border-color: #4CAF50;
}

.difficulty-slider {
  width: 100%;
  margin: 10px 0;
}

.difficulty-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
}

.tooltip {
  position: relative;
  display: inline-block;
  margin-left: 5px;
  cursor: help;
}

.tooltip-icon {
  background-color: #999;
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
}

.tooltip-text {
  position: absolute;
  visibility: hidden;
  width: 200px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

#promo-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #222;
  color: #eee;
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  z-index: 1000;
  border-top: 1px solid #444;
}

#promo-banner a {
  color: #4CAF50;
  font-weight: bold;
  text-decoration: none;
}

#promo-banner a:hover {
  text-decoration: underline;
}