:root {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --accent-color: #00bcd4;
  --panel-bg: rgba(30, 30, 30, 0.9);
  --border-color: #333;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden; /* Prevent scrollbars if canvas is full screen */
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  padding: 1rem;
  background-color: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--accent-color);
}

.back-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 1;
  color: var(--accent-color);
}

main {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
}

canvas {
  image-rendering: pixelated; /* Important for crisp scaling */
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  /* The canvas will be sized by JS, but max-width ensures it fits */
  max-width: 100%;
  max-height: 100%;
}

#controls {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 250px;
  background-color: var(--panel-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  z-index: 20;
}

#controls h3 {
  margin-top: 0;
  color: var(--accent-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.control-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

label {
  font-size: 0.9rem;
  margin-bottom: 5px;
  display: block;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-color);
  cursor: pointer;
}

select {
  width: 100%;
  padding: 5px;
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
}

span {
  font-family: monospace;
  font-size: 0.85rem;
  align-self: flex-end;
  color: #aaa;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

button {
  flex: 1;
  padding: 8px 15px;
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #444;
  border-color: var(--accent-color);
}

.instruction {
  margin-top: 20px;
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
  text-align: center;
}

@media (max-width: 600px) {
  #controls {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    border-left: none;
    border-right: none;
    padding: 10px;
    box-sizing: border-box;
  }

  main {
    flex-direction: column-reverse; /* Controls at bottom on mobile */
    overflow-y: auto;
  }

  .canvas-container {
    flex: 1;
    min-height: 50vh;
  }
}
