/* ============================================
   Legal Document (Terms / Privacy) — content styles
   ============================================
   Shared by the desktop pages (desktop/terms, desktop/privacy + legal.css frame) and the
   mobile pages (mobile/game-terms, mobile/game-privacy). Markup comes from the
   templates/legal/*_{ko,en}.html fragments:
     .legal-hero (.legal-eyebrow .legal-title .legal-lead .legal-dates)
     .legal-summary (.legal-summary__title .legal-summary__grid > .legal-summary__item)
     .legal-section > h2, .legal-article > h3, p/ul/ol, .legal-table-wrap > .legal-table
     .legal-contact
   Every token has a fallback so the mobile pages work without base.css.
   ============================================ */

.legal-doc {
    --ld-text: var(--text-secondary, #dcd9f2);
    --ld-text-2: var(--text-tertiary, #b4b0d2);
    --ld-muted: var(--text-muted, #8c88ae);
    --ld-line: var(--line-1, rgba(255, 255, 255, 0.07));
    --ld-line-2: var(--line-2, rgba(255, 255, 255, 0.12));
    --ld-surface: var(--surface-1, rgba(255, 255, 255, 0.035));
    --ld-surface-2: var(--surface-2, rgba(255, 255, 255, 0.06));
    --ld-accent: var(--accent-400, #a78bfa);
    --ld-accent-soft: var(--accent-soft, rgba(139, 92, 246, 0.16));
    --ld-display: var(--font-display, 'Space Grotesk', 'Pretendard Variable', Pretendard, sans-serif);
    color: var(--ld-text);
    font-size: 15.5px;
    line-height: 1.8;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* ---------- Language switch (mobile pages; desktop uses the page toolbar) ---------- */
.legal-doc .legal-doc__langs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 18px;
    border-radius: 999px;
    border: 1px solid var(--ld-line);
    background: rgba(0, 0, 0, 0.25);
}

.legal-doc .legal-doc__langs a {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--ld-text-2);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}

.legal-doc .legal-doc__langs a.is-active {
    background: var(--ld-surface-2);
    color: #fff;
}

/* ---------- Hero ---------- */
.legal-doc .legal-hero {
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--ld-line);
}

.legal-doc .legal-eyebrow {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 12px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: var(--ld-accent-soft);
    color: #d8ccff;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.legal-doc .legal-title {
    margin: 0 0 14px;
    font-family: var(--ld-display);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: #fff;
}

.legal-doc .legal-lead {
    max-width: 680px;
    margin: 0 0 20px;
    font-size: 16.5px;
    line-height: 1.75;
    color: var(--ld-text);
}

.legal-doc .legal-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.legal-doc .legal-dates > div {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--ld-line-2);
    background: var(--ld-surface);
    line-height: 30px;
}

.legal-doc .legal-dates dt {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ld-muted);
}

.legal-doc .legal-dates dd {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* ---------- At a glance ---------- */
.legal-doc .legal-summary {
    margin: 0 0 36px;
}

.legal-doc .legal-summary__title {
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ld-accent);
}

.legal-doc .legal-summary__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.legal-doc .legal-summary__item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--ld-line);
    background: var(--ld-surface);
}

.legal-doc .legal-summary__item::marker {
    content: none;
}

.legal-doc .legal-summary__icon {
    grid-row: span 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--ld-surface-2);
    font-size: 18px;
    line-height: 1;
}

.legal-doc .legal-summary__item strong {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.45;
    color: #fff;
}

.legal-doc .legal-summary__item p {
    margin: 4px 0 0;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ld-text-2);
}

/* ---------- Chapters & articles ---------- */
.legal-doc .legal-section {
    padding-top: 28px;
    margin-top: 28px;
    border-top: 1px solid var(--ld-line);
    scroll-margin-top: 24px;
}

.legal-doc .legal-section:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.legal-doc .legal-section h2 {
    margin: 0 0 18px;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: #fff;
}

.legal-doc .legal-article {
    margin: 0 0 22px;
    scroll-margin-top: 24px;
}

.legal-doc .legal-article:last-child {
    margin-bottom: 0;
}

.legal-doc .legal-article h3 {
    position: relative;
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    color: #f3f1ff;
}

/* "#" permalink added by legal.js (desktop) */
.legal-doc .legal-anchor {
    margin-left: 8px;
    font-weight: 600;
    color: var(--ld-muted);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.legal-doc .legal-article:hover .legal-anchor,
.legal-doc .legal-anchor:focus-visible {
    opacity: 1;
}

.legal-doc .legal-anchor:hover {
    color: var(--ld-accent);
}

.legal-doc p {
    margin: 0 0 10px;
}

.legal-doc ul,
.legal-doc ol {
    margin: 4px 0 12px;
    padding-left: 22px;
}

.legal-doc li {
    margin: 4px 0;
    padding-left: 2px;
}

.legal-doc li::marker {
    color: var(--ld-accent);
    font-weight: 700;
}

.legal-doc strong {
    color: #fff;
    font-weight: 700;
}

.legal-doc a {
    color: #c4b5fd;
    text-decoration: underline;
    text-decoration-color: rgba(196, 181, 253, 0.4);
    text-underline-offset: 3px;
}

.legal-doc a:hover {
    color: #fff;
    text-decoration-color: currentColor;
}

/* ---------- Tables (processors, transfers) ---------- */
.legal-doc .legal-table-wrap {
    margin: 10px 0 16px;
    overflow-x: auto;
    border: 1px solid var(--ld-line-2);
    border-radius: 14px;
}

.legal-doc .legal-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.55;
}

.legal-doc .legal-table th,
.legal-doc .legal-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--ld-line);
}

.legal-doc .legal-table th {
    background: var(--ld-surface-2);
    font-size: 12px;
    font-weight: 700;
    color: var(--ld-text-2);
    white-space: nowrap;
}

.legal-doc .legal-table tr:last-child td {
    border-bottom: none;
}

/* ---------- Contact ---------- */
.legal-doc .legal-contact {
    margin-top: 36px;
    padding: 22px 24px;
    border: 1px solid var(--ld-line-2);
    border-radius: 18px;
    background: var(--ld-surface);
}

.legal-doc .legal-contact h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.legal-doc .legal-contact p:last-child {
    margin-bottom: 0;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 640px) {
    .legal-doc {
        font-size: 15px;
        line-height: 1.75;
    }

    .legal-doc .legal-summary__grid {
        grid-template-columns: 1fr;
    }

    .legal-doc .legal-section h2 {
        font-size: 19px;
    }
}

/* ---------- Print: plain black on white ---------- */
@media print {
    .legal-doc,
    .legal-doc * {
        color: #000 !important;
        background: transparent !important;
        border-color: #ccc !important;
    }

    .legal-doc .legal-anchor {
        display: none;
    }
}
