/* Production mobile/responsive corrections. Loaded after the legacy styles. */
:root {
  --call-pink: #fc58aa;
  --call-pale: #fce4ef;
  --call-border: #d9c8d1;
  --call-text: #171217;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

#wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: clip !important;
}

#callResultSection {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#canvasflame {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#mynetwork {
  display: block;
  width: min(96vw, 1180px) !important;
  max-width: 100%;
  height: clamp(360px, 56vh, 640px) !important;
  min-height: 360px;
  margin: 0 auto;
  box-sizing: border-box;
  touch-action: none;
}

#mytable {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  box-sizing: border-box;
  padding-top: 2.2rem;
  scrollbar-gutter: stable;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.relationship-scroll-hint {
  position: absolute;
  top: 0.25rem;
  left: 0;
  width: max-content;
  max-width: calc(100vw - 1rem);
  padding: 0.3rem 0.65rem;
  border: 1px solid #ef9ac6;
  border-radius: 999px;
  background: #fff5fa;
  color: #8c1f57;
  font-size: 0.9rem;
  line-height: 1.3;
  pointer-events: none;
}

#girltable {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 2px;
  table-layout: auto;
}

#girltable th,
#girltable td {
  box-sizing: border-box;
  min-width: 8.5rem;
  max-width: 18rem;
  padding: 0.55rem 0.5rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.35;
  vertical-align: middle;
}

#girltable th:nth-child(1),
#girltable td:nth-child(1) {
  min-width: 8rem;
}

#girltable thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8cfe3;
  box-shadow: 0 1px 0 #fff;
}

#girltable tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 1px 0 0 #fff;
}

#girltable thead tr > :first-child {
  z-index: 4;
  background: #f8cfe3;
}

#girltable tbody tr:nth-child(odd) > :first-child {
  background: #fcdcec;
}

#girltable tbody tr:nth-child(even) > :first-child {
  background: #fcf2f7;
}

#callTextOptions,
#chartControlPanel,
.height-chart-controls,
.height-zoom-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
}

#heightChartContainer {
  width: min(100%, 1440px) !important;
  max-width: 100%;
  margin: 1rem auto !important;
  padding: 0.75rem;
  box-sizing: border-box;
}

.height-chart-shell {
  width: 100%;
  min-width: 0;
}

.height-chart-shell h3 {
  margin: 0 0 0.75rem;
}

.height-chart-controls {
  padding: 0.75rem;
  border: 1px solid var(--call-border);
  border-radius: 0.55rem;
  background: #fafafa;
}

.height-control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.7rem;
}

.height-control-group + .height-control-group {
  width: 100%;
  padding-top: 0.65rem;
  border-top: 1px solid #cfcfcf;
}

.height-chart-message {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #efb1d0;
  border-radius: 0.5rem;
  background: #fff5fa;
}

.height-zoom-controls {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0.65rem 0;
  padding: 0.5rem;
  border: 1px solid var(--call-border);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.height-zoom-controls button,
.height-zoom-controls input {
  min-height: 2.3rem;
}

.height-zoom-controls input[type="range"] {
  width: min(15rem, 46vw);
}

.height-chart-viewport {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--call-border);
  background: #fff;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.height-chart-surface {
  display: grid;
  grid-template-columns: 5rem auto;
  grid-template-rows: 720px auto;
  width: max-content;
  min-width: 100%;
  transform-origin: left top;
}

.height-y-axis {
  position: sticky;
  left: 0;
  z-index: 5;
  grid-column: 1;
  grid-row: 1;
  height: 720px;
  border-right: 1px solid #bbb;
  background: rgba(250, 250, 250, 0.97);
}

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

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

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

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

.height-x-axis-spacer {
  position: sticky;
  left: 0;
  z-index: 5;
  grid-column: 1;
  grid-row: 2;
  background: #fafafa;
  border-right: 1px solid #bbb;
  border-top: 1px solid #bbb;
}

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

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

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

.height-point:focus-visible {
  outline: 3px solid #1668d4;
  outline-offset: 2px;
}

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

.height-bar {
  position: absolute;
  bottom: 0;
  width: min(88px, 62%);
  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);
}

.height-bar-label {
  position: absolute;
  top: -2.8rem;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 8rem;
  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 {
  position: fixed;
  z-index: 10050;
  display: none;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.65rem 0.8rem;
  border: 1px solid #b33a78;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.98);
  color: var(--call-text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  white-space: pre-line;
  pointer-events: none;
}

input:focus-visible,
button:focus-visible,
select:focus-visible,
a:focus-visible,
label.girlbox:focus-within {
  outline: 3px solid #1668d4 !important;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  body {
    margin: 0;
    font-size: 16px;
  }

  #wrapper {
    padding: 0 0.25rem;
    box-sizing: border-box;
  }

  h1.title {
    font-size: clamp(1.15rem, 5vw, 1.65rem);
    line-height: 1.25;
  }

  fieldset {
    max-width: 100%;
    box-sizing: border-box;
  }

  #mynetwork {
    width: 100% !important;
    height: 52vh !important;
    min-height: 340px;
  }

  #mytable {
    padding-top: 2.5rem;
  }

  .relationship-scroll-hint {
    display: block;
    font-size: 0.82rem;
  }

  #girltable {
    font-size: 0.92rem;
  }

  #girltable th,
  #girltable td {
    min-width: 7.2rem;
    max-width: 12.5rem;
    padding: 0.45rem 0.4rem;
  }

  #girltable th:nth-child(1),
  #girltable td:nth-child(1) {
    min-width: 6.8rem;
  }

  #heightChartContainer {
    padding: 0.35rem;
  }

  .height-chart-controls,
  .height-zoom-controls {
    font-size: 0.95rem;
  }

  .height-chart-surface {
    grid-template-columns: 4.2rem auto;
  }

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

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

@media (min-width: 641px) {
  .relationship-scroll-hint {
    display: none;
  }
}
