/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
    --ink:       #24192f;
    --paper:     #fffdf7;
    --paper-2:   #f4fbff;
    --text:      #24192f;
    --muted:     rgba(36,25,47,0.66);
    --dark-muted: rgba(36,25,47,0.62);
    --border:    rgba(36,25,47,0.14);
    --line:      rgba(36,25,47,0.12);
    --pink:      #f94f86;
    --cyan:      #19bed4;
    --yellow:    #ffd45f;
    --green:     #45d491;
    --violet:    #8e75ff;
    --blue:      #406cff;
    --radius:    8px;
    --gap:       16px;
    --max-w:     1120px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        linear-gradient(90deg, rgba(36,25,47,0.052) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(0deg, rgba(36,25,47,0.042) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(135deg, rgba(255,212,95,0.4) 0 12%, transparent 12% 100%),
        linear-gradient(162deg, transparent 0 76%, rgba(25,190,212,0.24) 76% 100%),
        linear-gradient(180deg, #fffdf7 0%, #f4fbff 54%, #fff4fa 100%);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(255,253,247,0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 10px 30px rgba(36,25,47,0.07);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0;
    color: var(--ink);
    text-shadow: 3px 3px 0 rgba(255,212,95,0.72);
}

.header-auth {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.header-name {
    color: var(--muted);
    font-weight: 500;
}

.btn-signin {
    display: inline-block;
    padding: 6px 16px;
    background: var(--yellow);
    color: var(--ink);
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    border: 1px solid rgba(36,25,47,0.16);
    box-shadow: 0 4px 0 rgba(36,25,47,0.14);
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-signin:hover { transform: translateY(-1px); box-shadow: 0 5px 0 rgba(36,25,47,0.14); }

.btn-signout {
    padding: 5px 14px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--ink);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.btn-signout:hover { border-color: rgba(36,25,47,0.34); color: var(--ink); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
    padding: 76px 0 42px;
    position: relative;
}

.hero .container {
    position: relative;
}

.hero .container::before,
.hero .container::after {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: -1;
}

.hero .container::before {
    width: min(44vw, 440px);
    height: 18px;
    right: 24px;
    top: 18px;
    background: repeating-linear-gradient(90deg, var(--cyan) 0 22px, transparent 22px 34px);
    transform: rotate(-3deg);
    opacity: 0.72;
}

.hero .container::after {
    width: 112px;
    height: 112px;
    right: 11%;
    bottom: 16px;
    background:
        linear-gradient(45deg, rgba(255,255,255,0.32) 25%, transparent 25%) 0 0 / 18px 18px,
        var(--pink);
    border: 2px solid rgba(36,25,47,0.18);
    border-radius: var(--radius);
    transform: rotate(10deg);
    box-shadow: 10px 10px 0 rgba(36,25,47,0.13);
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid rgba(36,25,47,0.15);
    border-radius: 999px;
    background: rgba(255,255,255,0.72);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 4px 18px rgba(36,25,47,0.06);
}

.hero-wordmark {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0;
    line-height: 0.86;
    color: var(--ink);
    margin-bottom: 24px;
    text-shadow:
        5px 5px 0 var(--pink),
        10px 10px 0 rgba(25,190,212,0.58),
        15px 15px 0 rgba(36,25,47,0.11);
}

.hero-dot { color: var(--blue); }

.hero-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-top: 2px dashed rgba(36,25,47,0.18);
    padding-top: 18px;
}

.hero-tagline {
    max-width: 560px;
    font-size: clamp(1rem, 2vw, 1.32rem);
    color: var(--muted);
    font-weight: 700;
}

.hero-count {
    font-family: 'Syne', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--green);
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(36,25,47,0.14);
    box-shadow: 0 4px 0 rgba(36,25,47,0.14);
    white-space: nowrap;
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */
.games-section { padding: 18px 0 96px; }

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 280px;
    gap: var(--gap);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.68), rgba(255,255,255,0.16) 44%, rgba(36,25,47,0.08)),
        var(--card-color, #1a1a1a);
    border-radius: var(--radius);
    padding: 26px;
    color: var(--ink);
    overflow: hidden;
    border: 2px solid rgba(36,25,47,0.16);
    box-shadow:
        0 8px 0 rgba(36,25,47,0.14),
        0 18px 38px rgba(36,25,47,0.13);
    transition:
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.28s ease,
        filter 0.28s ease;
    animation: fadeUp 0.5s ease both;
    animation-delay: calc(var(--i, 0) * 65ms);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Gloss overlay */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.52) 0 12%, transparent 12% 100%),
        linear-gradient(140deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.08) 46%, transparent 72%);
    pointer-events: none;
    z-index: 1;
}

/* Vignette at bottom */
.card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50%;
    border-radius: 0 0 var(--radius) var(--radius);
    background:
        repeating-linear-gradient(-45deg, rgba(36,25,47,0.07) 0 2px, transparent 2px 12px),
        linear-gradient(to top, rgba(36,25,47,0.12), transparent);
    pointer-events: none;
    z-index: 1;
}

.card:hover {
    transform: translateY(-8px) rotate(-0.6deg) scale(1.012);
    box-shadow:
        0 12px 0 rgba(36,25,47,0.16),
        0 30px 56px rgba(36,25,47,0.22);
    filter: saturate(1.08);
}

.card-shine {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 78px;
    height: 78px;
    border-radius: var(--radius);
    border: 2px solid rgba(255,253,247,0.42);
    transform: rotate(12deg);
    background:
        linear-gradient(90deg, rgba(255,255,255,0.34) 2px, transparent 2px) 0 0 / 14px 14px,
        linear-gradient(0deg, rgba(255,255,255,0.24) 2px, transparent 2px) 0 0 / 14px 14px;
    opacity: 0.64;
    z-index: 1;
}

/* ── Card inner layout ────────────────────────────────────────────────────── */
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
}

.card-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    background: rgba(255,253,247,0.58);
    border: 1px solid rgba(255,253,247,0.6);
    font-size: 2.55rem;
    line-height: 1;
    filter: drop-shadow(0 3px 8px rgba(36,25,47,0.16));
    box-shadow: inset 0 -6px 0 rgba(36,25,47,0.08);
}

.card-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: rgba(255,253,247,0.48);
    border: 1px solid rgba(255,253,247,0.6);
    color: rgba(36,25,47,0.7);
}

.card-content {
    position: relative;
    z-index: 2;
    flex: 1;
    margin-top: 18px;
}

.card h2 {
    font-family: 'Syne', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
    margin-bottom: 6px;
    color: rgba(36,25,47,0.92);
}

.card p {
    max-width: 34rem;
    font-size: 0.92rem;
    color: rgba(36,25,47,0.66);
    line-height: 1.45;
    font-weight: 600;
}

.card-footer {
    position: relative;
    z-index: 2;
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.card-cta {
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(255,253,247,0.46);
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(36,25,47,0.62);
    letter-spacing: 0.02em;
    transition: color 0.15s, transform 0.15s;
    display: inline-block;
}

.card:hover .card-cta {
    color: rgba(36,25,47,0.88);
    transform: translateX(4px);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    font-size: 0.82rem;
    background: rgba(255,253,247,0.66);
    color: var(--muted);
}

.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-sep { opacity: 0.3; }

.site-footer a { color: var(--muted); transition: color 0.15s; }
.site-footer a:hover { color: var(--ink); }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 430px;
    padding: 34px;
    overflow: hidden;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,253,247,0.98)),
        var(--paper);
    border: 2px solid rgba(36,25,47,0.14);
    border-radius: var(--radius);
    box-shadow:
        0 10px 0 rgba(36,25,47,0.12),
        0 28px 60px rgba(36,25,47,0.14);
}

.login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 90% 8%, rgba(255,77,141,0.22) 0 58px, transparent 60px),
        linear-gradient(90deg, rgba(23,20,31,0.05) 1px, transparent 1px) 0 0 / 22px 22px,
        linear-gradient(0deg, rgba(23,20,31,0.04) 1px, transparent 1px) 0 0 / 22px 22px;
    pointer-events: none;
}

.login-card > * {
    position: relative;
    z-index: 1;
}

.login-logo {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
    font-family: 'Syne', 'DM Sans', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    text-decoration: none;
}

.login-sub {
    color: var(--dark-muted);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 28px;
}

.tab-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 24px;
    padding: 5px;
    background: rgba(23,20,31,0.07);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.tab-btn {
    min-width: 0;
    padding: 10px 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--dark-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab-btn.active {
    color: var(--ink);
    background: var(--yellow);
    box-shadow: 0 3px 0 rgba(36,25,47,0.12);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 800;
}

input[type=email],
input[type=password],
input[type=text] {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    border: 2px solid rgba(23,20,31,0.16);
    border-radius: 13px;
    outline: none;
    background: rgba(255,255,255,0.72);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input:focus {
    border-color: var(--pink);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255,77,141,0.15);
}

.field { margin-bottom: 16px; }

.btn-primary {
    width: 100%;
    margin-top: 4px;
    padding: 14px;
    border: none;
    border-radius: 13px;
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 5px 0 rgba(36,25,47,0.16);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 0 rgba(36,25,47,0.16);
    background: #2a2438;
}

.msg {
    padding: 12px 14px;
    border-radius: 13px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.msg.error {
    background: #ffe1e8;
    color: #971037;
    border: 1px solid rgba(151,16,55,0.14);
}

.msg.success {
    background: #dff9e8;
    color: #106136;
    border: 1px solid rgba(16,97,54,0.12);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
}

.login-footer a {
    color: var(--dark-muted);
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
}

.login-footer a:hover { color: var(--ink); }

.setup-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    background: var(--green);
    font-size: 2.25rem;
    box-shadow: 0 6px 0 rgba(36,25,47,0.12);
}

/* ── Utility Pages ────────────────────────────────────────────────────────── */
.utility-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.utility-card {
    width: min(100%, 460px);
    padding: 30px;
    background: rgba(255,253,247,0.92);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 0 rgba(36,25,47,0.12), 0 28px 60px rgba(36,25,47,0.14);
}

.utility-card h1 {
    margin: 8px 0 8px;
    font-family: 'Syne', 'DM Sans', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0;
}

.utility-card p {
    color: var(--muted);
    font-weight: 700;
}

.utility-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 224px;
    }

    .hero .container::after {
        width: 82px;
        height: 82px;
        right: 24px;
        bottom: 36px;
        opacity: 0.58;
    }
}

@media (max-width: 520px) {
    .container { padding: 0 16px; }
    .site-header .container { height: 60px; }
    .header-name { display: none; }
    .hero { padding: 42px 0 24px; }
    .hero .container::before,
    .hero .container::after { display: none; }
    .hero-kicker {
        max-width: 100%;
        white-space: normal;
        line-height: 1.35;
    }
    .hero-wordmark {
        font-size: clamp(2.35rem, 9vw, 2.95rem);
        margin-bottom: 22px;
        text-shadow:
            3px 3px 0 var(--pink),
            6px 6px 0 rgba(38,214,233,0.7),
            9px 9px 0 rgba(36,25,47,0.11);
    }
    .hero-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .games-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 10px;
    }
    .card,
    .card:nth-child(n) {
        min-height: 190px;
        padding: 22px;
        box-shadow:
            0 7px 0 rgba(36,25,47,0.14),
            0 16px 34px rgba(36,25,47,0.14);
    }
    .card-icon {
        width: 56px;
        height: 56px;
        font-size: 2.25rem;
    }
    .card h2 { font-size: 1.3rem; }
    .card-shine {
        width: 58px;
        height: 58px;
    }
    .login-page { padding: 16px; }
    .login-card {
        width: 100%;
        max-width: 366px;
        padding: 26px 20px;
        border-radius: 20px;
    }
}
