.terms-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  z-index: 2147483647;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.terms-overlay.hidden {
  display: none !important;
}

.terms-modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  background: #15181B;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: var(--color-text-primary, #FFFFFF);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.terms-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.terms-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.terms-description {
  margin: 0;
  font-size: 15px;
  color: var(--color-text-secondary, rgba(255, 255, 255, 0.5));
  line-height: 1.4;
}

.terms-content {
  flex: 1;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-primary, #FFFFFF);
  word-break: break-word;
  white-space: normal;
  max-height: 50vh;
}

.terms-content h1,
.terms-content h2,
.terms-content h3,
.terms-content h4,
.terms-content h5,
.terms-content h6 {
  margin: 18px 0 10px;
  line-height: 1.3;
  font-weight: 700;
}

.terms-content h1 {
  font-size: 1.35rem;
}

.terms-content h2 {
  font-size: 1.25rem;
}

.terms-content h3 {
  font-size: 1.1rem;
}

.terms-content h4,
.terms-content h5,
.terms-content h6 {
  font-size: 1rem;
}

.terms-content p {
  margin: 0 0 12px;
}

.terms-content ul,
.terms-content ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.terms-content li {
  margin: 6px 0;
}

.terms-content a {
  color: #8FD3FF;
  text-decoration: underline;
}

.terms-content code {
  display: inline;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

.terms-content a.terms-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s ease;
  white-space: normal;
  word-break: break-all;
}

.terms-content a.terms-link:hover,
.terms-content a.terms-link:active {
  background: rgba(255, 255, 255, 0.18);
}

.terms-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.terms-button {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 14px 24px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.15s ease;
}

.terms-button--primary {
  color: #FFFFFF;
  background: var(--gradient-brand);
  background-size: 225% 225%;
  background-position: 45% 0%;
  box-shadow: 0 0 20px 0 rgba(255, 255, 255, 0.15) inset;
  transition: background-position 0.5s ease-out, box-shadow 0.3s ease-in-out;
}

.terms-button--primary:hover,
.terms-button--primary:active {
  background-position: 100% 100%;
  box-shadow: 0 0 20px 0 rgba(255, 255, 255, 0.5) inset;
}

.terms-button--secondary {
  color: #FFFFFF;
  background: transparent;
  box-shadow: 0 0 30px -5px rgba(255, 255, 255, 0.25) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.terms-button--secondary:hover,
.terms-button--secondary:active {
  box-shadow: 0 0 10px 0px rgba(255, 255, 255, 0.6) inset;
}

@media (max-width: 500px) {
  .terms-modal {
    padding: 20px;
    border-radius: 16px;
  }

  .terms-title {
    font-size: 20px;
  }

  .terms-actions {
    flex-direction: column-reverse;
  }

  .terms-button {
    width: 100%;
  }
}
