.fractal-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #000;
}

.fractal-page::before {
  display: none;
}

#fractal {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.fx-open {
  position: fixed;
  z-index: 4;
  top: 1rem;
  left: 1rem;
  min-height: 2.5rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(22, 22, 22, 0.88);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.fx-open:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(18rem, 24rem) 1fr;
  pointer-events: none;
}

.fx-overlay[hidden] {
  display: none;
}

.fx-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  padding: 1.25rem 1.25rem 1.5rem;
  background: rgba(22, 22, 22, 0.94);
  border-right: 1px solid var(--line);
  overflow: auto;
  pointer-events: auto;
}

.fx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.fx-panel .kicker {
  margin: 0;
}

.fx-panel h1 {
  margin: 0.15rem 0 0;
  font-size: 1.85rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.fx-close {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.fx-close:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.fx-lead,
.fx-hint,
.fx-step {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.fx-step {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.fx-math {
  display: grid;
  gap: 0.4rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.fx-eq {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
}

.fx-math-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.fx-places-block {
  display: grid;
  gap: 0.45rem;
}

.fx-places-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fx-places {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fx-new {
  display: inline-block;
  margin-left: 0.28em;
  padding: 0.07em 0.38em 0.05em;
  border-radius: 0.22em;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.25;
  vertical-align: 0.18em;
  white-space: nowrap;
}

.fx-place {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  cursor: pointer;
}

.fx-place:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.fx-place.is-selected,
.fx-place[aria-pressed="true"] {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
  font-weight: 600;
}

.fx-place.is-selected:hover,
.fx-place[aria-pressed="true"]:hover {
  color: var(--ink);
  background: #ffd34a;
}

.fx-place.is-selected .fx-new,
.fx-place[aria-pressed="true"] .fx-new {
  background: var(--ink);
  color: var(--yellow);
}

.card-link .fx-new,
.fx-tile h3 .fx-new {
  margin-left: 0.45rem;
  font-size: 0.62rem;
  vertical-align: 0.22em;
}

.fx-form {
  display: grid;
  gap: 0.75rem;
}

.fx-field {
  display: grid;
  gap: 0.3rem;
}

.fx-field > span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fx-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.fx-field input,
.fx-field select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
}

.fx-field input:focus,
.fx-field select:focus {
  border-color: var(--yellow);
  outline: none;
}

.fx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.fx-actions .btn,
.fx-actions .btn-ghost {
  margin: 0;
  min-height: 2.6rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.fx-actions .btn {
  border: 0;
}

.fx-actions .btn-ghost {
  padding: 0.5rem 1rem;
}

.fractal-zoom-page #fractal,
.life-page #fractal,
.fluid-page #fractal {
  cursor: crosshair;
}

.flock-page #fractal {
  cursor: none;
}

.life-page.is-stalemate #fractal {
  filter: blur(7px) brightness(1.25);
  transform: scale(1.05);
  cursor: default;
}

.life-page.is-stalemate .fx-overlay,
.life-page.is-stalemate .fx-open {
  display: none;
}

.life-stalemate {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: var(--pad);
  background: rgba(8, 8, 8, 0.18);
}

.life-stalemate[hidden] {
  display: none;
}

.life-stalemate-card {
  max-width: 26rem;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(22, 22, 22, 0.96);
}

.life-stalemate-card h2 {
  margin: 0.15rem 0 0.65rem;
  font-size: clamp(1.85rem, 5vw, 2.55rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.life-stalemate-card p:not(.kicker) {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.life-stalemate-card .btn,
.life-stalemate-card .btn-ghost {
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.life-stalemate-card .btn {
  border: 0;
}

.life-stalemate-card .btn-ghost {
  min-height: 3.1rem;
  padding: 0.7rem 1.25rem;
}

.life-stalemate-card .fx-actions {
  margin-top: 0;
}

.life-stalemate-mute {
  display: none;
  margin-top: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.life-stalemate-mute.is-on {
  display: inline-block;
}

.life-stalemate-mute:hover {
  color: var(--yellow);
}

.life-stalemate-mute[hidden] {
  display: none;
}

.fx-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.9rem;
  margin-top: auto;
  padding-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fx-switch a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
}

.fx-switch .fx-new {
  margin-left: 0.28em;
  font-size: 0.55rem;
  vertical-align: 0;
}

.fx-switch a:hover,
.fx-switch a[aria-current="page"] {
  color: var(--yellow);
}

.fractal-hub-page .site-header {
  position: sticky;
}

.fractal-hub-page .header-inner {
  justify-content: space-between;
}

.fx-back {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}

.fx-back:hover {
  color: var(--yellow);
}

.fractal-hub-hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--line);
}

.fractal-hub-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
  font-weight: 600;
}

.fractal-hub-lead {
  margin: 1.25rem 0 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
}

.fractal-hub-block {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  border-bottom: 1px solid var(--line);
}

.fractal-hub-block h2 {
  margin: 0.35rem 0 1.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.04em;
}

.fractal-ideas {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fractal-ideas li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.fractal-ideas li:last-child {
  border-bottom: 1px solid var(--line);
}

.fractal-ideas strong {
  display: block;
  margin-bottom: 0.2rem;
}

.fractal-ideas span {
  color: var(--muted);
}

@media (min-width: 801px) {
  .fractal-hub-page .grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.fractal-hub-page .card {
  min-height: 14.5rem;
  padding: 0;
  gap: 0;
}

.fx-tile-main {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  padding: clamp(1.4rem, 3vw, 2rem) clamp(1.4rem, 3vw, 2rem) 0.65rem;
  text-decoration: none;
  color: inherit;
}

.fx-tile:has(.fx-tile-main:hover),
.fx-tile:has(.fx-wiki:hover) {
  background: var(--surface);
}

.fx-tile:has(.fx-tile-main:hover) h3 {
  color: var(--yellow);
}

.fx-tile .fx-wiki {
  margin-top: auto;
  align-self: flex-start;
  max-width: calc(100% - 2.8rem);
  padding: 0 clamp(1.4rem, 3vw, 2rem) 1.15rem;
  text-decoration: none;
  white-space: normal;
}

.fx-tile .fx-wiki:hover {
  color: var(--yellow);
}

.fx-tile .fx-wiki:hover .fx-wiki-lang {
  border-color: var(--yellow);
  color: var(--yellow);
}

.fx-wiki {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.fx-wiki-lang {
  padding: 0.05em 0.32em 0.02em;
  border: 1px solid var(--line);
  border-radius: 0.2em;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .fx-overlay {
    grid-template-columns: 1fr;
    align-items: end;
  }

  .fx-panel {
    height: auto;
    max-height: min(58dvh, 32rem);
    gap: 0.55rem;
    padding: 0.85rem 0.9rem 1rem;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .fx-panel h1 {
    font-size: 1.35rem;
  }

  .fx-lead {
    display: none;
  }

  .fx-math {
    padding: 0.45rem 0.55rem;
    gap: 0.25rem;
  }

  .fx-eq {
    font-size: 0.72rem;
  }

  .fx-math-note {
    display: none;
  }

  .fx-form {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .fx-actions {
    grid-column: 1 / -1;
  }

  .fx-form .fx-field:last-of-type,
  .fx-form .fx-field-wide {
    grid-column: 1 / -1;
  }

  .fx-field input,
  .fx-field select {
    min-height: 2.15rem;
  }

  .fx-hint,
  .fx-step {
    font-size: 0.85rem;
  }

  .fx-place {
    min-height: 1.95rem;
    padding: 0 0.55rem;
    font-size: 0.8rem;
  }
}
