/*
 * The analytics consent bar (gtag-init.js) and the 쿠키 설정 controls.
 *
 * Its own file, linked from index.html, so the bar is drawn even before - or
 * without - the app's stylesheet. Colours follow the system scheme, overridden
 * by the app's own choice (data-mantine-color-scheme, set by boot.js before
 * the first paint).
 */
html:not(.irx-analytics) [data-irx-consent-open],
html:not(.irx-analytics) .irx-analytics-only {
  display: none !important;
}

:root {
  --irxc-bg: #ffffff;
  --irxc-text: #1a1f27;
  --irxc-dim: #5f6875;
  --irxc-border: #d9dee6;
  --irxc-btn-bg: #f4f6f9;
  --irxc-btn-hover: #e9edf3;
  --irxc-link: #185ad4;
  --irxc-focus: #1f6feb;
  --irxc-shadow: rgba(15, 23, 42, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mantine-color-scheme='light']) {
    --irxc-bg: #16191e;
    --irxc-text: #d0d4db;
    --irxc-dim: #9aa3b0;
    --irxc-border: #2f353e;
    --irxc-btn-bg: #22262d;
    --irxc-btn-hover: #2a2f37;
    --irxc-link: #8fb0fa;
    --irxc-focus: #618ff7;
    --irxc-shadow: rgba(0, 0, 0, 0.5);
  }
}
:root[data-mantine-color-scheme='dark'] {
  --irxc-bg: #16191e;
  --irxc-text: #d0d4db;
  --irxc-dim: #9aa3b0;
  --irxc-border: #2f353e;
  --irxc-btn-bg: #22262d;
  --irxc-btn-hover: #2a2f37;
  --irxc-link: #8fb0fa;
  --irxc-focus: #618ff7;
  --irxc-shadow: rgba(0, 0, 0, 0.5);
}

/* Room under the page so the bar never hides its last controls. */
html.irx-consent-open body {
  padding-bottom: calc(var(--irx-consent-h, 120px) + 24px);
}
/* The "점검 중" notice (App.tsx DegradedNotice) moves above the bar. */
html.irx-consent-open .wk-degraded {
  bottom: calc(var(--irx-consent-h, 120px) + 24px + env(safe-area-inset-bottom));
}

.irx-consent {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 400;
  box-sizing: border-box;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 16px;
  border: 1px solid var(--irxc-border);
  border-radius: 14px;
  background: var(--irxc-bg);
  color: var(--irxc-text);
  box-shadow: 0 10px 30px -10px var(--irxc-shadow);
  font: 400 14px/1.55 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', sans-serif;
  letter-spacing: -0.006em;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.irx-consent-text {
  flex: 1 1 300px;
  margin: 0;
}
.irx-consent-text a {
  color: var(--irxc-link);
  font-weight: 600;
}
.irx-consent-now {
  color: var(--irxc-dim);
}
.irx-consent-actions {
  display: flex;
  gap: 8px;
  flex: none;
}
/* 허용 and 거부 look and weigh the same. */
.irx-consent .irx-consent-btn {
  min-width: 76px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--irxc-border);
  border-radius: 10px;
  background: var(--irxc-btn-bg);
  color: var(--irxc-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.irx-consent .irx-consent-btn:hover {
  background: var(--irxc-btn-hover);
}
.irx-consent a:focus-visible,
.irx-consent .irx-consent-btn:focus-visible,
.irx-consent-link:focus-visible {
  outline: 2px solid var(--irxc-focus);
  outline-offset: 2px;
}

/* 쿠키 설정 in the footer and the privacy policy: looks like the links beside it. */
.irx-consent-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 47.99em) {
  .irx-consent {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 12px;
  }
  .irx-consent-actions {
    width: 100%;
  }
  .irx-consent .irx-consent-btn {
    flex: 1;
  }
}

@media print {
  .irx-consent {
    display: none;
  }
}
