*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05030a;
}

html {
  min-width: 0;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: rgb(247 244 251 / 94%);
  background:
    radial-gradient(circle at 77% 9%, rgb(112 69 174 / 17%), transparent 28rem),
    linear-gradient(180deg, rgb(8 11 20 / 96%), rgb(13 6 19 / 98%));
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image: url("../assets/backgrounds/kingdom page desk.png");
  background-position: center;
  background-size: cover;
  opacity: 0.2;
}

a {
  color: #c9eefe;
  text-underline-offset: 0.2em;
}

a:hover {
  color: #fff;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #9deeff;
  outline-offset: 3px;
}

.legal-skip-link {
  position: fixed;
  z-index: 100;
  top: 0.6rem;
  left: 50%;
  padding: 0.65rem 0.9rem;
  border-radius: 0.55rem;
  color: #071018;
  background: #bceffa;
  font-weight: 750;
  transform: translate(-50%, -180%);
}

.legal-skip-link:focus {
  transform: translate(-50%, 0);
}

.legal-back-link {
  position: fixed;
  z-index: 20;
  top: 0.8rem;
  left: clamp(0.75rem, 2vw, 1.4rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.2rem;
  padding: 0.48rem 0.78rem;
  border: 1px solid rgb(190 220 255 / 25%);
  border-radius: 0.62rem;
  color: rgb(243 248 255 / 91%);
  background: rgb(6 10 20 / 78%);
  box-shadow: 0 0.5rem 1.2rem rgb(0 0 0 / 26%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-decoration: none;
}

.legal-shell {
  width: min(calc(100% - 2rem), 70rem);
  margin-inline: auto;
  padding: 7rem 0 5rem;
}

.legal-document {
  padding: clamp(1.5rem, 3.8vw, 3.6rem);
  border: 1px solid rgb(192 156 235 / 21%);
  border-radius: 1.15rem;
  background:
    linear-gradient(145deg, rgb(106 63 155 / 8%), transparent 34%),
    rgb(8 8 16 / 86%);
  box-shadow:
    0 1.5rem 4rem rgb(0 0 0 / 35%),
    inset 0 1px 0 rgb(255 255 255 / 5%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.legal-eyebrow {
  margin: 0 0 0.7rem;
  color: rgb(175 226 242 / 73%);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.legal-document h1 {
  max-width: 19ch;
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 1.5rem + 2.7vw, 4.3rem);
  line-height: 1.03;
  letter-spacing: -0.04em;
  text-shadow: 0 0.5rem 1.6rem rgb(0 0 0 / 65%);
}

.legal-intro {
  max-width: 70ch;
  margin: 1.3rem 0 0;
  color: rgb(237 234 243 / 78%);
  font-size: clamp(1rem, 0.94rem + 0.25vw, 1.15rem);
  line-height: 1.72;
}

.legal-status,
.legal-fallback {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid rgb(164 217 236 / 72%);
  border-radius: 0 0.55rem 0.55rem 0;
  color: rgb(230 242 248 / 86%);
  background: rgb(30 54 67 / 32%);
  line-height: 1.55;
}

.legal-fallback[hidden] {
  display: none;
}

.legal-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.6rem 0 0;
}

.legal-meta div {
  padding: 0.9rem 1rem;
  border: 1px solid rgb(192 156 235 / 16%);
  border-radius: 0.65rem;
  background: rgb(20 12 28 / 50%);
}

.legal-meta dt {
  color: rgb(186 222 236 / 74%);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-meta dd {
  margin: 0.35rem 0 0;
  color: rgb(248 245 251 / 91%);
  line-height: 1.45;
}

.legal-placeholder {
  display: inline-block;
  padding: 0.14rem 0.42rem;
  border: 1px solid rgb(249 191 116 / 35%);
  border-radius: 0.3rem;
  color: #ffdba9;
  background: rgb(91 50 11 / 31%);
  font-weight: 750;
}

.legal-content {
  max-width: 76ch;
  margin-top: 2.4rem;
}

.legal-content section + section {
  margin-top: 2.5rem;
  padding-top: 2.2rem;
  border-top: 1px solid rgb(196 167 232 / 13%);
}

.legal-content h2 {
  margin: 0 0 0.85rem;
  color: rgb(251 249 253 / 97%);
  font-size: clamp(1.25rem, 1.12rem + 0.5vw, 1.65rem);
  line-height: 1.24;
}

.legal-content h3 {
  margin: 1.65rem 0 0.65rem;
  color: rgb(235 218 250 / 94%);
  font-size: 1.08rem;
  line-height: 1.35;
}

.legal-content p,
.legal-content li {
  color: rgb(235 232 239 / 82%);
  line-height: 1.74;
}

.legal-content p {
  margin: 0.75rem 0;
}

.legal-content ul,
.legal-content ol {
  margin: 0.8rem 0;
  padding-left: 1.35rem;
}

.legal-content li + li {
  margin-top: 0.45rem;
}

.legal-code {
  overflow-wrap: anywhere;
  color: #cbefff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

.kingdom-guide-content {
  max-width: none;
}

.kingdom-guide-content > p,
.kingdom-guide-content section > h2,
.kingdom-guide-content section > h3,
.kingdom-guide-content section > p,
.kingdom-guide-content section > ol,
.kingdom-guide-content section > ul {
  max-width: 76ch;
}

.kingdom-guide-content code {
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #cbefff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

.legal-table-scroll {
  max-width: 100%;
  margin: 1.15rem 0;
  overflow-x: auto;
  border: 1px solid rgb(188 151 236 / 22%);
  border-radius: 0.75rem;
  background: rgb(13 9 22 / 72%);
  scrollbar-color: rgb(180 134 231 / 60%) rgb(11 8 18 / 70%);
}

.legal-table-scroll:focus-visible {
  outline: 2px solid #9deeff;
  outline-offset: 3px;
}

.legal-table-scroll table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
}

.legal-table-scroll th,
.legal-table-scroll td {
  padding: 0.85rem 0.95rem;
  border-right: 1px solid rgb(188 151 236 / 14%);
  border-bottom: 1px solid rgb(188 151 236 / 14%);
  color: rgb(235 232 239 / 82%);
  line-height: 1.58;
  text-align: left;
  vertical-align: top;
}

.legal-table-scroll th {
  color: #fff;
  background: rgb(51 27 72 / 72%);
  font-size: 0.92rem;
}

.legal-table-scroll th:last-child,
.legal-table-scroll td:last-child {
  border-right: 0;
}

.legal-table-scroll tbody tr:last-child td {
  border-bottom: 0;
}

.legal-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}

.legal-card {
  display: flex;
  flex-direction: column;
  min-height: 15rem;
  padding: 1.25rem;
  border: 1px solid rgb(188 151 236 / 22%);
  border-radius: 0.85rem;
  color: inherit;
  background: rgb(19 11 29 / 66%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 4%);
  text-decoration: none;
  transition: transform 170ms ease, border-color 170ms ease, background 170ms ease;
}

.legal-card:hover {
  border-color: rgb(206 172 250 / 48%);
  color: inherit;
  background: rgb(37 20 53 / 78%);
  transform: translateY(-2px);
}

.legal-card h2 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1.25;
}

.legal-card p {
  margin: 0.8rem 0 1.2rem;
  color: rgb(231 226 238 / 76%);
  line-height: 1.62;
}

.legal-card span {
  margin-top: auto;
  color: #bfeaff;
  font-weight: 750;
}

.legal-footer {
  max-width: 76ch;
  margin: 2rem auto 0;
  color: rgb(222 216 228 / 58%);
  font-size: 0.8rem;
  line-height: 1.55;
  text-align: center;
}

/* PinguSama site privacy: reuse the Home's blue/azure identity without
   changing the shared Kingdom legal pages. */
.site-privacy-body {
  color: #eafbff;
  background:
    radial-gradient(circle at 78% 8%, rgb(66 180 215 / 18%), transparent 29rem),
    linear-gradient(180deg, rgb(5 18 27 / 97%), rgb(4 12 19 / 99%));
}

.site-privacy-body::before {
  background-image: url("../assets/backgrounds/wallpaperdesk.png");
  opacity: 0.24;
}

.site-privacy-body .legal-document {
  border-color: rgb(158 223 232 / 26%);
  background:
    linear-gradient(145deg, rgb(61 171 205 / 10%), transparent 35%),
    rgb(5 17 25 / 88%);
  box-shadow:
    0 1.5rem 4rem rgb(0 7 16 / 38%),
    inset 0 1px 0 rgb(225 250 255 / 7%);
  text-align: center;
}

.site-privacy-body .legal-eyebrow {
  color: rgb(158 223 232 / 82%);
}

.site-privacy-body .legal-document h1 {
  max-width: 100%;
  margin-inline: auto;
  color: #f5feff;
  font-size: clamp(1.15rem, 4.8vw, 4.3rem);
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.site-privacy-body .legal-meta {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 25rem);
  margin-inline: auto;
}

.site-privacy-body .legal-meta div {
  border-color: rgb(158 223 232 / 22%);
  background: rgb(7 32 43 / 58%);
}

.site-privacy-body .legal-content {
  width: min(100%, 76ch);
  margin: 2.4rem auto 0;
}

.site-privacy-body .legal-content section + section {
  border-top-color: rgb(158 223 232 / 16%);
}

.site-privacy-body .legal-content h2,
.site-privacy-body .legal-content h3,
.site-privacy-body .legal-content p,
.site-privacy-body .legal-content ul {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.site-privacy-body .legal-content p {
  max-width: 72ch;
}

.site-privacy-body .legal-content ul {
  max-width: 66ch;
  padding-left: 0;
  list-style-position: inside;
}

.site-privacy-body .legal-content a {
  overflow-wrap: anywhere;
}

@media (max-width: 52rem) {
  body::before {
    background-image: url("../assets/backgrounds/kingdom page mobile.png");
  }

  .legal-shell {
    width: min(calc(100% - 1.2rem), 43rem);
    padding: 5.4rem 0 3rem;
  }

  .legal-document {
    padding: 1.25rem;
    border-radius: 0.9rem;
  }

  .legal-card-grid,
  .legal-meta {
    grid-template-columns: 1fr;
  }

  .legal-card {
    min-height: 0;
  }

  .legal-back-link {
    top: max(0.68rem, env(safe-area-inset-top));
    left: max(0.68rem, env(safe-area-inset-left));
  }

  .site-privacy-body::before {
    background-image: url("../assets/backgrounds/wallpapermob.png");
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .legal-card {
    transition: none;
  }
}
