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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  padding: 0.75rem;
  overflow: hidden;
}

h1 {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
  color: #f0f0f0;
  flex-shrink: 0;
}

.layout {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 3rem);
  margin: 0 auto;
  align-items: stretch;
}

.controls {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  height: 100%;
}

.controls section {
  background: #16213e;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.controls h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a0a0c0;
  margin-bottom: 0.6rem;
}

label {
  display: block;
  font-size: 0.8rem;
  color: #9090b0;
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
}

select, input[type="range"] {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 0.85rem;
}

input[type="file"] {
  width: 100%;
  font-size: 0.8rem;
  color: #a0a0c0;
}

input[type="color"] {
  width: 40px;
  height: 28px;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  background: #0f3460;
  cursor: pointer;
  padding: 2px;
}

textarea {
  width: 100%;
  height: 120px;
  padding: 0.5rem;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
}

textarea::placeholder {
  color: #6060a0;
}

button {
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover:not(:disabled) {
  background: #d63850;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.variant-row {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.variant-row label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #e0e0e0;
  cursor: pointer;
}

.variant-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #e94560;
  cursor: pointer;
}

.hint {
  font-size: 0.75rem;
  color: #7070a0;
  margin-top: 0.3rem;
}

.info {
  font-size: 0.7rem;
  color: #6060a0;
  margin-top: 0.4rem;
  line-height: 1.3;
}

#fontSizeValue {
  font-size: 0.8rem;
  color: #e94560;
  margin-left: 0.3rem;
  font-weight: 600;
}

.preview {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.canvas-container {
  position: relative;
  background: #16213e;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.canvas-hint {
  position: absolute;
  color: #505080;
  font-size: 0.9rem;
  pointer-events: none;
}

#previewCanvas {
  display: block;
  cursor: crosshair;
  max-width: 100%;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }
  .controls {
    width: 100%;
  }
}