html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #020306;
}

#polyhedra-app,
#polyhedra-app * { box-sizing: border-box; }

#polyhedra-app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 43%, rgba(35, 130, 164, 0.15), transparent 39%),
    radial-gradient(circle at 68% 62%, rgba(190, 66, 134, 0.075), transparent 35%),
    linear-gradient(145deg, #010205, #05070c 56%, #010204);
  color: #fff;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#polyhedra-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#polyhedra-canvas:active { cursor: grabbing; }

.polyhedra-loading {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

#polyhedra-panel [data-sfi-world-panel-body] button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(10, 14, 20, 0.58);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.025em;
  backdrop-filter: blur(12px);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

#polyhedra-panel [data-sfi-world-panel-body] button:hover {
  border-color: rgba(191, 232, 251, 0.52);
  background: rgba(191, 232, 251, 0.1);
}

#polyhedra-panel [data-sfi-world-panel-body] button:focus-visible,
#polyhedra-panel [data-sfi-world-panel-body] input:focus-visible,
#polyhedra-panel [data-sfi-world-panel-body] summary:focus-visible {
  outline: 2px solid var(--sfi-blue);
  outline-offset: 3px;
}

#polyhedra-panel [data-sfi-world-panel-body] button[aria-pressed="true"],
#polyhedra-panel [data-sfi-world-panel-body] button[aria-selected="true"] {
  border-color: rgba(191, 232, 251, 0.72);
  background: rgba(191, 232, 251, 0.16);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 18px rgba(191, 232, 251, 0.08);
}

.polyhedra-atlas-labels[hidden] { display: none; }

.polyhedra-atlas-labels {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.polyhedra-atlas-label {
  position: absolute;
  min-height: 0 !important;
  max-width: 124px;
  padding: 3px 7px !important;
  border: 1px solid transparent !important;
  border-radius: 999px;
  background: rgba(2, 5, 9, 0.48) !important;
  color: rgba(235, 247, 252, 0.67) !important;
  font-size: 8px !important;
  line-height: 1.15;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(5px);
}

.polyhedra-atlas-label:hover,
.polyhedra-atlas-label:focus-visible,
.polyhedra-atlas-label.is-hovered {
  z-index: 2;
  max-width: 220px;
  border-color: rgba(191, 232, 251, 0.5) !important;
  color: #fff !important;
  transform: translate(-50%, -50%) scale(1.08);
}

.polyhedra-atlas-label.is-space-filling {
  border-color: rgba(210, 175, 103, 0.52) !important;
  color: rgba(255, 239, 196, 0.9) !important;
}

.polyhedra-atlas-label.is-selected {
  border-color: rgba(191, 232, 251, 0.38) !important;
  color: rgba(255, 255, 255, 0.94) !important;
}

.polyhedra-atlas-label .polyhedra-list-tessellation {
  float: none;
  margin: 0 4px 0 0;
}

.polyhedra-atlas-name-full { display: none; }
.polyhedra-atlas-label:hover .polyhedra-atlas-name-short,
.polyhedra-atlas-label:focus-visible .polyhedra-atlas-name-short,
.polyhedra-atlas-label.is-hovered .polyhedra-atlas-name-short { display: none; }
.polyhedra-atlas-label:hover .polyhedra-atlas-name-full,
.polyhedra-atlas-label:focus-visible .polyhedra-atlas-name-full,
.polyhedra-atlas-label.is-hovered .polyhedra-atlas-name-full { display: inline; }

#polyhedra-app.is-atlas .polyhedra-single-only { display: none; }
#polyhedra-app.is-atlas #polyhedra-view-group {
  border-color: rgba(191, 232, 251, 0.72);
  background: rgba(191, 232, 251, 0.16);
  color: #fff;
}
#polyhedra-app.is-atlas .polyhedra-search,
#polyhedra-app.is-atlas .polyhedra-search-row { grid-template-columns: 1fr; }

#polyhedra-panel {
  overflow-x: hidden;
}

.polyhedra-current-kicker {
  margin: 4px 0 0;
  color: rgba(191, 232, 251, 0.66);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.polyhedra-family-tabs,
.polyhedra-dual-modes,
.polyhedra-segmented,
.polyhedra-toggle-row {
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  box-shadow: inset 0 1px 7px rgba(0, 0, 0, 0.28);
}

.polyhedra-family-tabs {
  grid-template-columns: 0.92fr 1.46fr 0.84fr 0.84fr;
  margin-top: 0;
}

.polyhedra-family-tabs button,
.polyhedra-dual-modes button,
.polyhedra-segmented button,
.polyhedra-toggle-row button {
  min-width: 0;
  min-height: 34px !important;
  padding: 6px 4px !important;
  border-color: transparent !important;
  background: transparent !important;
  font-size: 10px !important;
}

.polyhedra-family-tabs button {
  overflow: visible;
  letter-spacing: 0;
  white-space: nowrap;
}

.polyhedra-family-tabs button[aria-selected="true"],
.polyhedra-dual-modes button[aria-pressed="true"],
.polyhedra-segmented button[aria-pressed="true"],
.polyhedra-toggle-row button[aria-pressed="true"] {
  border-color: rgba(191, 232, 251, 0.58) !important;
  background: rgba(191, 232, 251, 0.13) !important;
}

.polyhedra-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  margin-top: 8px;
}

.polyhedra-search input {
  width: 100%;
  height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
  font-size: 12px;
}

.polyhedra-search input::placeholder { color: rgba(255, 255, 255, 0.38); }

.polyhedra-browser { margin-top: 8px; }

.polyhedra-solid-list {
  max-height: 114px;
  overflow-y: auto;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
}

.polyhedra-solid-list button {
  display: block;
  width: 100%;
  min-height: 31px !important;
  padding: 6px 9px !important;
  border-color: transparent !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.67) !important;
  text-align: left;
}

.polyhedra-solid-list button[aria-selected="true"] {
  background: rgba(191, 232, 251, 0.1) !important;
  color: #fff !important;
}

.polyhedra-solid-list button.is-space-filling {
  border-color: rgba(210, 175, 103, 0.48) !important;
  box-shadow: inset 0 0 0 1px rgba(210, 175, 103, 0.05);
}

.polyhedra-list-tessellation {
  float: right;
  margin-left: 8px;
  color: var(--sfi-gold-bright);
  font-size: 11px;
  line-height: 1;
  text-shadow: 0 0 9px rgba(210, 175, 103, 0.35);
}

.polyhedra-solid-list .johnson-number {
  display: inline-block;
  width: 31px;
  color: rgba(191, 232, 251, 0.62);
  font-variant-numeric: tabular-nums;
}

.polyhedra-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 7px;
}

.polyhedra-nav button { min-height: 34px !important; }

.polyhedra-current {
  padding: 15px 1px 13px;
  border-bottom: 1px solid rgba(210, 175, 103, 0.2);
}

.polyhedra-current h2 {
  margin: 4px 0 5px;
  color: rgba(255, 255, 255, 0.94);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.08;
}

.polyhedra-current > p {
  margin: 0;
  color: rgba(255, 255, 255, 0.54);
  font-size: 11px;
  line-height: 1.48;
}

.polyhedra-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.polyhedra-stats span {
  display: grid;
  padding: 8px 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.polyhedra-stats strong {
  margin-bottom: 2px;
  color: var(--sfi-blue);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: normal;
}

.polyhedra-space-filling {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
}

.polyhedra-space-filling[hidden],
.polyhedra-tessellation-controls[hidden] { display: none; }

.polyhedra-discovery {
  position: relative;
  padding: 8px 10px;
  border: 1px solid rgba(210, 175, 103, 0.5);
  border-radius: 10px;
  background: linear-gradient(110deg, rgba(210, 175, 103, 0.15), rgba(91, 186, 219, 0.08));
  color: var(--sfi-gold-bright);
  font-size: 10px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.polyhedra-space-filling button { min-height: 34px !important; }

.polyhedra-tessellation-controls {
  margin-top: 7px;
  padding: 1px 0 4px;
}

.polyhedra-tessellation-controls .polyhedra-range-control { margin-top: 5px; }

.polyhedra-tessellation-appearance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.polyhedra-tessellation-appearance button {
  min-height: 32px !important;
  padding-inline: 5px !important;
  font-size: 9px !important;
}

.polyhedra-tessellation-count {
  display: block;
  margin-top: 5px;
  padding: 0 2px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  white-space: nowrap;
}

.polyhedra-section {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.polyhedra-section summary {
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.polyhedra-facts {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
}

.polyhedra-facts > div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  font-size: 11px;
  line-height: 1.35;
}

.polyhedra-facts dt { color: rgba(255, 255, 255, 0.38); }
.polyhedra-facts dd { margin: 0; color: rgba(255, 255, 255, 0.7); }

.polyhedra-symmetry-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#polyhedra-panel .polyhedra-term {
  position: relative;
  min-height: 22px !important;
  padding: 2px 7px !important;
  border-color: rgba(191, 232, 251, 0.2) !important;
  background: rgba(191, 232, 251, 0.055) !important;
  color: rgba(224, 245, 255, 0.78) !important;
  font-size: 9px !important;
  line-height: 1.2;
}

[data-tooltip] { position: relative; }

[data-tooltip]::after {
  position: absolute;
  z-index: 20;
  left: 0;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: 235px;
  padding: 7px 9px;
  border: 1px solid rgba(191, 232, 251, 0.28);
  border-radius: 8px;
  background: rgba(4, 7, 12, 0.97);
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.83);
  content: attr(data-tooltip);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translateY(3px);
  transition: opacity 140ms ease, transform 140ms ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.polyhedra-toggle-row { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.polyhedra-two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 7px; }

.polyhedra-range-control {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
}

.polyhedra-range-control input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--sfi-blue);
}

.polyhedra-range-control output {
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.polyhedra-scale-note {
  display: block;
  margin: 5px 7px 0;
  color: rgba(191, 232, 251, 0.5);
  font-size: 9px;
  line-height: 1.35;
}

.polyhedra-scale-note[hidden] { display: none; }

.polyhedra-dual-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11px;
}

.polyhedra-dual-name button {
  min-height: 30px !important;
  padding: 5px 10px !important;
  border-color: transparent !important;
  background: transparent !important;
  color: var(--sfi-blue) !important;
}

.polyhedra-correspondence {
  margin: 3px 0 9px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  line-height: 1.5;
}

.polyhedra-dual-modes { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.polyhedra-mini-label {
  display: block;
  margin: 10px 0 -5px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.polyhedra-construction { margin-top: 10px; }

.polyhedra-construction-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.polyhedra-construction-head button { min-height: 30px !important; }

.polyhedra-construction input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--sfi-blue);
}

.polyhedra-net-view { margin-top: 9px; }

.polyhedra-fold-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.polyhedra-fold-head span:last-child { text-align: right; }

.polyhedra-fold-head output {
  color: rgba(255, 255, 255, 0.86);
  font-size: 9px;
  letter-spacing: 0.03em;
  text-transform: none;
}

.polyhedra-fold-range {
  width: 100%;
  margin: 7px 0 0;
  accent-color: var(--sfi-blue);
}

.polyhedra-net-navigation {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px auto;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.polyhedra-net-navigation button {
  min-height: 31px !important;
  padding: 5px 8px !important;
}

.polyhedra-net-navigation span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 10px;
  text-align: center;
}

.polyhedra-net-status {
  min-height: 16px;
  margin: 7px 1px 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 9px;
  line-height: 1.45;
}

.polyhedra-net-status.has-overlap { color: rgba(240, 154, 190, 0.9); }

.polyhedra-net-legend {
  display: flex;
  gap: 13px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 9px;
}

.polyhedra-net-legend span { display: inline-flex; align-items: center; gap: 5px; }

.polyhedra-net-legend i {
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: #75d4ee;
  box-shadow: 0 0 7px rgba(117, 212, 238, 0.35);
}

.polyhedra-net-legend .is-cut { background: var(--sfi-gold); box-shadow: 0 0 7px rgba(210, 175, 103, 0.35); }
.polyhedra-net-legend .is-overlap { height: 7px; background: #c56791; box-shadow: 0 0 7px rgba(197, 103, 145, 0.42); }


.polyhedra-selection {
  margin-top: 10px;
  padding: 11px;
  border: 1px solid rgba(191, 232, 251, 0.2);
  border-radius: 12px;
  background: rgba(191, 232, 251, 0.055);
}

.polyhedra-selection > span {
  display: block;
  color: rgba(191, 232, 251, 0.62);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.polyhedra-selection strong {
  display: block;
  margin-top: 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
}

.polyhedra-selection p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  line-height: 1.45;
}

@media (min-width: 641px) and (max-width: 1119px) {
  .polyhedra-solid-list { max-height: 88px; }
  .polyhedra-current { padding-top: 11px; }
  .polyhedra-current h2 { font-size: 21px; }
  .polyhedra-current > p { display: none; }
  .polyhedra-atlas-label { max-width: 72px; padding: 2px 4px !important; font-size: 6px !important; }
}

@media (max-width: 640px) {
  .polyhedra-solid-list { max-height: 88px; }
  .polyhedra-current { padding-top: 11px; }
  .polyhedra-current h2 { font-size: 21px; }
  .polyhedra-current > p { display: none; }
  .polyhedra-atlas-label { max-width: 72px; padding: 2px 4px !important; font-size: 6px !important; }
  .polyhedra-search-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .polyhedra-search { grid-column: 1 / -1; }
  .polyhedra-family-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 18px; }
  .polyhedra-dual-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 18px; }
  .polyhedra-family-tabs button,
  .polyhedra-dual-modes button { min-height: 32px !important; }
  .polyhedra-net-navigation { grid-template-columns: 32px minmax(0, 1fr) 32px auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
