:root {
    --primary-color: #4f46e5;
    --accent-color: #06b6d4;
    --text-main: #1f2937;
    --bg-light: #f9fafb;
    --font-cjk: system-ui;
}

/* CJK font stacks: Inter/Poppins have no CJK glyphs, so pick native fonts per language */
html:lang(zh) { --font-cjk: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC'; }
html:lang(ja) { --font-cjk: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', 'Noto Sans CJK JP'; }
html:lang(ko) { --font-cjk: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Noto Sans CJK KR'; }
html:lang(ko) body { word-break: keep-all; }
html:lang(ja) h1, html:lang(ja) h2, html:lang(ja) h3 { word-break: auto-phrase; }

* { box-sizing: border-box; }

body {
    font-family: 'Inter', var(--font-cjk), sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-main);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* Header */
header {
    padding: 1.2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.logo {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    white-space: nowrap;
}

nav { display: flex; align-items: center; }

nav a {
    margin-left: 2rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

nav a:hover { color: var(--primary-color); }

.nav-cta {
    margin-left: 2rem;
    background: var(--primary-color);
    color: white !important;
    padding: 0.5rem 1.4rem;
    border-radius: 50px;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s !important;
}

.nav-cta:hover {
    background: #4338ca !important;
    color: white !important;
    transform: translateY(-1px);
}

/* Language Switcher */
.lang-switcher {
    position: relative;
    margin-left: 1.8rem;
    font-size: 0.88rem;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 50px;
    padding: 0.35rem 0.8rem;
    font: inherit;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.lang-toggle:hover,
.lang-switcher.open .lang-toggle { border-color: var(--primary-color); color: var(--primary-color); }

.lang-toggle svg { width: 16px; height: 16px; flex-shrink: 0; }
.lang-toggle .caret { width: 10px; height: 10px; transition: transform 0.2s; }
.lang-switcher.open .caret { transform: rotate(180deg); }

.lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 140px;
    margin: 0;
    padding: 0.4rem;
    list-style: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.06);
}

.lang-switcher.open .lang-menu { display: block; }

nav .lang-menu a {
    display: block;
    margin: 0;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-weight: 500;
}

nav .lang-menu a:hover { background: #f3f4f6; }

nav .lang-menu a.active {
    color: var(--primary-color);
    font-weight: 700;
    background: rgba(79,70,229,0.08);
}

/* Hero */
.hero {
    min-height: 88vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: radial-gradient(circle at 80% 20%, #e0e7ff 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, #dcfce7 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, #fdf4ff 0%, transparent 70%);
    padding: 6rem 10% 4rem;
    position: relative;
}

.hero-badge {
    display: inline-block;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe);
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    margin-bottom: 1.5rem;
    letter-spacing: 0.04em;
}

.hero h1 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 4rem;
    margin: 0 0 1.2rem;
    color: #111827;
    line-height: 1.15;
}

.hero h1 span {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    max-width: 580px;
    color: #4b5563;
    margin-bottom: 2.5rem;
}

.hero-btns { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

.btn-primary {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.9rem 2.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(79,70,229,0.4);
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,70,229,0.5);
}

.btn-outline {
    display: inline-block;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.9rem 2.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Section common */
.section { padding: 5rem 10%; }

.section-label {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 0.8rem;
}

h2 {
    text-align: center;
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 2.4rem;
    margin: 0 0 1rem;
    color: #111827;
}

.section-sub {
    text-align: center;
    color: #6b7280;
    max-width: 540px;
    margin: 0 auto 3rem;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.feature-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.feature-card h3 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 1.1rem;
    margin: 0 0 0.6rem;
}

.feature-card p {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0;
}

/* Games */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.game-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.14);
}

.game-thumb {
    height: 240px;
    background-color: #e5e7eb;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.game-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    backdrop-filter: blur(4px);
}

.game-badge.new {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.game-badge.soon {
    background: rgba(245, 158, 11, 0.85);
}

.game-info {
    padding: 1.5rem;
}

.game-info h3 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
}

.game-info p {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0 0 1rem;
}

.game-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; }

.tag {
    background: #f3f4f6;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
}

/* About */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}

.about-text h2 { text-align: left; margin-bottom: 1rem; }

.about-text p { color: #4b5563; margin-bottom: 1.5rem; }

.values-list { list-style: none; padding: 0; margin: 0; }

.values-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.97rem;
    color: #374151;
}


.about-cards { display: flex; flex-direction: column; gap: 1.2rem; }

.about-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-left: 4px solid var(--primary-color);
}

.about-card h4 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.about-card p { color: #6b7280; font-size: 0.92rem; margin: 0; }

/* Footer */
footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 5rem 10% 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand p {
    font-size: 0.93rem;
    line-height: 1.7;
    margin-top: 0.8rem;
    color: #94a3b8;
    max-width: 260px;
}

.footer-col h4 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    color: white;
    font-size: 0.95rem;
    margin: 0 0 1.2rem;
}

.footer-col a, .footer-col p {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    transition: color 0.2s;
}

.footer-col a:hover { color: white; }

.social-links { display: flex; gap: 0.8rem; margin-top: 1.2rem; }

.social-link {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
}

.social-link:hover { background: var(--primary-color); color: white; }

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.88rem;
    color: #64748b;
}

.footer-bottom a { color: #64748b; text-decoration: none; }
.footer-bottom a:hover { color: #94a3b8; }

/* Legal pages */
.legal-hero {
    text-align: center;
    padding: 4rem 10% 3rem;
    background: radial-gradient(circle at 80% 20%, #e0e7ff 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, #dcfce7 0%, transparent 50%);
}

.legal-hero h1 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 2.6rem;
    margin: 0 0 0.6rem;
    color: #111827;
    line-height: 1.2;
}

.legal-hero p { margin: 0; color: #6b7280; }

.legal-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 5% 5rem;
}

.legal-doc {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 2.5rem 3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    margin-top: -1rem;
}

/* Show only the document matching the active language (English without JS) */
html:not([data-lang]) .legal-doc[data-for="en"],
html[data-lang="en"] .legal-doc[data-for="en"],
html[data-lang="zh"] .legal-doc[data-for="zh"],
html[data-lang="ja"] .legal-doc[data-for="ja"],
html[data-lang="ko"] .legal-doc[data-for="ko"] { display: block; }

.legal-doc h2 {
    text-align: left;
    font-size: 1.3rem;
    margin: 2.4rem 0 0.8rem;
    padding-top: 1.6rem;
    border-top: 1px solid #f3f4f6;
}

.legal-doc h2:first-of-type { margin-top: 1.5rem; }

.legal-doc h3 {
    font-family: 'Poppins', var(--font-cjk), sans-serif;
    font-size: 1.05rem;
    margin: 1.6rem 0 0.6rem;
    color: #111827;
}

.legal-doc p, .legal-doc li { color: #374151; font-size: 0.97rem; }
.legal-doc ul { padding-left: 1.4rem; margin: 0.6rem 0 1rem; }
.legal-doc li { margin-bottom: 0.4rem; }
.legal-doc strong { color: #111827; }
.legal-doc a { color: var(--primary-color); word-break: break-all; }
.legal-doc [id] { scroll-margin-top: 90px; }

.legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.legal-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    margin: 1rem 0 0;
}

/* Responsive */
@media (max-width: 900px) {
    .hero h1 { font-size: 2.8rem; }
    .about-content { grid-template-columns: 1fr; gap: 2rem; }
    .about-text h2 { text-align: center; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    nav a, .nav-cta { margin-left: 1.2rem; }
    .lang-switcher { margin-left: 1rem; }
}

@media (max-width: 820px) {
    nav > a:not(.nav-cta) { display: none; }
}

@media (max-width: 600px) {
    .hero h1 { font-size: 2.2rem; }
    .section { padding: 3.5rem 6%; }
    h2 { font-size: 2rem; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; text-align: center; }
    header { padding: 1rem 5%; }
    .logo { font-size: 1.25rem; }
    nav > a { display: none; }
    .lang-switcher { margin-left: 0.5rem; }
    .legal-hero { padding: 3rem 6% 2.5rem; }
    .legal-hero h1 { font-size: 1.9rem; }
    .legal-doc { padding: 1.8rem 1.4rem; border-radius: 16px; }
}
