* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: background 0.25s ease, color 0.25s ease;
    position: relative;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body::before {
    content: "";
    position: fixed;
    top: -10%;
    left: 50%;
    width: 900px;
    height: 600px;
    transform: translateX(-50%);
    background:
        radial-gradient(closest-side, rgba(255, 203, 61, 0.08), transparent 70%),
        radial-gradient(closest-side at 70% 60%, rgba(125, 211, 252, 0.06), transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: body-glow-drift 18s ease-in-out infinite alternate;
}

@keyframes body-glow-drift {
    from { transform: translateX(-54%) translateY(0); }
    to { transform: translateX(-46%) translateY(30px); }
}

.site-header, main, footer {
    position: relative;
    z-index: 1;
}

h1, h2, h3 { font-family: var(--font-heading); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 2rem;
    background: color-mix(in srgb, var(--color-bg-alt) 90%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .site-header {
    border-bottom: 1px solid rgba(15, 17, 25, 0.08);
}

.site-header .brand {
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), #ff9f4d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: none;
    font-size: 1.3rem;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.site-header nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.15s ease, background 0.15s ease;
}

.site-header nav a:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .site-header nav a:hover {
    background: rgba(15, 17, 25, 0.06);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

#theme-toggle, #guide-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    color: var(--color-text);
}

#theme-toggle:hover, #guide-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

#theme-toggle:hover {
    transform: translateY(-2px) rotate(15deg);
}

#guide-toggle {
    font-weight: 800;
}

main { max-width: 1000px; margin: 0 auto; padding: 3rem 1.5rem; }

.site-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--color-bg) 70%, transparent);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.site-modal--open {
    display: flex;
}

.site-modal-card {
    position: relative;
    background: color-mix(in srgb, var(--color-bg-alt) 92%, transparent);
    backdrop-filter: blur(14px);
    color: var(--color-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.65);
    width: 100%;
    max-width: 32rem;
    max-height: 80vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.site-modal-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    opacity: 0.7;
}

.site-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
}

.site-modal-header h2 {
    margin: 0;
    font-family: var(--font-heading);
}

.site-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color 0.15s ease;
}

.site-modal-close:hover { color: #ff6169; }

.site-modal-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.guide-section h3 {
    color: var(--color-primary);
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.guide-section p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.hero {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3.5rem;
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: clamp(2.4rem, 7vw, 3.6rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), #ff9f4d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-tagline {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.hero-intro {
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: 1.75rem;
}

.hero-cta {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary), #ff9f4d);
    color: #0f1115;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 12px 28px -12px rgba(255, 203, 61, 0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px -14px rgba(255, 203, 61, 0.6);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
}

.feature-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    background: color-mix(in srgb, var(--color-bg-alt) 92%, transparent);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--color-text);
    box-shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.5);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 203, 61, 0.15);
}

.feature-icon {
    font-size: 1.8rem;
}

.feature-card h3 {
    font-size: 1rem;
    color: var(--color-primary);
}

.feature-card p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.favorites-intro {
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 1.5rem;
}

.favorite-card-sprite {
    width: 100%;
    max-width: 140px;
    display: block;
    margin: 0 auto;
    image-rendering: pixelated;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.favorite-card {
    background: var(--color-bg-alt);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.5);
    padding: 1.25rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.favorite-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px -18px rgba(0, 0, 0, 0.55);
}

.video-embed {
    position: relative;
    padding-top: 56.25%;
    margin-top: 0.75rem;
    border-radius: var(--radius);
    overflow: hidden;
}
.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

[data-theme="light"] {
    --color-bg: #f7f7f9;
    --color-bg-alt: #ffffff;
    --color-text: #1a1d24;
    --color-text-muted: #5a5d66;
}

.gen-select {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.diff-btn, .gen-btn {
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.diff-btn:hover, .gen-btn:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.diff-btn.active, .gen-btn.active {
    background: linear-gradient(135deg, var(--color-primary), #ff9f4d);
    border-color: transparent;
    color: #0f1115;
}

.mp-panels {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mp-panel {
    background: var(--color-bg-alt);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    flex: 1;
    min-width: 260px;
}

.mp-panel h2 {
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.mp-panel form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mp-panel input[type="text"] {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--color-bg);
    color: var(--color-text);
}

.mp-panel fieldset {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.mp-panel legend {
    padding: 0 0.4rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mp-panel button[type="submit"] {
    padding: 0.65rem 1rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--color-primary), #ff9f4d);
    color: #0f1115;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.mp-panel button[type="submit"]:hover { transform: translateY(-2px); }

.room-code {
    color: var(--color-primary);
    letter-spacing: 0.2rem;
}

.player-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.player-list li {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    background: var(--color-bg);
    margin-bottom: 0.4rem;
}

.error-text {
    color: #ff6b6b;
    text-align: center;
}

.contact-page {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-intro {
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.contact-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-bg-alt);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--color-text);
    transition: transform 0.12s ease, border-color 0.15s ease;
}

.contact-link:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.contact-link-label {
    font-weight: 700;
    color: var(--color-primary);
}

.contact-link-value {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.contact-footer-note {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.pokeball-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #ee1515 0%, #ee1515 48%, #222 48%, #222 52%, #fff 52%, #fff 100%);
    border: 3px solid #222;
    box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: pokeball-spin 0.9s linear infinite;
}

.pokeball-spinner::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 3px solid #222;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

@keyframes pokeball-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pokeball-spinner--small {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.pokeball-spinner--small::after {
    width: 6px;
    height: 6px;
    border-width: 2px;
}