/* HTML CSS JS Compiler – base tokens & reset */
:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f172a;
  --muted: #64748b;
  --border: #d7e0ea;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --focus: #0284c7;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --font: "Segoe UI", "SF Pro Text", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SF Mono", "Consolas", ui-monospace, monospace;
  --header-h: 56px;
  --max: 1280px;
  --transition: 150ms ease;
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 1000;
  background: var(--accent);
  color: #041018;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
}

h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
  color: var(--muted);
}

p strong,
li strong {
  color: var(--text);
}

ul,
ol {
  color: var(--muted);
}

code,
kbd {
  font-family: var(--mono);
  font-size: 0.9em;
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

pre code {
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.55;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.container-wide {
  width: min(100% - 1.25rem, 1440px);
  margin-inline: auto;
}

/* Site chrome: header, footer, page shells */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.05;
  text-align: center;
  color: var(--accent);
  font-weight: 700;
}

.brand__text {
  font-size: 0.95rem;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 0.15rem;
}

.nav-desktop a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-desktop a:hover,
.nav-desktop a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}

.icon-btn:hover,
.menu-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lang-switcher {
  position: relative;
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
}

.lang-switcher__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 200px;
  max-height: 320px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  display: none;
  z-index: 120;
}

.lang-switcher__panel[data-open="true"] {
  display: block;
}

.lang-switcher__panel a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.lang-switcher__panel a:hover,
.lang-switcher__panel a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--text);
}

.nav-mobile {
  display: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.nav-mobile[data-open="true"] {
  display: block;
}

.nav-mobile a {
  display: block;
  padding: 0.85rem 1rem;
  color: var(--text);
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.hero {
  padding: 1.5rem 0 1rem;
}

.hero__grid {
  display: grid;
  gap: 1rem;
}

.hero__kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #041018;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #041018;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-sm {
  min-height: 34px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}

.section {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.section__header {
  margin-bottom: 1.5rem;
  max-width: 48rem;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.feature-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.feature-chip strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.feature-chip span {
  color: var(--muted);
  font-size: 0.88rem;
}

.steps {
  display: grid;
  gap: 0.85rem;
  counter-reset: step;
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 1rem 3.2rem;
  position: relative;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.grid-2,
.grid-3,
.grid-cards {
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}

.card h3 {
  margin-bottom: 0.4rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}

.example-btn {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
}

.example-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.faq details[open] summary {
  margin-bottom: 0.55rem;
}

.breadcrumbs {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  padding: 0.65rem 0;
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.breadcrumbs__item:not(:last-child)::after {
  content: "/";
  margin: 0 0.55rem;
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  speak: never;
}

.breadcrumbs__link {
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
  padding: 0.1rem 0.15rem;
}

.breadcrumbs__link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumbs__current {
  color: var(--text);
  font-weight: 600;
  max-width: min(100%, 28rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2.5rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.footer-col h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.footer-col a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0;
  font-size: 0.92rem;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.prose {
  max-width: 48rem;
}

/* Never shrink a layout container — keeps breadcrumbs / hero / tools aligned */
.container.prose,
.container-wide.prose {
  max-width: var(--max);
}

.page-hero {
  padding: 1.25rem 0 0.85rem;
}

.page-hero h1 {
  margin: 0 0 0.55rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.page-hero > p,
.tool-page-hero__lead {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 52rem;
  line-height: 1.55;
}

.page-hero .container > p:last-child {
  margin-bottom: 0;
}

.tool-workspace {
  --tool-bg: #000000;
  --tool-panel: #0a0a0a;
  --tool-panel-head: #141414;
  --tool-border: #2e2e2e;
  --tool-text: #f3f3f3;
  --tool-muted: #a3a3a3;
  margin: 0.35rem 0 1.75rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--tool-text);
}

.tool-layout {
  display: grid;
  gap: 1rem;
  margin-block: 0;
  margin-inline: auto;
  align-items: stretch;
  padding: 1rem;
  background-color: #000000;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  border: 1px solid #222;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.tool-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 380px;
  background: var(--tool-panel);
  border: 1px solid var(--tool-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.tool-panel__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  min-height: 3.25rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--tool-border);
  background: var(--tool-panel-head);
  color: var(--tool-text);
}

.tool-panel__head strong {
  color: var(--tool-text);
  font-size: 0.92rem;
}

.tool-panel__head > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.tool-panel__head .status {
  color: var(--tool-muted);
}

.tool-panel__head .btn-secondary,
.tool-panel__head .btn-ghost {
  background: #1a1a1a;
  border-color: #333;
  color: var(--tool-text);
}

.tool-panel__head .btn-secondary:hover,
.tool-panel__head .btn-ghost:hover {
  background: #262626;
  border-color: var(--accent);
  color: #fff;
}

.tool-panel__body {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #050505;
}

.tool-textarea {
  width: 100%;
  flex: 1;
  min-height: 300px;
  border: 0;
  resize: vertical;
  padding: 1rem 1.1rem;
  background: transparent;
  color: #e8e8e8;
  caret-color: var(--accent);
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.55;
  box-sizing: border-box;
}

.tool-textarea::placeholder {
  color: var(--tool-muted);
}

.tool-textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}

.related-links a {
  font-size: 0.92rem;
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.related-links a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
}

th {
  background: var(--surface-2);
  color: var(--text);
}

td {
  color: var(--muted);
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.status[data-tone="ok"] {
  color: var(--ok);
}

@media (min-width: 768px) {
  .nav-desktop {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }

  .feature-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3,
  .grid-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .brand__text-full {
    display: inline;
  }
}

/* Compiler workspace */

.compiler-section {
  padding: 0.5rem 0 1.5rem;
}

.compiler {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.compiler__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.compiler__toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.compiler__toolbar-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.compiler__shortcut {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.compiler__body {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 520px;
}

.compiler__editors {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-bottom: 1px solid var(--border);
}

.editor-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
}

.editor-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.editor-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.editor-panels {
  flex: 1;
  min-height: 280px;
  position: relative;
}

.editor-panel {
  display: none;
  height: 100%;
  min-height: 280px;
}

.editor-panel[data-active="true"] {
  display: flex;
}

.editor {
  display: grid;
  grid-template-columns: auto 1fr;
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: var(--bg);
}

.editor__gutter {
  padding: 0.85rem 0.45rem 0.85rem 0.65rem;
  text-align: right;
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  user-select: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.editor__input {
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: 0;
  resize: none;
  padding: 0.85rem 0.85rem;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editor__input.wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.editor__input:focus {
  outline: none;
}

.compiler__preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 320px;
  background: var(--bg);
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.preview-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-right: 0.25rem;
}

.device-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.device-btn[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.viewport-meta {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
}

.preview-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: var(--bg);
  overflow: auto;
}

.preview-frame-wrap {
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: width 180ms ease;
  margin: 0 auto;
}

.preview-frame-wrap[data-device="tablet"] {
  width: min(100%, 768px);
}

.preview-frame-wrap[data-device="mobile"] {
  width: min(100%, 390px);
}

.preview-frame {
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: 0;
  background: #fff;
}

.preview-empty {
  color: #64748b;
  font-size: 0.92rem;
  text-align: center;
  padding: 2rem 1rem;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: #fff;
  z-index: 1;
}

.preview-empty[hidden] {
  display: none !important;
}

.preview-frame-wrap {
  position: relative;
}

.compiler__console {
  border-top: 1px solid var(--border);
  background: var(--surface);
  max-height: 220px;
  display: flex;
  flex-direction: column;
}

.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.console-head h3 {
  margin: 0;
  font-size: 0.85rem;
}

.console-body {
  overflow: auto;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  min-height: 72px;
}

.console-line {
  display: grid;
  grid-template-columns: 72px 64px 1fr;
  gap: 0.5rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.console-line[data-type="warn"] {
  color: var(--warn);
}

.console-line[data-type="error"] {
  color: var(--danger);
}

.console-line[data-type="info"] {
  color: var(--accent);
}

.console-empty {
  color: var(--muted);
}

.compiler-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  background: var(--surface);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.toggle input {
  accent-color: var(--accent);
}

.settings-popover {
  position: relative;
}

.settings-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  width: min(260px, 80vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  display: none;
  z-index: 50;
}

.settings-panel[data-open="true"] {
  display: grid;
  gap: 0.65rem;
}

.settings-panel label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.settings-panel input[type="range"] {
  width: 100%;
}

.compiler.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  border-radius: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.compiler.is-fullscreen .compiler__body {
  flex: 1;
  min-height: 0;
}

.compiler.is-fullscreen .editor-panels,
.compiler.is-fullscreen .editor-panel,
.compiler.is-fullscreen .editor,
.compiler.is-fullscreen .editor__input,
.compiler.is-fullscreen .compiler__preview,
.compiler.is-fullscreen .preview-frame-wrap,
.compiler.is-fullscreen .preview-frame {
  min-height: 0;
  height: 100%;
}

.error-banner {
  display: none;
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, var(--danger) 15%, var(--surface));
  border-top: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border));
  color: var(--danger);
  font-size: 0.85rem;
}

.error-banner[data-visible="true"] {
  display: block;
}

@media (min-width: 960px) {
  .compiler__body {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    min-height: 620px;
  }

  .compiler__editors {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  .editor-panels,
  .editor-panel,
  .editor,
  .editor__input {
    min-height: 560px;
  }

  .preview-frame-wrap,
  .preview-frame {
    min-height: 480px;
  }
}

/* Components: tool cards, notices, etc. */

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), background var(--transition);
}

.tool-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  color: inherit;
}

.tool-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.tool-card p {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
}

.tool-card__cta {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.category-block {
  margin-bottom: 2rem;
}

.category-block h2 {
  margin-bottom: 0.85rem;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.notice--warn {
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 35%, var(--border));
}

.placeholder-config {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.cta-band {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.cta-band p {
  margin: 0.35rem 0 0;
  max-width: 40rem;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.pill-list a {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  background: var(--surface);
}

.pill-list a:hover {
  color: var(--text);
  border-color: var(--accent);
}

.use-case-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.use-case {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
}

.use-case h3 {
  font-size: 0.98rem;
  margin-bottom: 0.35rem;
}

.use-case p {
  margin: 0;
  font-size: 0.88rem;
}

.tool-hero-visual {
  margin: 1rem 0 0;
}

.tool-hero-visual img {
  width: min(100%, 420px);
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.how-steps {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 1rem 0 1.5rem;
  list-style: none;
  padding: 0;
  counter-reset: how-step;
}

.how-step {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.9rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  counter-increment: how-step;
}

.how-step__media {
  position: relative;
  width: 120px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.how-step__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.how-step__media::after {
  content: counter(how-step);
  position: absolute;
  left: 0.35rem;
  top: 0.35rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #041018;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.how-step__body h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.how-step__body p {
  margin: 0;
  font-size: 0.9rem;
}

.tool-meta-grid {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.tool-meta-grid h2 {
  margin-top: 0;
}

@media (min-width: 768px) {
  .how-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .how-step {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .how-step__media {
    width: 100%;
    height: 140px;
  }

  .tool-meta-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

/* Responsive refinements */

@media (max-width: 959px) {
  .compiler__toolbar {
    position: sticky;
    top: var(--header-h);
    z-index: 40;
  }

  .compiler__shortcut {
    display: none;
  }

  .console-line {
    grid-template-columns: 56px 1fr;
  }

  .console-line time {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand__text {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero {
    padding-top: 1rem;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .preview-toolbar .device-btn:nth-child(n + 5) {
    display: none;
  }
}

[dir="rtl"] .editor__gutter {
  text-align: left;
  border-right: 0;
  border-left: 1px solid var(--border);
}

[dir="rtl"] .lang-switcher__panel {
  right: auto;
  left: 0;
}

[dir="rtl"] .step {
  padding: 1rem 3.2rem 1rem 1rem;
}

[dir="rtl"] .step::before {
  left: auto;
  right: 1rem;
}

/* Theme helpers */

.theme-transition {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(2, 132, 199, 0.08), transparent 60%),
    radial-gradient(700px 360px at 95% 0%, rgba(99, 102, 241, 0.06), transparent 55%);
}
