.main:has(> .lg) { background: var(--bg); }
@media (prefers-reduced-motion: no-preference) { .main:has(> .lg) { scroll-behavior: smooth; } }

.lg {
  --lg-surface: var(--home-surface);
  --lg-shine: #ffffffb3;
  --lg-shadow: 0 1px 2px #28392c0d, 0 22px 44px -32px #1a3a2640;
  --lg-ease: cubic-bezier(.16, 1, .3, 1);
  --lg-focus: 0 0 0 3px color-mix(in srgb, var(--main) 30%, transparent);
  max-width: 64rem;
  font-variant-numeric: lining-nums proportional-nums;
}
:root[data-theme="dark"] .lg {
  --lg-shine: #ffffff12;
  --lg-shadow: 0 1px 2px #0000004d, 0 22px 44px -30px #000000b3;
}
.lg.centered { transform: none; }

.lg-switch { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 4px 0 28px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--lg-surface); box-shadow: inset 0 1px 0 var(--lg-shine); }
.lg-switch a { padding: 7px 14px; border-radius: 10px; color: var(--secondary); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background-color .2s var(--lg-ease), color .2s var(--lg-ease); }
.lg-switch a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.lg-switch a[aria-current="page"] { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line), 0 1px 3px #0000000f; }
.lg-switch a:focus-visible { outline: none; box-shadow: var(--lg-focus); }

.lg .lg-head { display: grid; justify-items: start; gap: 10px; margin-bottom: 40px; }
.lg .lg-kicker { margin: 0; color: var(--main); font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.lg .lg-head h1 { margin: 0; font-size: clamp(34px, 4vw, 52px); font-weight: 500; letter-spacing: -.045em; line-height: 1.05; }
.lg .legal__meta.lg-updated { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 0; padding: 4px 12px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--lg-surface); color: var(--secondary); font-size: 12.5px; }
.lg-updated::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--main); box-shadow: 0 0 0 3px color-mix(in srgb, var(--main) 16%, transparent); }

.lg-body { display: grid; grid-template-columns: minmax(0, 640px) 220px; justify-content: space-between; gap: clamp(32px, 5vw, 72px); align-items: start; }
.lg-toc { position: sticky; top: 28px; order: 2; }
.lg-toc__title { margin: 0 0 12px; color: var(--secondary); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.lg-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; border-left: 1px solid var(--line); }
.lg-toc li { counter-increment: toc; }
.lg-toc a { position: relative; display: flex; gap: 10px; margin-left: -1px; padding: 6px 0 6px 14px; border-left: 2px solid transparent; color: var(--secondary); font-size: 13.5px; line-height: 1.4; text-decoration: none; transition: color .2s var(--lg-ease), border-color .2s var(--lg-ease); }
.lg-toc a::before { content: counter(toc, decimal-leading-zero); flex: none; color: color-mix(in srgb, var(--secondary) 65%, transparent); font-family: var(--font-mono); font-size: 11px; line-height: 1.75; }
.lg-toc a:hover { color: var(--text); }
.lg-toc a[aria-current="true"] { border-left-color: var(--main); color: var(--text); font-weight: 500; }
.lg-toc a[aria-current="true"]::before { color: var(--main); }
.lg-toc a:focus-visible { outline: none; box-shadow: var(--lg-focus); border-radius: 6px; }

.lg-doc { max-width: 640px; min-width: 0; counter-reset: sec; }
.lg .lg-doc p { margin: 0 0 16px; color: color-mix(in srgb, var(--text) 84%, var(--secondary)); font-size: 16px; line-height: 1.72; text-wrap: pretty; }
.lg .lg-doc p:last-child { margin-bottom: 0; }
.lg-doc strong { color: var(--text); font-weight: 600; }
.lg-doc a { color: var(--link); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.lg-doc a:focus-visible { outline: none; box-shadow: var(--lg-focus); border-radius: 4px; }
.lg .lg-doc code { padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--lg-surface); color: var(--text); font-size: .86em; }
.lg .lg-doc .lg-lead { margin-bottom: 8px; color: var(--text); font-size: 18px; line-height: 1.7; }

.lg .legal__note.lg-note { position: relative; margin: 0 0 28px; padding: 18px 20px 18px 20px; border: 1px solid color-mix(in srgb, var(--main) 22%, var(--line)); border-left: 1px solid color-mix(in srgb, var(--main) 22%, var(--line)); border-radius: 16px; background: color-mix(in srgb, var(--main) 5%, var(--lg-surface)); color: var(--text); font-size: 15px; line-height: 1.7; }
.lg-note__tag { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: var(--main); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.lg-note__tag::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 5.5h12M4 10h12M4 14.5h7'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 5.5h12M4 10h12M4 14.5h7'/%3E%3C/svg%3E") center / contain no-repeat; }

.lg-brief { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; padding: 0; list-style: none; }
.lg-brief a { display: grid; align-content: start; gap: 12px; height: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--lg-surface); color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.45; text-decoration: none; box-shadow: inset 0 1px 0 var(--lg-shine), var(--lg-shadow); transition: transform .3s var(--lg-ease), border-color .3s var(--lg-ease); }
.lg-brief a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--main) 30%, var(--line)); }
.lg-brief__ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--main) 10%, transparent); }
.lg-brief__ico svg { width: 18px; height: 18px; fill: none; stroke: var(--main); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.lg-sec { position: relative; padding-top: 36px; counter-increment: sec; }
.lg .lg-sec h2 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; color: var(--text); font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; scroll-margin-top: 24px; }
.lg .lg-sec h2::before { content: counter(sec, decimal-leading-zero); flex: none; color: var(--main); font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.lg-sec + .lg-sec { border-top: 1px solid var(--line); margin-top: 36px; }
.lg-anchor { position: absolute; top: 38px; left: -26px; display: grid; place-items: center; width: 20px; height: 22px; border-radius: 6px; color: var(--secondary); font-family: var(--font-mono); font-size: 14px; text-decoration: none; opacity: 0; transition: opacity .2s var(--lg-ease), color .2s; }
.lg-sec + .lg-sec .lg-anchor { top: 38px; }
.lg-sec:hover .lg-anchor, .lg-anchor:focus-visible { opacity: 1; }
.lg-anchor:hover { color: var(--main); }
.lg-anchor:focus-visible { outline: none; box-shadow: var(--lg-focus); }

.lg-table { margin: 4px 0 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--lg-surface); box-shadow: inset 0 1px 0 var(--lg-shine), var(--lg-shadow); }
.lg .legal__table { width: 100%; margin: 0; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.lg .legal__table th, .lg .legal__table td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; vertical-align: top; }
.lg .legal__table tr:last-child > * { border-bottom: 0; }
.lg .legal__table:not(:has(thead)) tr:first-child > th, .lg .legal__table thead th { background: color-mix(in srgb, var(--text) 3.5%, transparent); color: var(--secondary); font-size: 12.5px; font-weight: 600; }
.lg .legal__table td:first-child { font-weight: 500; }
.lg .legal__table tbody th { font-weight: 500; }
.lg .legal__table td + td, .lg .legal__table th + td { color: color-mix(in srgb, var(--text) 82%, var(--secondary)); }
.lg .legal__table tbody tr:hover > *, .lg .legal__table:not(:has(thead)) tr:not(:first-child):hover > * { background: color-mix(in srgb, var(--main) 3%, transparent); }
.lg .legal__table code { display: inline-block; margin-bottom: 6px; }
.lg-kind { display: table; padding: 1px 8px; border-radius: 999px; font-family: inherit; font-size: 11px; font-weight: 600; }
.lg-kind.is-cookie { background: color-mix(in srgb, var(--main) 11%, transparent); color: var(--main); }
.lg-kind.is-local { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--secondary); }

.lg-merchant__card { position: relative; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--main) 10%, transparent), transparent 60%), var(--lg-surface); box-shadow: inset 0 1px 0 var(--lg-shine), var(--lg-shadow); }
.lg-merchant__tag { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px; padding: 3px 10px 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--main) 10%, transparent); color: var(--main); font-size: 12px; font-weight: 600; }
.lg-merchant__tag svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: no-preference) {
  .lg-head, .lg-switch, .lg-toc, .lg-doc { animation: lg-rise .6s var(--lg-ease) backwards; }
  .lg-head { animation-delay: .04s; } .lg-toc { animation-delay: .1s; } .lg-doc { animation-delay: .14s; }
  @keyframes lg-rise { from { opacity: 0; transform: translateY(8px); } }
}

@media (max-width: 960px) {
  .lg-body { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .lg-toc { order: 0; position: static; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--lg-surface); }
  .lg-toc ol { columns: 2; column-gap: 24px; border-left: 0; }
  .lg-toc a { padding-left: 0; border-left: 0; break-inside: avoid; }
  .lg-doc { max-width: none; }
  .lg-anchor { display: none; }
}

@media (max-width: 640px) {
  .lg-toc ol { columns: 1; }
  .lg-brief { grid-template-columns: minmax(0, 1fr); }
  .lg .legal__table, .lg .legal__table tbody, .lg .legal__table tr, .lg .legal__table th, .lg .legal__table td { display: block; }
  .lg .legal__table thead, .lg .legal__table tr:first-child:has(> th + th) { display: none; }
  .lg .legal__table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .lg .legal__table tr:last-child { border-bottom: 0; }
  .lg .legal__table th, .lg .legal__table td { padding: 2px 0; border: 0; }
  .lg .legal__table td:first-child { margin-bottom: 4px; }
  .lg .legal__table tr:not(:first-child):hover > * { background: none; }
  .lg-switch { display: flex; }
  .lg-switch a { flex: 1; text-align: center; padding: 7px 8px; }
}

@media print {
  .lg-switch, .lg-toc, .lg-anchor { display: none; }
  .lg-body { display: block; }
}
