body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  transition: background-color 0.3s, color 0.3s;
}

body.dark {
  background: #181c1f;
  color: #f0f0f0;
}

body.light-mode {
  background: #f0f0f0;
  color: #222;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 60px;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #d32f2f;
  font-size: 2.5em;
}

body.dark h1 {
  color: #ef5350;
}

.game-area {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.tree-container {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 400px;
}

body.dark .tree-container {
  background: #23272a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tree-svg {
  width: 100%;
  height: auto;
  max-width: 400px;
  display: block;
  margin: 0 auto;
}

.ornament-layer {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 400px;
  height: 500px;
  cursor: crosshair;
  pointer-events: auto;
}

.ornament {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.1s;
  user-select: none;
}

.ornament:hover {
  transform: scale(1.1);
  z-index: 10;
}

.ornament:active {
  cursor: grabbing;
}

.controls-panel {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 250px;
  max-width: 300px;
}

body.dark .controls-panel {
  background: #23272a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.score-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid #eee;
}

body.dark .score-section {
  border-bottom-color: #444;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.score-label {
  font-weight: 600;
  color: #666;
}

body.dark .score-label {
  color: #aaa;
}

.score-value {
  font-size: 1.5em;
  font-weight: bold;
  color: #1976d2;
}

body.dark .score-value {
  color: #90caf9;
}

.ornament-palette h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #1976d2;
  font-size: 1.2em;
}

body.dark .ornament-palette h3 {
  color: #90caf9;
}

.ornament-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.ornament-btn {
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 2em;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

body.dark .ornament-btn {
  background: #2c2f33;
}

.ornament-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ornament-btn.selected {
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.3);
}

body.dark .ornament-btn.selected {
  border-color: #90caf9;
  box-shadow: 0 0 0 3px rgba(144, 202, 249, 0.3);
}

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

.action-btn {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  color: white;
}

.action-btn:hover {
  transform: translateY(-2px);
}

.action-btn:active {
  transform: translateY(0);
}

.clear-btn {
  background: #f44336;
}

.clear-btn:hover {
  background: #d32f2f;
}

.random-btn {
  background: #ff9800;
}

.random-btn:hover {
  background: #f57c00;
}

@media (max-width: 900px) {
  .game-area {
    flex-direction: column;
    align-items: center;
  }

  .tree-container {
    width: 100%;
    max-width: 400px;
  }

  .ornament-layer {
    width: 100%;
    max-width: 400px;
    height: 500px;
  }

  .controls-panel {
    width: 100%;
    max-width: 400px;
  }
}

@media (max-width: 500px) {
  .tree-svg {
    max-width: 100%;
  }

  .ornament-layer {
    width: calc(100% - 40px);
    max-width: calc(100vw - 80px);
    height: calc((100vw - 80px) * 1.25);
  }
}

