:root {
  --bg: #ffffff;
  --bg-sidebar: #fafaf9;
  --panel: #fafaf9;
  --card: #ffffff;
  --border: rgba(31, 30, 29, 0.13);
  --text: #141413;
  --text-dim: #6b6b66;
  --purple: #7c3aed;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #059669;
  --orange: #d97706;
  --danger: #c0392b;

  --if-color: var(--purple);
  --id-color: var(--blue);
  --ex-color: var(--cyan);
  --mem-color: var(--green);
  --wb-color: var(--orange);

  --code-bg: #1e1e1e;
  --code-gutter-bg: #181818;
  --code-border: #2f2f2f;
  --code-text: #d4d4d4;
  --code-line: #6e7681;
  --tok-kw: #c586c0;
  --tok-reg: #9cdcfe;
  --tok-num: #b5cea8;
  --tok-comment: #6a9955;
  --tok-str: #ce9178;
  --tok-type: #4ec9b0;
  --tok-pre: #808080;
  --tok-label: #dcdcaa;
  --tok-addr: #858585;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

body { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.15s ease, padding 0.15s ease;
}
.sidebar.collapsed { width: 64px; padding: 20px 10px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 22px;
  padding: 2px 4px;
  background: none;
  border: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}
.sidebar-brand:hover { border-color: transparent; }
.sidebar-brand-mark { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; display: block; }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-name { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-brand-by { font-size: 11px; color: var(--text-dim); }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 2px 0; }
.sidebar.collapsed .sidebar-brand-text { display: none; }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-link.active .nav-icon { color: var(--purple); }

/* The admin pages: only shown when at least one of them is available. */
.nav-manage { display: none; margin-top: 18px; }
.nav-manage:has(.nav-link:not(.hidden)) { display: flex; }
.nav-group-label {
  padding: 0 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sidebar.collapsed .nav-group-label { height: 1px; padding: 0; margin: 0 8px 8px; background: var(--border); font-size: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.nav-link:hover { background: rgba(31, 30, 29, 0.05); color: var(--text); }
.nav-link.active { background: rgba(31, 30, 29, 0.06); color: var(--text); }
.sidebar.collapsed .nav-link { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .nav-link .label { display: none; }

.dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.dot-purple { background: var(--purple); }
.dot-blue { background: var(--blue); }
.dot-cyan { background: var(--cyan); }
.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }
.dot-red { background: var(--danger); }

/* Shares the bottom row with the fold button instead of its own row --
   flex:1 lets it take the space left of that button, growing from the
   sidebar's left edge rather than centering in its own intrinsic width. */
.sidebar-legal {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.legal-link {
  background: none;
  border: none;
  padding: 2px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
}
.legal-link:hover { color: var(--text); border-color: transparent; }
.legal-sep { color: var(--border); font-size: 11px; }
.sidebar.collapsed .sidebar-legal { display: none; }

.sidebar-footer-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 4px;
  border-top: 1px solid var(--border);
}
.sidebar.collapsed .sidebar-footer-row { padding: 10px 0 4px; justify-content: center; }

.sidebar-fold-btn {
  background: var(--purple);
  border: 1px solid var(--purple);
  border-radius: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-fold-btn:hover { background: #6d28d9; border-color: #6d28d9; }

/* A dedicated bar reserving its own space at the top of the content area,
   rather than a small floating box -- otherwise it visually collides with
   whatever a given page's own header puts in that top-right corner (e.g.
   the Results screen's VCD/Regdump/Memdump downloads). */
.topbar {
  position: fixed;
  top: 0;
  left: 221px;
  right: 0;
  height: 56px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: left 0.15s ease;
}
body.sidebar-collapsed .topbar { left: 65px; }

/* Doubles as every page's header -- the current section/screen name, kept
   in the one bar that's always on screen instead of each page repeating its
   own title row underneath (that used to cost ~60px of dead vertical space
   above the toolbar on every page). */
.topbar-title { font-size: 15px; font-weight: 600; margin: 0; white-space: nowrap; flex-shrink: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; }
.topbar-auth { flex-shrink: 0; margin-left: auto; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 19, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  position: relative;
  width: 400px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: rgba(31, 30, 29, 0.06); border-color: transparent; }

.auth-modal-title { margin: 0 0 20px; font-size: 21px; font-weight: 700; color: var(--text); text-align: center; }

.auth-login-form { display: flex; flex-direction: column; gap: 12px; }
.auth-login-form input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.auth-login-form input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.auth-login-form button[type="submit"] {
  padding: 12px;
  font-size: 14px;
  border-radius: 9px;
  margin-top: 4px;
}
.auth-login-error { font-size: 12.5px; color: var(--danger); min-height: 15px; }
.auth-login-error.success { color: var(--green); }
.auth-login-note { font-size: 12.5px; color: var(--text-dim); margin: 0 0 4px; line-height: 1.5; }

.auth-switch-link { margin: 14px 0 0; text-align: center; }
.auth-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin: 14px 0; }
.auth-consent input { margin-top: 3px; flex-shrink: 0; }
.auth-consent-link { font-size: inherit; text-decoration: underline; padding: 0; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--purple);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: #6d28d9; }

.auth-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0; font-size: 11.5px; color: var(--text-dim); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-idp-buttons { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.auth-idp-buttons button.ghost { padding: 12px; font-size: 14px; border-radius: 9px; }
.auth-github-btn { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text); }
.auth-google-btn-slot { display: flex; justify-content: center; }
/* Google's rendered sign-in button isn't a plain <button> we can .disabled
   -- muted + non-interactive while a login request is in flight instead. */
.auth-idp-disabled { pointer-events: none; opacity: 0.5; }

.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 6px;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- Account menu (topbar) ---------- */

.account { position: relative; display: flex; align-items: center; gap: 10px; }
.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 3px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: rgba(31, 30, 29, 0.05); border-color: transparent; }
.account-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.account-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--green);
}
.account-dot-grace, .account-dot-pending { background: var(--orange); }
.account-dot-expired, .account-dot-rejected, .account-dot-disabled { background: var(--danger); }
.account-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.account-chevron { width: 14px; height: 14px; fill: none; stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 250px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(31, 30, 29, 0.14);
}
.account-menu-head { padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.account-menu-name { font-size: 14px; font-weight: 600; }
.account-menu-email { font-size: 12px; color: var(--text-dim); margin-top: 2px; word-break: break-all; }
.account-menu-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.account-menu-access { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.account-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.account-menu-item:hover { background: rgba(31, 30, 29, 0.05); }
@media (max-width: 640px) {
  .account-name, .account-btn > .auth-status { display: none; }
}
.auth-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}
.auth-status-active { background: rgba(5, 150, 105, 0.12); color: var(--green); }
.auth-status-approved { background: rgba(5, 150, 105, 0.12); color: var(--green); }
.auth-status-grace { background: rgba(217, 119, 6, 0.12); color: var(--orange); }
.auth-status-pending { background: rgba(217, 119, 6, 0.12); color: var(--orange); }
.auth-status-expired { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.auth-status-rejected { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.auth-status-disabled { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.auth-validity { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* ---------- Content / sections ---------- */

.content {
  flex: 1;
  min-width: 0;
  margin-left: 221px;
  padding: 76px 40px 40px; /* 56px topbar + 20px breathing room */
  transition: margin-left 0.15s ease;
  height: 100vh;
  overflow-y: auto;
  /* A thin custom scrollbar instead of the OS-default one -- on Windows
     Chromium that default includes small up/down arrow buttons at each
     end, which used to sit unnoticed in the dead margin .content's old
     max-width left empty, and now stand out sitting flush against real
     content. Defining any ::-webkit-scrollbar rule replaces the whole
     native (buttons included) scrollbar with just a styled track/thumb. */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--border) transparent; /* Firefox */
}
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
/* No max-width here on purpose -- .content is also the scrolling
   container (overflow-y: auto), and capping its width left a dead strip
   of empty space plus a scrollbar sitting short of the real screen edge
   on anything wider than ~1320px, while the topbar above it already spans
   the full remaining width (right: 0). flex:1 alone makes it genuinely
   fill whatever's left of the viewport at any size; individual sections
   (e.g. .home-description's own percentage width) are what keep long-form
   text readable on a wide screen, not an outer cap here. */
body.sidebar-collapsed .content { margin-left: 65px; }

.section { display: none; }
.section.active { display: block; height: 100%; }

.sim-screen { display: none; }
.sim-screen.active { display: block; }

/* The code-editing screen fits the viewport exactly (like Compiler
   Explorer) so only the editor boxes scroll, never the page itself -- the
   toolbar and header are fixed height, the editor panel takes whatever
   space is left. Other screens (Results, Home, About) stay normal
   documents that scroll within .content when they overflow. */
#sim-code.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
#sim-code #sim-active { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#sim-code .toolbar { flex-shrink: 0; padding: 8px 14px; margin-bottom: 12px; }
#sim-code .panel.editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  overflow: hidden;
}

.sim-locked {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  color: var(--text-dim);
}
.sim-locked p { font-size: 16px; margin: 0; }

.lede { color: var(--text-dim); margin: 0 0 14px; font-size: 14px; line-height: 1.6; }

/* ---------- Home ---------- */

.home { max-width: 900px; margin: 0 auto; padding: 16px 0 32px; }
.home-hero { text-align: center; margin-bottom: 30px; }
.home-logo { width: 210px; max-width: 70%; height: auto; display: block; margin: 0 auto 22px; }
.home-title { max-width: 640px; margin: 0 auto 12px; font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; text-transform: none; color: var(--text); text-wrap: balance; }
.home-sub { max-width: 620px; margin: 0 auto; font-size: 15px; line-height: 1.6; color: var(--text-dim); }

.home-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.home-action {
  --accent: var(--purple);
  --accent-soft: rgba(124, 58, 237, 0.1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 26px 24px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 14px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.home-action:hover { border-color: var(--accent); box-shadow: 0 10px 28px rgba(31, 30, 29, 0.09); transform: translateY(-2px); }
.home-action-sim { --accent: var(--blue); --accent-soft: rgba(37, 99, 235, 0.1); }
.home-action-ch { --accent: var(--orange); --accent-soft: rgba(217, 119, 6, 0.12); }
.home-action-icon { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.home-action-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-action-title { font-size: 19px; font-weight: 700; color: var(--text); }
.home-action-desc { flex: 1; font-size: 13.5px; line-height: 1.55; color: var(--text-dim); }
.home-action-progress { font-size: 13px; font-weight: 600; color: var(--orange); }
.home-action-cta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  margin-top: 6px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.home-signin { margin: 22px 0 0; text-align: center; font-size: 13.5px; color: var(--text-dim); }
.home-foot {
  max-width: 680px;
  margin: 44px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}
.home-signin .link-btn, .home-foot .link-btn { font-size: inherit; }

@media (max-width: 700px) {
  .home { padding-top: 8px; }
  .home-actions { grid-template-columns: 1fr; }
  .home-title { font-size: 24px; }
}

/* A layout-only box -- no border/background of its own, just a narrower
   column than the page's full content width so the intro prose reads
   comfortably at a paragraph-length line width, with justified edges. 75%
   of .content (the space left after the sidebar), not a fixed px width, so
   it stays proportional as the sidebar collapses/expands or the viewport
   resizes. */
.home-description { width: 85%; }
/* Darker than the site-wide muted .lede color (--text-dim) -- these are the
   pages' main reading content, not secondary/caption text, so they get the
   full-contrast --text color instead. */
.home-description .lede { text-align: justify; color: var(--text); }
.home-description ul.lede { margin: 0 0 14px; padding-left: 24px; }
.home-description ul.lede li { margin-bottom: 4px; }
.home-description > h2:first-child { margin-top: 0; }


.hidden { display: none !important; }

/* Inline <code> spans in prose (About page, etc.) -- distinct from the
   full code-editor blocks above, just a small monospace pill so syntax
   references don't blend into the surrounding paragraph text. */
code {
  background: rgba(31, 30, 29, 0.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
  color: var(--text);
}

/* Side-by-side comparison cards (e.g. Assembly vs. C on the About page). */
.compare-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 6px; }
.compare-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.compare-card.accent-blue { border-top-color: var(--blue); }
.compare-card.accent-cyan { border-top-color: var(--cyan); }
.compare-card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.compare-card p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.6; }

/* ---------- Panels / forms ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.editor label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); flex: 1; }


/* The run outcome is the first tile of the results summary strip (it also
   carries .stat-tile), tinted by how the run ended. */
.run-outcome { cursor: default; }
.run-outcome.ok { background: rgba(5, 150, 105, 0.08); color: var(--green); border-color: rgba(5, 150, 105, 0.25); border-top-color: var(--green); }
.run-outcome.warning { background: rgba(192, 57, 43, 0.08); color: var(--danger); border-color: rgba(192, 57, 43, 0.25); border-top-color: var(--danger); }

/* Outcome + stat tiles share one grid: .summary-grid's own box is dropped
   (display: contents) so the tiles renderSummary() writes into it flow as
   siblings of the outcome tile. */
.results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.results-summary .summary-grid { display: contents; }
.results-summary .run-outcome { grid-column: span 2; }

.results-diagram { margin-bottom: 14px; }
.dash-pane { margin-bottom: 14px; }
.dash-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Only the compact dashboard layout uses tabs (see the media queries at the
   end of this file). */
#sim-results .dash-tabs { display: none; }
.dash-code .disasm {
  height: 140px;
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--code-border);
  border-radius: 8px;
}

/* Background-job completion toasts -- a simulation submitted while browsing
   elsewhere finishes silently server-side; this is the only signal the user
   gets, so it needs to survive navigation (fixed, not inside .content) and
   stack if more than one job finishes before being dismissed. */
.notifications {
  position: fixed;
  top: 140px;
  right: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}
.notification {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.notification.ok { background: rgba(5, 150, 105, 0.1); color: var(--green); border-color: rgba(5, 150, 105, 0.3); }
.notification.error { background: rgba(192, 57, 43, 0.1); color: var(--danger); border-color: rgba(192, 57, 43, 0.3); }
.notification-text { flex: 1; }
.notification-dismiss {
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.7;
}
.notification-dismiss:hover { opacity: 1; border-color: transparent; }

.cookie-banner {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}
.cookie-banner p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.cookie-banner button { flex-shrink: 0; }

/* Read-only and usually just a handful of lines -- 260px left a mostly
   empty dark box for any typical program. Caps to a more realistic size;
   .code-highlight already scrolls internally (overflow-y: auto) for
   anything longer. */
.results-source-editor { height: 140px; margin-bottom: 4px; }
/* This view has no <textarea> at all (read-only, nothing to type into), so
   .code-highlight is the only layer present -- its usual pointer-events:none
   (needed elsewhere to let clicks/scroll pass through to the textarea
   underneath) leaves nothing to receive scroll/click here at all. */
.results-source-editor .code-highlight { pointer-events: auto; }

.lang-toggle { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 2px; box-sizing: border-box; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.lang-btn { height: 100%; box-sizing: border-box; background: transparent; border: none; border-radius: 6px; padding: 0 12px; font-size: 12px; font-weight: 500; color: var(--text-dim); cursor: pointer; }
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--purple); color: #fff; }

.disasm {
  background: var(--code-bg);
  color: var(--code-text);
  border-color: var(--code-border);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  margin-top: 10px;
  margin-bottom: 0;
}

input, textarea, select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--purple); outline-offset: -1px; }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.toolbar-field { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.toolbar-field input, .toolbar-field select { width: 80px; height: 32px; padding: 0 8px; box-sizing: border-box; }
.toolbar #run-btn { height: 32px; padding: 0 16px; }
.toolbar-status { flex: 1; min-width: 120px; text-align: right; }

.editor-row { display: flex; gap: 20px; align-items: stretch; flex: 1; min-height: 0; }
.editor-row .grow { flex: 1; min-width: 0; }
textarea { resize: none; line-height: 1.5; }

/* ---------- Code editor (wrapping, in-line gutter numbers, syntax highlight) ---------- */

.editor-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.editor-label { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.preview-status { font-size: 11px; font-style: italic; }

.code-editor {
  position: relative;
  flex: 1;
  min-height: 160px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  overflow: hidden;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 20px;
}

/* Purely decorative -- a static strip behind the gutter numbers, which
   actually live inside .code-highlight so they scroll with the content and
   can never drift out of sync with wrapped line heights. */
.code-gutter-bg {
  position: absolute;
  inset: 0 auto 0 0;
  width: 46px;
  background: var(--code-gutter-bg);
  border-right: 1px solid var(--code-border);
  pointer-events: none;
  z-index: 0;
}

.code-highlight, .code-input {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 14px 12px 58px;
  font: inherit;
  line-height: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  overflow-x: hidden;
  tab-size: 4;
  scrollbar-width: thin; /* Firefox */
}

/* Same reasoning as .content's scrollbar rules above -- without this,
   Windows renders its default scrollbar here, with the clickable up/down
   arrow buttons at each end that read as a stray, unexplained icon
   floating in the corner of the code box. */
.code-highlight::-webkit-scrollbar, .code-input::-webkit-scrollbar { width: 8px; }
.code-highlight::-webkit-scrollbar-track, .code-input::-webkit-scrollbar-track { background: transparent; }
.code-highlight::-webkit-scrollbar-thumb, .code-input::-webkit-scrollbar-thumb { background: var(--code-border); border-radius: 4px; }
.code-highlight::-webkit-scrollbar-thumb:hover, .code-input::-webkit-scrollbar-thumb:hover { background: var(--code-text); }

.code-highlight { color: var(--code-text); pointer-events: none; z-index: 1; }

.code-line { position: relative; min-height: 20px; }
.gutter-num {
  position: absolute;
  left: -48px;
  top: 0;
  width: 30px;
  text-align: right;
  color: var(--code-line);
  user-select: none;
}

.code-input {
  background: transparent;
  color: transparent;
  caret-color: var(--code-text);
  border: none;
  resize: none;
  outline: none;
  z-index: 2;
}
.code-input::selection { background: rgba(124, 58, 237, 0.35); }
.code-readonly .code-input { caret-color: transparent; cursor: default; }

.tok-kw { color: var(--tok-kw); }
.tok-reg { color: var(--tok-reg); }
.tok-num { color: var(--tok-num); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-str { color: var(--tok-str); }
.tok-type { color: var(--tok-type); }
.tok-pre { color: var(--tok-pre); }
.tok-label { color: var(--tok-label); }
.tok-addr { color: var(--tok-addr); }

button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { border-color: var(--purple); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--purple); color: #fff; border-color: var(--purple); font-weight: 600; }
button.primary:hover { background: #6d28d9; }
button.ghost { background: transparent; }
button.small { padding: 6px 10px; font-size: 12px; }

.status { font-size: 12px; color: var(--text-dim); min-height: 16px; }
.status.error { color: var(--danger); }

.contact-form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin-top: 8px; }
.contact-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.contact-field textarea { resize: vertical; font-family: inherit; }
.contact-form button[type="submit"] { align-self: flex-start; padding: 9px 20px; }

.downloads { display: flex; gap: 8px; }

/* ---------- Cycle nav / pipeline stages ---------- */

.cycle-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
}
/* The slider lives inside the nav bar (taking whatever width is left)
   instead of on a row of its own. */
.cycle-nav .cycle-slider { flex: 1 1 160px; width: auto; margin: 0; }
.cycle-label { font-size: 11px; letter-spacing: 0.04em; color: var(--text-dim); text-transform: uppercase; }
.cycle-label strong { color: var(--text); font-size: 14px; margin-left: 6px; }
.cycle-count { margin-left: auto; color: var(--text-dim); font-size: 12px; }

#play-btn.playing { background: var(--danger); border-color: var(--danger); color: #fff; }
#play-speed { width: 64px; height: 36px; padding: 0 6px; font-size: 12px; }

.cycle-jump { display: flex; align-items: center; gap: 6px; }
.cycle-jump label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.cycle-jump input {
  width: 80px; height: 28px; padding: 0 8px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); font-size: 12px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cycle-jump input::-webkit-outer-spin-button, .cycle-jump input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cycle-slider {
  display: block;
  width: 100%;
  height: 20px;
  margin: 0 0 16px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.cycle-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border); }
.cycle-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border); }
.cycle-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--purple);
  margin-top: -5px;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--purple);
}
.cycle-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--purple); border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--purple);
}

/* ---------- Datapath diagram ---------- */
/* A fixed-viewBox SVG, so it scales to the container width with no JS
   resize handling -- every element below is sized/positioned in the same
   diagram units used when it was authored (see index.html). */
.datapath {
  display: block;
  /* Capped and centered instead of width:100% -- it was authored at 940
     diagram units and stretching to a wide .content (1300px+ on a normal
     laptop) just scaled it (and the vertical scroll it costs) up well past
     its native, perfectly legible size for no benefit. */
  width: 100%;
  max-width: 820px;
  height: auto;
  margin: 0 auto 16px;
  font-family: "SF Mono", Consolas, monospace;
}

.dp-box rect {
  fill: var(--card);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke 0.15s, fill 0.15s;
}
.dp-box text {
  fill: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}
.dp-box-sub {
  font-size: 11px !important;
  font-weight: 400 !important;
  fill: var(--text-dim) !important;
}

/* Pipeline registers (IF/ID, ID/EX, EX/MEM, MEM/WB): thin bars, not boxes
   with room for a label inside -- the name sits above instead. */
/* Lighter than a solid dark fill on purpose -- at the original var(--text-dim)
   fill these read as four black walls cutting across the diagram instead of
   registers, out of proportion with how little space they actually take. */
.dp-box-latch rect { fill: var(--border); stroke: none; }
.dp-box-latch text { font-size: 10px; font-weight: 700; fill: var(--text-dim); text-anchor: start; }

.dp-box-dim rect { stroke-dasharray: 4 3; }
.dp-box-dim text { fill: var(--text-dim); font-weight: 400; }

/* A bubble (no real instruction, or a flush-inserted nop) in a stage that
   normally carries real work -- same dashed/dim language as the structurally
   idle Hazard Unit box above, just applied per-cycle instead of always on. */
.dp-box.bubble rect { stroke-dasharray: 4 3; opacity: 0.6; }
.dp-box.bubble text { fill: var(--text-dim); font-weight: 400; }

/* IMEM/DMEM: the physical memories, each lighting up only the cycles
   they're actually accessed -- same condition the old per-stage cards used. */
.dp-box-mem.active rect { stroke: var(--if-color); stroke-width: 2; }
.dp-box-mem .dp-dot { fill: var(--border); transition: fill 0.15s; }
.dp-box-mem.active .dp-dot { fill: var(--if-color); }
#dp-dmem.active rect { stroke: var(--mem-color); }
#dp-dmem.active .dp-dot { fill: var(--mem-color); }

/* BTB only exists in the elaborated design on OrchidCore V3 -- dimmed on
   V1/V2 (see renderDatapath), not per-cycle, since there's nothing to light
   up when it's simply not part of the build. */
.dp-box-btb rect { stroke-dasharray: 4 3; opacity: 0.45; transition: opacity 0.15s; }
.dp-box-btb text { fill: var(--text-dim); }
.dp-box-btb.enabled rect { stroke: var(--id-color); stroke-dasharray: none; opacity: 1; }
.dp-box-btb.enabled text { fill: var(--text); }

/* Colored by stage and solidly "on" -- the backbone is never idle in a
   healthy pipeline, unlike the hazard/forwarding wires below, which really
   are occasional (see index.html's comment on #dp-backbone). */
.dp-bb { stroke-width: 1.5; fill: none; opacity: 0.85; }
.dp-bb-if { stroke: var(--if-color); }
.dp-bb-id { stroke: var(--id-color); }
.dp-bb-ex { stroke: var(--ex-color); }
.dp-bb-mem { stroke: var(--mem-color); }
.dp-bb-wb { stroke: var(--wb-color); }

/* Wires: dim/grey until the condition that puts a real value on them this
   cycle is true (see renderDatapath) -- same "only light up when actually
   active" idea the IMEM/DMEM boxes already use. Faint enough at rest that
   seven of them idle at once doesn't read as visual noise; only the one
   that's actually carrying something this cycle should draw the eye. */
.dp-wire { stroke: var(--border); stroke-width: 1.2; fill: none; opacity: 0.3; transition: stroke 0.15s, opacity 0.15s, stroke-width 0.15s; }
.dp-wire.active { opacity: 1; stroke-width: 2.25; }
.dp-wire-ex.active { stroke: var(--ex-color); }
.dp-wire-wb.active { stroke: var(--wb-color); }
.dp-wire-ctrl.active { stroke: var(--id-color); }
.dp-wire-btb { stroke-dasharray: 4 3; opacity: 0.3; }
.dp-wire-btb.enabled { opacity: 0.7; stroke-dasharray: none; }
.dp-wire-btb.active { stroke: var(--id-color); }

.dp-label { font-size: 10px; font-weight: 600; fill: var(--text-dim); opacity: 0.6; transition: opacity 0.15s, fill 0.15s; }
/* Bus width in bits, same convention the reference datapath diagram uses --
   purely informational (every wire here is a fixed 32-bit RV32I bus except
   the 1-bit stall/flush/predict controls, which carry no width label), so
   unlike dp-label these never need to react to activity state. */
.dp-bits { font-size: 9px; fill: var(--text-dim); opacity: 0.5; text-anchor: middle; }
.dp-label-ex.active { fill: var(--ex-color); opacity: 1; }
.dp-label-wb.active { fill: var(--wb-color); opacity: 1; }
.dp-label-ctrl.active { fill: var(--id-color); opacity: 1; }
.dp-label-btb { opacity: 0.3; }
.dp-label-btb.enabled { opacity: 0.7; }
.dp-label-btb.active { fill: var(--id-color); opacity: 1; }

/* Hover affordance: every box and wire is hoverable (see DIAGRAM_HOVER in
   app.js) to show its current signal values in #signal-desc below, without
   scrolling down to hunt for it in the Signals grid. Wires get an invisible
   wide hit-path laid just before the thin visible one so hovering doesn't
   require pixel-precision on a 1-2px line; ":hover + .dp-wire" lights up
   its real sibling through that same hit-path. */
.dp-box { cursor: help; }
.dp-box:hover rect { stroke: var(--purple); }
.dp-wire-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: help; pointer-events: stroke; }
.dp-wire-hit:hover + .dp-wire { opacity: 1; stroke: var(--purple); stroke-width: 2.25; }

/* Forwarding Unit: the real forwarding_unit module (separate from
   pipeline_controller, which only decides stall/flush) that actually
   selects fa/fb -- lights up the same cyan as the fwd A/B wires it drives,
   on the same condition, instead of looking like structurally-always-dim
   control logic the way Pipeline Ctrl correctly does. */
#dp-fwdunit.active rect { stroke: var(--ex-color); stroke-dasharray: none; }
#dp-fwdunit.active text { fill: var(--text); }

.hover-desc {
  font-size: 12px;
  color: var(--text-dim);
  padding: 10px 16px;
}

/* ---------- Datapath / pipeline timeline switch ---------- */

.view-toggle { height: 28px; margin-bottom: 8px; }
.results-diagram[data-view="datapath"] .timeline { display: none; }
.results-diagram[data-view="timeline"] .datapath { display: none; }

.timeline {
  overflow: auto;
  height: 420px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
}
.tl-legend {
  position: sticky;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  color: var(--text-dim);
}
.tl-key { display: inline-block; min-width: 30px; padding: 1px 4px; border-radius: 4px; text-align: center; font-family: "SF Mono", Consolas, monospace; font-weight: 600; }
.tl-legend-text { margin-right: 8px; }
.tl-legend-dim { margin-left: auto; }

.tl-table { border-collapse: separate; border-spacing: 0; }
.tl-table th, .tl-table td { height: 22px; padding: 0; }
/* Keep in sync with TL_COL_W / TL_LABEL_W in app.js. */
.tl-cyc {
  position: sticky; top: 0; z-index: 1;
  width: 34px; min-width: 34px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.tl-cyc:hover { color: var(--purple); }
.tl-cyc.tl-now { background: var(--purple); color: #fff; border-radius: 4px 4px 0 0; }
th.tl-label {
  position: sticky; top: 0; left: 0; z-index: 3;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
}
td.tl-label {
  position: sticky; left: 0; z-index: 2;
  width: 190px; min-width: 190px; max-width: 190px;
  padding: 0 8px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-cell { text-align: center; font-size: 10.5px; font-weight: 600; }
.tl-cell.tl-now { box-shadow: inset 1px 0 0 var(--purple), inset -1px 0 0 var(--purple); background-color: rgba(124, 58, 237, 0.05); }
.tl-IF { background: color-mix(in srgb, var(--if-color) 18%, transparent); color: var(--if-color); }
.tl-ID { background: color-mix(in srgb, var(--id-color) 18%, transparent); color: var(--id-color); }
.tl-EX { background: color-mix(in srgb, var(--ex-color) 18%, transparent); color: var(--ex-color); }
.tl-MEM { background: color-mix(in srgb, var(--mem-color) 18%, transparent); color: var(--mem-color); }
.tl-WB { background: color-mix(in srgb, var(--wb-color) 18%, transparent); color: var(--wb-color); }
.tl-stall {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--id-color) 22%, transparent) 0 3px, transparent 3px 7px);
  color: var(--id-color);
  font-style: italic;
}
.tl-x { color: var(--danger); font-weight: 700; }
.tl-key.tl-x { background: rgba(192, 57, 43, 0.08); }
.tl-active td.tl-label { font-weight: 600; color: var(--text); }
.tl-discarded td.tl-label { text-decoration: line-through; color: var(--text-dim); }
.tl-startup td.tl-label { color: var(--text-dim); font-style: italic; }
.tl-startup .tl-cell { opacity: 0.5; }

h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 14px 0 8px;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 8px;
}
.signals-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
/* Wide enough for a full "0xDEADBEEF" (10 characters) hex value at
   .cell .value's font-size without wrapping or clipping. */
.registers-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.summary-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.stat-tile.accent-purple { border-top-color: var(--purple); }
.stat-tile.accent-blue { border-top-color: var(--blue); }
.stat-tile.accent-cyan { border-top-color: var(--cyan); }
.stat-tile.accent-green { border-top-color: var(--green); }
.stat-tile.accent-orange { border-top-color: var(--orange); }
.stat-tile .stat-label { font-size: 11px; color: var(--text-dim); }
.stat-tile .stat-value { font-family: "SF Mono", Consolas, monospace; font-size: 20px; font-weight: 600; margin-top: 4px; }
.stat-tile .stat-caption { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.cell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: default;
}

.entity-admin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.entity-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.entity-admin-actions { display: flex; gap: 8px; flex-shrink: 0; }
.entity-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.entity-progress-head h2 { margin: 0; }
.entity-progress-member summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; cursor: pointer; }
.entity-progress-member summary .name { font-size: 13px; color: var(--text); font-weight: 600; }
.entity-progress-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.entity-progress-summary strong { color: var(--orange); }
.entity-progress-core { font-family: "SF Mono", Consolas, monospace; }
.entity-progress-table { margin-top: 10px; }
.entity-progress-table td:last-child { font-family: "SF Mono", Consolas, monospace; color: var(--text-dim); }
.cell.signal { cursor: help; }
.cell.signal:hover { border-color: var(--purple); }
.cell .name { font-size: 11px; color: var(--text-dim); }
.sig-src { font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 4px; border-radius: 3px; margin-left: 4px; border: 1px solid currentColor; opacity: 0.8; }
.sig-src-reg { color: var(--blue); }
.sig-src-comb { color: var(--cyan); }
.sig-src-ctrl { color: var(--orange); }
.cell .value { font-family: "SF Mono", Consolas, monospace; font-size: 13px; margin-top: 2px; }
.cell.nonzero .value { color: var(--purple); font-weight: 600; }

.mem-hexdump {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 320px;
  overflow-y: auto;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
}
.mem-row { color: var(--text-dim); white-space: pre; }
.mem-row.nonzero { color: var(--text); }
.mem-row .mem-addr { color: var(--text-dim); }
.mem-row.nonzero .mem-hex { color: var(--purple); font-weight: 600; }
.mem-row .mem-ascii { color: var(--cyan); }
.mem-row.mem-gap { font-style: italic; opacity: 0.7; }

.btb-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 320px;
  overflow-y: auto;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12.5px;
}
.btb-row {
  display: grid;
  grid-template-columns: 1fr 2fr 3fr 1.5fr 2fr;
  gap: 8px;
  padding: 3px 0;
  color: var(--text);
}
.btb-row.btb-header { color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 4px; }
.btb-index { color: var(--text-dim); }
.btb-hex { color: var(--purple); }
.btb-dir-taken { color: var(--green); }
.btb-dir-not-taken { color: var(--text-dim); }
.btb-empty { color: var(--text-dim); padding: 6px 0; }

/* ---------- Results dashboard ---------- */
/* On a large enough viewport the Results screen is a fixed-height
   dashboard: the page itself never scrolls, each data pane scrolls inside
   itself instead. Two layouts share the styles in this first block:
   - full (>= 1200x680): every panel visible at once, beside/below the
     diagram;
   - compact (down to 1000x540): the diagram plus ONE tabbed panel
     (summary / code / signals / registers / memory / BTB).
   Below that it falls back to the plain stacked layout above. */
@media (min-width: 1000px) and (min-height: 540px) {
  .content:has(> #section-simulator.active > #sim-results.active) { padding: 66px 20px 14px; }

  #sim-results.active { display: grid; height: 100%; min-height: 0; gap: 10px; }

  #sim-results .stat-tile { padding: 5px 10px; border-top-width: 2px; }
  #sim-results .stat-tile .stat-value { font-size: 15px; margin-top: 1px; }
  #sim-results .stat-tile .stat-label,
  #sim-results .stat-tile .stat-caption { font-size: 10px; }
  #sim-results .cycle-nav { grid-area: nav; margin: 0; padding: 6px 12px; flex-wrap: nowrap; }

  .results-diagram { grid-area: diagram; display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; margin: 0; }
  .results-diagram .datapath { flex: 1 1 0; min-height: 0; width: 100%; height: 100%; max-width: none; margin: 0; }
  .results-diagram .hover-desc { flex: none; height: 48px; overflow-y: auto; margin: 0; padding: 6px 12px; line-height: 1.45; }
  .results-diagram .view-toggle { flex: none; align-self: flex-start; margin: 0; }
  .results-diagram .timeline { flex: 1 1 0; min-height: 0; height: auto; margin: 0; }

  .dash-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
  }
  .dash-pane-head { flex: none; min-height: 32px; padding: 4px 10px; border-bottom: 1px solid var(--border); background: var(--panel); }
  .dash-pane-head h2 { margin: 0; font-size: 11px; }
  .dash-pane-head button.small { padding: 2px 8px; font-size: 11px; }
  .dash-pane-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    padding: 4px 10px;
    align-content: start;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  /* Code pane: the source / compiled view fills the whole pane body. */
  .dash-code .dash-pane-body { display: flex; flex-direction: column; padding: 0; }
  .dash-code .results-source-editor,
  .dash-code .disasm { flex: 1 1 0; min-height: 0; height: auto; margin: 0; border: none; border-radius: 0; }

  /* Signals and registers become dense name/value rows (like a debugger's
     watch window) instead of cards, so far more fit in a pane at once. */
  .dash-signals .signals-grid { grid-template-columns: 1fr; gap: 0; }
  .dash-regs .registers-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 14px; }
  .dash-pane .cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 2px;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
  }
  .dash-pane .cell.signal:hover { background: var(--panel); }
  /* Signal rows: name | source tag | value, with the tags lined up in one
     column down the middle instead of trailing each name. .name's box is
     dropped so its label text and tag become separate grid items. */
  .dash-signals .cell.signal {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
  }
  .dash-signals .cell.signal .name { display: contents; }
  .dash-signals .cell.signal .sig-src { margin: 0; justify-self: center; }
  .dash-signals .cell.signal .value { justify-self: end; }
  .dash-pane .cell .name { min-width: 0; }
  .dash-pane .cell .value { margin: 0; font-size: 12px; white-space: nowrap; flex: none; }

  .dash-pane-body.mem-hexdump,
  .dash-pane-body.btb-table { border: none; border-radius: 0; max-height: none; background: transparent; font-size: 11.5px; padding: 6px 10px; }
  .dash-btb .btb-row { gap: 6px; }
}

/* Full layout: summary + nav on top, diagram in the middle, code/signals
   beside it, registers/memory/BTB below it. */
@media (min-width: 1200px) and (min-height: 680px) {
  #sim-results.active {
    grid-template-columns: minmax(0, 1fr) clamp(320px, 27%, 480px);
    grid-template-rows: auto auto minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-areas:
      "summary summary"
      "nav     nav"
      "diagram side"
      "bottom  side";
  }

  /* Always one row here (a second row of tiles would come straight out of
     the diagram's height) -- labels wrap inside a tile instead. */
  #sim-results .results-summary {
    grid-area: summary;
    margin: 0;
    gap: 6px;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .results-side { grid-area: side; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  .dash-code { flex: 2 1 0; }
  .dash-signals { flex: 3 1 0; }
  .results-bottom { grid-area: bottom; display: flex; gap: 10px; min-height: 0; min-width: 0; }
  .results-bottom .dash-pane { flex: 1 1 0; min-width: 0; }
  .results-bottom .dash-mem { flex-grow: 1.3; }
}

/* Compact layout: whatever the dashboard range covers that the full layout
   doesn't (narrower than 1200px, or shorter than 680px). The diagram keeps
   the whole left side; on the right, the outcome tile stays visible above
   one tabbed panel. The wrappers' boxes are dropped (display: contents) so
   the stats grid and every pane sit directly in the same "panel" grid
   area -- only the active tab's one is displayed (see setDashTab in
   app.js). */
@media (min-width: 1000px) and (max-width: 1199.98px) and (min-height: 540px),
       (min-width: 1000px) and (min-height: 540px) and (max-height: 679.98px) {
  #sim-results.active {
    grid-template-columns: minmax(0, 1fr) clamp(300px, 32%, 420px);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "nav     nav"
      "diagram outcome"
      "diagram tabs"
      "diagram panel";
  }
  #sim-results .results-summary,
  #sim-results .results-side,
  #sim-results .results-bottom { display: contents; }

  #sim-results .run-outcome { grid-area: outcome; }
  #sim-results .dash-tabs { grid-area: tabs; display: flex; width: 100%; height: 30px; }
  #sim-results .dash-tabs .lang-btn { flex: 1 1 auto; padding: 0 6px; font-size: 11px; }

  #sim-results .dash-pane,
  #sim-results .summary-grid { grid-area: panel; display: none; }
  #sim-results[data-tab="summary"] .summary-grid { display: grid; }
  #sim-results[data-tab="code"] .dash-code,
  #sim-results[data-tab="signals"] .dash-signals,
  #sim-results[data-tab="regs"] .dash-regs,
  #sim-results[data-tab="mem"] .dash-mem,
  #sim-results[data-tab="btb"] .dash-btb { display: flex; }
  /* The tab already names the panel; only the code pane keeps its header,
     for the language and the Source/Compiled switch. */
  #sim-results .dash-pane:not(.dash-code) .dash-pane-head { display: none; }

  #sim-results .summary-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    align-content: start;
    gap: 6px;
    min-height: 0;
    overflow: auto;
  }

  /* A narrower nav bar: smaller buttons, and the slider gives up width
     first. */
  #sim-results .cycle-nav { gap: 10px; }
  #sim-results .cycle-nav button { padding: 6px 10px; }
  #sim-results .cycle-nav .cycle-slider { flex-basis: 80px; min-width: 60px; }
  .results-diagram .hover-desc { height: 40px; }
}

/* ---------- Responsive ---------- */

/* ---------- Challenges ---------- */

#section-challenges.active { display: flex; flex-direction: column; }
#ch-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ch-screen { display: none; }
.ch-screen.active { display: block; }

.ch-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-head h2 { margin: 0; }
.ch-lang-toggle { margin-left: auto; }

.ch-core-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 6px; }
.ch-core-card, .ch-level-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  border-top: 3px solid var(--purple);
}
.ch-core-card:hover:not(:disabled), .ch-level-card:hover:not(:disabled) { border-color: var(--purple); }
.ch-core-card:disabled, .ch-level-card:disabled { cursor: not-allowed; opacity: 0.55; border-top-color: var(--border); }
.ch-core-name { font-size: 18px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.ch-core-name span { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.ch-core-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; flex: 1; }
.ch-core-foot, .ch-level-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.ch-total-stars { color: var(--orange); font-weight: 600; }
.ch-soon { font-style: italic; }

.ch-rules { margin: 12px 0; font-size: 13px; line-height: 1.6; }
.ch-rules h3 { margin: 0 0 6px; font-size: 13px; }
.ch-rules ul { margin: 0; padding-left: 20px; }
.ch-rules li { margin-bottom: 3px; }

.ch-level-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ch-level-card { border-top-color: var(--blue); }
.ch-level-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ch-level-num { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.ch-level-title { font-size: 15px; font-weight: 600; }
.ch-level-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; flex: 1; }

.ch-tag { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.ch-tag-data { background: rgba(124, 58, 237, 0.1); color: var(--purple); }
.ch-tag-branch { background: rgba(217, 119, 6, 0.12); color: var(--orange); }

.ch-stars { letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.ch-star { color: var(--border); }
.ch-star.on { color: var(--orange); }

/* Play screen: brief on the left, editor on the right; fits the viewport
   (only the brief and the editor scroll) like the simulator's code screen. */
#ch-play.active {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}
.ch-brief { margin: 0; overflow-y: auto; min-height: 0; }
.ch-title { font-size: 18px; margin: 12px 0 6px; }
.ch-goal { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; }

.ch-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ch-table th { text-align: left; font-weight: 600; font-size: 11px; color: var(--text-dim); padding: 4px 6px; border-bottom: 1px solid var(--border); }
.ch-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); font-family: "SF Mono", Consolas, monospace; }
.ch-table td:last-child { font-family: inherit; color: var(--text-dim); }
.ch-memory tr.ch-out td:last-child { color: var(--purple); font-weight: 600; }

.ch-scores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.ch-scores .stat-tile { padding: 8px 10px; }
.ch-scores .stat-value { font-size: 18px; }

.ch-hint { font-size: 13px; line-height: 1.55; }
.ch-hint summary { cursor: pointer; font-weight: 600; color: var(--purple); }
.ch-hint p { margin: 8px 0 0; }

.ch-work { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.ch-work .ch-toolbar { margin: 0; padding: 8px 14px; flex-shrink: 0; }
.ch-toolbar #ch-run-btn { height: 32px; padding: 0 20px; }
.ch-instr-count { font-size: 12px; color: var(--text-dim); font-family: "SF Mono", Consolas, monospace; }
.ch-instr-count.over { color: var(--danger); font-weight: 600; }
.ch-work .code-editor { flex: 1; min-height: 240px; }

.ch-result {
  flex-shrink: 0;
  max-height: 40%;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}
.ch-result.good { background: rgba(5, 150, 105, 0.07); border-color: rgba(5, 150, 105, 0.3); border-left-color: var(--green); }
.ch-result.meh { background: rgba(217, 119, 6, 0.07); border-color: rgba(217, 119, 6, 0.3); border-left-color: var(--orange); }
.ch-result.bad { background: rgba(192, 57, 43, 0.06); border-color: rgba(192, 57, 43, 0.3); border-left-color: var(--danger); }
.ch-result-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-result.good .ch-result-head strong { color: var(--green); }
.ch-result.bad .ch-result-head strong { color: var(--danger); }
.ch-result-actions { margin-left: auto; display: flex; gap: 8px; }
.ch-result-detail { margin-top: 4px; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ch-new-best { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--purple); }
.ch-check { margin-top: 8px; max-width: 420px; }
.ch-check td:last-child { font-family: "SF Mono", Consolas, monospace; color: var(--text); }
.ch-check tr.ch-mismatch td { color: var(--danger); }
.ch-error { margin: 6px 0 0; font-size: 12px; white-space: pre-wrap; font-family: "SF Mono", Consolas, monospace; }

/* Not enough room for side by side: stack, and let the page scroll. */
@media (max-width: 900px), (max-height: 560px) {
  #ch-body { display: block; }
  #ch-play.active { display: flex; flex-direction: column; height: auto; }
  .ch-brief, .ch-work { flex-shrink: 0; }
  .ch-brief { overflow: visible; }
  .ch-work .code-editor { flex: none; height: 380px; }
  .ch-result { max-height: none; }
}

/* Sidebar auto-collapses to its icon rail below this width (app.js mirrors
   the breakpoint to drive the same .collapsed/.sidebar-collapsed classes the
   manual fold button uses, so topbar/content offsets stay in sync with it
   automatically -- nothing sidebar-specific needed here). */
@media (max-width: 720px) {
  .content { padding: 72px 20px 32px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: 13px; }
  .account-name { max-width: 90px; }

  /* Compiler-Explorer-style side-by-side editors don't fit a phone-width
     screen -- stack them and let each keep its own scroll instead of
     squeezing three columns down to unreadable widths. */
  .editor-row { flex-direction: column; overflow-y: auto; }
  .editor-main.grow { flex: none; height: 260px; }
  #sim-code .panel.editor { overflow-y: auto; }

  /* 75% of an already-narrow phone-width content area leaves too little
     room for justified prose -- go full width below the desktop breakpoint. */
  .home-description { width: 100%; }
}

@media (max-width: 480px) {
  /* Title + auth + the Results screen's back/download buttons no longer
     fit one 56px row at phone width -- wrap onto a second row (its own
     horizontal scroller) instead of clipping/overlapping the Log in
     button. .content's padding-top grows to match the now-taller topbar. */
  .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding: 8px 14px; row-gap: 6px; }
  .topbar-title { order: 1; flex: 1 1 auto; }
  .topbar-auth { order: 2; margin-left: 0; }
  .topbar-actions { order: 3; flex: 1 1 100%; }
  .content { padding-top: 108px; }
}

/* ---------- Subscribe ---------- */

.subscribe { max-width: 980px; }
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.price-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.price-card-main { border: 2px solid var(--purple); box-shadow: 0 10px 28px rgba(124, 58, 237, 0.1); }
.price-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; font-size: 14px; font-weight: 700; }
.price-period { height: 28px; }
.price-period .lang-btn { padding: 0 10px; font-size: 11.5px; }
.price-amount { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.price-amount span { font-size: 14px; font-weight: 500; color: var(--text-dim); letter-spacing: 0; }
.price-amount-text { font-size: 26px; }
.price-desc { margin: 0; min-height: 40px; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.price-list { flex: 1; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--border); list-style: none; font-size: 13px; line-height: 1.5; }
.price-list li { position: relative; padding-left: 20px; margin-bottom: 6px; }
.price-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.price-btn { align-self: stretch; margin-top: 4px; }
.price-foot { margin: 14px 0 22px; font-size: 13px; color: var(--text-dim); }
@media (max-width: 860px) { .price-grid { grid-template-columns: 1fr; } }

.subscribe-form { display: flex; flex-direction: column; gap: 14px; max-width: 720px; margin-top: 8px; }
.subscribe-form > .lang-toggle { align-self: flex-start; }
.subscribe-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); }
.subscribe-form input, .subscribe-form textarea { font-size: 14px; padding: 8px 10px; }
.subscribe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.subscribe-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.subscribe-signin { max-width: 720px; margin-top: 8px; }
.subscribe-signin .lede { margin-bottom: 12px; }
.subscribe-pending { max-width: 720px; padding: 8px 12px; border-left: 3px solid var(--orange); background: rgba(217, 119, 6, 0.06); border-radius: 6px; }
#subscribe-email[readonly] { background: var(--panel); color: var(--text-dim); }

/* ---------- Admin (super admin) ---------- */

.admin-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-summary { font-size: 12px; color: var(--text-dim); }
.admin-summary.error { color: var(--danger); }
.admin-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.lang-btn.active .admin-badge { background: #fff; color: var(--purple); }
.admin-tab { display: flex; flex-direction: column; gap: 10px; }
.admin-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.admin-card-pending { border-left: 3px solid var(--orange); }
.admin-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-card-body { font-size: 13px; line-height: 1.5; }
.admin-notes { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--panel); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-dim); }
.admin-actions, .admin-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-row-actions { min-width: 260px; }
.admin-dim { font-size: 12px; color: var(--text-dim); }
.admin-strong { font-weight: 600; }
.admin-note { font-size: 12px; color: var(--text-dim); margin: 0; }
.admin-danger { color: var(--danger); }
.admin-danger:hover { border-color: var(--danger); }
.admin-request-status { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.admin-request-pending { color: var(--orange); }
.admin-request-resolved { color: var(--green); }
.admin-request-rejected { color: var(--danger); }
.admin-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; padding: 10px 12px; }
.admin-form input, .admin-form select { height: 30px; padding: 0 8px; font-size: 13px; }
.admin-form label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.admin-member-form { background: var(--panel); border-radius: 8px; }
.admin-check input { height: auto; }
.admin-date { height: 28px; padding: 0 6px; font-size: 12px; }
.admin-seats { width: 70px; height: 28px; padding: 0 6px; font-size: 12px; }
.admin-toolbar { display: flex; align-items: center; gap: 12px; }
.admin-toolbar input { flex: 1; max-width: 420px; height: 32px; padding: 0 10px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table td { font-family: inherit; color: var(--text); vertical-align: middle; }
.admin-table td:last-child { color: var(--text); }
.admin-secret { display: flex; flex-direction: column; gap: 8px; border-left: 3px solid var(--green); }
.admin-secret-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-password { font-size: 14px; font-weight: 700; user-select: all; }

/* Free tier: V1 only */
.core-free-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
#core-toggle .lang-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ch-needs-sub { color: var(--purple); font-weight: 600; }
.ch-core-card.paywalled { border-top-color: var(--border); }
.ch-core-card.paywalled .ch-core-name { color: var(--text-dim); }

.subscribe-other { margin: 14px 0 0; font-size: 13px; color: var(--text-dim); }
.subscribe-other .link-btn, #section-contact .lede .link-btn { font-size: inherit; }
.admin-reply { font-size: 12.5px; font-weight: 600; color: var(--purple); text-decoration: none; margin-right: auto; align-self: center; }
.admin-reply:hover { text-decoration: underline; }
#admin-tab-messages .admin-notes { color: var(--text); }

/* Companies: one wide card under the plans, leading to the Contact page. */
.price-card-wide { flex-direction: row; align-items: center; gap: 24px; margin-top: 16px; }
.price-card-wide .price-desc { min-height: 0; margin-top: 6px; max-width: 640px; }
.price-wide-text { flex: 1; }
.price-card-wide .price-btn { align-self: center; flex-shrink: 0; min-width: 160px; margin-top: 0; }
@media (max-width: 860px) {
  .price-card-wide { flex-direction: column; align-items: stretch; }
  .price-card-wide .price-btn { align-self: stretch; }
}
