/* Shared consent UI. The white panel and blue actions follow the supplied reference. */
.cookie-consent,
.cookie-preferences,
.cookie-consent-status {
  --cookie-white: #fff;
  --cookie-ink: #171717;
  --cookie-muted: #535963;
  --cookie-line: #dfe3e8;
  --cookie-blue: #1d5fd6;
  box-sizing: border-box;
  color: var(--cookie-ink);
  font-family: var(--font-zh, "Noto Sans SC", sans-serif);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  text-align: left;
}

html[lang="en"] :is(.cookie-consent, .cookie-preferences, .cookie-consent-status) {
  font-family: var(--font-en, "Inter", sans-serif);
}

.cookie-consent *,
.cookie-preferences * {
  box-sizing: border-box;
}

.cookie-consent[hidden],
.cookie-settings-link[hidden],
.cookie-consent-status[hidden] {
  display: none;
}

.cookie-consent {
  position: fixed;
  z-index: 1000;
  inset: auto 24px max(24px, env(safe-area-inset-bottom));
  width: min(720px, calc(100% - 48px));
  max-height: calc(100svh - 48px);
  margin-inline: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px;
  border: 1px solid var(--cookie-line);
  border-radius: 6px;
  background: var(--cookie-white);
  box-shadow: 0 8px 40px rgb(0 0 0 / 16%);
}

.cookie-consent h2,
.cookie-preferences h2 {
  margin: 0;
  color: var(--cookie-ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.cookie-consent p {
  margin: 16px 0 24px;
  color: var(--cookie-muted);
}

.cookie-consent-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cookie-consent .cookie-button,
.cookie-preferences .cookie-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  border: 1.5px solid var(--cookie-blue);
  border-radius: 3px;
  background: var(--cookie-blue);
  color: var(--cookie-white);
  font: inherit;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.cookie-consent .cookie-button-outline,
.cookie-preferences .cookie-button-outline {
  background: var(--cookie-white);
  color: var(--cookie-blue);
}

.cookie-consent .cookie-button:hover,
.cookie-preferences .cookie-button:hover {
  border-color: #1549a9;
  background: #1549a9;
}

.cookie-consent .cookie-button-outline:hover,
.cookie-preferences .cookie-button-outline:hover {
  background: #edf3ff;
}

:is(.cookie-consent, .cookie-preferences) button:focus-visible,
.cookie-settings-link:focus-visible {
  outline: 3px solid #1d5fd6;
  outline-offset: 4px;
}

html.has-cookie-preferences {
  overflow: hidden;
}

.cookie-preferences {
  width: min(560px, calc(100% - 40px));
  max-height: calc(100svh - 48px);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--cookie-line);
  border-radius: 6px;
  background: var(--cookie-white);
  box-shadow: 0 16px 64px rgb(0 0 0 / 24%);
}

.cookie-preferences::backdrop {
  background: rgb(0 0 0 / 55%);
}

.cookie-preferences-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 0;
}

.cookie-preferences .cookie-close {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px -10px -6px 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--cookie-muted);
  cursor: pointer;
}

.cookie-close:hover {
  background: #f1f3f5;
}

.cookie-close svg {
  width: 20px;
  height: 20px;
}

.cookie-preferences-body {
  padding: 16px 28px 24px;
}

.cookie-preferences-intro,
.cookie-preferences-note {
  margin: 0;
  color: var(--cookie-muted);
  font-size: 14px;
}

.cookie-preferences-note {
  margin: 12px 0 20px;
}

.cookie-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 20px;
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--cookie-line);
}

.cookie-category h3,
.cookie-category label {
  display: block;
  margin: 0;
  color: var(--cookie-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.cookie-category p {
  margin: 6px 0 0;
  color: var(--cookie-muted);
  font-size: 13px;
  line-height: 1.65;
}

.cookie-required {
  padding-top: 2px;
  color: #23633b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.cookie-category input[type="checkbox"] {
  appearance: auto;
  align-self: start;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--cookie-blue);
  cursor: pointer;
}

.cookie-category input:focus-visible {
  outline: 3px solid var(--cookie-blue);
  outline-offset: 4px;
}

.cookie-preferences-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.footer-legal .cookie-settings-link {
  align-self: flex-start;
  min-height: 30px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.cookie-settings-link:hover {
  color: var(--footer-gold, #c09968);
}

.cookie-consent-status {
  position: fixed;
  z-index: 1001;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 12px 18px;
  border: 1px solid var(--cookie-line);
  border-radius: 4px;
  background: var(--cookie-white);
  box-shadow: 0 4px 20px rgb(0 0 0 / 12%);
  font-size: 14px;
}

/* Landscape windows use a shallow banner with copy and actions side by side. */
@media (min-width: 1024px) {
  .cookie-consent {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px clamp(24px, 3vw, 48px);
    inset-inline: 32px;
    width: min(1440px, calc(100% - 64px));
    padding: 28px 32px;
  }

  .cookie-consent h2,
  .cookie-consent p {
    grid-column: 1;
  }

  .cookie-consent p {
    max-width: 76ch;
    margin: 0;
  }

  .cookie-consent-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    width: clamp(360px, 31vw, 456px);
  }

  .cookie-consent .cookie-button {
    min-height: 50px;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  .cookie-consent {
    inset: auto 12px max(12px, env(safe-area-inset-bottom)) 12px;
    width: auto;
    max-height: calc(100svh - 24px - env(safe-area-inset-bottom));
    padding: 24px 20px 20px;
  }

  .cookie-consent h2,
  .cookie-preferences h2 {
    font-size: 22px;
  }

  .cookie-consent p {
    margin: 16px 0 22px;
  }

  .cookie-consent-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .cookie-consent .cookie-button {
    min-height: 50px;
  }

  .cookie-preferences {
    width: calc(100% - 24px);
    max-height: calc(100svh - 24px - env(safe-area-inset-bottom));
  }

  .cookie-preferences-header {
    padding: 22px 20px 0;
  }

  .cookie-preferences-body {
    padding: 16px 20px 20px;
  }

  .cookie-preferences-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-consent .cookie-button,
  .cookie-preferences .cookie-button {
    transition: none;
  }
}
