:root {
  --bg: #f3f1ec;
  --surface: #fffdfa;
  --border: #e5dfd6;
  --text: #1a1816;
  --muted: #6f6963;
  --accent: #c2410c;
  --accent-soft: #fff7ed;
  --radius: 12px;
  --legal-column: 720px;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

.legal-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 1.25rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
}

.legal-top,
.legal-card,
.legal-footer {
  width: 100%;
  max-width: var(--legal-column);
  margin-left: auto;
  margin-right: auto;
}

.legal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.65rem;
  padding: 0.4rem 0 1.15rem;
  border-bottom: 1px solid var(--border);
  min-height: 3.75rem;
}

.legal-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.legal-brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
}

.legal-brand-text {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.legal-brand-logo {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 11px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(194, 65, 12, 0.14);
}

.legal-brand-slug {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.seo-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}

.seo-links a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-right: 0.75rem;
}

.seo-links a:hover {
  text-decoration: underline;
}

.legal-back {
  flex-shrink: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  margin-right: -0.35rem;
  border-radius: 9px;
  transition: color 0.15s ease, background 0.15s ease;
}

.legal-back:hover {
  color: var(--accent);
  background: rgba(26, 24, 22, 0.04);
}

.legal-top-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.lang-menu {
  position: relative;
}

.lang-globe-btn {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lang-globe-btn:hover,
.lang-globe-btn.is-open {
  border-color: #fdba74;
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.08);
}

.lang-globe-icon {
  display: block;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 130;
  min-width: 8.5rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(26, 24, 22, 0.1);
}

.lang-dropdown[hidden] {
  display: none !important;
}

.lang-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.48rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.lang-option:hover {
  background: #faf8f5;
  color: var(--accent);
}

.lang-option.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.lang-option.is-active::after {
  content: "✓";
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
}

.locale-en-note {
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.84rem;
}

.legal-card {
  flex: 1;
  margin: 0 auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.legal-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.legal-updated {
  margin: 0 0 1.15rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.legal-card h2 {
  margin: 1.35rem 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.legal-card p:not(.legal-note),
.legal-card li {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
  color: #44403c;
}

.legal-card ul,
.legal-card ol {
  margin: 0 0 0.65rem;
  padding-left: 1.25rem;
}

.legal-card li {
  margin-bottom: 0.35rem;
}

.legal-card a:not(.free-tool-btn--link):not(.btn-primary) {
  color: var(--accent);
}

.legal-card a:hover {
  text-decoration: none;
}

.legal-card .legal-note {
  margin: 0.65rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #fed7aa;
  background: var(--accent-soft);
  font-size: 0.8rem;
  color: #7c2d12;
}

.legal-contact-grid {
  display: grid;
  gap: 0.65rem;
  margin: 0.85rem 0 0;
}

.legal-contact-item {
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #faf8f5;
}

.legal-contact-item strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.84rem;
}

.legal-contact-item p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.legal-contact-item a {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.legal-footer {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.74rem;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
}

.legal-footer a:hover {
  color: var(--accent);
}

.legal-footer a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.back-to-top {
  position: fixed;
  right: clamp(0.85rem, 3vw, 1.65rem);
  bottom: clamp(1.1rem, 3.5vh, 1.85rem);
  z-index: 40;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffdfa;
  color: var(--accent);
  box-shadow: 0 4px 18px rgba(26, 24, 22, 0.1);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-soft);
  border-color: #fed7aa;
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .legal-top {
    min-height: 3.35rem;
    margin-bottom: 1.35rem;
    padding-bottom: 0.95rem;
  }

  .legal-brand-logo {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 10px;
  }

  .legal-brand-text {
    font-size: 1.02rem;
  }

  .legal-back {
    font-size: 0.8rem;
    padding: 0.4rem 0.55rem;
    margin-right: -0.2rem;
  }

  .legal-card h1 {
    font-size: 1.2rem;
  }
}
