/* ======================================================
   TOS / Changelog Page — New Design System
   ====================================================== */

#tos {
  background-color: var(--background);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: var(--foreground);
  padding-top: 90px;
  padding-bottom: 60px;
}

#tos .container {
  width: 95%;
  max-width: 860px;
}

#tos h2 {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--foreground);
  line-height: 1.2;
}

/* Document cards */
.tos-card {
  background: linear-gradient(168deg, rgba(14,14,22,.95) 0%, rgba(7,7,12,.98) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,.5),
    0 4px 16px rgba(0,0,0,.3),
    inset 0 1px 0 rgba(255,255,255,.02);
}

.tos-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--dark-deeper);
  border-bottom: 1px solid rgba(201,168,76,.15);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.tos-card-header:hover {
  background: rgba(201,168,76,.06);
}

.tos-card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.03em;
}

.tos-card-toggle {
  color: var(--muted-foreground);
  transition: transform 0.3s, color 0.3s;
  flex-shrink: 0;
}

.tos-card-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

.tos-card.open .tos-card-toggle {
  transform: rotate(180deg);
  color: var(--gold);
}

.tos-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.tos-card.open .tos-card-body {
  height: min(70vh, 600px);
  max-height: min(70vh, 600px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tos-card.open .tos-card-body::-webkit-scrollbar {
  width: 8px;
}

.tos-card.open .tos-card-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, .3);
}

.tos-card.open .tos-card-body::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, .35);
  border-radius: 4px;
}

.tos-card.open .tos-card-body::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 168, 76, .55);
}

.tos-card-content {
  padding: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.8;
  color: rgba(237,230,218,.85);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-sans);
}

/* Changelog specific */
.tos-card-content.changelog {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: rgba(237,230,218,.8);
}

@media (max-width: 768px) {
  #tos {
    padding-top: 80px;
    padding-bottom: 40px;
  }

  #tos .container {
    width: 100%;
    padding: 0 10px;
  }

  #tos h2 {
    font-size: 1.375rem;
  }

  .tos-card-header {
    padding: 0.875rem 1rem;
  }

  .tos-card-title {
    font-size: 0.9rem;
  }

  .tos-card-content {
    padding: 1rem;
    font-size: 0.8125rem;
  }
}
