/* Corrective layout layer loaded after site-overhaul.css. */
:root {
  --magi-pink: #f84fa6;
  --magi-pink-dark: #a82768;
  --magi-pale: #fce1ee;
  --magi-border: #d9c7d1;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

#wrapper,
#callResultSection,
#canvasflame,
#heightChartContainer,
#mytable {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#canvasflame {
  overflow: hidden !important;
}

#mynetwork {
  width: min(96vw, 1180px) !important;
  max-width: 100% !important;
  margin-inline: auto;
  touch-action: none;
}

/* Relationship table: the page never becomes wider than the viewport. */
#mytable {
  position: relative;
  display: block;
  padding: 0 !important;
  overflow: visible !important;
  contain: layout paint;
}

.relationship-table-controls,
.height-zoom-controls-v2 {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  width: 100%;
  margin: 0.55rem 0;
  padding: 0.5rem;
  box-sizing: border-box;
  border: 1px solid var(--magi-border);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

.relationship-table-controls button,
.height-zoom-controls-v2 button {
  min-height: 2.2rem;
}

.relationship-table-controls input[type="range"],
.height-zoom-controls-v2 input[type="range"] {
  width: min(14rem, 40vw);
}

.relationship-height-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.relationship-height-control input[type="range"] {
  width: min(9rem, 28vw);
}

.relationship-table-viewport {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 70vh;
  min-height: 280px;
  max-height: 90vh;
  overflow: auto;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid var(--magi-border);
  background: #fff;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  contain: strict;
}

.relationship-table-stage,
.height-chart-stage-v2 {
  position: relative;
  overflow: visible;
}

.relationship-table-surface,
.height-chart-surface-v2 {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: left top;
  will-change: transform;
}

.relationship-scroll-hint-v2 {
  flex: 1 1 100%;
  color: #7d1e50;
  font-size: 0.86rem;
  line-height: 1.3;
}

#girltable {
  width: max-content !important;
  min-width: 0 !important;
  margin: 0 !important;
  border-collapse: separate;
  border-spacing: 2px;
  table-layout: fixed;
  font-size: 14px;
}

#girltable th,
#girltable td {
  position: static !important;
  width: 9rem;
  min-width: 9rem !important;
  max-width: 9rem !important;
  padding: 0.45rem 0.4rem !important;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.3;
  vertical-align: middle;
}

#girltable tr > :first-child {
  width: 11rem;
  min-width: 11rem !important;
  max-width: 11rem !important;
  box-shadow: none !important;
}

#girltable thead th {
  position: static !important;
  background: #f8cfe3;
}

/* Height chart uses an explicitly sized stage; zoom no longer leaves a large blank area. */
#heightChartContainer {
  overflow: hidden;
}

.height-chart-viewport-v2 {
  width: 100%;
  max-width: 100%;
  height: min(76vh, 850px);
  min-height: 360px;
  overflow: auto;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid var(--magi-border);
  background: #fff;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  contain: strict;
}

.height-chart-surface-v2 {
  display: grid;
  grid-template-rows: 720px 5rem;
  width: max-content;
  min-width: 0;
  background: #fff;
}

.height-y-axis-v2 {
  position: relative;
  grid-row: 1;
  height: 720px;
  border-right: 1px solid #aaa;
  background: #fafafa;
  z-index: 8;
}

.height-y-label-v2 {
  position: absolute;
  right: 0.45rem;
  transform: translateY(-50%);
  font-size: 0.84rem;
  white-space: nowrap;
}

.height-plot-v2 {
  position: relative;
  grid-row: 1;
  height: 720px;
  overflow: hidden;
  background-color: #fff;
  background-image: repeating-linear-gradient(
    to top,
    rgba(30, 30, 30, 0.12) 0,
    rgba(30, 30, 30, 0.12) 1px,
    transparent 1px,
    transparent 12px
  );
}

.height-major-line-v2 {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #5c2947;
  opacity: 0.86;
  pointer-events: none;
  z-index: 1;
}

.height-category-column-v2 {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed #bbb;
  pointer-events: none;
  z-index: 1;
}

.height-point-guide-v2 {
  position: absolute;
  left: 0;
  height: 0;
  border-top: 2px dashed rgba(238, 61, 151, 0.46);
  pointer-events: none;
  z-index: 2;
  transition: opacity 120ms ease, border-color 120ms ease, border-width 120ms ease;
}

.height-point-guide-v2.is-active {
  border-top-width: 3px;
  border-top-color: rgba(214, 20, 116, 0.96);
  z-index: 5;
}

.height-point-v2 {
  position: absolute;
  width: 3.35rem;
  height: 3.35rem;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 3px solid var(--magi-pink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  overflow: hidden;
  z-index: 4;
}

.height-point-v2:hover,
.height-point-v2:focus-visible,
.height-point-v2.is-active {
  border-color: #ce176f;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 0 0 6px rgba(206, 23, 111, 0.75);
  z-index: 20;
}

.height-point-v2 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.height-x-axis-spacer-v2 {
  grid-row: 2;
  border-right: 1px solid #aaa;
  border-top: 1px solid #aaa;
  background: #fafafa;
}

.height-x-axis-v2 {
  display: flex;
  grid-row: 2;
  min-height: 5rem;
  border-top: 1px solid #aaa;
  background: #fafafa;
}

.height-x-label-v2 {
  flex: 0 0 auto;
  box-sizing: border-box;
  padding: 0.45rem 0.3rem;
  border-left: 1px dashed #ccc;
  text-align: center;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.height-bar-v2 {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  border: 2px solid #b52970;
  border-bottom: 0;
  border-radius: 0.45rem 0.45rem 0 0;
  background: linear-gradient(to top, #f28ec1, #ffd3e9);
  z-index: 4;
}

.height-bar-label-v2 {
  position: absolute;
  top: -2.8rem;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 9rem;
  padding: 0.2rem 0.35rem;
  border-radius: 0.3rem;
  background: #fff;
  color: #42152d;
  font-size: 0.8rem;
  text-align: center;
  white-space: nowrap;
}

.height-chart-tooltip-v2 {
  position: fixed;
  z-index: 10060;
  display: none;
  max-width: min(22rem, calc(100vw - 1.2rem));
  padding: 0.65rem 0.8rem;
  border: 1px solid #b33a78;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.98);
  color: #171217;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  white-space: pre-line;
  pointer-events: none;
}

@media (max-width: 640px) {
  .relationship-table-controls,
  .height-zoom-controls-v2 {
    gap: 0.35rem 0.45rem;
    padding: 0.38rem;
    font-size: 0.86rem;
  }

  .relationship-table-controls input[type="range"],
  .height-zoom-controls-v2 input[type="range"] {
    width: min(9rem, 34vw);
  }

  .relationship-height-control input[type="range"] {
    width: min(6.5rem, 24vw);
  }

  .relationship-table-viewport {
    height: 66vh;
    min-height: 360px;
    resize: none;
  }

  #girltable {
    font-size: 13px;
  }

  #girltable th,
  #girltable td {
    width: 8rem;
    min-width: 8rem !important;
    max-width: 8rem !important;
    padding: 0.36rem 0.3rem !important;
  }

  #girltable tr > :first-child {
    width: 9.5rem;
    min-width: 9.5rem !important;
    max-width: 9.5rem !important;
  }

  .height-chart-viewport-v2 {
    height: 72vh;
    min-height: 430px;
    resize: none;
  }

  .height-y-label-v2 {
    font-size: 0.72rem;
  }

  .height-point-v2 {
    width: 3rem;
    height: 3rem;
  }
}
