.yarn-row { display:flex; align-items:center; gap:var(--pfse-spacing-1); margin:0; flex: 0 0 auto; width: 100%; }
.yarn-slider { flex:1; min-width: 50%; }
.yarn-value { width:56px; font-family: monospace; display:flex; flex-direction:column; align-items:center; gap:4px; }
.yarn-container { display: flex; flex-direction: column; gap: var(--pfse-spacing-2); height: 100%;  justify-content: space-evenly; box-sizing: border-box; }

/* Minimal focus styles for keyboard users */
.yarn-panel input[type="range"]:focus { outline: 2px solid #6ca0ff; outline-offset: 2px; }

/* Hide internal slider numeric output; we provide a 3-decimal external output */
.yarn-panel .number-slider__value { display: none; }
.yarn-panel .number-slider__ratio { display: none; }

.evolution-header, .yarn-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.evolution-header h3, .yarn-header h3 { margin:0; font-size:var(--pfse-font-size-h3); font-weight:600; letter-spacing:0.5px; color:var(--pfse-text-muted); }
.evolution-steps__select, .yarn-steps__select { min-width:36px; max-width:120px; padding-inline:8px; }
.evolution-grid { display:flex; gap:16px; justify-content:space-between; align-items:stretch; height: 100%; }
.evolution-column {
  /* Stable 3-row layout: top=value, middle=slider, bottom=glyph */
  display: grid;
  grid-template-rows: auto 1fr auto; /* value / slider / glyph */
  align-items: center;
  justify-items: center;
  gap: var(--pfse-spacing-2);
  min-height: 180px;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: visible; /* allow rotated inputs to render without clipping */
}

/* Place slider/value/label into explicit grid rows so transforms don't
   push glyphs out of flow. */
.evolution-column .yarn-slider { grid-row: 2; position: relative; width: 100%; align-self: stretch; justify-self: center; height: 100%; padding-inline: var(--pfse-spacing-2); overflow: visible; }
.evolution-column .evolution-value { grid-row: 1; align-self: start; }
.evolution-column .evolution-label { grid-row: 3; align-self: end; position: relative; z-index: 50; pointer-events: none; }
.evolution-label { font-family: "EB Garamond", serif; font-weight:700; letter-spacing:0.02em; }
.evolution-value { font-family: monospace;  text-align:center; }

/* Alpha/Beta (evolution) and Omega/Sigma (yarn) boxed label styles */
.evolution-label, .yarn-label {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "EB Garamond", serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  box-sizing: border-box;
  border: 2px groove var(--pfse-border-primary);
  border-radius: 0;
  background: var(--pfse-surface-secondary);
  color: var(--pfse-focus-ring-color);
  text-align: center;
  -webkit-font-smoothing:antialiased;
}

/* Ensure evolution glyphs don't stretch and sit below their sliders */
.evolution-label {
  display: inline-flex !important;
  flex: 0 0 auto;
  margin-top: auto; /* push to bottom of the column */
  align-self: center;
  z-index: 3;
}

/* Make the boxed glyphs visually prominent across themes and ensure they
   appear above the slider thumbs/tracks. Use high-contrast text and a
   surface background so the alpha/beta letters remain visible. */
.evolution-label {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: var(--pfse-surface-primary);
  border: 2px solid var(--pfse-border-primary);
  color: var(--pfse-text-high);
  font-family: var(--pfse-font-greek);
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
  z-index: 50;
  pointer-events: none;
}

/* Yarn labels smaller to fit the square and leave more room for the slider */
.yarn-label {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: var(--pfse-surface-primary);
  border: 2px solid var(--pfse-border-primary);
  color: var(--pfse-text-high);
  font-family: var(--pfse-font-greek);
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
  z-index: 30;
  pointer-events: none;
}

.evolution-column .yarn-slider {
  grid-row: 2;
  position: relative;
  width: 100%;
  align-self: stretch;
  justify-self: center;
  padding-inline: var(--pfse-spacing-2);
}

/* Ensure Evolution uses the same horizontal slider sizing as Yarn */
.evolution-column .yarn-slider .number-slider,
.evolution-column .yarn-slider input[type="range"] {
  width: 100%;
  display: block;
}
.evolution-panel input[type="range"]:focus { outline: 2px solid var(--pfse-focus-ring-color, #6ca0ff); outline-offset: 2px; }
.evolution-panel .number-slider__value { display: none; }
.evolution-panel .number-slider__ratio { display: none; }

/* Balanced panel layout: ensure Evolution and Yarn panels occupy similar vertical space
   and internal sliders share a consistent structure (vertical sliders are rotated).
   Use spacing tokens and flex so the layout scales with design tokens. */
.evolution-panel, .yarn-panel {
  display: flex;
  flex-direction: column;
  gap: var(--pfse-spacing-2);
  min-height: 0;
  height: 100%;
}

/* Avoid clipping of absolutely-positioned rotated inputs or glyph labels
   inside the evolution panel. Keep overflow visible so the 48×48 label
   boxes are never clipped by panel bounds. */
.evolution-panel {
  overflow: visible;
}

.evolution-column {
  overflow: visible;
}

/* Make the evolution grid grow to fill available panel space */
.evolution-panel .evolution-grid {
  display: flex;
  gap: var(--pfse-spacing-3);
  align-items: stretch;
  justify-content: space-between;
  flex: 1 1 auto;
  height: 100%;
  padding: var(--pfse-spacing-2) 0;
}

/* Horizontal slider track sizing (yarn) */
.yarn-slider .number-slider,
.yarn-slider input[type="range"] { width: 100%; }

.evolution-column { /* grid layout defined above */ }

/* small visual polish: consistent inner padding handled in single .evolution-panel .vertical-slider rule above */

/* Panels row and square panel wrapper to ensure 2x1 fits parent width responsively */
.panels-row {
  display:flex;
  gap: var(--pfse-spacing-3);
  width: 100%;
  align-items: stretch;
  justify-content: space-between;
  box-sizing: border-box;
}

.panel--square {
  flex: 1 1 0;
  min-width: 0; /* allow shrinking inside flex container */
  aspect-ratio: 1 / 1; /* keep square */
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  min-height: 0;
}

.panel--square > * {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

/* slider-column: top=value, middle=slider, bottom=glyph; slider is centered between value and label */
.slider-column {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  gap: var(--pfse-spacing-2);
  width: 100%;
  box-sizing: border-box;
}

/* Make the top numeric value visible and readable; keep yarn-specific
   width and alignment for the yarn panel. */
.evolution-value {
  position: static;
  width: auto;
  height: auto;
  font-family: monospace;
  display:flex;
  flex-direction:column;
  align-items:center;
  color: var(--pfse-text-muted);
  margin-bottom: 4px;
}
.yarn-value {
  width:56px;
  font-family: monospace;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
}

/* Ratio column for numerator / hr / denominator */
.ratio-column { display:flex; flex-direction:column; align-items:center; gap:2px; }
.ratio-num { font-size:0.95rem; line-height:1; }
.ratio-hr { width:32px; height:1px; background:var(--pfse-text-muted); }
.ratio-den { font-size:0.95rem; line-height:1; opacity:0.95; }
