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

body {
  background: #000;
  color: #a1a1aa;
  font-family: 'Courier New', monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #a1a1aa;
}

#viz {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

textarea {
  width: 100%;
  background: rgba(24, 24, 27, 0.85);
  border: 1px solid #3f3f46;
  border-radius: 4px;
  padding: 1rem;
  color: #f4f4f5;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  outline: none;
}

textarea:focus {
  border-color: #52525b;
}

textarea::placeholder {
  color: #52525b;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.form-row label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #52525b;
  margin-right: -0.25rem;
}

.form-row select {
  background: rgba(24, 24, 27, 0.85);
  border: 1px solid #3f3f46;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  color: #a1a1aa;
  font-family: inherit;
  font-size: 0.75rem;
  outline: none;
}

.form-row select:focus {
  border-color: #52525b;
}

button {
  align-self: flex-end;
  padding: 0.5rem 1.5rem;
  background: rgba(39, 39, 42, 0.85);
  border: none;
  border-radius: 4px;
  color: #a1a1aa;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #3f3f46;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.error {
  color: #ef4444;
  font-size: 0.85rem;
}

.hidden {
  display: none;
}

#info-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  font-style: italic;
  font-size: 0.85rem;
  align-self: unset;
}

#info-panel {
  position: fixed;
  top: 4rem;
  right: 1.5rem;
  z-index: 15;
  width: 340px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: rgba(9, 9, 11, 0.95);
  border: 1px solid #27272a;
  border-radius: 4px;
  overflow: hidden;
}

#info-tabs {
  display: flex;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem;
  background: none;
  border: none;
  border-radius: 0;
  align-self: unset;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: #52525b;
  cursor: pointer;
  transition: color 0.2s;
}

.tab-btn:hover {
  background: none;
  color: #a1a1aa;
}

.tab-btn.active {
  color: #a1a1aa;
  border-bottom: 1px solid #52525b;
}

.tab-content {
  overflow-y: auto;
  padding: 0.75rem;
  flex: 1;
}

#history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-entry {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.history-prompt {
  font-size: 0.75rem;
  color: #a1a1aa;
}

.history-code {
  font-size: 0.65rem;
  color: #52525b;
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(24, 24, 27, 0.8);
  border: 1px solid #27272a;
  border-radius: 2px;
  padding: 0.5rem;
}

#tab-about {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#tab-about p {
  font-size: 0.75rem;
  color: #52525b;
  line-height: 1.6;
}

#tab-about a {
  color: #a1a1aa;
  text-decoration: none;
}

#tab-about a:hover {
  text-decoration: underline;
}

#info-panel.hidden,
#tab-about.hidden {
  display: none;
}

#tuning-panel.hidden {
  display: none;
}

#tuning-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(9, 9, 11, 0.85);
  border: 1px solid #27272a;
  border-radius: 4px;
  padding: 0.75rem 1rem;
}

.tuning-toggles {
  display: flex;
  gap: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #27272a;
}

.tuning-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #52525b;
  cursor: pointer;
}

.tuning-toggle input[type=checkbox] {
  accent-color: #52525b;
}

.tuning-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tuning-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #52525b;
  width: 2.8rem;
}

.tuning-val {
  font-size: 0.7rem;
  color: #3f3f46;
  width: 2rem;
  text-align: right;
}

#tuning-panel input[type=range] {
  accent-color: #52525b;
  width: 90px;
}

