/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow-x: hidden; }
:root {
    --bg-1: #0a0a23;
    --bg-2: #1a0a3e;
    --bg-3: #2d1b69;
    --ink: #f6f3ff;
    --ink-soft: #b8b3d6;
    --pink: #ff4d8d;
    --pink-soft: #ffaecf;
    --cyan: #00e0ff;
    --purple: #7c5cff;
    --yellow: #ffd93d;
    --green: #26de81;
    --red: #ff5a5f;
    --shadow-glow: 0 8px 32px rgba(124, 92, 255, 0.35);
    --radius-lg: 22px;
    --radius-md: 14px;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Hiragino Kaku Gothic ProN', sans-serif;
    color: var(--ink);
    background:
        radial-gradient(ellipse at 20% 0%, #4a1e8c 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, #d6228e 0%, transparent 45%),
        radial-gradient(ellipse at 50% 100%, #1b3a99 0%, transparent 55%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-1) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- screen system ---------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }
.game-screen.active { display: flex; flex-direction: column; }

/* ---------- sakura background ---------- */
.sakura-container {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0;
    overflow: hidden;
}
.petal {
    position: absolute; top: -40px;
    font-size: 22px;
    animation: fall linear infinite;
    opacity: 0.85;
    filter: drop-shadow(0 0 6px rgba(255, 158, 200, 0.5));
}
@keyframes fall {
    0% { transform: translateY(-10vh) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.9; }
    100% { transform: translateY(110vh) translateX(80px) rotate(540deg); opacity: 0; }
}

/* ---------- main screen ---------- */
#mainScreen { position: relative; z-index: 1; padding: 24px 18px 60px; max-width: 1200px; margin: 0 auto; }

.hero {
    text-align: center;
    padding: 36px 12px 28px;
    position: relative;
}
.logo-wrap {
    display: inline-block;
    padding: 22px 32px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-glow);
}
.logo-kanji {
    font-family: 'Yuji Mai', serif;
    font-size: clamp(36px, 8vw, 64px);
    color: var(--pink-soft);
    text-shadow:
        0 0 20px rgba(255, 77, 141, 0.65),
        0 4px 0 #6b1d4d;
    margin-bottom: 4px;
    letter-spacing: 4px;
    animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.logo {
    font-size: clamp(28px, 7vw, 52px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--cyan), var(--pink), var(--yellow));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 6s ease infinite;
    letter-spacing: 1px;
}
.logo .accent { display: inline-block; }
@keyframes gradient-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.tagline {
    margin-top: 10px;
    color: var(--ink-soft);
    font-size: clamp(13px, 3vw, 16px);
    font-weight: 700;
}
.badges { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.badge {
    padding: 5px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pink), #ff8b3e);
    color: #fff; font-size: 12px; font-weight: 800;
    box-shadow: 0 4px 12px rgba(255, 77, 141, 0.4);
}
.badge.alt { background: linear-gradient(135deg, var(--purple), var(--cyan)); box-shadow: 0 4px 12px rgba(0, 224, 255, 0.4); }
.badge.alt2 { background: linear-gradient(135deg, var(--green), #00d4aa); box-shadow: 0 4px 12px rgba(38, 222, 129, 0.4); }

/* ---------- hero banner image ---------- */
.hero-banner {
    display: block;
    margin: 22px auto 0;
    max-width: 720px;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 77, 141, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}
.hero-banner img { display: block; width: 100%; height: auto; }
.hero-banner:hover { transform: translateY(-3px); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), 0 0 32px rgba(255, 77, 141, 0.4); }
.hero-banner:active { transform: scale(0.99); }

/* ---------- shared image banners ---------- */
.section-banner {
    display: block;
    margin: 0 auto 22px;
    max-width: 640px;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.2s;
}
.section-banner img { display: block; width: 100%; height: auto; }
.section-banner:hover { transform: translateY(-2px); }

.cta-banner {
    display: block;
    margin: 0 auto 22px;
    max-width: 520px;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 217, 61, 0.2);
    border: 1px solid rgba(255, 217, 61, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.cta-banner img { display: block; width: 100%; height: auto; }
.cta-banner:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 32px rgba(255, 217, 61, 0.35); }

/* ---------- promo cards (game-details intro) ---------- */
.game-details-promos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin: 0 0 28px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.promo-card {
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    background: rgba(255, 255, 255, 0.04);
}
.promo-card img { display: block; width: 100%; height: 100%; object-fit: contain; }
.promo-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 224, 255, 0.4);
    box-shadow: 0 14px 30px rgba(0, 224, 255, 0.2);
}

/* ---------- detail card thumbnails ---------- */
.detail-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-left: auto;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s;
}
.detail-card:hover .detail-thumb { transform: scale(1.05) rotate(-2deg); }
@media (max-width: 500px) {
    .detail-thumb { width: 70px; height: 70px; }
}

/* ---------- earn section hero image ---------- */
.earn-hero-image {
    display: block;
    width: 100%;
    max-width: 520px;
    margin: 0 auto 22px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 217, 61, 0.4);
    box-shadow: 0 12px 32px rgba(255, 217, 61, 0.25);
}

/* ---------- game grid ---------- */
.games-section { margin-top: 22px; padding: 0 4px; }
.section-title {
    text-align: center;
    font-size: clamp(20px, 4.5vw, 28px);
    margin-bottom: 22px;
    color: var(--ink);
    text-shadow: 0 2px 12px rgba(0, 224, 255, 0.35);
    letter-spacing: 2px;
}

.games-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
@media (min-width: 640px) {
    .games-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px; }
}
@media (min-width: 900px) {
    .games-grid { grid-template-columns: repeat(3, 1fr); gap: 26px; }
}

.game-card {
    position: relative;
    padding: 24px 16px 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, var(--c1, var(--purple)) 0%, var(--c2, var(--pink)) 100%);
    color: #fff;
    text-align: center;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    isolation: isolate;
    min-height: 170px;
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
}
.game-card::before {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.25), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(0,0,0,0.18), transparent 50%);
}
.game-card::after {
    content: ''; position: absolute; inset: -2px; border-radius: inherit; z-index: -2;
    background: linear-gradient(45deg, var(--cyan), var(--pink), var(--yellow), var(--cyan));
    background-size: 300% 300%;
    opacity: 0; transition: opacity 0.3s;
    animation: gradient-shift 4s linear infinite;
}
.game-card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45); }
.game-card:hover::after { opacity: 1; }
.game-card:active { transform: scale(0.97); }

.card-icon { font-size: clamp(36px, 8vw, 50px); line-height: 1; margin-bottom: 4px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)); }
.card-title { font-size: clamp(20px, 4vw, 26px); font-weight: 900; letter-spacing: 1px; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.card-sub { font-size: 12px; opacity: 0.9; letter-spacing: 1px; }
.card-tag {
    position: absolute; top: 10px; right: 10px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ---------- features section ---------- */
.features-section { margin-top: 60px; padding: 0 4px; }
.features-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.feature-card {
    padding: 22px 20px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.2s, border-color 0.2s;
}
.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 224, 255, 0.4);
    box-shadow: 0 12px 30px rgba(0, 224, 255, 0.15);
}
.feature-icon {
    font-size: 36px;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 10px rgba(255, 77, 141, 0.4));
}
.feature-card h3 {
    font-size: 18px;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.feature-card p {
    font-size: 14px;
    color: var(--ink-soft);
    line-height: 1.7;
}

/* ---------- game details ---------- */
.game-details { margin-top: 60px; padding: 0 4px; }
.detail-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px 22px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}
.detail-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--pink), var(--cyan));
    opacity: 0.85;
}
.detail-card[data-color="pink"]::before { background: linear-gradient(90deg, #ff4d8d, #ffb347); }
.detail-card[data-color="purple"]::before { background: linear-gradient(90deg, #7c5cff, #00e0ff); }
.detail-card[data-color="green"]::before { background: linear-gradient(90deg, #00d4aa, #7cffcb); }
.detail-card[data-color="indigo"]::before { background: linear-gradient(90deg, #5e72e4, #1f1f3a); }
.detail-card[data-color="orange"]::before { background: linear-gradient(90deg, #ff6b6b, #feca57); }
.detail-card[data-color="emerald"]::before { background: linear-gradient(90deg, #26de81, #20bf6b); }
.detail-card:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.2); }

.detail-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}
.detail-icon {
    font-size: clamp(36px, 7vw, 48px);
    flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(255, 77, 141, 0.35));
}
.detail-head h3 {
    font-size: clamp(20px, 4.5vw, 26px);
    font-weight: 900;
    color: var(--ink);
    letter-spacing: 1px;
    margin-bottom: 2px;
}
.detail-head h3 .en {
    font-size: 13px;
    font-weight: 700;
    color: var(--cyan);
    opacity: 0.8;
    letter-spacing: 1.5px;
    margin-left: 6px;
}
.detail-tag {
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 700;
    letter-spacing: 0.5px;
}
.detail-card > p {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.85;
    margin-bottom: 16px;
}
.detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.detail-meta span {
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}

/* ---------- FAQ ---------- */
.faq-section { margin-top: 60px; padding: 0 4px; }
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.faq-item:hover { border-color: rgba(0, 224, 255, 0.3); }
.faq-item[open] { border-color: rgba(255, 77, 141, 0.4); }
.faq-item summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 800;
    font-size: 15px;
    color: var(--ink);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    font-size: 22px;
    color: var(--cyan);
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 12px;
}
.faq-item[open] summary::after { content: '−'; transform: rotate(180deg); color: var(--pink); }
.faq-item summary:hover { background: rgba(255, 255, 255, 0.04); }
.faq-item p {
    padding: 0 20px 18px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.8;
}

/* ---------- CTA ---------- */
.cta-section {
    margin-top: 60px;
    padding: 40px 24px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 77, 141, 0.25), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 224, 255, 0.2), transparent 50%),
        rgba(124, 92, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.cta-section h2 {
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--cyan), var(--pink), var(--yellow));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 5s ease infinite;
    margin-bottom: 14px;
    letter-spacing: 2px;
}
.cta-section p {
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 24px;
}
.cta-button {
    display: inline-block;
    padding: 16px 40px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: 2px;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(124, 92, 255, 0.5);
    transition: transform 0.15s, box-shadow 0.2s;
}
.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(124, 92, 255, 0.7);
}
.cta-button:active { transform: scale(0.97); }

/* ---------- earn section ---------- */
.earn-section {
    margin-top: 60px;
    padding: 36px 24px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 217, 61, 0.22), transparent 55%),
        radial-gradient(circle at 85% 80%, rgba(255, 77, 141, 0.22), transparent 55%),
        rgba(20, 8, 50, 0.5);
    border: 1px solid rgba(255, 217, 61, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}
.earn-section::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(135deg, var(--yellow), var(--pink), var(--cyan), var(--yellow));
    background-size: 300% 300%;
    z-index: -1;
    border-radius: inherit;
    animation: gradient-shift 6s linear infinite;
    opacity: 0.3;
}
.earn-hero { text-align: center; margin-bottom: 32px; }
.earn-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--yellow), #ff8b3e);
    color: #1a0a3e;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 2px;
    margin-bottom: 14px;
    box-shadow: 0 6px 18px rgba(255, 217, 61, 0.5);
    animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.earn-title {
    font-size: clamp(26px, 6.5vw, 40px);
    font-weight: 900;
    color: var(--ink);
    letter-spacing: 2px;
    line-height: 1.3;
    margin-bottom: 14px;
    text-shadow: 0 4px 16px rgba(255, 217, 61, 0.4);
}
.earn-accent {
    background: linear-gradient(135deg, var(--yellow), #ff8b3e, var(--pink));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 5s ease infinite;
}
.earn-lead {
    color: var(--ink);
    font-size: clamp(14px, 3.5vw, 17px);
    line-height: 1.8;
}
.earn-lead strong { color: var(--yellow); }

.earn-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    margin-bottom: 28px;
}
.earn-card {
    padding: 22px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 217, 61, 0.25);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.earn-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 217, 61, 0.6);
    box-shadow: 0 12px 28px rgba(255, 217, 61, 0.2);
}
.earn-icon {
    font-size: 38px;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 12px rgba(255, 217, 61, 0.4));
}
.earn-card h3 {
    font-size: 17px;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 8px;
}
.earn-card p {
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.75;
}
.earn-card strong { color: var(--yellow); font-weight: 900; }

.earn-cta-wrap { text-align: center; }
.earn-cta {
    display: inline-block;
    padding: 16px 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--yellow), #ff8b3e, var(--pink));
    background-size: 200% 200%;
    color: #1a0a3e;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 1.5px;
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(255, 217, 61, 0.5);
    transition: transform 0.15s, box-shadow 0.2s;
    animation: gradient-shift 4s ease infinite;
}
.earn-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(255, 217, 61, 0.7);
}
.earn-cta:active { transform: scale(0.96); }
.earn-note {
    margin-top: 14px;
    font-size: 12px;
    color: var(--ink-soft);
    opacity: 0.85;
    line-height: 1.6;
}

/* ---------- earn modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 2, 20, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: linear-gradient(180deg, #1a0a3e 0%, #0a0a23 100%);
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 217, 61, 0.4);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(255, 77, 141, 0.3);
    transform: translateY(40px) scale(0.92);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.15s, transform 0.1s, border-color 0.2s;
}
.modal-close:hover {
    background: var(--pink);
    border-color: var(--pink);
    transform: rotate(90deg);
}
.modal-close:active { transform: rotate(90deg) scale(0.9); }

.modal-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: calc(var(--radius-lg) - 2px) calc(var(--radius-lg) - 2px) 0 0;
    background: #1a0a3e;
}
.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: modal-zoom 8s ease-in-out infinite alternate;
}
@keyframes modal-zoom {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}
.modal-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 35, 0.85) 100%);
    pointer-events: none;
}
.modal-flash {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--yellow), #ff8b3e);
    color: #1a0a3e;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 1.5px;
    box-shadow: 0 6px 16px rgba(255, 217, 61, 0.5);
    animation: badge-pulse 1.8s ease-in-out infinite;
}

.modal-body { padding: 22px 24px 24px; }
.modal-title {
    font-size: clamp(22px, 5.5vw, 28px);
    font-weight: 900;
    color: var(--ink);
    letter-spacing: 1.5px;
    line-height: 1.3;
    text-align: center;
    margin-bottom: 12px;
}
.modal-accent {
    background: linear-gradient(135deg, var(--yellow), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.modal-sub {
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
}
.modal-sub strong { color: var(--yellow); }
.modal-list {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
}
.modal-list li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--yellow);
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--ink);
    font-weight: 700;
}
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.modal-cta {
    display: block;
    text-align: center;
    padding: 14px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--yellow), #ff8b3e, var(--pink));
    background-size: 200% 200%;
    color: #1a0a3e;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: 1px;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(255, 217, 61, 0.45);
    animation: gradient-shift 4s ease infinite;
    transition: transform 0.15s, box-shadow 0.2s;
}
.modal-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(255, 217, 61, 0.6);
}
.modal-cta:active { transform: scale(0.97); }
.modal-later {
    padding: 10px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
    background: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.modal-later:hover { color: var(--ink); }
.modal-disclaimer {
    text-align: center;
    color: var(--ink-soft);
    font-size: 11px;
    opacity: 0.7;
    line-height: 1.6;
}

/* ---------- footer ---------- */
.footer { margin-top: 50px; padding: 24px 12px; text-align: center; color: var(--ink-soft); font-size: 12px; }
.footer-sub { margin-top: 4px; opacity: 0.75; }

/* ---------- game screen ---------- */
.game-screen {
    position: relative; z-index: 2;
    background:
        radial-gradient(ellipse at top, #2d1b69 0%, transparent 60%),
        linear-gradient(180deg, var(--bg-1) 0%, #050514 100%);
    color: var(--ink);
    min-height: 100vh; min-height: 100dvh;
}
.game-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 35, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: sticky; top: 0; z-index: 10;
}
.back-btn, .fs-btn {
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--ink);
    font-weight: 800;
    font-size: 14px;
    transition: background 0.15s, transform 0.1s;
}
.back-btn { display: flex; align-items: center; gap: 6px; }
.back-btn span { font-size: 18px; }
.fs-btn { font-size: 18px; padding: 10px 14px; }
.back-btn:hover, .fs-btn:hover { background: rgba(255, 255, 255, 0.2); }
.back-btn:active, .fs-btn:active { transform: scale(0.95); }
#gameTitle {
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 2px;
}

.game-stage {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: 22px 16px 30px;
    position: relative;
    overflow-y: auto;
}

/* ---------- shared game UI ---------- */
.status-bar {
    display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
    margin-bottom: 22px; width: 100%; max-width: 600px;
}
.status-pill {
    flex: 1; min-width: 110px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
}
.status-pill .label { font-size: 11px; color: var(--ink-soft); letter-spacing: 1px; }
.status-pill .value { font-size: clamp(20px, 5vw, 26px); font-weight: 900; margin-top: 2px; }
.status-pill.you .value { color: var(--cyan); }
.status-pill.bot .value { color: var(--pink); }

.btn-primary {
    padding: 12px 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff; font-weight: 900; font-size: 16px;
    letter-spacing: 1px;
    box-shadow: 0 8px 24px rgba(124, 92, 255, 0.45);
    transition: transform 0.1s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(124, 92, 255, 0.55); }
.btn-primary:active { transform: scale(0.96); }
.btn-secondary {
    padding: 10px 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink);
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.16); }

.message {
    text-align: center;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin: 10px 0 18px;
    font-weight: 800;
    font-size: clamp(15px, 3.5vw, 18px);
    min-height: 28px;
    transition: background 0.3s;
}
.message.win { background: linear-gradient(135deg, rgba(38, 222, 129, 0.2), rgba(38, 222, 129, 0.05)); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.message.lose { background: linear-gradient(135deg, rgba(255, 90, 95, 0.2), rgba(255, 90, 95, 0.05)); color: var(--red); border: 1px solid rgba(255, 90, 95, 0.3); }
.message.draw { background: linear-gradient(135deg, rgba(255, 217, 61, 0.2), rgba(255, 217, 61, 0.05)); color: var(--yellow); border: 1px solid rgba(255, 217, 61, 0.3); }
.message.info { background: rgba(124, 92, 255, 0.15); color: var(--cyan); border: 1px solid rgba(0, 224, 255, 0.25); }

.controls-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Janken ---------- */
.janken-arena {
    display: grid; grid-template-columns: 1fr 60px 1fr; gap: 14px;
    align-items: center; width: 100%; max-width: 480px;
    margin: 18px 0;
}
.janken-slot {
    aspect-ratio: 1; max-width: 180px;
    margin: 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(60px, 18vw, 90px);
    width: 100%;
}
.janken-slot.shake { animation: shake 0.5s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px) rotate(-3deg); } 75% { transform: translateX(6px) rotate(3deg); } }
.janken-vs { font-size: clamp(20px, 5vw, 30px); font-weight: 900; color: var(--yellow); text-shadow: 0 0 14px rgba(255, 217, 61, 0.6); text-align: center; }
.janken-choices { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.janken-btn {
    width: clamp(72px, 18vw, 100px); aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    font-size: clamp(36px, 9vw, 50px);
    box-shadow: 0 8px 20px rgba(124, 92, 255, 0.45);
    transition: transform 0.1s;
    border: 3px solid rgba(255, 255, 255, 0.15);
}
.janken-btn:hover { transform: scale(1.08) rotate(-6deg); }
.janken-btn:active { transform: scale(0.92); }

/* ---------- Tic Tac Toe ---------- */
.ttt-board {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; width: min(86vw, 360px); aspect-ratio: 1;
    margin: 10px 0;
}
.ttt-cell {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    font-size: clamp(36px, 12vw, 60px);
    font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, transform 0.1s;
    cursor: pointer;
}
.ttt-cell:hover { background: rgba(255, 255, 255, 0.12); }
.ttt-cell:active { transform: scale(0.95); }
.ttt-cell.x { color: var(--cyan); text-shadow: 0 0 14px rgba(0, 224, 255, 0.7); }
.ttt-cell.o { color: var(--pink); text-shadow: 0 0 14px rgba(255, 77, 141, 0.7); }
.ttt-cell.win { background: rgba(255, 217, 61, 0.25); border-color: var(--yellow); animation: pulse 0.6s infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 0 rgba(255, 217, 61, 0.6); } to { box-shadow: 0 0 20px rgba(255, 217, 61, 0.9); } }

/* ---------- Memory ---------- */
.memory-board {
    display: grid;
    gap: 8px;
    width: min(94vw, 480px);
    margin: 10px 0;
}
.memory-board.cols-4 { grid-template-columns: repeat(4, 1fr); }
.memory-card {
    aspect-ratio: 3/4;
    perspective: 600px;
    cursor: pointer;
}
.memory-inner {
    position: relative; width: 100%; height: 100%;
    transition: transform 0.4s;
    transform-style: preserve-3d;
}
.memory-card.flipped .memory-inner { transform: rotateY(180deg); }
.memory-card.matched .memory-inner { transform: rotateY(180deg); }
.memory-card.matched { animation: matched 0.6s; }
@keyframes matched { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.memory-face {
    position: absolute; inset: 0;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(24px, 7vw, 40px);
    font-weight: 900;
}
.memory-front {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border: 2px solid rgba(255, 255, 255, 0.18);
    color: #fff; font-family: 'Yuji Mai', serif;
}
.memory-front::before { content: '照'; font-size: clamp(28px, 8vw, 46px); opacity: 0.9; }
.memory-back {
    background: rgba(255, 255, 255, 0.95);
    transform: rotateY(180deg);
    color: #111;
}

/* ---------- Othello ---------- */
.othello-board {
    display: grid; grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    width: min(94vw, 480px); aspect-ratio: 1;
    background: #14532d;
    padding: 6px;
    border-radius: var(--radius-md);
    border: 3px solid #2a7541;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.4);
}
.othello-cell {
    background: #1e7a3f;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    position: relative;
}
.othello-cell.legal::after {
    content: ''; width: 24%; aspect-ratio: 1; border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    animation: pulse-dot 1.2s infinite;
}
@keyframes pulse-dot { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.3); opacity: 1; } }
.othello-disc {
    width: 84%; aspect-ratio: 1; border-radius: 50%;
    box-shadow: inset -2px -3px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.4);
    animation: drop 0.25s ease;
}
@keyframes drop { from { transform: scale(0); } to { transform: scale(1); } }
.othello-disc.black { background: radial-gradient(circle at 30% 30%, #444, #000); }
.othello-disc.white { background: radial-gradient(circle at 30% 30%, #fff, #c0c0c0); }

/* ---------- Hit & Blow ---------- */
.hitblow-input {
    display: flex; gap: 8px; justify-content: center; margin: 14px 0;
}
.hitblow-input input {
    width: 56px; height: 64px;
    text-align: center;
    font-size: 28px; font-weight: 900;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.hitblow-input input:focus { border-color: var(--cyan); background: rgba(0, 224, 255, 0.1); }
.hitblow-history {
    width: 100%; max-width: 420px;
    max-height: 280px; overflow-y: auto;
    margin-top: 16px;
}
.hitblow-row {
    display: grid; grid-template-columns: 1fr auto auto;
    gap: 10px; align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 6px;
    font-weight: 800;
}
.hitblow-row .guess { letter-spacing: 6px; font-size: 18px; color: var(--ink); }
.hitblow-row .hit { color: var(--green); }
.hitblow-row .blow { color: var(--yellow); }
.hitblow-rules {
    font-size: 12px;
    color: var(--ink-soft);
    text-align: center;
    max-width: 360px;
    line-height: 1.6;
    margin-top: 8px;
}

/* ---------- Snake ---------- */
.snake-wrap {
    width: 100%; max-width: 480px;
    display: flex; flex-direction: column; align-items: center;
}
canvas#snakeCanvas {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    width: min(92vw, 420px);
    aspect-ratio: 1;
    touch-action: none;
    box-shadow: 0 0 24px rgba(38, 222, 129, 0.25);
}
.snake-controls {
    display: grid;
    grid-template-areas: ". up ." "left . right" ". down .";
    gap: 8px;
    margin-top: 18px;
}
.snake-controls button {
    width: 60px; height: 60px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 24px;
    font-weight: 900;
    color: var(--ink);
    transition: background 0.15s, transform 0.1s;
}
.snake-controls button:hover { background: rgba(255, 255, 255, 0.2); }
.snake-controls button:active { transform: scale(0.9); }
.snake-up { grid-area: up; }
.snake-down { grid-area: down; }
.snake-left { grid-area: left; }
.snake-right { grid-area: right; }

/* ---------- toast ---------- */
.toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 8, 50, 0.95);
    color: var(--ink);
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
    max-width: 90vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- mobile tweaks ---------- */
@media (max-width: 420px) {
    .game-header { padding: 10px 12px; }
    .back-btn, .fs-btn { padding: 8px 12px; font-size: 13px; }
    .ttt-board { width: 92vw; }
    .memory-board.cols-4 { gap: 6px; }
}

/* ---------- when in fullscreen mode ---------- */
:fullscreen .game-screen { min-height: 100vh; }
:fullscreen .game-stage { padding-bottom: 40px; }
:-webkit-full-screen .game-screen { min-height: 100vh; }
