.utility-grid,
.utility-panel,
.ratio-panel,
.ratio-favorite-content,
.ratio-favorite-content form,
.ratio-favorite-content .manager-form { min-width: 0; max-width: 100%; }

.context-panel { align-items: center; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 24px; margin-top: 18px; padding-top: 15px; }
.context-label-wrap { flex: 1; min-width: 0; }
.context-label-wrap small { color: var(--muted); display: block; font-size: 10px; margin-top: 4px; }
.context-label-wrap .profile-math-note { color: var(--brass-bright); }
.context-label-wrap .profile-math-note b { font-weight: 700; }
.context-controls { align-items: center; display: flex; gap: 8px; }
.context-controls > select,
.context-subcontrol select { background-color: rgba(3,13,24,.42); border: 1px solid var(--line); border-radius: 7px; min-height: 34px; }
.context-controls > select { min-width: 145px; }
.context-subcontrol { align-items: center; color: var(--soft); display: flex; font-family: "DM Mono", monospace; font-size: 9px; gap: 6px; white-space: nowrap; }
.context-subcontrol select { color: var(--muted); font-family: Manrope, sans-serif; font-size: 10px; min-width: 105px; }
.context-subcontrol select option { background: var(--navy); }
.context-subcontrol[hidden],
.ratio-context-strip[hidden],
.ratio-focus[hidden] { display: none !important; }
.nearby-guidance { color: var(--muted); font-size: 10px; white-space: nowrap; }
.profile-feedback { background: rgba(211,169,95,.08); border: 1px solid rgba(211,169,95,.28); border-radius: 7px; color: var(--brass-bright); flex-basis: 100%; font-family: "DM Mono", monospace; font-size: 10px; line-height: 1.45; margin-top: 1px; padding: 8px 10px; }
.profile-feedback.profile-feedback-active { background: rgba(211,169,95,.14); border-color: var(--line-strong); }
.theme-picks { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.theme-pick-heading { align-items: baseline; display: flex; gap: 10px; }
.theme-pick-heading small { color: var(--soft); font-size: 10px; }
.theme-pick-row { align-items: center; display: flex; gap: 10px; margin-top: 8px; min-width: 0; }
.theme-pick-row[hidden] { display: none !important; }
.theme-pick-chip { min-height: 27px; }
.custom-profile-editor { border-top: 1px solid var(--line); flex-basis: 100%; margin-top: 13px; padding-top: 12px; width: 100%; }
.custom-profile-editor[hidden] { display: none !important; }
.custom-profile-editor > div:first-child small { color: var(--soft); display: block; font-size: 10px; margin-top: 3px; }
.custom-profile-fields { align-items: end; display: grid; gap: 8px; grid-template-columns: 1fr 1.2fr auto auto; margin-top: 10px; }
.custom-profile-fields label { color: var(--soft); display: block; font-family: "DM Mono", monospace; font-size: 9px; }
.custom-profile-fields input { background: rgba(3,13,24,.42); border: 1px solid var(--line); border-radius: 7px; display: block; font-family: Manrope, sans-serif; font-size: 12px; margin-top: 5px; min-height: 34px; padding: 0 9px; }
.custom-profile-fields button:not(.reset-button) { background: var(--brass); border: 0; border-radius: 7px; color: #172436; font-size: 11px; font-weight: 700; min-height: 34px; padding: 0 11px; }
.custom-profile-editor > small { color: var(--soft); display: block; font-size: 10px; margin-top: 7px; }

.scale-explorer { border-bottom: 1px solid var(--line); padding: 0; }
.scale-explorer summary { align-items: center; cursor: pointer; display: flex; justify-content: space-between; list-style: none; padding: 11px 0 12px; }
.scale-explorer summary::-webkit-details-marker { display: none; }
.scale-explorer summary small { color: var(--soft); display: block; font-family: "DM Mono", monospace; font-size: 9px; margin-top: 3px; }
.scale-explorer[open] .summary-plus { transform: rotate(45deg); }
.explorer-track { align-items: end; display: flex; flex: 1; gap: 0; justify-content: space-between; min-width: 0; overflow: hidden; padding: 4px 5px 0; }
.explorer-node { align-items: center; color: var(--soft); display: flex; flex: 1; flex-direction: column; font-family: "DM Mono", monospace; font-size: 9px; min-width: 42px; position: relative; text-align: center; }
.explorer-node:not(:last-child)::after { background: var(--line); content: ""; height: 1px; left: 50%; position: absolute; right: -50%; top: 4px; }
.explorer-node i { background: var(--soft); border: 2px solid var(--navy); border-radius: 50%; height: 9px; position: relative; width: 9px; z-index: 1; }
.explorer-node b { font-weight: 400; margin-top: 5px; white-space: nowrap; }
.explorer-node.favorite i { background: var(--brass); }
.explorer-node.current { color: var(--brass-bright); }
.explorer-node.current i { background: var(--brass-bright); box-shadow: 0 0 0 3px rgba(211,169,95,.16); }

.ratio-focus { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 15px; }
.ratio-focus-heading small { color: var(--soft); display: block; font-size: 10px; margin-top: 4px; }
.ratio-focus .compare-fields { margin-top: 13px; max-width: 330px; }
.ratio-focus .compare-result { margin-top: 11px; }
.ratio-focus-nearby { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 13px; }
.ratio-focus-nearby .tool-title { margin-bottom: 0; }
.ratio-focus-nearby .ratio-context-list { margin-top: 8px; }
.result-caveat { color: var(--soft); flex-basis: 100%; font-size: 10px; margin-top: 2px; }
.hero-panel.ratio-primary-active .size-inputs,
.hero-panel.ratio-primary-active .favorite-tools,
.hero-panel.ratio-primary-active .result-stage,
.hero-panel.ratio-primary-active .preset-row,
.hero-panel.ratio-primary-active .input-error { display: none; }
.hero-panel.ratio-primary-active .context-panel { margin-top: 17px; }

.ratio-context-strip { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 13px; }
.ratio-context-strip > div:first-child { align-items: baseline; display: flex; gap: 10px; }
.ratio-context-strip > div:first-child small { color: var(--soft); font-size: 10px; }
.ratio-context-list { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 3px; }
.ratio-nearby-chip { font-size: 10px; }

.bridge-tool { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 15px; }
.bridge-tool .tool-title { margin-bottom: 3px; }
.bridge-tool .tool-title + small { color: var(--soft); display: block; font-size: 10px; }
.bridge-fields { align-items: end; display: grid; gap: 8px; grid-template-columns: 1fr 1.15fr auto; margin-top: 13px; }
.bridge-fields .input-shell { min-height: 40px; }
.bridge-fields input { font-size: 13px; }
.bridge-fields button { background: var(--brass); border: 0; border-radius: 7px; color: #172436; font-size: 11px; font-weight: 700; min-height: 40px; padding: 0 13px; }
.bridge-result { color: var(--brass-bright); font-family: "DM Mono", monospace; font-size: 11px; margin: 12px 0 0; }

@media (max-width: 680px) {
  .context-panel { align-items: start; display: block; }
  .context-controls { align-items: stretch; display: grid; grid-template-columns: 1fr; margin-top: 11px; }
  .context-controls > select { width: 100%; }
  .context-subcontrol { justify-content: space-between; }
  .context-subcontrol select { flex: 1; }
  .profile-feedback { margin-top: 12px; }
  .scale-explorer { display: block; }
  .scale-explorer summary { padding: 10px 0; }
  .explorer-track { justify-content: flex-start; overflow-x: auto; padding-bottom: 5px; }
  .explorer-node { flex: 0 0 53px; }
  .ratio-focus .compare-fields { max-width: 250px; }
  .bridge-fields { grid-template-columns: 1fr 1fr; }
  .bridge-fields button { grid-column: 1 / -1; }
  .ratio-context-strip > div:first-child { display: block; }
  .ratio-context-strip > div:first-child small { display: block; margin-top: 4px; }
  .nearby-guidance { white-space: normal; }
  .theme-pick-heading { display: block; }
  .theme-pick-heading small { display: block; margin-top: 3px; }
  .theme-pick-row { align-items: start; }
  .theme-pick-row .favorite-chip-list { max-width: calc(100vw - 70px); }
  .custom-profile-fields { grid-template-columns: 1fr 1fr; }
  .custom-profile-fields button { grid-column: span 1; }
  .ratio-favorite-content form { width: 100%; }
  .ratio-favorite-content #ratio-favorite-input { min-width: 0; }
}
