/* Optional analytics controls remain available without blocking the page. */
.sa-preferences,
.sa-panel {
  box-sizing: border-box;
  color: var(--text-main, #f4f1e8);
  background: var(--bg-surface, #0e1f17);
  border: 1px solid var(--border-medium, #486052);
  font: 13px/1.55 var(--font, system-ui, -apple-system, sans-serif);
  box-shadow: 0 6px 24px rgb(0 0 0 / 22%);
}

.sa-preferences {
  position: fixed;
  z-index: 1249;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  max-width: calc(100vw - 24px);
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.sa-panel {
  position: fixed;
  z-index: 1250;
  left: max(12px, env(safe-area-inset-left, 0px));
  bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 56px);
  width: min(400px, calc(100vw - 24px));
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border-radius: var(--radius-lg, 18px);
  text-align: left;
  overflow-wrap: anywhere;
}

.sa-panel[hidden],
.sa-preferences[hidden] {
  display: none !important;
}

.sa-title {
  margin: 0 96px 10px 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-main, #f4f1e8);
}

.sa-description {
  margin: 0 0 16px;
  color: var(--text-muted, #b5c4ba);
}

.sa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sa-button,
.sa-close {
  box-sizing: border-box;
  min-height: 44px;
  border: 1px solid var(--border-medium, #486052);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-surface-elevated, #172d21);
  color: var(--text-main, #f4f1e8);
  font: inherit;
  cursor: pointer;
}

.sa-button {
  max-width: 100%;
  padding: 10px 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sa-primary {
  background: var(--accent-emerald, #3ddc97);
  border-color: var(--accent-emerald, #3ddc97);
  color: #08150f;
}

.sa-status {
  margin: 12px 0 0;
  color: var(--text-muted, #b5c4ba);
  font-size: 12px;
}

.sa-status:empty {
  display: none;
}

.sa-close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 44px;
  width: auto;
  max-width: 110px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow-wrap: normal;
}

.sa-preferences:hover,
.sa-button:hover,
.sa-close:hover {
  border-color: var(--accent-emerald, #3ddc97);
}

.sa-preferences:focus-visible,
.sa-button:focus-visible,
.sa-close:focus-visible {
  outline: 3px solid var(--accent-gold, #e8c65a);
  outline-offset: 3px;
}

.sa-button:disabled,
.sa-close:disabled {
  opacity: .6;
  cursor: not-allowed;
}

@media (max-width: 420px) {
  .sa-panel { padding: 16px; }
  .sa-button { flex: 1 1 140px; }
}

@media (forced-colors: active) {
  .sa-preferences,
  .sa-panel,
  .sa-button,
  .sa-close { border-color: ButtonText; }
  .sa-primary { color: ButtonText; background: ButtonFace; }
  .sa-preferences:focus-visible,
  .sa-button:focus-visible,
  .sa-close:focus-visible { outline-color: Highlight; }
}
@media (max-width: 600px) {
  .sa-preferences { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
}
#card-modal.open ~ .sa-preferences,
#card-modal.open ~ .sa-panel { display: none; }
