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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 2px solid #e2e8f0;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  flex: 1;
}

.back {
  color: #4a90d9;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.back:hover { text-decoration: underline; }

.status {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
}

.status.loading { background: #fef3c7; color: #92400e; }
.status.ready   { background: #d1fae5; color: #065f46; }
.status.error   { background: #fee2e2; color: #991b1b; }

main {
  display: flex;
  flex: 1;
  gap: 0;
  overflow: hidden;
}

.demos {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  width: 38%;
  overflow-y: auto;
  flex-shrink: 0;
}

.demo-card {
  background: #fff;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
}

.demo-card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.desc {
  font-size: 0.8rem;
  color: #718096;
  margin-bottom: 0.6rem;
}

.desc code {
  background: #f7fafc;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.75rem;
  color: #4a5568;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-row input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid #cbd5e0;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #2d3748;
  background: #f7fafc;
}

.input-row input:focus {
  outline: none;
  border-color: #4a90d9;
  background: #fff;
}

.input-row button {
  padding: 0.4rem 0.9rem;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.input-row button:hover { background: #357abd; }
.input-row button:disabled { background: #a0aec0; cursor: not-allowed; }

.output {
  margin-top: 0.5rem;
  min-height: 1.4rem;
  font-size: 0.875rem;
  color: #2d6a4f;
  font-weight: 500;
  word-break: break-all;
}

.source {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow: hidden;
  border-left: 2px solid #e2e8f0;
  background: #fff;
}

.source h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.badge {
  font-size: 0.7rem;
  font-weight: 500;
  background: #ebf8ff;
  color: #2b6cb0;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.source pre {
  flex: 1;
  overflow-y: auto;
  background: #1a202c;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.6;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}
