/* Consent panel — scoped to .bof-consent. Do not style global form controls. */

.bof-consent[hidden] {
  display: none !important;
}

.bof-consent {
  position: fixed;
  inset: 0;
  z-index: var(--z-consent, 140);
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: rgba(26, 24, 32, 0.42);
  color: var(--ink, #1c1a1c);
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.bof-consent__panel {
  pointer-events: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  max-height: min(calc(100dvh - 24px), calc(100vh - 24px));
  max-height: min(calc(100svh - 24px), calc(100dvh - 24px), calc(100vh - 24px));
  overflow: hidden;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0;
  background: var(--paper, #fbf8f3);
  color: var(--ink, #1c1a1c);
  border: 1px solid var(--line, rgba(28, 26, 28, 0.14));
  border-radius: var(--radius-md, 22px);
  box-shadow: var(--shadow-sm, 0 10px 30px rgba(28, 20, 24, 0.08));
  opacity: 0;
  transform: translateY(12px);
}

.bof-consent__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 30px 32px 8px;
}

.bof-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  flex: 0 0 auto;
  z-index: 1;
  margin: 0;
  padding: 12px 32px 28px;
  background: var(--paper, #fbf8f3);
  border-top: 1px solid var(--line, rgba(28, 26, 28, 0.1));
}

.bof-consent.is-open .bof-consent__panel {
  opacity: 1;
  transform: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.bof-consent__eyebrow {
  margin: 0 0 8px;
  color: var(--accent, #e80752);
  font-family: var(--font, Corbel, "Trebuchet MS", Arial, sans-serif);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bof-consent__title {
  margin: 0 0 10px;
  color: var(--ink, #1c1a1c);
  font-family: var(--font, Corbel, "Trebuchet MS", Arial, sans-serif);
  font-size: clamp(1.5rem, 2.2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.bof-consent__body {
  margin: 0 0 22px;
  max-width: 42em;
  color: var(--muted, #6c6669);
  font-size: 0.98rem;
  line-height: 1.55;
}

.bof-consent__choices {
  display: grid;
  gap: 14px;
  margin: 0 0 24px;
  padding: 0;
}

.bof-consent__choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0;
  color: var(--ink, #1c1a1c);
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
  min-height: 44px;
  padding: 10px 4px;
  box-sizing: border-box;
}

.bof-consent__choice--necessary {
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-alt, #f2ece5) 70%, var(--paper, #fbf8f3));
  border-radius: var(--radius-sm, 12px);
  cursor: default;
}

.bof-consent__choice-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bof-consent__choice-hint {
  color: var(--muted, #6c6669);
  font-size: 0.8rem;
  font-weight: 600;
}

.bof-consent__choice input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  border: 1px solid var(--line-strong, rgba(28, 26, 28, 0.28));
  border-radius: 4px;
  background-color: var(--paper, #fbf8f3);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  cursor: pointer;
}

.bof-consent__choice input[type="checkbox"]:checked {
  background-color: var(--accent, #e80752);
  border-color: var(--accent, #e80752);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 6.2 4.8 9 10 3' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.bof-consent__choice input[type="checkbox"]:disabled {
  cursor: default;
  opacity: 1;
  background-color: var(--accent, #e80752);
  border-color: var(--accent, #e80752);
  filter: none;
}

.bof-consent__choice input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent, #e80752);
  outline-offset: 3px;
}

.bof-consent__btn {
  box-sizing: border-box;
  min-height: 46px;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.bof-consent__btn:focus-visible {
  outline: 3px solid var(--accent, #e80752);
  outline-offset: 3px;
}

.bof-consent__btn:active:not(:disabled) {
  transform: translateY(1px);
}

.bof-consent__btn--ghost {
  background: transparent;
  color: var(--ink, #1c1a1c);
  border: 1px solid var(--line-strong, rgba(28, 26, 28, 0.28));
}

.bof-consent__btn--ghost:hover {
  background: var(--surface-alt, #f2ece5);
}

.bof-consent__btn--secondary {
  background: var(--surface, #fff);
  color: var(--ink, #1c1a1c);
  border: 1px solid var(--line-strong, rgba(28, 26, 28, 0.28));
}

.bof-consent__btn--secondary:hover {
  background: var(--surface-alt, #f2ece5);
}

.bof-consent__btn--primary {
  background: var(--button-task-bg, var(--ink, #1c1a1c));
  color: var(--button-task-text, #fff);
  border: 1px solid var(--button-task-bg, var(--ink, #1c1a1c));
}

.bof-consent__btn--primary:hover {
  background: var(--button-task-hover, #2a2622);
  border-color: var(--button-task-hover, #2a2622);
}

.footer-bottom .button-link {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font: inherit;
}

.footer-bottom .button-link:focus-visible {
  outline: 3px solid var(--accent, #e80752);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .bof-consent {
    align-items: flex-end;
    justify-content: center;
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px));
  }

  .bof-consent__panel {
    width: 100%;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100svh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    min-height: 0;
    margin: 0;
    border-radius: 18px;
  }

  .bof-consent__scroll {
    padding: 16px 16px 6px;
  }

  .bof-consent__title {
    font-size: 1.28rem;
    margin-bottom: 6px;
  }

  .bof-consent__body {
    margin-bottom: 12px;
    font-size: 0.92rem;
  }

  .bof-consent__choices {
    gap: 8px;
    margin-bottom: 0;
  }

  .bof-consent__actions {
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .bof-consent__btn {
    width: 100%;
    min-height: 46px;
  }
}

/*
 * Short viewports (esp. landscape phones): stack actions regardless of width.
 * Root cause of MOB-CONSENT-LAND-01: 667×375 bypassed max-width:520 stacking.
 */
@media (max-height: 500px) {
  .bof-consent {
    align-items: stretch;
    justify-content: center;
    padding: max(6px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }

  .bof-consent__panel {
    width: min(860px, 100%);
    max-height: calc(100dvh - 12px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100svh - 12px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    min-height: 0;
    border-radius: 14px;
  }

  .bof-consent__scroll {
    padding: 10px 14px 4px;
  }

  .bof-consent__title {
    margin-bottom: 4px;
    font-size: 1.1rem;
  }

  .bof-consent__body {
    margin-bottom: 8px;
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .bof-consent__choices {
    gap: 6px;
    margin-bottom: 0;
  }

  .bof-consent__choice {
    font-size: 0.88rem;
  }

  .bof-consent__choice--necessary {
    padding: 6px 8px;
  }

  .bof-consent__actions {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .bof-consent__btn {
    width: 100%;
    flex: 0 0 auto;
    min-height: 42px;
    font-size: 0.88rem;
  }
}

@media (max-width: 520px) and (max-height: 700px) {
  .bof-consent__scroll {
    padding: 12px 12px 4px;
  }

  .bof-consent__title {
    margin-bottom: 4px;
    font-size: 1.18rem;
  }

  .bof-consent__body {
    margin-bottom: 8px;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .bof-consent__choices {
    gap: 6px;
  }

  .bof-consent__choice--necessary {
    padding: 6px 8px;
  }

  .bof-consent__actions {
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .bof-consent__btn {
    min-height: 44px;
  }
}

.bof-consent__panel[data-consent-view="initial"] .bof-consent__scroll {
  padding-bottom: 4px;
}

.bof-consent__panel[data-consent-view="initial"] .bof-consent__body {
  margin-bottom: 8px;
}

@media (max-width: 520px) {
  .bof-consent__panel[data-consent-view="initial"] {
    max-height: min(72dvh, 72vh);
  }

  .bof-consent__panel[data-consent-view="initial"] .bof-consent__scroll {
    padding: 14px 16px 4px;
  }

  .bof-consent__panel[data-consent-view="initial"] .bof-consent__title {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  .bof-consent__panel[data-consent-view="initial"] .bof-consent__body {
    margin-bottom: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bof-consent__panel,
  .bof-consent.is-open .bof-consent__panel,
  .bof-consent__btn {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
