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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.logo-code {
  color: #e0e0e0;
}

.logo-ink {
  background: linear-gradient(135deg, #ff2d7b, #c026d3, #ff2d7b);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ink-shimmer 4s ease-in-out infinite;
}

@keyframes ink-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  gap: 1rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-group label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
}

.control-group select {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #333;
  background: #16213e;
  color: #e0e0e0;
  font-size: 0.85rem;
  cursor: pointer;
}

.control-group--toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  align-self: center;
}

.control-group--toggle label {
  text-transform: none;
  font-size: 0.85rem;
  color: #ccc;
}

.control-group--toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4361ee;
}

#copy-btn {
  margin-left: auto;
  padding: 0.5rem 1.2rem;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  align-self: center;
}

#copy-btn:hover {
  background: #3a56d4;
}

#copy-btn.copied {
  background: #2ecc71;
}

.editor {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 400px;
}

#code-input {
  resize: none;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: #0f0f23;
  color: #e0e0e0;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  tab-size: 4;
}

#code-input:focus {
  outline: 2px solid #4361ee;
  outline-offset: -1px;
}

.preview {
  border-radius: 8px;
  border: 1px solid #333;
  overflow: auto;
}

.preview pre {
  margin: 0;
  padding: 1rem;
  min-height: 100%;
  border-radius: 8px;
}

.preview code {
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Line numbers */
.preview code.with-line-numbers {
  counter-reset: line;
}

.preview code.with-line-numbers .line {
  display: block;
}

.preview code.with-line-numbers .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 3ch;
  margin-right: 1.5ch;
  text-align: right;
  color: #666;
  user-select: none;
}

footer {
  margin-top: 1rem;
  padding: 1rem 1rem 2rem;
  border-top: 1px solid #333;
  text-align: center;
  font-size: 0.8125rem;
  color: #666;
}

footer a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: #4361ee;
}

.keyboard-hint {
  font-size: 0.75rem;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", monospace;
  color: #666;
  margin-top: 8px;
  opacity: 0.7;
}

.built-with {
  margin-top: 8px;
  color: #666;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .editor {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  #copy-btn {
    margin-left: 0;
  }
}
