:root {
  --bg: #fffbf0;
  --fg: #1a1a1a;
  --accent: #ff6b35;
  --accent2: #4ecdc4;
  --accent3: #ffe66d;
  --border: #1a1a1a;
  --shadow: 4px 4px 0px #1a1a1a;
  --shadow-lg: 6px 6px 0px #1a1a1a;
  --radius: 0;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 3px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 900;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.5px;
}

.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 0.5rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--fg);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 2px solid transparent;
  transition: all 0.15s;
}

.nav-links a:hover, .nav-links a.active {
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--accent3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.1s;
  text-decoration: none;
  color: var(--fg);
  background: white;
  font-family: var(--font);
}

.btn:hover { transform: translate(1px, 1px); box-shadow: 3px 3px 0px var(--border); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: var(--accent2); }
.btn-warning { background: var(--accent3); }
.btn-danger { background: #ff4444; color: white; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; box-shadow: 2px 2px 0px var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow) !important; }

/* Cards */
.card {
  border: 3px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  background: white;
}

.card-header {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 3px solid var(--border);
  font-family: var(--font);
  font-size: 0.95rem;
  background: white;
  transition: box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: var(--shadow);
}

textarea { resize: vertical; min-height: 100px; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.grid { display: grid; gap: 2rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 2rem;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.hero h1 span { color: var(--accent); }

.hero p {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  color: #555;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Language chips */
.lang-chips { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin: 2rem 0; }
.lang-chip {
  padding: 0.5rem 1.2rem;
  border: 2px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--accent3);
  box-shadow: 3px 3px 0px var(--border);
}

/* Feature cards */
.feature { text-align: center; }
.feature-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.feature h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.5rem; }
.feature p { color: #555; font-size: 0.95rem; }

/* Code block */
.code-block {
  background: #1a1a1a;
  color: #f0f0f0;
  padding: 1.25rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  overflow-x: auto;
  border: 3px solid var(--border);
  line-height: 1.5;
}

.code-block .kw { color: #ff79c6; }
.code-block .str { color: #50fa7b; }
.code-block .cm { color: #6272a4; }

/* Playground */
.playground-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; min-height: calc(100vh - 80px); padding: 2rem; }
.playground-panel { display: flex; flex-direction: column; gap: 1.5rem; }

.voice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.voice-option {
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.1s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.voice-option:hover { background: var(--accent3); }
.voice-option.selected { background: var(--accent); color: white; box-shadow: var(--shadow); }
.voice-gender { font-size: 0.75rem; opacity: 0.7; }

.audio-player {
  border: 3px solid var(--border);
  padding: 1.5rem;
  background: white;
  text-align: center;
}

.audio-player audio { width: 100%; margin-top: 0.75rem; }

/* Status indicator */
.status { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.9rem; }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--border);
}
.status-dot.ok { background: #50fa7b; }
.status-dot.error { background: #ff4444; }
.status-dot.loading { background: var(--accent3); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Table */
.table-wrap { overflow-x: auto; border: 3px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 2px solid #eee; }
th { background: var(--fg); color: white; font-weight: 700; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.5px; border-bottom: none; }
tr:hover td { background: #fffbf0; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
.modal-overlay.active { display: flex; }
.modal { background: white; border: 3px solid var(--border); box-shadow: var(--shadow-lg); padding: 2rem; max-width: 500px; width: 90%; }
.modal-header { font-weight: 800; font-size: 1.2rem; margin-bottom: 1rem; }

/* Alert */
.alert {
  padding: 1rem 1.25rem;
  border: 3px solid var(--border);
  font-weight: 600;
  margin-bottom: 1rem;
}
.alert-success { background: #d4edda; }
.alert-error { background: #f8d7da; }
.alert-info { background: #cce5ff; }

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 3px solid var(--border);
  font-weight: 600;
  color: #666;
  margin-top: 4rem;
}

/* Responsive */
@media (max-width: 768px) {
  .playground-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.5rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav { flex-direction: column; gap: 0.75rem; }
  .voice-grid { grid-template-columns: 1fr; }
  .container { padding: 1rem; }
}

/* Range input */
input[type="range"] {
  -webkit-appearance: none;
  height: 8px;
  background: var(--border);
  border: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  background: var(--accent);
  border: 3px solid var(--border);
  cursor: pointer;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }

/* ── Documentation Page ── */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 1.5rem 1rem 2rem 2rem;
  border-right: 3px solid var(--border);
  background: white;
}

.docs-sidebar .toc-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  margin-bottom: 0.75rem;
}

.docs-sidebar a {
  display: block;
  text-decoration: none;
  color: #555;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  margin: 1px 0;
  border-left: 3px solid transparent;
  transition: all 0.1s;
}

.docs-sidebar a:hover {
  color: var(--fg);
  background: var(--accent3);
  border-left-color: var(--accent);
}

.docs-sidebar a.toc-active {
  color: var(--fg);
  background: var(--accent3);
  border-left-color: var(--accent);
  font-weight: 700;
}

.docs-sidebar .toc-section {
  font-weight: 800;
  color: var(--fg);
  font-size: 0.85rem;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  padding: 0.3rem 0.6rem;
  border-left: 3px solid var(--border);
}

.docs-sidebar .toc-sub {
  padding-left: 1.2rem;
  font-size: 0.78rem;
}

.docs-content {
  padding: 2rem 3rem 4rem;
  min-width: 0;
}

.docs-content h1 {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
}

.docs-content .subtitle {
  color: #555;
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}

.docs-content h2 {
  font-size: 1.6rem;
  font-weight: 900;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 3px solid var(--border);
}

.docs-content h2:first-of-type {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.docs-content h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.docs-content p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.docs-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: #f0f0f0;
  padding: 0.15em 0.4em;
  border: 1px solid #ddd;
}

.docs-content .code-block code {
  background: none;
  padding: 0;
  border: none;
}

/* Method badge */
.method {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid var(--border);
  margin-right: 0.4rem;
  letter-spacing: 0.5px;
}

.method-get { background: #d4edda; }
.method-post { background: #cce5ff; }
.method-delete { background: #f8d7da; }
.method-put { background: var(--accent3); }

/* Endpoint card */
.endpoint-card {
  border: 3px solid var(--border);
  background: white;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--border);
  background: #fafafa;
}

.endpoint-path {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
}

.endpoint-desc {
  margin-left: auto;
  font-size: 0.82rem;
  color: #666;
  font-weight: 600;
}

.endpoint-body {
  padding: 1.25rem;
}

.endpoint-body h4 {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin: 1rem 0 0.5rem;
}

.endpoint-body h4:first-child { margin-top: 0; }

.endpoint-body .code-block {
  margin: 0.5rem 0;
}

/* Param table (compact) */
.param-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.param-table th {
  background: #f5f5f5;
  color: var(--fg);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  text-align: left;
}
.param-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #eee;
}
.param-table td:first-child {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
}
.param-table .required { color: var(--accent); font-weight: 700; }

/* Architecture diagram */
.arch-diagram {
  background: #1a1a1a;
  color: #f0f0f0;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 1.5rem;
  border: 3px solid var(--border);
  overflow-x: auto;
  white-space: pre;
  margin: 1rem 0;
}

/* Info box */
.info-box {
  padding: 1rem 1.25rem;
  border: 3px solid var(--border);
  margin: 1rem 0;
  font-size: 0.9rem;
}
.info-box.tip { background: #d4edda; border-left: 6px solid #28a745; }
.info-box.warn { background: var(--accent3); border-left: 6px solid var(--accent); }
.info-box.note { background: #cce5ff; border-left: 6px solid #007bff; }
.info-box strong { font-weight: 800; }

/* Stats grid for architecture */
.stats-mini {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.stats-mini .stat {
  border: 2px solid var(--border);
  padding: 0.75rem;
  text-align: center;
  background: white;
}
.stats-mini .stat-value {
  font-size: 1.3rem;
  font-weight: 900;
}
.stats-mini .stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-top: 0.2rem;
}

/* Flow diagram */
.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 1rem 0;
  align-items: center;
}
.flow-step {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  background: white;
}
.flow-step.active { background: var(--accent); color: white; }
.flow-step.cache { background: var(--accent2); }
.flow-arrow {
  padding: 0 0.3rem;
  font-weight: 900;
  font-size: 1.1rem;
  color: #999;
}

/* Schema table */
.schema-table { width: 100%; border-collapse: collapse; margin: 1rem 0; border: 3px solid var(--border); }
.schema-table th {
  background: var(--fg);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.6rem 0.75rem;
  text-align: left;
}
.schema-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #eee;
}
.schema-table td:first-child {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.82rem;
}
.schema-table td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #666;
}

/* Config table */
.config-row td:first-child {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
}

/* responsive docs */
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .docs-content { padding: 1.5rem; }
  .endpoint-header { flex-direction: column; align-items: flex-start; }
  .endpoint-desc { margin-left: 0; margin-top: 0.3rem; }
}
