*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: #FFFFFF;
  color: #09090B;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono-display {
  font-family: 'JetBrains Mono', monospace;
}

/* Base Layout Constraints */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px 20px;
  min-width: 0;
}

@media (max-width: 600px) {
  .main-wrapper {
    padding: 16px 12px 36px 12px;
  }
}

/* Header & Navigation */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #E4E4E7;
  margin-bottom: 32px;
}

.brand-zone {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #09090B;
  text-decoration: none;
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  color: #71717A;
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: #71717A;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: #09090B;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #000000;
  color: #FFFFFF;
  border: 1px solid #000000;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  text-decoration: none;
  line-height: 1;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #FAFAFA;
  color: #09090B;
  border: 1px solid #E4E4E7;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
  line-height: 1;
}

.btn-secondary:hover {
  background-color: #F4F4F5;
}

/* Tool Hero Block */
.hero-block {
  margin-bottom: 28px;
}

.hero-heading {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #09090B;
  margin-bottom: 8px;
  line-height: 1.2;
}

.hero-sub {
  font-size: 14px;
  color: #71717A;
  max-width: 820px;
  line-height: 1.6;
}

/* Grid Framework */
.app-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  align-items: start;
}

.app-grid > * {
  min-width: 0;
}

@media (max-width: 960px) {
  .app-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* Card Design & Panels */
.panel-card {
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 6px;
  padding: 24px;
  min-width: 0;
}

@media (max-width: 600px) {
  .panel-card {
    padding: 16px;
  }
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #09090B;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #09090B;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.help-text {
  font-size: 11px;
  color: #71717A;
  margin-top: 4px;
  line-height: 1.4;
}

/* Form Inputs & Segmented Controls */
.form-group {
  margin-bottom: 20px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  background: #FFFFFF;
  border: 1px solid #E4E4E7;
  padding: 3px;
  border-radius: 4px;
}

.segment-btn {
  background: transparent;
  border: none;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #71717A;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}

.segment-btn.active {
  background: #000000;
  color: #FFFFFF;
}

@media (max-width: 480px) {
  .segmented-control {
    grid-template-columns: 1fr;
  }
}

.input-select, .input-text, .input-number {
  width: 100%;
  padding: 10px 12px;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  font-size: 13px;
  color: #09090B;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-select:focus, .input-text:focus, .input-number:focus {
  border-color: #09090B;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  padding: 12px;
  border-radius: 4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #09090B;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #000000;
  cursor: pointer;
}

/* Results Engine View */
.result-box {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}

.result-status-banner {
  padding: 12px 14px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #000000;
}

.status-medical {
  background-color: #09090B;
  color: #FFFFFF;
}

.status-vision {
  background-color: #FAFAFA;
  color: #09090B;
  border-color: #E4E4E7;
}

.status-split {
  background-color: #FFFFFF;
  color: #09090B;
  border-left: 6px solid #000000;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #E4E4E7;
  font-size: 13px;
}

.breakdown-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.breakdown-label {
  font-weight: 600;
  color: #71717A;
}

.breakdown-val {
  font-weight: 700;
  text-align: right;
  color: #09090B;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.code-tag {
  display: inline-block;
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #09090B;
  font-family: 'JetBrains Mono', monospace;
}

.tag-alert {
  background-color: #09090B;
  color: #FFFFFF;
  border-color: #09090B;
}

.callout-box {
  background-color: #FAFAFA;
  border-left: 3px solid #09090B;
  padding: 12px;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #09090B;
}

/* Quick Copy Action */
.action-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-copy {
  flex: 1;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  color: #09090B;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-copy:hover {
  background-color: #FAFAFA;
  border-color: #09090B;
}

/* Technical Algorithmic Authority Section */
.methodology-container {
  margin-top: 48px;
  border-top: 1px solid #E4E4E7;
  padding-top: 36px;
}

.methodology-heading {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #09090B;
  margin-bottom: 12px;
}

.methodology-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .methodology-grid {
    grid-template-columns: 1fr;
  }
}

.methodology-card {
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 16px;
}

.methodology-card h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.methodology-card p {
  font-size: 12px;
  color: #71717A;
  line-height: 1.6;
}

/* Monetization Safe Zones */
.ad-zone {
  margin: 32px 0;
  border: 1px dashed #E4E4E7;
  background-color: #FAFAFA;
  padding: 16px;
  border-radius: 4px;
  text-align: center;
}

.ad-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #71717A;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ad-content {
  font-size: 12px;
  color: #09090B;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 600px) {
  .ad-content {
    flex-direction: column;
    text-align: center;
  }
}

.contextual-recom {
  margin-top: 20px;
  padding: 14px;
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  font-size: 12px;
}

.recom-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717A;
  margin-bottom: 4px;
}

.recom-link {
  color: #09090B;
  font-weight: 700;
  text-decoration: underline;
}

/* Modal Implementation */
.modal-scrim {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(9, 9, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-scrim.hidden {
  display: none !important;
}

.modal-window {
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  border-radius: 6px;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #E4E4E7;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #71717A;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #09090B;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  font-size: 13px;
  color: #09090B;
  margin-bottom: 12px;
  font-family: inherit;
}

textarea.input-control {
  resize: vertical;
  min-height: 80px;
}

/* Floating Donation Widget */
.support-widget-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #FFFFFF;
  border: 1px solid #E4E4E7;
  color: #09090B;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 90;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.support-widget-float:hover {
  transform: translateY(-2px);
  border-color: #09090B;
}

/* Structural Footer (Final Flow Region) */
.page-footer {
  margin-top: 54px;
  border-top: 1px solid #E4E4E7;
  background-color: #FAFAFA;
  padding: 36px 20px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 12px;
  color: #71717A;
}

.footer-col {
  flex: 1;
  min-width: 220px;
}

.footer-col h5 {
  font-size: 12px;
  font-weight: 700;
  color: #09090B;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: #71717A;
  text-decoration: none;
}

.footer-links a:hover {
  color: #09090B;
}

.disclaimer-text {
  font-size: 11px;
  line-height: 1.5;
  color: #71717A;
  margin-top: 8px;
}