.site-error-banner,
.auth-error-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5010;
  width: min(560px, calc(100% - 24px));
  padding: 12px 16px;
  border: 1px solid rgba(220, 80, 70, 0.55);
  background: rgba(42, 14, 12, 0.96);
  color: #f6d4ce;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.site-error-banner[hidden],
.auth-error-banner[hidden] { display: none !important; }
.site-error-banner[data-error="lock"] {
  border-color: rgba(212, 175, 55, 0.5);
  background: rgba(22, 16, 10, 0.96);
  color: #f0e0b8;
}
.site-error-banner[data-error="lock"] strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.site-error-banner[data-error="lock"] p {
  margin: 0 0 10px;
}
.site-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.site-error-actions a,
.site-error-actions button {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 999px;
  padding: 6px 12px;
}
.site-error-actions a {
  background: #7a5c1c;
  color: #f0e0b8;
  text-decoration: none;
  border: 1px solid rgba(212, 175, 55, 0.45);
}
.site-error-actions button {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(240, 224, 184, 0.28);
}

.auth-inline-error {
  display: block;
  margin-top: 6px;
  max-width: 220px;
  color: #e8a39a;
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.35;
}
.auth-cluster {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.terms-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(6, 5, 4, 0.78);
  backdrop-filter: blur(10px);
}
.terms-overlay[hidden] { display: none !important; }

.terms-card {
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(28, 22, 16, 0.98), rgba(12, 10, 8, 0.98));
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  padding: 26px 24px 22px;
  color: #f4efe4;
}

.terms-card small {
  display: block;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  color: #d4af37;
  margin-bottom: 8px;
  font-family: Inter, system-ui, sans-serif;
}

.terms-card h2 {
  font-family: "Playfair Display", "Newsreader", Georgia, serif;
  font-size: 1.7rem;
  line-height: 1.2;
  margin: 0 0 12px;
  font-weight: 600;
}

.terms-scroll {
  overflow: auto;
  min-height: 140px;
  max-height: 38vh;
  padding: 12px 14px 12px 0;
  margin: 0 0 14px;
  border-top: 1px solid rgba(212, 175, 55, 0.22);
  border-bottom: 1px solid rgba(212, 175, 55, 0.22);
}

.terms-scroll h3 {
  font-family: Inter, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d4af37;
  margin: 14px 0 6px;
}

.terms-scroll h3:first-child { margin-top: 4px; }

.terms-scroll p,
.terms-scroll li {
  font-family: "Cormorant Garamond", Lora, Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.55;
  color: #c4b8a8;
  margin: 0 0 8px;
}

.terms-scroll ul {
  margin: 0 0 10px;
  padding-left: 1.15rem;
}

.terms-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 80, 70, 0.5);
  background: rgba(90, 22, 18, 0.45);
  color: #f6d4ce;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}
.terms-error[hidden] { display: none !important; }

.terms-check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(20, 16, 12, 0.55);
  cursor: pointer;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #f0e0b8;
}
.terms-check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.terms-box {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  border: 2px solid #d4af37;
  background: #1a1408;
  border-radius: 3px;
  box-sizing: border-box;
  display: grid;
  place-content: center;
}
.terms-check input:focus-visible + .terms-box {
  box-shadow: 0 0 0 2px #1a1408, 0 0 0 4px #d4af37;
}
.terms-check input:checked + .terms-box {
  background: #d4af37;
}
.terms-check input:checked + .terms-box::after {
  content: "";
  width: 10px;
  height: 5px;
  border: 2px solid #1a1408;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(0, -1px);
}
.terms-check.is-invalid {
  border-color: rgba(220, 80, 70, 0.75);
  background: rgba(90, 22, 18, 0.28);
  box-shadow: 0 0 0 1px rgba(220, 80, 70, 0.35);
}

.terms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.terms-btn {
  font-family: Inter, system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0e0b8;
  padding: 11px 16px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: transparent;
  cursor: pointer;
}
.terms-btn.solid {
  background: linear-gradient(180deg, #e0c56a, #d4af37);
  color: #1a1408;
  border-color: #d4af37;
}
.terms-btn-block {
  width: 100%;
  justify-content: center;
}
.terms-btn:hover { filter: brightness(1.08); }
.terms-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

body.terms-locked,
body.site-locked {
  overflow: hidden;
}
body.terms-locked .sitting-guide,
body.site-locked .sitting-guide {
  visibility: hidden;
}
body.site-locked > *:not(#terms-overlay):not(#site-error-banner):not(#auth-error-banner) {
  pointer-events: none !important;
  user-select: none;
}
body.site-locked > *:not(#terms-overlay):not(#site-error-banner):not(#auth-error-banner) * {
  pointer-events: none !important;
}
#terms-overlay,
#terms-overlay * {
  pointer-events: auto !important;
}

@media (max-width: 640px) {
  .terms-card { padding: 20px 16px 18px; }
  .terms-scroll { max-height: 32vh; }
}
