.cookie-banner[hidden],
.cookie-dialog[hidden] { display: none; }

.cookie-banner {
  box-sizing: border-box;
  position: fixed;
  z-index: 900;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100dvh - 32px - env(safe-area-inset-bottom));
  padding: 20px 22px;
  border: 1px solid #43525c;
  border-radius: 14px;
  background: #0a1015;
  color: #f1f2ef;
  box-shadow: 0 16px 48px rgb(0 0 0 / 46%);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-50%);
}

.cookie-banner h2,
.cookie-dialog h2 { margin: 0; font-size: clamp(21px, 2vw, 28px); line-height: 1.08; }
.cookie-banner p,
.cookie-dialog p { margin: 8px 0 0; color: #b7c0c7; font-size: 14px; line-height: 1.5; }
.cookie-banner a,
.cookie-dialog a { color: #e5eef3; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cookie-button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #51616c;
  border-radius: 8px;
  background: #111a20;
  color: #edf0ee;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.cookie-button:hover { border-color: #768994; }
.cookie-button:focus-visible,
.cookie-settings-link:focus-visible { outline: 3px solid #5ab9ef; outline-offset: 3px; }
.cookie-button-primary { border-color: #47afe7; background: #36a8e3; color: #061019; }
.cookie-button-quiet { background: transparent; }

@media (min-width: 900px) {
  .cookie-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 28px;
    align-items: end;
  }
  .cookie-banner h2 { grid-column: 1; grid-row: 1; }
  .cookie-banner p { grid-column: 1; grid-row: 2; max-width: 720px; }
  .cookie-banner .cookie-actions {
    grid-column: 2;
    grid-row: 1 / 3;
    justify-content: flex-end;
    margin-top: 0;
  }
}

.cookie-dialog {
  box-sizing: border-box;
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid #34414a;
  border-radius: 12px;
  background: #0a1015;
  color: #f1f2ef;
  overflow: hidden;
}
.cookie-dialog::backdrop { background: rgb(0 0 0 / 76%); }
.cookie-dialog-inner { position: relative; max-height: calc(100dvh - 24px); padding: 24px; overflow-y: auto; overscroll-behavior: contain; }
.cookie-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.cookie-dialog-close { width: 44px; height: 44px; padding: 0; flex: none; }
.cookie-options { display: grid; gap: 10px; margin: 20px 0; }
.cookie-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #2a353d;
  border-radius: 8px;
}
.cookie-option strong { font-size: 16px; }
.cookie-option p { grid-column: 1 / -1; margin: 0; }
.cookie-option input { width: 22px; height: 22px; accent-color: #36a8e3; }
.cookie-required { color: #87a0af; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.cookie-settings-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cookie-gpc { color: #d9bd91 !important; }

@media (max-width: 520px) {
  .cookie-banner {
    left: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    padding: 16px;
    border-radius: 12px;
    transform: none;
  }
  .cookie-banner h2 { font-size: 21px; }
  .cookie-banner p { font-size: 13.5px; line-height: 1.45; }
  .cookie-actions { display: grid; grid-template-columns: 1fr; }
  .cookie-button { width: 100%; min-height: 46px; }
  .cookie-dialog[open] {
    position: fixed;
    inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px;
    width: auto;
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    margin: 0;
    border-radius: 16px;
  }
  .cookie-dialog-inner {
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    padding: 20px 16px 16px;
  }
  .cookie-dialog-head { display: block; padding-right: 52px; }
  .cookie-dialog-head h2 { font-size: 23px; }
  .cookie-dialog-head p { max-width: 30ch; }
  .cookie-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: 0;
    border-radius: 50%;
  }
  .cookie-dialog .cookie-actions { margin-top: 14px; }
  .cookie-option { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px; }
  .cookie-required { font-size: 11px; }
}

@media (max-width: 340px) {
  .cookie-required {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (min-width: 521px) and (max-width: 899px) {
  .cookie-banner { width: min(720px, calc(100vw - 32px)); }
  .cookie-banner .cookie-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cookie-banner .cookie-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-dialog { scroll-behavior: auto; }
}
