/* ==========================================================================
   Brick Builder (/bricks) — styles for the client app in js/bricks.js
   Everything is scoped under .brk. Calm, friendly surfaces (white cards on
   the site background, thin borders, soft shadows); the color comes from the
   models themselves and from a few brick details: the difficulty "towers",
   the step bar and the studs on the main button. The building stage stays
   light in both themes, like the page of an instruction booklet.
   It is a standalone page (view/bricks.php has no site nav or footer), so
   this file also carries the document basics: font, tokens, top bar.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* brick colors */
  --brk-red: #e2231a;
  --brk-red-d: #b3150e;
  --brk-yellow: #ffc400;
  --brk-blue: #1f6fd1;
  --brk-green: #2aa650;
  --brk-orange: #f57d20;
  --brk-lime: #9bcf3c;
  --brk-pink: #f277a8;
  --brk-lightblue: #7cc4f0;

  /* surfaces (dark theme = site default) */
  --brk-card: #161a21;
  --brk-soft: #1d222b;
  --brk-line: #2a303b;
  --brk-text: #f2f4f8;
  --brk-muted: #9aa4b4;
  --brk-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  --brk-page: #0b0d12;
  --brk-stage: radial-gradient(ellipse at 50% 60%, #ffffff 0 45%, #eef3f8 100%);
  --brk-focus: #ffc400;
  --brk-radius: 20px;

  color-scheme: dark;
}

:root[data-theme='light'] {
  color-scheme: light;
  --brk-card: #ffffff;
  --brk-soft: #f4f1ea;
  --brk-line: #e6e1d6;
  --brk-text: #1f2430;
  --brk-muted: #667085;
  --brk-shadow: 0 1px 2px rgba(31, 36, 48, 0.06), 0 10px 26px rgba(31, 36, 48, 0.08);
  --brk-page: #faf8f4;
}

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

/* ---------- the document ---------- */
html {
  -webkit-text-size-adjust: 100%;
}

body.brk-doc {
  margin: 0;
  min-height: 100vh;
  background: var(--brk-page);
  color: var(--brk-text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.brk-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

@media (min-width: 700px) {
  .brk-page {
    padding-inline: 32px;
  }
}

.brk-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
}

.brk-brand,
.brk-topbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  color: var(--brk-text);
  text-decoration: none;
  border-radius: 12px;
  font: 600 0.95rem 'Inter', system-ui, sans-serif;
}

.brk-brand {
  padding: 0 12px 0 6px;
  margin-left: -6px;
}

.brk-brand svg {
  width: 18px;
  height: 18px;
  color: var(--brk-muted);
}

.brk-topbar__actions {
  display: flex;
  gap: 6px;
}

.brk-topbtn {
  min-width: 40px;
  padding: 0 10px;
  border: 1px solid var(--brk-line);
  background: var(--brk-card);
  cursor: pointer;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.brk-topbtn svg {
  width: 18px;
  height: 18px;
}

.brk-brand:hover,
.brk-topbtn:hover {
  background: var(--brk-soft);
}

.brk-brand:focus-visible,
.brk-topbtn:focus-visible {
  outline: 3px solid var(--brk-focus);
  outline-offset: 2px;
}

.brk-ico-sun,
:root[data-theme='light'] .brk-ico-moon {
  display: none;
}

:root[data-theme='light'] .brk-ico-sun {
  display: block;
}

.brk-pagefoot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3rem 0 max(1.5rem, env(safe-area-inset-bottom));
  color: var(--brk-muted);
  font-size: 0.82rem;
}

/* while building, the build view fills the screen: no footer to scroll to */
body.brk-building .brk-pagefoot {
  display: none;
}

.brk-pagefoot a {
  color: inherit;
}

.brk {
  display: block;
  padding-top: 0.75rem;
}

.brk [hidden] {
  display: none !important;
}

.brk button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  margin: 0;
}

.brk button:focus-visible,
.brk input:focus-visible {
  outline: 3px solid var(--brk-focus);
  outline-offset: 2px;
}

.brk h1,
.brk h2 {
  color: var(--brk-text);
  margin: 0;
}

.brk-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.brk-c-red { --c: var(--brk-red); }
.brk-c-yellow { --c: var(--brk-yellow); }
.brk-c-blue { --c: var(--brk-blue); }
.brk-c-green { --c: var(--brk-green); }
.brk-c-orange { --c: var(--brk-orange); }
.brk-c-lime { --c: var(--brk-lime); }
.brk-c-pink { --c: var(--brk-pink); }
.brk-c-lightblue { --c: var(--brk-lightblue); }

.brk-note {
  margin: 0;
  padding: 1.5rem;
  text-align: center;
  color: var(--brk-muted);
  border: 1px dashed var(--brk-line);
  border-radius: var(--brk-radius);
}

/* ---------- header (server-rendered) ---------- */
.brk-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1.75rem;
}

.brk-head__title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brk-head__sub {
  margin: 0.4rem 0 0;
  color: var(--brk-muted);
  font-size: 1.05rem;
}

.brk-head__tools {
  flex: 0 1 360px;
  min-width: 0;
}

.brk.is-building .brk-head {
  display: none;
}

.brk-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  margin: 0;
  padding: 0 8px 0 16px;
  border: 1px solid var(--brk-line);
  border-radius: 999px;
  background: var(--brk-card);
  color: var(--brk-muted);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.brk-search:focus-within {
  border-color: var(--brk-blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brk-blue) 18%, transparent);
}

.brk-search > svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.brk-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--brk-text);
  font: 500 1rem inherit;
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.brk-search input::placeholder {
  color: var(--brk-muted);
}

.brk-search input::-webkit-search-cancel-button {
  display: none;
}

.brk-search input:focus-visible {
  outline: none;
}

.brk-search__clear {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--brk-soft);
}

.brk-search__clear svg {
  width: 16px;
  height: 16px;
}

/* ---------- difficulty towers: n stacked bricks ---------- */
.brk-tower {
  display: inline-flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  width: 18px;
  height: 36px;
  padding-top: 4px;
  flex: none;
}

.brk-tower i {
  position: relative;
  display: block;
  height: 6px;
  margin-top: 1px;
  border-radius: 2px;
  background: var(--c);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.brk-tower i:last-child::before {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 100%;
  width: 5px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--c);
  box-shadow: 7px 0 0 var(--c);
}

/* ---------- home ---------- */
.brk-home {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.brk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brk-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
  margin: -2px;
  scrollbar-width: none;
}

.brk-tabs::-webkit-scrollbar {
  display: none;
}

.brk-tab {
  flex: none;
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 14px 10px 12px;
  border: 1px solid var(--brk-line);
  border-radius: 14px;
  background: var(--brk-card);
  font-weight: 600 !important;
  font-size: 0.95rem;
  transition: border-color 0.15s, background-color 0.15s;
}

.brk-tab:hover {
  border-color: color-mix(in srgb, var(--c) 60%, var(--brk-line));
}

.brk-tab[aria-pressed='true'] {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--brk-card));
  box-shadow: inset 0 0 0 1px var(--c);
}

.brk-tab__name {
  line-height: 1.2;
}

.brk-tab__n {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brk-soft);
  color: var(--brk-muted);
  font-size: 0.78rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.brk-levelname {
  display: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.brk-home.is-searching .brk-levelname {
  visibility: hidden;
}

.brk-home.is-searching .brk-tabs {
  opacity: 0.45;
}

.brk-textbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--brk-muted) !important;
  font-weight: 600 !important;
  font-size: 0.95rem;
}

.brk-textbtn svg {
  width: 20px;
  height: 20px;
}

.brk-textbtn:hover {
  background: var(--brk-soft);
  color: var(--brk-text) !important;
}

.brk-results {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
}

/* last model banner */
.brk-last {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--brk-line);
  border-radius: var(--brk-radius);
  background: var(--brk-card);
}

.brk-last__pic {
  flex: none;
  width: 64px;
  height: 56px;
  padding: 6px;
  border-radius: 12px;
  background: var(--tint);
}

.brk-last__pic svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brk-last__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.brk-last__text small,
.brk-last__text span {
  color: var(--brk-muted);
  font-size: 0.88rem;
}

.brk-last__text b {
  font-weight: 700;
}

/* model cards */
.brk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.brk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
  border: 1px solid var(--brk-line);
  border-radius: 18px;
  background: var(--brk-card);
  overflow: hidden;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

/* Hover only recolors the frame: nothing moves or scales, so scrolling the
   list under a resting mouse pointer never makes the models jump around */
@media (hover: hover) {
  .brk-card:hover {
    border-color: color-mix(in srgb, var(--c) 55%, var(--brk-line));
    box-shadow: var(--brk-shadow);
  }
}

.brk-card__pic {
  display: block;
  height: 140px;
  padding: 14px;
  background: var(--tint);
}

.brk-card__pic svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.brk-card__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px 13px;
}

.brk-card__name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
}

.brk-card__meta {
  color: var(--brk-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.brk-card__prog {
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--brk-soft);
  overflow: hidden;
}

.brk-card__prog i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--c);
}

.brk-card__done {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brk-green);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.brk-card__done svg {
  width: 16px;
  height: 16px;
}

.brk-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 0.5rem;
  color: var(--brk-muted);
  font-size: 0.88rem;
}

.brk-stat {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brk-meter {
  display: block;
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: var(--brk-soft);
  overflow: hidden;
}

.brk-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--brk-green);
  transition: width 0.4s ease;
}

.brk-link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--brk-muted) !important;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- buttons ---------- */
/* The main button is a red brick: studs on top, a darker edge below */
.brk-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 22px;
  margin-top: 6px !important;
  border: 0;
  border-radius: 14px;
  background: var(--brk-red);
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 1.15rem;
  box-shadow: 0 4px 0 var(--brk-red-d);
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.15s;
}

.brk-cta::before {
  content: '';
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 100%;
  height: 6px;
  background: radial-gradient(9px 12px at 50% 100%, var(--brk-red) 0 96%, transparent 100%) 0 0 / 34px 100% space;
  pointer-events: none;
}

.brk-cta svg {
  width: 20px;
  height: 20px;
}

.brk-cta:hover {
  background: #ee2b21;
}

.brk-cta:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--brk-red-d);
}

.brk-cta--sm {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.95rem;
}

.brk-cta--sm::before {
  left: 20%;
  right: 20%;
  height: 5px;
  background-size: 26px 100%;
}

.brk-btn2 {
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid var(--brk-line);
  border-radius: 14px;
  background: transparent;
  font-weight: 600 !important;
}

.brk-btn2:hover {
  background: var(--brk-soft);
}

.brk-chipbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid #dde3ea;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2430 !important;
  font-weight: 600 !important;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(31, 36, 48, 0.08);
}

.brk-chipbtn svg {
  width: 18px;
  height: 18px;
}

.brk-chipbtn:hover {
  background: #fff;
}

.brk-iconbtn,
.brk-backbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 44px;
  border: 1px solid var(--brk-line);
  border-radius: 12px;
  background: var(--brk-card);
  font-weight: 600 !important;
}

.brk-iconbtn {
  flex: none;
  width: 44px;
}

.brk-backbtn {
  flex: none;
  padding: 0 14px 0 8px;
}

.brk-iconbtn svg,
.brk-backbtn svg {
  width: 20px;
  height: 20px;
}

.brk-iconbtn:hover,
.brk-backbtn:hover {
  background: var(--brk-soft);
}

/* ---------- build ---------- */
.brk-build {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* svh, not dvh: the small viewport height stays put while a phone's
     address bar slides in and out during scrolling, so the stage (and the
     model drawn to fit it) does not resize under the finger */
  height: calc(100vh - 88px);
  height: calc(100svh - 88px);
  min-height: 540px;
  max-height: 940px;
}

.brk-bhead {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brk-bhead__title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.brk-bhead__title h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.brk-lvl {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  color: var(--brk-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.brk-lvl .brk-tower {
  width: 14px;
  height: 28px;
  transform: translateY(-2px);
}

.brk-lvl .brk-tower i {
  height: 4px;
}

.brk-lvl .brk-tower i:last-child::before {
  left: 2px;
  width: 4px;
  height: 2px;
  box-shadow: 6px 0 0 var(--c);
}

.brk-bmain {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.brk-stage {
  position: relative;
  min-height: 0;
  border: 1px solid var(--brk-line);
  border-radius: 24px;
  background: var(--brk-stage);
  overflow: hidden;
  touch-action: pan-y;
}

.brk-view {
  display: block;
  width: 100%;
  height: 100%;
}

.brk-rot {
  position: absolute;
  left: 14px;
  bottom: 14px;
}

.brk-toast {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: #1f2430;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  animation: brk-fade 0.3s ease both;
}

.brk-toast .brk-chipbtn {
  padding: 5px 12px;
  border: 0;
}

@keyframes brk-fade {
  from { transform: translate(-50%, -8px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.brk-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--brk-line);
  border-radius: 24px;
  background: var(--brk-card);
}

.brk-panel__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brk-steplabel {
  margin: 0;
  font-size: 1rem;
  color: var(--brk-muted);
}

.brk-steplabel b {
  color: var(--brk-text);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brk-build.is-done .brk-steplabel b {
  color: var(--brk-green);
}

/* step bar: one little brick per step */
.brk-steps {
  display: flex;
  gap: 4px;
  padding-top: 4px;
}

.brk-seg {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--brk-soft);
  transition: background-color 0.2s;
}

.brk-seg::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: min(8px, 50%);
  height: 3px;
  transform: translateX(-50%);
  border-radius: 2px 2px 0 0;
  background: inherit;
  opacity: 0;
}

.brk-seg.is-on,
.brk-seg.is-now {
  background: var(--c);
}

.brk-seg.is-on::before,
.brk-seg.is-now::before {
  opacity: 1;
}

.brk-seg.is-now {
  outline: 2px solid var(--brk-text);
  outline-offset: 2px;
}

.brk-seg:hover {
  filter: brightness(1.1);
}

.brk-need {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brk-need__text {
  margin: 0 0 10px;
  color: var(--brk-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.brk-parts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brk-part {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 8px 4px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
}

.brk-part__pic {
  flex: none;
  display: grid;
  place-items: center;
  width: 60px;
  height: 46px;
  border-radius: 10px;
  background: #f3f5f8;
}

.brk-part__pic svg {
  display: block;
  width: 48px;
  height: 36px;
  overflow: visible;
}

.brk-part__n {
  font-weight: 800;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.2ch;
}

.brk-part__name {
  flex: 1;
  color: var(--brk-text);
  font-size: 0.9rem;
  line-height: 1.3;
}

.brk-parts--check .brk-part:hover {
  background: var(--brk-soft);
}

.brk-part__tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--brk-line);
  border-radius: 7px;
  color: transparent;
  transition: background-color 0.15s, border-color 0.15s;
}

.brk-part__tick svg {
  width: 14px;
  height: 14px;
}

.brk-part.is-got .brk-part__tick {
  border-color: var(--brk-green);
  background: var(--brk-green);
  color: #fff;
}

.brk-part.is-got .brk-part__pic,
.brk-part.is-got .brk-part__n,
.brk-part.is-got .brk-part__name {
  opacity: 0.45;
}

.brk-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brk-hint {
  display: none;
  margin: -4px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--brk-muted);
}

@media (pointer: fine) {
  .brk-hint {
    display: block;
  }
}

.brk-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.brk-confetti i {
  position: absolute;
  top: -20px;
  width: 14px;
  height: 8px;
  border-radius: 2px;
  background: var(--c);
  animation: brk-fall 2.6s linear infinite;
}

.brk-confetti i::before {
  content: '';
  position: absolute;
  left: 2px;
  bottom: 100%;
  width: 4px;
  height: 2px;
  border-radius: 1px 1px 0 0;
  background: var(--c);
  box-shadow: 6px 0 0 var(--c);
}

@keyframes brk-fall {
  to { transform: translateY(110vh) rotate(540deg); }
}

/* ---------- tablets and phones ---------- */
@media (max-width: 899px) {
  .brk-bmain {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .brk-stage {
    flex: 1;
    min-height: 220px;
  }

  .brk-panel {
    flex: none;
    gap: 12px;
    padding: 14px;
  }

  .brk-panel__head {
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }

  .brk-steplabel {
    flex: none;
    white-space: nowrap;
  }

  .brk-steplabel b {
    font-size: 1.15rem;
  }

  .brk-steps {
    flex: 1;
    min-width: 0;
  }

  .brk-need {
    flex: none;
    max-height: 22vh;
    max-height: 22svh;
  }

  .brk-need__text {
    margin-bottom: 6px;
  }

  .brk-parts {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .brk-part {
    width: auto;
  }

  .brk-parts--check li {
    flex: 1 1 100%;
  }

  .brk-parts--check .brk-part {
    width: 100%;
  }

  .brk-actions {
    flex-direction: row-reverse;
  }

  .brk-actions .brk-cta {
    flex: 1;
  }

  .brk-actions .brk-btn2 {
    min-height: 56px;
    margin-top: 6px;
  }
}

@media (max-width: 560px) {
  .brk-head {
    margin-bottom: 1.25rem;
  }

  .brk-head__tools {
    flex-basis: 100%;
  }

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

  .brk-card__pic {
    height: 116px;
    padding: 10px;
  }

  .brk-card__body {
    padding: 9px 11px 11px;
  }

  .brk-bar {
    gap: 8px;
  }

  .brk-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    width: calc(100% + 4px);
  }

  .brk-tab {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    font-size: 0.7rem;
    letter-spacing: -0.01em;
  }

  .brk-tab__name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brk-tab__n {
    display: none;
  }

  .brk-bar .brk-textbtn {
    margin-left: auto;
    padding: 6px 4px;
    font-size: 0.88rem;
  }

  .brk-rot span {
    display: none;
  }

  .brk-rot {
    left: 10px;
    bottom: 10px;
    padding: 8px;
  }

  .brk-backbtn span {
    display: none;
  }

  .brk-backbtn {
    width: 44px;
    padding: 0;
  }

  .brk-lvl span {
    display: none;
  }

  .brk-stage {
    min-height: 150px;
  }

  .brk-build {
    min-height: 430px;
    gap: 10px;
  }

  .brk-part__pic {
    width: 50px;
    height: 40px;
  }

  .brk-part__pic svg {
    width: 40px;
    height: 30px;
  }
}

@media (max-width: 420px) {
  .brk-tab__name {
    display: none;
  }

  .brk-tab {
    padding: 8px 0 10px;
  }

  .brk-levelname {
    display: block;
  }
}

/* ---------- full screen mode ---------- */
html.brk-lock,
html.brk-lock body.brk-doc {
  overflow: hidden;
}

.brk.brk--focus {
  position: fixed;
  inset: 0;
  z-index: 1500;
  overflow: auto;
  background: var(--brk-page);
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.brk.brk--focus .brk-body,
.brk.brk--focus .brk-build {
  height: 100%;
}

.brk.brk--focus .brk-build {
  max-height: none;
  min-height: 0;
}

/* ---------- motion ---------- */
.brk-drop {
  animation: brk-drop 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

@keyframes brk-drop {
  from { transform: translateY(-70px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.brk-hop {
  animation: brk-hop 0.9s ease-in-out infinite alternate;
}

@keyframes brk-hop {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.brk-spin {
  animation: brk-spin 0.3s ease-out;
  transform-origin: 50% 60%;
}

@keyframes brk-spin {
  from { transform: rotate(-10deg) scale(0.95); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .brk-drop,
  .brk-hop,
  .brk-spin,
  .brk-toast {
    animation: none;
  }

  .brk-confetti {
    display: none;
  }

  .brk-card,
  .brk-cta {
    transition: none;
  }
}
