html {
  overflow-x: hidden;
}

.pool-page {
  --pool-blue: #075985;
  --pool-blue-dark: #0c4a6e;
  --pool-cyan: #0891b2;
  --pool-soft: rgba(14, 165, 233, 0.12);
  --pool-panel: rgba(255, 255, 255, 0.86);
  --pool-panel-strong: #f0f9ff;
  --pool-line: rgba(7, 89, 133, 0.18);
  --pool-line-strong: rgba(8, 145, 178, 0.42);
  --pool-ink: #0f2533;
  --pool-muted: #4b6472;
  --pool-red: #dc2626;
  --pool-amber: #d97706;
  --pool-green: #15803d;
  --pool-svg: #0f3344;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(240, 249, 255, 0.96), rgba(236, 254, 255, 0.84) 44%, rgba(255, 255, 255, 0.96)),
    linear-gradient(180deg, #f8fcff, #ffffff);
}

:root[data-theme="dark"] .pool-page {
  --pool-blue: #7dd3fc;
  --pool-blue-dark: #bae6fd;
  --pool-cyan: #67e8f9;
  --pool-soft: rgba(14, 165, 233, 0.16);
  --pool-panel: rgba(15, 23, 42, 0.86);
  --pool-panel-strong: #0f172a;
  --pool-line: rgba(125, 211, 252, 0.17);
  --pool-line-strong: rgba(103, 232, 249, 0.42);
  --pool-ink: #f8fafc;
  --pool-muted: #cbd5e1;
  --pool-red: #fca5a5;
  --pool-amber: #fbbf24;
  --pool-green: #86efac;
  --pool-svg: #e0f2fe;
  background:
    linear-gradient(135deg, #020617, #082f49 54%, #0f172a),
    #020617;
}

.pool-page .container {
  width: min(calc(100vw - 2rem), var(--content));
}

.pool-page .site-header {
  background: rgba(240, 249, 255, 0.88);
  border-bottom-color: var(--pool-line);
}

:root[data-theme="dark"] .pool-page .site-header {
  background: rgba(2, 6, 23, 0.86);
}

.pool-page h1,
.pool-page h2,
.pool-page h3,
.pool-page h4,
.pool-page .logo {
  letter-spacing: 0;
}

.pool-page [hidden] {
  display: none !important;
}

.pool-page .reveal {
  opacity: 1;
  transform: none;
}

.pool-hero {
  padding: 3.2rem 0 1.8rem;
}

.pool-hero-grid,
.pool-calculator-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 0.92fr);
  align-items: start;
}

.pool-hero-grid > *,
.pool-calculator-grid > *,
.pool-related-grid > *,
.pool-behavior-grid > *,
.pool-material-grid > * {
  min-width: 0;
}

.pool-eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--pool-line);
  border-radius: 999px;
  background: var(--pool-soft);
  color: var(--pool-blue-dark);
  font-weight: 900;
}

.pool-eyebrow {
  padding: 0.42rem 0.78rem;
}

.section-kicker {
  padding: 0.28rem 0.72rem;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.pool-hero h1 {
  margin: 0.62rem 0 0.35rem;
  text-wrap: balance;
}

.pool-subtitle,
.pool-muted,
.pool-tip,
.pool-warning,
.field-help,
.quick-head p,
.pool-card p,
.pool-related-card p,
.result-summary dd {
  color: var(--pool-muted);
}

.pool-subtitle {
  max-width: 900px;
  margin: 0;
  font-size: 1.08rem;
}

.pool-visual-card,
.quick-card,
.pool-tool-panel,
.pool-results-panel,
.pool-card,
.pool-related-card {
  border: 1px solid var(--pool-line);
  border-radius: 20px;
  background: var(--pool-panel);
  box-shadow: var(--shadow-soft);
}

.pool-visual-card {
  padding: 1rem;
  color: var(--pool-svg);
}

.pool-visual-card svg,
.pool-result-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.pool-safety {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
  border-radius: 16px;
  background: #fef2f2;
  color: #7f1d1d;
}

:root[data-theme="dark"] .pool-safety {
  border-color: rgba(252, 165, 165, 0.28);
  background: rgba(127, 29, 29, 0.42);
  color: #fecaca;
}

.pool-safety strong {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--font-heading);
  text-transform: uppercase;
}

.section {
  padding: 2rem 0 3rem;
}

.section-heading {
  max-width: 960px;
}

.section-heading h2 {
  margin: 0.35rem 0 0.55rem;
  font-family: var(--font-heading);
  font-size: 2.25rem;
  line-height: 1.08;
}

.quick-card,
.pool-tool-panel,
.pool-results-panel {
  padding: 1rem;
}

.quick-card {
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(224, 242, 254, 0.86)),
    #eff6ff;
}

:root[data-theme="dark"] .quick-card {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(8, 47, 73, 0.74)),
    #0f172a;
}

.quick-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.quick-head h2,
.pool-tool-head h2,
.pool-results-panel h3,
.pool-card h3,
.pool-related-card h3 {
  margin: 0;
  font-family: var(--font-heading);
}

.quick-head h2 {
  font-size: 1.18rem;
  text-transform: uppercase;
}

.pool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.76rem 1rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  background: #075985;
  color: #fff;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.16);
}

.pool-button.wide {
  width: 100%;
}

.pool-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--pool-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  -webkit-overflow-scrolling: touch;
}

:root[data-theme="dark"] .pool-table-wrap {
  background: rgba(255, 255, 255, 0.04);
}

.pool-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.pool-table th,
.pool-table td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--pool-line);
  vertical-align: top;
}

.pool-table th {
  background: rgba(14, 165, 233, 0.08);
  color: var(--pool-blue-dark);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.pool-table tr:last-child td {
  border-bottom: 0;
}

.pool-table td:first-child {
  font-weight: 800;
}

.pool-card .pool-table {
  min-width: 0;
  font-size: 0.92rem;
}

.pool-calculator-grid {
  grid-template-columns: minmax(0, 1fr) minmax(400px, 0.94fr);
}

.pool-tool-head,
.pool-result-head,
.pool-result-total,
.pool-result-actions {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.pool-tool-head {
  margin-bottom: 1rem;
}

.pool-tool-head p,
.pool-result-head span {
  color: var(--pool-muted);
  font-weight: 700;
}

.pool-mode-switch,
.pool-segmented,
.pool-step-nav,
.pool-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.pool-mode-switch button,
.pool-segmented button,
.pool-step-nav button,
.pool-result-actions button {
  min-height: 42px;
  border: 1px solid var(--pool-line);
  border-radius: 999px;
  padding: 0.62rem 0.9rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  font-weight: 800;
}

:root[data-theme="dark"] .pool-mode-switch button,
:root[data-theme="dark"] .pool-segmented button,
:root[data-theme="dark"] .pool-step-nav button,
:root[data-theme="dark"] .pool-result-actions button {
  background: rgba(255, 255, 255, 0.05);
}

.pool-mode-switch button[aria-pressed="true"],
.pool-segmented button.is-active,
.pool-option-grid button.is-active,
.pool-material-choice button.is-active,
.pool-height-options button.is-active {
  border-color: var(--pool-line-strong);
  background: linear-gradient(135deg, rgba(7, 89, 133, 0.13), rgba(14, 165, 233, 0.09));
  color: var(--pool-blue-dark);
}

.pool-progress {
  height: 10px;
  overflow: hidden;
  margin: 0 0 1rem;
  border-radius: 999px;
  background: rgba(7, 89, 133, 0.12);
}

.pool-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #075985, #06b6d4);
  transition: width 180ms ease;
}

.wizard-panel,
.expert-panel,
.pool-step {
  display: grid;
  gap: 1rem;
}

.pool-step {
  padding: 0.95rem;
  border: 1px solid var(--pool-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.28);
}

:root[data-theme="dark"] .pool-step {
  background: rgba(255, 255, 255, 0.04);
}

.pool-step h3,
.pool-step h4 {
  margin: 0;
  font-family: var(--font-heading);
}

.pool-step h4 {
  font-size: 1rem;
}

.pool-option-grid,
.pool-material-choice,
.pool-check-grid,
.pool-related-grid,
.pool-behavior-grid,
.pool-material-grid {
  display: grid;
  gap: 0.75rem;
}

.pool-option-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pool-option-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pool-material-choice {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pool-option-grid button,
.pool-material-choice button {
  display: grid;
  gap: 0.25rem;
  min-height: 118px;
  padding: 0.85rem;
  border: 1px solid var(--pool-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--text);
  text-align: left;
}

.pool-option-grid button strong,
.pool-material-choice button strong {
  font-size: 1rem;
}

.pool-option-grid button span,
.pool-material-choice button span {
  color: var(--pool-muted);
  font-weight: 650;
}

.pool-field-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pool-field-grid label,
.wide-label {
  display: grid;
  gap: 0.4rem;
  color: var(--text);
  font-weight: 800;
}

.pool-field-grid input,
.pool-field-grid select,
.wide-label select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--pool-line);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  background: var(--bg-elevated);
  color: var(--text);
}

.pool-field-grid label[data-entry="dimensions"],
.pool-field-grid label[data-entry="direct"],
.pool-field-grid label[data-entry="aboveGround"] {
  display: none;
}

.pool-field-grid.is-dimensions label[data-entry="dimensions"],
.pool-field-grid.is-direct label[data-entry="direct"],
.pool-field-grid.is-aboveGround label[data-entry="aboveGround"] {
  display: grid;
}

.pool-check-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pool-check-grid label {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.8rem;
  border: 1px solid var(--pool-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  font-weight: 700;
}

.pool-warning,
.pool-note,
.pool-tip {
  margin: 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--pool-amber);
  border-radius: 0 14px 14px 0;
  background: rgba(217, 119, 6, 0.1);
  font-weight: 650;
}

.pool-warning {
  border-left-color: var(--pool-red);
  background: rgba(220, 38, 38, 0.08);
  color: var(--text);
}

.pool-tip {
  border-left-color: var(--pool-blue);
  background: rgba(7, 89, 133, 0.08);
}

.pool-code-card {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--pool-line);
  border-radius: 16px;
  background: rgba(14, 165, 233, 0.07);
}

.pool-code-card ul,
.pool-reminders {
  margin: 0;
  padding-left: 1.1rem;
}

.pool-results-panel {
  display: grid;
  gap: 0.9rem;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(7, 89, 133, 0.88)),
    #0f172a;
  color: #f8fafc;
}

.pool-result-head span {
  color: rgba(248, 250, 252, 0.78);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pool-results-panel .result-summary dd,
.pool-results-panel .pool-muted {
  color: rgba(248, 250, 252, 0.78);
}

.pool-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.25rem 0.68rem;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.2);
  color: #bbf7d0;
  font-weight: 900;
}

.pool-status-pill.is-blocked {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

.pool-result-visual {
  min-height: 178px;
  border-radius: 16px;
  border: 1px solid rgba(248, 250, 252, 0.11);
  background: rgba(255, 255, 255, 0.05);
}

.result-summary {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.result-summary div {
  display: grid;
  gap: 0.1rem;
}

.result-summary dt {
  color: rgba(248, 250, 252, 0.68);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-summary dd {
  margin: 0;
  font-weight: 700;
}

.pool-code-status {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.pool-result-block {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pool-result-block h4 {
  margin: 0;
  font-family: var(--font-heading);
}

.pool-result-line,
.pool-result-total div {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: baseline;
}

.pool-result-line small {
  display: block;
  color: rgba(248, 250, 252, 0.68);
  font-weight: 650;
}

.pool-result-total {
  padding: 0.85rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pool-result-total span {
  display: block;
  color: rgba(248, 250, 252, 0.68);
  font-size: 0.88rem;
  font-weight: 700;
}

.pool-result-total strong {
  font-size: 1.35rem;
}

.pool-result-actions {
  flex-wrap: wrap;
}

.pool-result-actions button {
  flex: 1 1 140px;
  color: inherit;
}

.share-output {
  margin: 0;
  min-height: 1.5em;
  color: rgba(248, 250, 252, 0.72);
  font-size: 0.92rem;
  word-break: break-word;
}

.pool-behavior-grid,
.pool-material-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.pool-card,
.pool-related-card {
  padding: 1rem;
}

.pool-card ul {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
}

.pool-card h3,
.pool-related-card h3 {
  font-size: 1.12rem;
}

.pool-related-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pool-related-card span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(7, 89, 133, 0.11);
  color: var(--pool-blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.pool-related-card a {
  display: inline-flex;
  margin-top: 0.8rem;
  color: var(--pool-blue-dark);
  font-weight: 850;
}

.pool-faq {
  display: grid;
  gap: 0.85rem;
}

.pool-faq details {
  overflow: hidden;
  border: 1px solid var(--pool-line);
  border-radius: 18px;
  background: var(--pool-panel);
  box-shadow: var(--shadow-soft);
}

.pool-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 850;
  list-style: none;
}

.pool-faq summary::-webkit-details-marker {
  display: none;
}

.pool-faq summary::after {
  content: "+";
  color: var(--pool-blue);
  font-size: 1.35rem;
  line-height: 1;
}

.pool-faq details[open] summary::after {
  content: "-";
}

.pool-faq details > div {
  padding: 0 1.1rem 1.1rem;
}

.pool-faq p {
  margin: 0;
  color: var(--pool-muted);
}

@media (max-width: 1080px) {
  .pool-hero-grid,
  .pool-calculator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .pool-option-grid,
  .pool-option-grid.compact,
  .pool-material-choice,
  .pool-check-grid,
  .pool-related-grid,
  .pool-behavior-grid,
  .pool-material-grid {
    grid-template-columns: 1fr;
  }

  .quick-head,
  .pool-tool-head,
  .pool-result-head,
  .pool-result-total {
    flex-direction: column;
    align-items: flex-start;
  }

  .pool-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .pool-hero {
    padding-top: 2.6rem;
  }

  .pool-hero h1 {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
  }

  .section-heading h2 {
    font-size: 2rem;
  }

  .pool-table {
    min-width: 700px;
  }

  .pool-button,
  .pool-result-actions button {
    width: 100%;
  }

  .pool-results-panel {
    padding: 0.9rem;
  }
}

@media (max-width: 520px) {
  .pool-page .container {
    width: min(calc(100vw - 2rem), 360px);
    margin-inline: 1rem;
  }

  .pool-hero h1,
  .section-heading h2 {
    overflow-wrap: anywhere;
  }
}
