/* =========================================================================
 *  Akismpo theme for Bootstrap 5
 *  A monospace, terminal-flavoured light/dark theme with traffic-light
 *  status colors.
 *  ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root,
[data-bs-theme="light"] {
  /* -- base palette -------------------------------------------------- */
  --cr-bg:        #ffffff;
  --cr-surface:   #f8f9fa;
  --cr-surface-2: #f1f3f2;
  --cr-border:    #e3e6e4;
  --cr-fg:        #1c1f1d;
  --cr-muted:     #6b746e;
  --cr-muted-2:   #9aa39c;

  /* -- brand / accent -------------------------------------------------- */
  --cr-accent:       #17a34a;
  --cr-accent-fg:    #ffffff;
  --cr-accent-soft:  #e8f7ee;

  /* -- status / grade traffic lights ----------------------------------- */
  --cr-s:  #17a34a;   /* runs great */
  --cr-a:  #4d9e3d;   /* runs well  */
  --cr-b:  #7c9a2e;   /* decent     */
  --cr-c:  #d99a1b;   /* tight fit  */
  --cr-d:  #e07a1f;   /* barely runs*/
  --cr-f:  #dc3b3b;   /* too heavy  */

  --cr-s-bg: #e7f6ec; --cr-a-bg: #eef6e7; --cr-b-bg: #f5f6e3;
  --cr-c-bg: #fdf3de; --cr-d-bg: #fcebe0; --cr-f-bg: #fbe6e6;

  --bs-body-bg: var(--cr-bg);
  --bs-body-color: var(--cr-fg);
  --bs-border-color: var(--cr-border);
  color-scheme: light;
}

[data-bs-theme="dark"] {
  --cr-bg:        #0d1210;
  --cr-surface:   #141a17;
  --cr-surface-2: #1a211d;
  --cr-border:    #263029;
  --cr-fg:        #e7ece9;
  --cr-muted:     #8b968f;
  --cr-muted-2:   #5e6b63;

  --cr-accent:       #34d372;
  --cr-accent-fg:    #06170d;
  --cr-accent-soft:  #132a1c;

  --cr-s:  #34d372; --cr-a:  #7fd15b; --cr-b:  #b8d15b;
  --cr-c:  #e8b545; --cr-d:  #ef9a4d; --cr-f:  #f2645f;

  --cr-s-bg: #10281a; --cr-a-bg: #17281a; --cr-b-bg: #23281a;
  --cr-c-bg: #2b2417; --cr-d-bg: #2c1e17; --cr-f-bg: #2c1717;

  --bs-body-bg: var(--cr-bg);
  --bs-body-color: var(--cr-fg);
  --bs-border-color: var(--cr-border);
  color-scheme: dark;
}

/* =========================================================================
 *  Base
 *  ========================================================================= */

html, body {
  background: var(--cr-bg);
  color: var(--cr-fg);
}

body {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.cr-heading {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cr-fg);
}

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

::selection { background: var(--cr-accent-soft); color: var(--cr-fg); }

.cr-muted { color: var(--cr-muted) !important; }
.cr-muted-2 { color: var(--cr-muted-2) !important; }

.cr-container { max-width: 1180px; }

code, .cr-code, kbd, pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* =========================================================================
 *  Navbar
 *  ========================================================================= */

.cr-navbar {
  background: var(--cr-bg);
  border-bottom: 1px solid var(--cr-border);
}

.cr-navbar .navbar-brand {
  font-weight: 600;
  color: var(--cr-fg);
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
}

.cr-navbar .navbar-brand .cr-brand-mark {
  color: var(--cr-accent);
}

.cr-navbar .navbar-updated {
  font-size: .75rem;
  color: var(--cr-muted-2);
  font-weight: 400;
}

.cr-navbar .nav-link {
  color: var(--cr-muted);
  font-size: .875rem;
  padding: .4rem .7rem;
}

.cr-navbar .nav-link:hover,
.cr-navbar .nav-link.active {
  color: var(--cr-fg);
}

.cr-icon-btn {
  color: var(--cr-muted);
  border: none;
  background: transparent;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .375rem;
}
.cr-icon-btn:hover { color: var(--cr-fg); background: var(--cr-surface-2); }

/* =========================================================================
 *  Buttons
 *  ========================================================================= */

.btn {
  font-family: inherit;
  font-size: .875rem;
  border-radius: .5rem;
  font-weight: 500;
}

.btn-cr-primary {
  background: var(--cr-accent);
  border: 1px solid var(--cr-accent);
  color: var(--cr-accent-fg);
}
.btn-cr-primary:hover { filter: brightness(0.94); color: var(--cr-accent-fg); }

.btn-cr-outline {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  color: var(--cr-fg);
}
.btn-cr-outline:hover { background: var(--cr-surface-2); color: var(--cr-fg); }

.btn-cr-soft {
  background: var(--cr-accent-soft);
  border: 1px solid transparent;
  color: var(--cr-accent);
}
.btn-cr-soft:hover { filter: brightness(0.97); color: var(--cr-accent); }

.cr-pill-group .btn {
  border-radius: 999px;
  font-size: .8125rem;
  padding: .3rem .9rem;
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  color: var(--cr-muted);
}
.cr-pill-group .btn.active {
  background: var(--cr-fg);
  color: var(--cr-bg);
  border-color: var(--cr-fg);
}

/* =========================================================================
 *  Cards / surfaces
 *  ========================================================================= */

.cr-card {
  background: var(--cr-bg);
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
}

.cr-card-header {
  background: var(--cr-surface);
  border-bottom: 1px solid var(--cr-border);
  padding: .75rem 1rem;
  font-size: .8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.cr-panel {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: 1rem;
}

.cr-panel-accent {
  background: var(--cr-accent-soft);
  border: 1px solid var(--cr-accent);
  border-radius: .5rem;
  padding: 1.1rem;
}

.cr-kv {
  display: flex;
  justify-content: space-between;
  padding: .4rem 0;
  border-bottom: 1px dashed var(--cr-border);
  font-size: .8125rem;
}
.cr-kv:last-child { border-bottom: 0; }
.cr-kv dt { color: var(--cr-muted); font-weight: 400; }
.cr-kv dd { margin: 0; font-weight: 600; }

/* =========================================================================
 *  Badges / chips
 *  ========================================================================= */

.cr-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 500;
  padding: .2rem .55rem;
  border-radius: .375rem;
  border: 1px solid transparent;
}

.cr-badge-outline { background: transparent; border-color: var(--cr-border); color: var(--cr-muted); }
.cr-badge-accent   { background: var(--cr-accent-soft); color: var(--cr-accent); }
.cr-badge-violet   { background: #f1eafb; color: #7c3aed; }
[data-bs-theme="dark"] .cr-badge-violet { background: #221a33; color: #b794f6; }
.cr-badge-blue     { background: #e7f1fd; color: #2563eb; }
[data-bs-theme="dark"] .cr-badge-blue { background: #16233a; color: #7db4f5; }

/* status / grade traffic-light badges -------------------------------- */
.cr-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: .375rem;
}
.cr-status::before {
  content: "";
  width: .4rem; height: .4rem;
  border-radius: 50%;
  background: currentColor;
}

.cr-status-s { color: var(--cr-s); background: var(--cr-s-bg); }
.cr-status-a { color: var(--cr-a); background: var(--cr-a-bg); }
.cr-status-b { color: var(--cr-b); background: var(--cr-b-bg); }
.cr-status-c { color: var(--cr-c); background: var(--cr-c-bg); }
.cr-status-d { color: var(--cr-d); background: var(--cr-d-bg); }
.cr-status-f { color: var(--cr-f); background: var(--cr-f-bg); }

.cr-grade {
  width: 1.9rem; height: 1.9rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: .375rem;
  font-weight: 700;
  font-size: 1rem;
}
.cr-grade-s { color: var(--cr-s); background: var(--cr-s-bg); }
.cr-grade-a { color: var(--cr-a); background: var(--cr-a-bg); }
.cr-grade-b { color: var(--cr-b); background: var(--cr-b-bg); }
.cr-grade-c { color: var(--cr-c); background: var(--cr-c-bg); }
.cr-grade-d { color: var(--cr-d); background: var(--cr-d-bg); }
.cr-grade-f { color: var(--cr-f); background: var(--cr-f-bg); }

/* =========================================================================
 *  Tables
 *  ========================================================================= */

.cr-table {
  --bs-table-bg: transparent;
  font-size: .8125rem;
  margin-bottom: 0;
}
.cr-table thead th {
  text-transform: none;
  font-weight: 500;
  color: var(--cr-muted-2);
  font-size: .7rem;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--cr-border);
  background: var(--cr-surface);
  padding: .6rem .9rem;
}
.cr-table td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--cr-border);
  vertical-align: middle;
  color: var(--cr-fg);
}
.cr-table tbody tr:last-child td { border-bottom: 0; }
.cr-table tbody tr:hover td { background: var(--cr-surface); }

.cr-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--cr-surface-2);
  overflow: hidden;
}
.cr-bar-fill { height: 100%; border-radius: 3px; }

/* =========================================================================
 *  Tier list rows
 *  ========================================================================= */

.cr-tier-row {
  display: flex;
  border-bottom: 1px solid var(--cr-border);
}
.cr-tier-row:last-child { border-bottom: 0; }

.cr-tier-label {
  flex: 0 0 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.cr-tier-s { color: var(--cr-s); background: var(--cr-s-bg); }
.cr-tier-a { color: var(--cr-a); background: var(--cr-a-bg); }
.cr-tier-b { color: var(--cr-b); background: var(--cr-b-bg); }
.cr-tier-c { color: var(--cr-c); background: var(--cr-c-bg); }
.cr-tier-d { color: var(--cr-d); background: var(--cr-d-bg); }
.cr-tier-f { color: var(--cr-f); background: var(--cr-f-bg); }

.cr-tier-items {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1rem;
  align-items: center;
}

.cr-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  padding: .3rem .6rem;
  border: 1px solid var(--cr-border);
  border-radius: .375rem;
  background: var(--cr-bg);
}
.cr-chip .cr-chip-dot {
  width: .4rem; height: .4rem; border-radius: 50%;
}
.cr-chip .cr-chip-muted { color: var(--cr-muted-2); }

/* =========================================================================
 *  Code blocks
 *  ========================================================================= */

.cr-codeblock {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-size: .8125rem;
}
.cr-codeblock code { color: var(--cr-accent); background: none; }

/* =========================================================================
 *  Filter bar (hardware selector strip)
 *  ========================================================================= */

.cr-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  padding: .9rem 1.1rem;
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  background: var(--cr-surface);
}
.cr-filterbar .cr-field { min-width: 6rem; }
.cr-filterbar .cr-field-label {
  font-size: .7rem;
  color: var(--cr-muted-2);
  display: flex; align-items: center; gap: .3rem;
  margin-bottom: .15rem;
}
.cr-filterbar .cr-field-value { font-weight: 600; font-size: .875rem; }

/* =========================================================================
 *  Misc utility
 *  ========================================================================= */

.cr-divider { border-top: 1px solid var(--cr-border); }
.cr-hairline { height: 1px; background: var(--cr-border); border: 0; }

.cr-section-eyebrow {
  font-size: .75rem;
  color: var(--cr-muted);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.cr-footer {
  border-top: 1px solid var(--cr-border);
  color: var(--cr-muted-2);
  font-size: .8125rem;
}

.form-control, .form-select {
  font-family: inherit;
  background: var(--cr-bg);
  border: 1px solid var(--cr-border);
  color: var(--cr-fg);
  font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--cr-accent);
  box-shadow: 0 0 0 .2rem var(--cr-accent-soft);
  background: var(--cr-bg);
  color: var(--cr-fg);
}
.form-check-input:checked {
  background-color: var(--cr-accent);
  border-color: var(--cr-accent);
}

/* =========================================================================
 *  Stat strip  ("104 MODELS · 292 DEVICES · 22 LABS")
 *  ========================================================================= */

.cr-stat-strip {
  font-size: .75rem;
  letter-spacing: .04em;
  color: var(--cr-muted-2);
}
.cr-stat-strip .cr-dot-sep::before {
  content: "·";
  margin: 0 .6rem;
}

/* =========================================================================
 *  Mini model table (compact rows used on landing sections)
 *  ========================================================================= */

.cr-mini-table { width: 100%; font-size: .8125rem; }
.cr-mini-table tr { border-bottom: 1px solid var(--cr-border); }
.cr-mini-table tr:last-child { border-bottom: 0; }
.cr-mini-table td { padding: .6rem .25rem; vertical-align: middle; }
.cr-mini-table tr:hover { background: var(--cr-surface); }

.cr-mini-name {
  font-weight: 600;
  color: var(--cr-fg);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cr-mini-name .cr-mini-icon {
  width: 1.3rem; height: 1.3rem;
  border-radius: .3rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cr-surface-2);
  font-size: .7rem;
  flex: none;
}
.cr-mini-org { color: var(--cr-muted); }
.cr-mini-speed { text-align: right; font-weight: 600; white-space: nowrap; }

.cr-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--cr-border);
  padding-bottom: .5rem;
  margin-bottom: .25rem;
}
.cr-section-head h3 {
  font-size: .9375rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.cr-section-head .cr-section-sub {
  font-size: .75rem;
  color: var(--cr-muted-2);
}

/* =========================================================================
 *  Numbered steps ("How it works")
 *  ========================================================================= */

.cr-step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem;
  color: var(--cr-accent);
  border: 1px solid var(--cr-border);
  border-radius: .35rem;
  padding: .05rem .4rem;
  display: inline-block;
  margin-bottom: .6rem;
}
.cr-step h4 { font-size: .9375rem; margin-bottom: .35rem; }
.cr-step p { font-size: .8125rem; color: var(--cr-muted); margin-bottom: 0; }

/* =========================================================================
 *  Device / lab chips
 *  ========================================================================= */

.cr-devicechip, .cr-labchip {
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  background: var(--cr-bg);
  padding: .65rem .85rem;
}
.cr-devicechip .cr-devicechip-name { font-weight: 600; font-size: .8125rem; }
.cr-devicechip .cr-devicechip-spec { font-size: .7rem; color: var(--cr-muted-2); }

.cr-labchip { display: flex; align-items: center; gap: .6rem; }
.cr-labchip-icon {
  width: 2rem; height: 2rem;
  border-radius: .4rem;
  background: var(--cr-surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  font-size: .9rem;
}
.cr-labchip-name { font-weight: 600; font-size: .8125rem; }
.cr-labchip-sub { font-size: .7rem; color: var(--cr-muted-2); }

/* =========================================================================
 *  Model summary cards ("Open models worth running locally")
 *  ========================================================================= */

.cr-modelcard {
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: 1rem;
  height: 100%;
  background: var(--cr-bg);
}
.cr-modelcard .cr-modelcard-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .5rem;
}
.cr-modelcard .cr-modelcard-name { font-weight: 600; }
.cr-modelcard .cr-modelcard-size {
  font-size: .7rem;
  color: var(--cr-muted-2);
  border: 1px solid var(--cr-border);
  border-radius: .3rem;
  padding: .05rem .4rem;
}
.cr-modelcard p { font-size: .8125rem; color: var(--cr-muted); margin: 0; }

/* =========================================================================
 *  Guide cards
 *  ========================================================================= */

.cr-guidecard {
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: 1.1rem;
  background: var(--cr-surface);
  height: 100%;
}
.cr-guidecard .cr-guidecard-label {
  font-size: .7rem;
  color: var(--cr-muted-2);
  letter-spacing: .04em;
  margin-bottom: .4rem;
}
.cr-guidecard h4 { font-size: .9375rem; margin-bottom: .35rem; }
.cr-guidecard p { font-size: .8125rem; color: var(--cr-muted); margin: 0; }

/* =========================================================================
 *  FAQ accordion
 *  ========================================================================= */

.cr-accordion .accordion-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--cr-border);
  border-radius: 0;
}
.cr-accordion .accordion-item:first-child { border-top: 1px solid var(--cr-border); }
.cr-accordion .accordion-button {
  background: transparent;
  color: var(--cr-fg);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  padding: .9rem .25rem;
  box-shadow: none;
}
.cr-accordion .accordion-button:not(.collapsed) {
  background: transparent;
  color: var(--cr-accent);
  box-shadow: none;
}
.cr-accordion .accordion-button::after {
  background-image: none;
  content: "+";
  font-size: 1.1rem;
  color: var(--cr-muted-2);
  width: auto; height: auto;
  transform: none;
  line-height: 1;
}
.cr-accordion .accordion-button:not(.collapsed)::after {
  content: "−";
  color: var(--cr-accent);
}
.cr-accordion .accordion-body {
  padding: 0 .25rem 1rem;
  font-size: .8125rem;
  color: var(--cr-muted);
}

/* =========================================================================
 *  Model detail page extras
 *  ========================================================================= */

.btn-cr-amber {
  background: #fdf3de;
  border: 1px solid transparent;
  color: #92660a;
}
.btn-cr-amber:hover { filter: brightness(0.97); color: #92660a; }
[data-bs-theme="dark"] .btn-cr-amber { background: #2b2417; color: #e8b545; }

.cr-avatar {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: .5rem;
  background: var(--cr-fg);
  color: var(--cr-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex: none;
}

.cr-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: .8125rem;
  color: var(--cr-muted);
}
.cr-meta-row span { display: inline-flex; align-items: center; gap: .35rem; }

.cr-label-sm {
  font-size: .7rem;
  letter-spacing: .04em;
  color: var(--cr-muted-2);
  margin-bottom: .5rem;
}

.cr-hw-row {
  display: flex;
  justify-content: space-between;
  padding: .4rem 0;
  font-size: .8125rem;
}
.cr-hw-row dt { color: var(--cr-muted); font-weight: 400; }
.cr-hw-row dd { margin: 0; font-weight: 600; }

.cr-faq-block + .cr-faq-block { margin-top: 1.5rem; }
.cr-faq-block h4 { font-size: 1rem; margin-bottom: .4rem; }
.cr-faq-block p { color: var(--cr-muted); font-size: .875rem; margin: 0; }

/* =========================================================================
 *  Docs page: chart boxes, bar charts, diagrams
 *  ========================================================================= */

.cr-doc-section { margin-bottom: 3rem; }
.cr-doc-section h2 { font-size: 1.25rem; margin-bottom: .75rem; }
.cr-doc-section > p { max-width: 760px; color: var(--cr-fg); margin-bottom: 1.25rem; }

.cr-chartbox {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: 1.25rem 1.5rem;
  max-width: 760px;
}
.cr-chart-title {
  font-size: .7rem;
  letter-spacing: .05em;
  color: var(--cr-muted-2);
  margin-bottom: 1.4rem;
}
.cr-chart-caption {
  font-size: .7rem;
  color: var(--cr-muted-2);
  margin-top: .9rem;
  margin-bottom: 0;
}

/* vertical bar chart -------------------------------------------------- */
.cr-vbarchart { display: flex; align-items: stretch; }
.cr-vbars { display: flex; align-items: flex-end; gap: .9rem; flex: 1; height: 210px; }
.cr-vbar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; flex: 1; }
.cr-vbar-toplabel { font-size: .68rem; color: var(--cr-muted-2); margin-bottom: .4rem; white-space: nowrap; }
.cr-vbar { width: 100%; border-radius: .3rem .3rem 0 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: .4rem; }
.cr-vbar-label { font-size: .68rem; font-weight: 700; color: #1c1f1d; }
.cr-vbar-axis {
  flex: 0 0 auto;
  margin-left: 1.25rem;
  padding-left: 1rem;
  border-left: 1px dashed var(--cr-border);
  height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--cr-muted-2);
  white-space: nowrap;
}

/* horizontal quality/size bars ----------------------------------------- */
.cr-qbar-row { display: grid; grid-template-columns: 4.5rem 1fr 4.2rem; align-items: center; gap: .75rem; margin-bottom: .55rem; }
.cr-qbar-row:last-child { margin-bottom: 0; }
.cr-qbar-format { font-weight: 600; font-size: .8125rem; }
.cr-qbar-track { background: var(--cr-surface-2); border-radius: .3rem; height: 1.4rem; overflow: hidden; }
.cr-qbar-fill { height: 100%; border-radius: .3rem; display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; color: #1c1f1d; }
.cr-qbar-size { text-align: right; color: var(--cr-muted-2); font-size: .75rem; white-space: nowrap; }

/* MoE diagram ------------------------------------------------------------ */
.cr-moe-diagram { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.cr-moe-svg { flex: 1 1 380px; min-width: 300px; }
.cr-moe-stats { flex: 0 0 auto; font-size: .8125rem; }
.cr-moe-stats .cr-kv { border-bottom: 0; padding: .25rem 0; gap: 1.5rem; }

/* speed guide list -------------------------------------------------------- */
.cr-speed-list .cr-speed-row {
  display: flex;
  gap: .75rem;
  padding: .4rem 0;
  font-size: .875rem;
  border-bottom: 1px dashed var(--cr-border);
}
.cr-speed-list .cr-speed-row:last-child { border-bottom: 0; }
.cr-speed-value { font-weight: 700; min-width: 7rem; }

/* horizontal bandwidth bars ------------------------------------------------ */
.cr-hbar-row { display: grid; grid-template-columns: 5.5rem 1fr 4.2rem; align-items: center; gap: .75rem; margin-bottom: .6rem; font-size: .8125rem; }
.cr-hbar-row:last-child { margin-bottom: 0; }
.cr-hbar-track { background: var(--cr-surface-2); border-radius: .3rem; height: 1.05rem; overflow: hidden; }
.cr-hbar-fill { height: 100%; border-radius: .3rem; }
.cr-hbar-value { text-align: right; font-weight: 600; white-space: nowrap; }

/* =========================================================================
 *  Category / listing page
 *  ========================================================================= */

.cr-fitbar-track {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--cr-surface-2);
}
.cr-fitbar-seg { height: 100%; }

.cr-grade-tally {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-size: .8125rem;
}
.cr-grade-tally b { font-weight: 700; margin-right: .3rem; }

.cr-divider-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--cr-muted-2);
  font-size: .75rem;
  margin: 1.5rem 0;
}
.cr-divider-label::before,
.cr-divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--cr-border);
}

.cr-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}
.cr-filter-row .form-select,
.cr-filter-row .form-control {
  width: auto;
  font-size: .8125rem;
  padding: .4rem .7rem;
}

.cr-searchbar {
  position: relative;
  flex: 1 1 260px;
}
.cr-searchbar input {
  padding-left: 2.2rem;
}
.cr-searchbar .cr-search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cr-muted-2);
  font-size: .8125rem;
  pointer-events: none;
}

.cr-result-row {
  display: grid;
  grid-template-columns: 1.6fr .9fr 1.4fr .8fr 3.5rem;
  align-items: center;
  gap: 1rem;
  padding: .75rem .25rem;
  border-bottom: 1px solid var(--cr-border);
  font-size: .8125rem;
}
.cr-result-row:last-child { border-bottom: 0; }
.cr-result-row:hover { background: var(--cr-surface); }
.cr-result-name { font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.cr-result-cat { color: var(--cr-muted); white-space: nowrap; }
.cr-result-size-wrap .cr-bar-track { margin-bottom: .25rem; }
.cr-result-size-wrap span { font-size: .72rem; color: var(--cr-muted-2); }
.cr-result-speed { white-space: nowrap; font-weight: 500; }
.cr-result-score { text-align: right; font-weight: 700; }

@media (max-width: 767px) {
  .cr-result-row { grid-template-columns: 1fr auto; grid-template-areas: "name score" "cat cat" "size size" "speed speed"; row-gap: .35rem; }
  .cr-result-name { grid-area: name; }
  .cr-result-score { grid-area: score; }
  .cr-result-cat { grid-area: cat; }
  .cr-result-size-wrap { grid-area: size; }
  .cr-result-speed { grid-area: speed; }
}

/* =========================================================================
 *  Tier List page extras
 *  ========================================================================= */

.cr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-size: .8125rem;
}
.cr-toolbar .form-check {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.cr-toolbar .form-check-input {
  margin: 0;
}
.cr-toolbar-sep {
  width: 1px;
  height: 1rem;
  background: var(--cr-border);
}
.cr-toolbar select.form-select {
  width: auto;
  display: inline-block;
  padding: .2rem .5rem;
  font-size: .8125rem;
}

.cr-tier-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .85rem 1.1rem;
  background: var(--cr-surface);
  border-bottom: 1px solid var(--cr-border);
  font-size: .875rem;
  font-weight: 600;
}
.cr-tier-card-header .cr-tier-card-meta {
  font-size: .75rem;
  font-weight: 400;
  color: var(--cr-muted-2);
}

.cr-tier-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .7rem 1.1rem;
  border-top: 1px solid var(--cr-border);
  font-size: .8125rem;
  color: var(--cr-muted);
}

.cr-tier-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  font-size: .8125rem;
  color: var(--cr-muted);
}
.cr-tier-legend b { font-weight: 700; margin-right: .3rem; }

/* =========================================================================
 *  Devices page
 *  ========================================================================= */

.cr-back-link {
  font-size: .8125rem;
  color: var(--cr-muted);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.cr-back-link:hover { color: var(--cr-fg); }

.cr-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--cr-border);
  background: var(--cr-surface);
  border-radius: .5rem;
  padding: .5rem .9rem;
  font-size: .8125rem;
  color: var(--cr-fg);
}
.cr-cat-chip .cr-cat-chip-count {
  color: var(--cr-muted-2);
  font-weight: 600;
}
.cr-cat-chip .cr-cat-chip-icon {
  width: 1.1rem;
  text-align: center;
  flex: none;
}

.cr-group-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.cr-group-header .cr-group-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: .5rem;
  border: 1px solid var(--cr-border);
  background: var(--cr-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 1.1rem;
}
.cr-group-header h2 { font-size: 1.15rem; margin: 0; }
.cr-group-header p { font-size: .8125rem; color: var(--cr-muted); margin: 0; }

.cr-device-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  background: var(--cr-bg);
  padding: .7rem .9rem;
}
.cr-device-tile:hover { background: var(--cr-surface); border-color: var(--cr-muted-2); }
.cr-device-tile .cr-device-icon {
  font-size: 1rem;
  flex: none;
  width: 1.2rem;
  text-align: center;
}
.cr-device-tile .cr-device-name { font-weight: 600; font-size: .8125rem; }
.cr-device-tile .cr-device-sub { font-size: .7rem; color: var(--cr-muted-2); }
.cr-device-tile .cr-device-spec {
  font-size: .72rem;
  color: var(--cr-muted);
  border: 1px solid var(--cr-border);
  border-radius: .35rem;
  padding: .15rem .45rem;
  white-space: nowrap;
  flex: none;
}

.cr-subgroup-label {
  font-size: .75rem;
  letter-spacing: .03em;
  color: var(--cr-muted-2);
  margin: 1.75rem 0 .75rem;
}
.cr-subgroup-label:first-child { margin-top: 0; }

/* =========================================================================
 *  Build page (PC part picker)
 *  ========================================================================= */

.cr-subtabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--cr-border);
  margin-bottom: 1.5rem;
}
.cr-subtabs .nav-link {
  color: var(--cr-muted);
  font-size: .8125rem;
  font-weight: 500;
  padding: .65rem .9rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
}
.cr-subtabs .nav-link.active {
  color: var(--cr-fg);
  border-bottom-color: var(--cr-accent);
}
.cr-subtabs .nav-link:hover:not(.active) { color: var(--cr-fg); }

/* ---- overview: component rows ---- */
.cr-build-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--cr-border);
}
.cr-build-row:last-of-type { border-bottom: 0; }

.cr-build-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  color: var(--cr-muted-2);
  text-align: center;
}
.cr-build-cat-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .5rem;
  border: 1px solid var(--cr-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.cr-build-cat-label {
  font-size: .65rem;
  letter-spacing: .03em;
  font-weight: 600;
}

.cr-build-item {
  display: flex;
  align-items: center;
  gap: .9rem;
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: .6rem .9rem;
  background: var(--cr-bg);
}
.cr-build-thumb {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: .4rem;
  background: var(--cr-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 1.2rem;
  overflow: hidden;
}
.cr-build-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-build-name { font-weight: 600; font-size: .8125rem; margin-bottom: .25rem; }
.cr-build-meta { font-size: .72rem; color: var(--cr-muted); display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.cr-build-meta .cr-stock-ok { color: var(--cr-s); display: inline-flex; align-items: center; gap: .3rem; }

.cr-build-empty {
  flex: 1;
  border: 1px dashed var(--cr-border);
  border-radius: .5rem;
  padding: 1rem;
  color: var(--cr-muted-2);
  font-size: .8125rem;
}

.cr-build-price {
  text-align: right;
  white-space: nowrap;
}
.cr-build-price .cr-save-row {
  font-size: .72rem;
  display: flex;
  gap: .4rem;
  justify-content: flex-end;
  margin-bottom: .15rem;
}
.cr-build-price .cr-save-amt { color: var(--cr-d); font-weight: 600; }
.cr-build-price .cr-discount-pill {
  background: var(--cr-d-bg);
  color: var(--cr-d);
  border-radius: .3rem;
  padding: 0 .35rem;
  font-weight: 700;
}
.cr-build-price .cr-price-now { font-size: 1.05rem; font-weight: 700; }
.cr-build-price .cr-price-was { font-size: .72rem; color: var(--cr-muted-2); text-decoration: line-through; }

.cr-build-delete {
  border: 0;
  background: none;
  color: var(--cr-muted-2);
  font-size: 1rem;
  line-height: 1;
  padding: .25rem;
}
.cr-build-delete:hover { color: var(--cr-f); }

.cr-build-add-btn {
  white-space: nowrap;
}

/* ---- totals bar ---- */
.cr-totalbar {
  position: sticky;
  bottom: 0;
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  z-index: 5;
}
.cr-totalbar .cr-total-label {
  font-size: .7rem;
  letter-spacing: .03em;
  color: var(--cr-muted-2);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.cr-totalbar .cr-total-price { font-size: 1.6rem; font-weight: 700; }
.cr-totalbar .cr-total-was { font-size: .8125rem; color: var(--cr-muted-2); text-decoration: line-through; }
.cr-totalbar .cr-total-save {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  margin-bottom: .25rem;
}

/* ---- components tab: sidebar ---- */
.cr-comp-sidebar-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: .65rem .8rem;
  background: var(--cr-bg);
  margin-bottom: .5rem;
  cursor: pointer;
}
.cr-comp-sidebar-item:hover { border-color: var(--cr-muted-2); }
.cr-comp-sidebar-item.active {
  border-color: var(--cr-accent);
  box-shadow: 0 0 0 1px var(--cr-accent);
  background: var(--cr-accent-soft);
}
.cr-comp-sidebar-thumb {
  width: 2.4rem; height: 2.4rem;
  border-radius: .4rem;
  background: var(--cr-surface-2);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  font-size: 1rem;
}
.cr-comp-sidebar-name { font-weight: 600; font-size: .8125rem; }
.cr-comp-sidebar-sub { font-size: .7rem; color: var(--cr-muted-2); }
.cr-comp-sidebar-price { font-size: .75rem; font-weight: 600; color: var(--cr-accent); }

/* ---- components tab: main panel ---- */
.cr-comp-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.cr-comp-panel-header h2 {
  font-size: 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cr-comp-panel-header .cr-comp-count { color: var(--cr-muted-2); font-weight: 400; }

.cr-comp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-left: auto;
}
.cr-comp-toolbar .form-control,
.cr-comp-toolbar .form-select {
  font-size: .8125rem;
  width: auto;
}
.cr-filter-btn {
  position: relative;
}
.cr-filter-count {
  position: absolute;
  top: -.4rem;
  right: -.4rem;
  background: var(--cr-accent);
  color: var(--cr-accent-fg);
  border-radius: 50%;
  width: 1.1rem;
  height: 1.1rem;
  font-size: .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cr-info-banner {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--cr-accent-soft);
  border: 1px solid var(--cr-accent);
  border-radius: .5rem;
  padding: .6rem .9rem;
  font-size: .8125rem;
  margin-bottom: 1rem;
}

.cr-comp-card {
  display: flex;
  gap: 1rem;
  border: 1px solid var(--cr-border);
  border-radius: .5rem;
  padding: 1rem;
  background: var(--cr-bg);
  margin-bottom: .75rem;
}
.cr-comp-card.cr-comp-card-chosen {
  border-color: var(--cr-accent);
  box-shadow: 0 0 0 1px var(--cr-accent);
}
.cr-comp-card-thumb {
  width: 6rem; height: 6rem;
  border-radius: .4rem;
  background: var(--cr-surface-2);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  font-size: 1.6rem;
  overflow: hidden;
}
.cr-comp-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-comp-card-body { flex: 1; min-width: 0; }
.cr-comp-card-title { font-weight: 600; font-size: .9375rem; margin-bottom: .5rem; }
.cr-comp-specs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.cr-spec-pill {
  font-size: .7rem;
  border: 1px solid var(--cr-border);
  border-radius: .3rem;
  padding: .1rem .5rem;
  color: var(--cr-muted);
  white-space: nowrap;
}
.cr-spec-pill b { color: var(--cr-fg); font-weight: 700; margin-left: .25rem; }

.cr-comp-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem;
}

.cr-choose-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--cr-border);
  border-radius: .375rem;
  padding: .4rem .8rem;
  font-size: .8125rem;
  font-weight: 600;
  background: var(--cr-bg);
  color: var(--cr-fg);
  white-space: nowrap;
}
.cr-choose-btn .cr-radio-dot {
  width: .9rem; height: .9rem;
  border-radius: 50%;
  border: 2px solid var(--cr-muted-2);
  flex: none;
}
.cr-choose-btn.cr-chosen {
  border-color: var(--cr-accent);
  color: var(--cr-accent);
  background: var(--cr-accent-soft);
}
.cr-choose-btn.cr-chosen .cr-radio-dot {
  border-color: var(--cr-accent);
  background: var(--cr-accent);
  box-shadow: inset 0 0 0 2px var(--cr-accent-soft);
}

/* ---- filter offcanvas ---- */
.cr-filter-offcanvas {
  background: var(--cr-bg);
  color: var(--cr-fg);
  border-left: 1px solid var(--cr-border);
  width: 360px;
}
.cr-filter-offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--cr-border);
  padding: 1rem 1.25rem;
}
.cr-filter-offcanvas .offcanvas-body { padding: 1.1rem 1.25rem; }
.cr-filter-group { margin-bottom: 1.5rem; }
.cr-filter-group-label {
  font-size: .7rem;
  letter-spacing: .03em;
  color: var(--cr-muted-2);
  margin-bottom: .6rem;
}
.cr-range-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cr-range-row .form-control { font-size: .8125rem; }
.cr-range-note { font-size: .72rem; color: var(--cr-muted-2); margin-top: .4rem; display: flex; justify-content: space-between; }
.cr-filter-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem 0;
  font-size: .8125rem;
}
.cr-filter-check input { margin: 0; }
.cr-filter-check.cr-filter-check-active { color: var(--cr-accent); font-weight: 600; }
.cr-filter-offcanvas .offcanvas-footer {
  border-top: 1px solid var(--cr-border);
  padding: 1rem 1.25rem;
  display: flex;
  gap: .6rem;
}

/* =========================================================================
 *  Responsive media (images, native video, embedded video)
 *  Fixes: images/videos rendering oversized on mobile, overflowing the
 *  viewport, or ignoring the container width.
 *  ========================================================================= */

/* Any plain <img> or <video> never exceeds its container, and keeps
 *  its natural aspect ratio while doing so. Apply site-wide. */
img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Optional helper for a plain image you want to fully fill its box
 *  without distortion (e.g. a card thumbnail): <img class="cr-media-cover"> */
.cr-media-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Optional helper when you want an image capped at a max width and
 *  centered, e.g. inside prose: <img class="cr-media-contained"> */
.cr-media-contained {
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

/* Responsive 16:9 wrapper for embedded video (YouTube, Vimeo, etc.).
 *  iframes have no intrinsic size, so without a wrapper like this they
 *  render at their hardcoded width/height attributes — usually 560×315
 *  — which either overflows a narrow phone screen or stays tiny on a
 *  wide one. Wrap the <iframe> in a <div class="cr-video-embed">.
 *  A different ratio: add cr-video-embed--4-3 / --1-1 or set
 *  --cr-embed-ratio inline. */
.cr-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: var(--cr-embed-ratio, 16 / 9);
  overflow: hidden;
  border-radius: .5rem;
  background: var(--cr-surface-2);
}
.cr-video-embed iframe,
.cr-video-embed video,
.cr-video-embed embed,
.cr-video-embed object {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.cr-video-embed--4-3 { aspect-ratio: 4 / 3; }
.cr-video-embed--1-1 { aspect-ratio: 1 / 1; }

/* Native <video> shown full-width with controls, capped so it never
 *  forces horizontal scroll or dwarfs the surrounding text on phones. */
.cr-video-native {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: .5rem;
  background: #000;
}

/* A figure wrapping either kind of media, with an optional caption. */
.cr-media-figure {
  margin: 0 0 1.5rem;
}
.cr-media-figure figcaption {
  font-size: .75rem;
  color: var(--cr-muted-2);
  margin-top: .5rem;
}
