/* shared.css */
body {
  display: flex;
  box-sizing: border-box;
  --base: 3px;
  --step-1: calc(var(--base) * 1.618);
  --step-2: calc(var(--step-1) * 1.618);
  --step-3: calc(var(--step-2) * 1.618);
  --step-4: calc(var(--step-3) * 1.618);
  --cell-size: var(--step-1);
  --gap: var(--step-2);
  --page-padding: var(--step-4);
  padding: var(--page-padding);
  background-color: #2a2a2a;
  justify-content: center;
  align-items:  center;
  min-height: 100vh;
  margin: 0;
}

.bloom-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.bloom-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  opacity: 0;
  position: relative;
}

.bloom-cell:before, .bloom-cell:after {
  content: "";
  position: absolute;
  background: inherit;
  filter: blur(var(--cell-size)) brightness(80%) opacity(.8);
  z-index: -1;
  background-size: 100% 100%;
  width: 100%;
  height: 100%;
}

.bloom-cell:before {
  top: -10%;
  left: -10%;
}

.bloom-cell:after {
  bottom: -10%;
  left: -10%;
}

.github-link {
  position: fixed;
  top: var(--step-3);
  right: var(--step-3);
  display: flex;
  z-index: 10;
  background: #09090b;
  border-radius: 50%;
  justify-content: center;
  align-items:  center;
  width: 40px;
  height: 40px;
  transition: background .2s;
}

.github-link:hover {
  background: #18181b;
}

.github-link svg {
  fill: #fff;
  width: 20px;
  height: 20px;
}

/* playground.css */
body {
  align-items:  flex-start;
}

#playground {
  display: flex;
  gap: var(--step-3);
  flex-direction: column;
  width: 100%;
  max-width: 960px;
}

.playground-header {
  display: flex;
  align-items:  center;
}

.back-link {
  color: #fff;
  text-decoration: none;
  border-radius: var(--step-4);
  padding: var(--step-2) var(--step-3);
  letter-spacing: .02em;
  background: #09090b;
  transition: background .2s;
  font-family: Martian Mono, monospace;
  font-size: 14px;
}

.back-link:hover {
  background: #18181b;
}

.playground-body {
  display: flex;
  gap: var(--step-4);
}

.controls {
  display: flex;
  gap: var(--step-2);
  overflow-y: auto;
  flex-direction: column;
  flex-shrink: 0;
  width: 320px;
  max-height: calc(100vh - 120px);
}

.control-group {
  display: flex;
  gap: var(--step-1);
  flex-direction: column;
}

.control-group label {
  color: #a1a1aa;
  letter-spacing: .02em;
  font-family: Martian Mono, monospace;
  font-size: 12px;
}

.control-group select, .control-group input[type="number"], .control-group textarea {
  color: #fff;
  outline: none;
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: 6px;
  padding: 8px 10px;
  transition: border-color .2s;
  font-family: Martian Mono, monospace;
  font-size: 13px;
}

.control-group select:focus, .control-group input[type="number"]:focus, .control-group textarea:focus {
  border-color: #52525b;
}

.control-group textarea {
  resize: vertical;
  min-height: 60px;
}

.control-group select {
  cursor: pointer;
}

.control-row {
  display: flex;
  align-items:  center;
  gap: var(--step-2);
}

.control-row label {
  color: #a1a1aa;
  letter-spacing: .02em;
  font-family: Martian Mono, monospace;
  font-size: 12px;
}

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

.control-separator {
  margin: var(--step-1) 0;
  border: none;
  border-top: 1px solid #27272a;
}

.pattern-error {
  color: #ef4444;
  min-height: 1em;
  font-family: Martian Mono, monospace;
  font-size: 11px;
}

.pattern-editor {
  display: flex;
  gap: var(--step-1);
  flex-direction: column;
}

.pattern-editor-label {
  color: #a1a1aa;
  letter-spacing: .02em;
  font-family: Martian Mono, monospace;
  font-size: 12px;
}

.frame-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 4px;
}

.frame-tab {
  color: #a1a1aa;
  cursor: pointer;
  user-select: none;
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: 4px;
  padding: 4px 8px;
  transition: background .15s, border-color .15s, color .15s;
  font-family: Martian Mono, monospace;
  font-size: 11px;
}

.frame-tab:hover {
  background: #18181b;
}

.frame-tab.active {
  color: #fff;
  background: #27272a;
  border-color: #52525b;
}

.frame-actions {
  display: flex;
  gap: 4px;
  margin-left: 4px;
}

.frame-action-btn {
  color: #52525b;
  display: flex;
  cursor: pointer;
  background: none;
  border: 1px solid #27272a;
  border-radius: 4px;
  justify-content: center;
  align-items:  center;
  width: 24px;
  height: 24px;
  padding: 0;
  transition: color .15s, border-color .15s;
  font-family: Martian Mono, monospace;
  font-size: 13px;
  line-height: 1;
}

.frame-action-btn:hover {
  color: #a1a1aa;
  border-color: #52525b;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 96px;
}

.pattern-cell {
  cursor: pointer;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  transition: background .15s, border-color .15s;
}

.pattern-cell:hover {
  border-color: #52525b;
}

.pattern-cell.on {
  background: #52525b;
  border-color: #71717a;
}

.color-row {
  display: flex;
  align-items:  flex-end;
  gap: var(--step-2);
}

.color-inputs {
  display: flex;
  gap: var(--step-1);
  flex: 1;
  min-width: 0;
}

.color-inputs .control-group {
  flex: 1;
  min-width: 0;
}

.color-inputs input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.color-picker {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 1px solid #27272a;
  border-radius: 6px;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}

.color-picker::-moz-color-swatch {
  border: none;
  border-radius: 5px;
}

.cell-size-range {
  accent-color: #52525b;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.cell-size-value {
  color: #a1a1aa;
  text-align: right;
  min-width: 42px;
  font-family: Martian Mono, monospace;
  font-size: 12px;
}

.copy-config-btn {
  color: #fff;
  cursor: pointer;
  margin-top: var(--step-1);
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: 6px;
  padding: 10px;
  transition: background .2s, border-color .2s;
  font-family: Martian Mono, monospace;
  font-size: 13px;
}

.copy-config-btn:hover {
  background: #18181b;
  border-color: #52525b;
}

.preview {
  display: flex;
  flex: 1;
  justify-content: center;
  align-items:  center;
  min-height: 300px;
}

.preview-container {
  --cell-size: 24px;
}

@media (max-width: 720px) {
  .playground-body {
    flex-direction: column-reverse;
  }

  .controls {
    width: 100%;
    max-height: none;
  }

  .preview {
    min-height: 200px;
  }
}
