/* ============================================================
   subnetmaskcalc.net — shared design system
   Light theme, mint accent, engineer-first
   ============================================================ */

/* Fonts are now preconnected and stylesheet-loaded from each page's <head>
   instead of @import here. @import in CSS creates a serialized dependency
   that delays rendering by 100-300 ms; <link rel="preconnect"> + a direct
   stylesheet <link> lets the font request race the CSS request in parallel. */

:root {
  --bg: #ffffff;
  --bg-elev: #f7f8fa;
  --bg-card: #ffffff;
  --line: #e6e8ee;
  --line-bright: #d4d8e2;
  --ink: #0e1426;
  --ink-dim: #5a6685;
  --ink-mute: #8a96b4;
  --accent: #00a86b;
  --accent-soft: #e6f7ef;
  --accent-hot: #008f5b;
  --hot: #e63757;
  --hot-soft: #fde8ed;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --grid: rgba(14, 20, 38, 0.04);
  --shadow-sm: 0 1px 2px rgba(14, 20, 38, 0.04);
  --shadow-md: 0 4px 12px rgba(14, 20, 38, 0.06);
  --shadow-lg: 0 30px 60px -20px rgba(14, 20, 38, 0.15), 0 0 0 1px rgba(0, 168, 107, 0.05);
}

[data-theme="dark"] {
  --bg: #0a0e1a;
  --bg-elev: #131825;
  --bg-card: #131825;
  --line: #1f2638;
  --line-bright: #2d3548;
  --ink: #e8ecf5;
  --ink-dim: #a0a8bd;
  --ink-mute: #6b7590;
  --accent: #7df9c4;
  --accent-soft: #1a3a2e;
  --accent-hot: #5fe5a8;
  --hot: #ff6b85;
  --hot-soft: #3a1a23;
  --warn: #f59e0b;
  --warn-soft: #3a2a0a;
  --blue: #60a5fa;
  --blue-soft: #1a2a4a;
  --grid: rgba(125, 249, 196, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(125, 249, 196, 0.08);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.2s, color 0.2s;
}

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

body {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 168, 107, 0.08), transparent 70%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
}

::selection { background: var(--accent); color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: 'JetBrains Mono', monospace; }
.serif-i { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; }

/* ============ TOP NAV ============ */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 28px; height: 28px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; border-radius: 5px; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 168, 107, 0.25);
}
.logo-domain { color: var(--ink); }
.logo-tld { color: var(--accent); }

.nav {
  display: flex;
  gap: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin-left: auto;
  margin-right: 16px;
}
.nav a {
  color: var(--ink-dim);
  position: relative;
  padding: 4px 0;
  transition: color 0.15s;
}
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav a.active { color: var(--accent); font-weight: 700; }
.nav a.active::after {
  content: "";
  position: absolute;
  bottom: -22px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.topbar-cta {
  display: flex;
  gap: 8px;
}
.btn-ghost {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost:hover { border-color: var(--line-bright); color: var(--ink); background: var(--bg-elev); text-decoration: none; }

/* ============ BUTTONS ============ */
.btn-primary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 12px 22px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: 0 8px 24px rgba(0, 168, 107, 0.22);
}
.btn-primary:hover {
  background: var(--accent-hot);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 168, 107, 0.32);
  text-decoration: none;
}
.btn-secondary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink);
  padding: 10px 22px;
  border: 2px solid var(--line-bright);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--ink-mute); background: var(--bg-elev); text-decoration: none; }

.btn-cheatsheet {
  font-size: 12px !important;
  padding: 8px 14px !important;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.18) !important;
}
.btn-cheatsheet:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 168, 107, 0.28) !important;
}

/* ============ HEADINGS ============ */
h1 {
  font-family: 'Inter Tight', sans-serif;
  font-size: 56px;
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 20px;
}
h1 em { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); }
h2 {
  font-family: 'Inter Tight', sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 16px;
}
h2 em { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); }
h3 {
  font-family: 'Inter Tight', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 12px;
}
h4 {
  font-family: 'Inter Tight', sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 8px;
}
p { color: var(--ink-dim); margin-bottom: 12px; }

/* ============ SECTION HEADER ============ */
.section {
  max-width: 1320px;
  margin: 0 auto;
  padding: 80px 32px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  gap: 24px;
  flex-wrap: wrap;
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.section-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-mute);
  text-align: right;
}

/* ============ PAGE HEADER (for sub-pages) ============ */
.page-header {
  max-width: 1320px;
  margin: 0 auto;
  padding: 64px 32px 40px;
  border-bottom: 1px solid var(--line);
}
.page-header h1 {
  font-size: 48px;
  margin-bottom: 14px;
}
.page-header p {
  font-size: 17px;
  max-width: 640px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 20px;
  padding: 5px 11px;
  border: 1px solid var(--accent);
  border-radius: 100px;
  background: var(--accent-soft);
}
.eyebrow::before { content: "▸"; }

/* ============ CARD ============ */
.card {
  background: var(--bg-card);
  border: 2px solid var(--line-bright);
  border-radius: 12px;
  padding: 27px;
  box-shadow: var(--shadow-sm);
}
.card-elev { box-shadow: var(--shadow-md); }

/* ============ INPUTS ============ */
.input-wrap label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 8px;
}
.input-field, select.input-field, textarea.input-field {
  width: 100%;
  background: var(--bg-elev);
  border: 2px solid var(--line-bright);
  color: var(--ink);
  padding: 12px 15px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.input-field:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.12);
}
textarea.input-field { font-family: 'JetBrains Mono', monospace; resize: vertical; min-height: 90px; }

/* chip selector */
.chip-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 6px 11px;
  border: 1px solid var(--line-bright);
  border-radius: 100px;
  color: var(--ink-dim);
  cursor: pointer;
  background: transparent;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--line-bright); color: var(--ink); }
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

/* ============ TAGS / BADGES ============ */
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.tag.new::before, .tag.beta::before, .tag.core::before, .tag.cloud::before, .tag.ai::before {
  padding: 1px 5px; border-radius: 3px; font-weight: 800; margin-right: 5px; color: #fff;
}
.tag.new::before { content: "NEW"; background: var(--accent); }
.tag.beta::before { content: "BETA"; background: var(--warn); }
.tag.core::before { content: "CORE"; background: var(--ink); }
.tag.cloud::before { content: "CLOUD"; background: var(--blue); }
.tag.ai::before { content: "AI"; background: var(--hot); }

/* ============ RESULTS GRID ============ */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.result-cell {
  background: #fff;
  padding: 12px 14px;
  position: relative;
}
.result-cell .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.result-cell .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-all;
}
.result-cell .val.hot { color: var(--accent); font-weight: 700; }
.copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: transparent;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.result-cell:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--accent); }

/* ============ BINARY VIZ ============ */
.binary-viz {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.binary-viz-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.binary-row {
  display: flex; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  flex-wrap: wrap;
}
.binary-octet {
  display: flex; gap: 1px;
  padding: 6px 8px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--line);
}
.bit { width: 13px; text-align: center; color: var(--ink-mute); font-weight: 500; }
.bit.net { color: var(--accent); font-weight: 700; }
.bit.host { color: var(--hot); font-weight: 700; }
.binary-legend {
  display: flex; gap: 18px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  flex-wrap: wrap;
}
.legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-dot.net { background: var(--accent); }
.legend-dot.host { background: var(--hot); }

/* ============ FOOTER ============ */
footer {
  border-top: 1px solid var(--line);
  padding: 60px 32px 36px;
  background: var(--bg-elev);
}
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink-dim);
  max-width: 320px;
  margin-top: 14px;
}
.footer-col h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  font-weight: 500;
}
.footer-col a {
  display: block;
  color: var(--ink);
  font-size: 14px;
  padding: 3px 0;
}
.footer-col a:hover { color: var(--accent); text-decoration: none; }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-mute);
  flex-wrap: wrap;
  gap: 10px;
}

/* ============ UTILITY ============ */
.prose p { font-size: 16px; color: var(--ink); margin-bottom: 16px; line-height: 1.65; }
.prose h2 { font-size: 28px; margin-top: 40px; margin-bottom: 14px; }
.prose h3 { font-size: 20px; margin-top: 28px; margin-bottom: 10px; }
.prose ul, .prose ol { padding-left: 22px; margin-bottom: 16px; color: var(--ink); }
.prose li { margin-bottom: 6px; }
.prose code {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent-hot);
}
.prose pre {
  background: var(--ink);
  color: #e8ecf5;
  padding: 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.prose pre code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 18px;
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  margin-bottom: 16px;
  color: var(--ink);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  h1 { font-size: 40px; }
  h2 { font-size: 30px; }
  .nav { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .section { padding: 50px 24px; }
  .page-header { padding: 40px 24px 32px; }
  .topbar-inner { padding: 14px 20px; }
}
@media (max-width: 560px) {
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  .footer-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .section-meta { text-align: left; }
}

/* ============================================================================
   AD BANNER (728x90 desktop / 320x50 mobile)
   - Sits between the top nav and the page-header on every page.
   - Tight strip, no background, no border — keeps it from competing with
     the calculator UI visually.
   ============================================================================ */
.ad-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 12px;
  margin: 0;
  background: transparent;
}
.ad-banner-inner {
  display: none;
  max-width: 100%;
}
.ad-banner-inner.desktop { width: 728px; height: 90px; }
.ad-banner-inner.mobile  { width: 320px; height: 50px; }
@media (min-width: 768px) {
  .ad-banner-inner.desktop { display: block; }
  .ad-banner-inner.mobile  { display: none;  }
}
@media (max-width: 767px) {
  .ad-banner-inner.desktop { display: none;  }
  .ad-banner-inner.mobile  { display: block; }
}

/* ============================================================================
   CONSENT BANNER (only shown in EU/EEA/UK/CH/CA — see assets/js/consent.js)
   ============================================================================ */
#smc-consent-banner {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 9999;
  max-width: 980px;
  margin: 0 auto;
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  box-shadow: 0 24px 60px -20px rgba(14, 20, 38, 0.35), 0 0 0 1px rgba(0, 168, 107, 0.08);
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
}
.smc-consent-inner {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 18px 20px;
  flex-wrap: wrap;
}
.smc-consent-text {
  flex: 1 1 320px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}
.smc-consent-text strong { color: var(--ink); font-weight: 600; }
.smc-consent-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.smc-consent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.smc-consent-btn {
  appearance: none;
  border: 1px solid var(--line-bright);
  background: transparent;
  color: var(--ink);
  font: 600 13px 'Inter Tight', system-ui, sans-serif;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.smc-consent-btn:hover { border-color: var(--ink-mute); }
.smc-consent-btn.smc-consent-accept {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
[data-theme="dark"] .smc-consent-btn.smc-consent-accept {
  color: #0a0e1a;
}
.smc-consent-btn.smc-consent-accept:hover { background: var(--accent-hot); }

@media (max-width: 600px) {
  #smc-consent-banner { left: 8px; right: 8px; bottom: 8px; }
  .smc-consent-inner { padding: 14px; gap: 14px; }
  .smc-consent-actions { width: 100%; }
  .smc-consent-btn { flex: 1; }
}

/* Floating "Manage cookies" reopener, shown after a choice has been made
   in consent-required regions. */
.smc-consent-manage {
  position: fixed;
  left: 12px; bottom: 12px;
  z-index: 9998;
  appearance: none;
  border: 1px solid var(--line-bright);
  background: var(--bg-card);
  color: var(--ink-dim);
  font: 600 11px 'Inter Tight', system-ui, sans-serif;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity .15s, color .15s;
}
.smc-consent-manage:hover { opacity: 1; color: var(--ink); }

/* ============================================================================
   RELATED TOOLS / PREFIXES grid (used on /N and mask landing pages)
   ============================================================================ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.related-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
  transition: border-color .15s, transform .1s, background .15s;
  text-decoration: none !important;
  color: inherit !important;
}
.related-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.related-card-title {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  color: var(--accent);
  font-size: 15px;
  margin-bottom: 6px;
}
.related-card-desc {
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.45;
}

/* ============================================================================
   CODE EXAMPLES (tabbed, with copy button + expandable secondary languages)
   ============================================================================ */
.code-examples {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
}
.code-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  padding: 8px 8px 0 8px;
}
.code-tab {
  appearance: none;
  border: none;
  background: transparent;
  font: 600 12px 'JetBrains Mono', ui-monospace, monospace;
  color: var(--ink-mute);
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color .12s, background .12s;
  position: relative;
  top: 1px;
}
.code-tab:hover { color: var(--ink); }
.code-tab[aria-selected="true"] {
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--bg-card);
}
.code-tab.code-tab-expand {
  margin-left: auto;
  font-weight: 500;
  color: var(--ink-dim);
}
.code-tab.code-tab-expand[aria-expanded="true"] { color: var(--accent); }
.code-tab.code-extra { display: none; }
.code-tabs[data-expanded="true"] .code-tab.code-extra { display: inline-block; }
.code-tab-copy {
  margin-left: auto;
  margin-right: 6px;
  appearance: none;
  border: 1px solid var(--line-bright);
  background: var(--bg-card);
  color: var(--ink-dim);
  font: 600 11px 'Inter Tight', system-ui, sans-serif;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.code-tab-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-tab-copy.copied { color: var(--accent); border-color: var(--accent); }
.code-panels { position: relative; }
.code-panel {
  display: none;
  padding: 18px 20px 20px 20px;
  margin: 0;
  overflow-x: auto;
  background: var(--bg-card);
  font: 13px / 1.55 'JetBrains Mono', ui-monospace, monospace;
  color: var(--ink);
  white-space: pre;
  -webkit-font-smoothing: antialiased;
}
.code-panel[data-active="true"] { display: block; }
.code-panel-output {
  border-top: 1px dashed var(--line);
  margin-top: 14px;
  padding-top: 12px;
  color: var(--ink-dim);
  font-size: 12px;
}
.code-panel-output::before {
  content: "Output:";
  display: block;
  font-weight: 700;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  font-size: 10px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
@media (max-width: 600px) {
  .code-tab { padding: 8px 10px; font-size: 11px; }
  .code-panel { font-size: 12px; padding: 14px; }
}

/* ============================================================================
   THEMED DIALOG (smcConfirm / smcPrompt)
   ============================================================================ */
.smc-dialog-backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 20, 38, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .16s ease-out;
}
.smc-dialog-backdrop.smc-dialog-open { opacity: 1; }

.smc-dialog {
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  box-shadow: 0 28px 70px -16px rgba(14, 20, 38, 0.40),
              0 0 0 1px rgba(0, 168, 107, 0.08);
  max-width: 460px;
  width: 100%;
  padding: 24px 26px 22px 26px;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform .18s ease-out, opacity .18s ease-out;
}
.smc-dialog-backdrop.smc-dialog-open .smc-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.smc-dialog:focus { outline: none; }

.smc-dialog-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.005em;
}

.smc-dialog-message {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

.smc-dialog-input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line-bright);
  background: var(--bg-elev);
  color: var(--ink);
  font: 14px 'JetBrains Mono', ui-monospace, monospace;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 18px;
  transition: border-color .12s, background .12s;
}
.smc-dialog-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.12);
}

.smc-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.smc-dialog-btn {
  appearance: none;
  font: 600 13.5px 'Inter Tight', system-ui, sans-serif;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  border: 1px solid var(--line-bright);
  background: transparent;
  color: var(--ink);
}
.smc-dialog-btn:hover { border-color: var(--ink-mute); }
.smc-dialog-btn:active { transform: translateY(1px); }
.smc-dialog-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.18);
}

.smc-dialog-btn-confirm {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
[data-theme="dark"] .smc-dialog-btn-confirm { color: #0a0e1a; }
.smc-dialog-btn-confirm:hover { background: var(--accent-hot); border-color: var(--accent-hot); }

.smc-dialog-btn-danger {
  background: #e63757;
  border-color: #e63757;
  color: #ffffff;
}
.smc-dialog-btn-danger:hover { background: #c8294a; border-color: #c8294a; }

@media (max-width: 480px) {
  .smc-dialog-backdrop { padding: 12px; }
  .smc-dialog { padding: 20px 18px 16px 18px; }
  .smc-dialog-actions { flex-direction: column-reverse; }
  .smc-dialog-btn { width: 100%; }
}
