/* === LogicLab landing page — palette aligned with the app theme === */
:root {
    --teal: #00897B;
    --teal-dark: #00695C;
    --teal-light: #4DB6AC;
    --teal-bg: #E0F2F1;
    --surface: #FAFAF9;
    --surface-elevated: #FFFFFF;
    --ink: #1A1A1A;
    --ink-soft: #5C5C5C;
    --ink-faint: #8A8A8A;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--surface);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === Hero === */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--teal-bg) 0%, #FAFAF9 100%);
    padding: 64px 0 96px;
    text-align: center;
}

.hero-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}

.blob-1 {
    width: 380px;
    height: 380px;
    background: #4DB6AC;
    top: -80px;
    left: -120px;
}

.blob-2 {
    width: 280px;
    height: 280px;
    background: #FFD54F;
    top: 40px;
    right: -80px;
    opacity: 0.35;
}

.blob-3 {
    width: 320px;
    height: 320px;
    background: #CE93D8;
    bottom: -120px;
    left: 30%;
    opacity: 0.25;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.logo {
    width: 140px;
    height: 140px;
    margin: 0 auto 24px;
    display: block;
    filter: drop-shadow(0 8px 16px rgba(0, 137, 123, 0.25));
    animation: gentle-float 6s ease-in-out infinite;
}

@keyframes gentle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 16px;
}

.tagline {
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 12px;
}

.tagline-sub {
    font-size: 1rem;
    color: var(--ink-soft);
    max-width: 540px;
    margin: 0 auto 40px;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--teal);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--teal-dark);
}

.btn-secondary {
    background: var(--surface-elevated);
    color: var(--teal-dark);
    border: 2px solid var(--teal-light);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: var(--teal-bg);
}

/* === Games section === */
.games-section {
    padding: 80px 0;
    background: var(--surface);
}

.games-section h2,
.download-section h2 {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 8px;
}

.section-intro {
    text-align: center;
    color: var(--ink-soft);
    margin-bottom: 48px;
    font-size: 1.05rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.game-card {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.game-card:hover {
    transform: translateY(-4px) rotate(-0.5deg);
    box-shadow: var(--shadow-md);
}

.game-card img {
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.game-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 6px;
}

.game-card p {
    color: rgba(26, 26, 26, 0.75);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* On wide screens, span the last odd card across 2 columns for symmetry */
@media (min-width: 900px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .game-card-wide {
        grid-column: span 1;
    }
}

/* === Daily-duel / friends section ===================================
   A dark "arena" band that breaks the light flow to spotlight the social
   hook: same grid for everyone → race your friends on the clock. The right
   column is a faux friends-leaderboard that animates in on scroll. */

.duel-section {
    position: relative;
    overflow: hidden;
    padding: 92px 0;
    /* Deep teal-ink gradient — distinct from the surrounding light sections. */
    background:
        radial-gradient(120% 80% at 85% -10%, #0A4A43 0%, transparent 55%),
        linear-gradient(155deg, #06302C 0%, #0B3F39 48%, #082B27 100%);
    color: #F2FBF9;
}

/* Soft coloured glows floating behind the content for depth. */
.duel-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
}

.duel-glow-a {
    width: 420px; height: 420px;
    background: #00BFA5;
    opacity: 0.28;
    top: -140px; left: -100px;
}

.duel-glow-b {
    width: 360px; height: 360px;
    background: #FFD54F;
    opacity: 0.14;
    bottom: -150px; right: 8%;
}

.duel-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: center;
}

@media (min-width: 860px) {
    .duel-grid {
        grid-template-columns: 1.05fr 0.95fr;
        gap: 64px;
    }
}

/* --- Left copy --- */
.duel-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px 6px 11px;
    border-radius: 999px;
    background: rgba(0, 191, 165, 0.14);
    border: 1px solid rgba(77, 182, 172, 0.35);
    color: #7FE8D8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.duel-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #2DE0C0;
    box-shadow: 0 0 0 0 rgba(45, 224, 192, 0.7);
    animation: duel-pulse 2.2s ease-out infinite;
}

@keyframes duel-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(45, 224, 192, 0.6); }
    70%  { box-shadow: 0 0 0 9px rgba(45, 224, 192, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 224, 192, 0); }
}

.duel-copy h2 {
    margin: 18px 0 16px;
    font-size: clamp(1.9rem, 4.4vw, 2.7rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: #FFFFFF;
}

.duel-lede {
    max-width: 480px;
    margin: 0 0 24px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(226, 251, 249, 0.78);
}

.duel-lede strong { color: #FFFFFF; font-weight: 700; }

.duel-points {
    list-style: none;
    margin: 0 0 30px;
    padding: 0;
    display: grid;
    gap: 14px;
}

.duel-points li {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 0.98rem;
    color: rgba(226, 251, 249, 0.82);
}

.duel-points strong { color: #FFFFFF; font-weight: 700; }

.duel-point-ic {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 11px;
    background: rgba(0, 191, 165, 0.16);
    border: 1px solid rgba(77, 182, 172, 0.28);
    color: #5FE3CF;
}

.duel-point-ic i { font-size: 20px; }

.btn-duel {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 14px 26px;
    border-radius: var(--radius-sm, 12px);
    background: linear-gradient(135deg, #FFD54F 0%, #FFB300 100%);
    color: #3A2E00;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 10px 26px -8px rgba(255, 179, 0, 0.55);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.btn-duel i { font-size: 20px; }

.btn-duel:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -8px rgba(255, 179, 0, 0.6);
    filter: brightness(1.04);
}

/* --- Right: friends leaderboard mockup --- */
.duel-card {
    position: relative;
    padding: 20px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 30px 60px -24px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@media (min-width: 860px) {
    /* A touch of dynamism: the card leans, straightens on hover. */
    .duel-card {
        transform: rotate(1.4deg);
        transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.5, 1);
    }
    .duel-card:hover { transform: rotate(0deg) translateY(-3px); }
}

.duel-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.duel-card-game {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.duel-card-day {
    display: block;
    margin-top: 1px;
    font-size: 0.76rem;
    color: rgba(226, 251, 249, 0.55);
}

.duel-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 99, 99, 0.16);
    color: #FF8A8A;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.duel-live-pip {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #FF6B6B;
    animation: duel-blink 1.4s steps(2, jump-none) infinite;
}

@keyframes duel-blink { 50% { opacity: 0.25; } }

.duel-board {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.duel-row {
    display: grid;
    grid-template-columns: 26px 38px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    /* Staggered reveal — see scroll trigger / load fallback below. */
    opacity: 0;
    transform: translateY(12px);
}

.duel-board-in .duel-row,
.duel-board-in .duel-card-foot {
    animation: duel-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--row) * 0.09s);
}

@keyframes duel-rise {
    to { opacity: 1; transform: translateY(0); }
}

/* The player's own row — highlighted with the brand teal. */
.duel-row.is-you {
    background: linear-gradient(135deg, rgba(0, 191, 165, 0.22), rgba(0, 191, 165, 0.10));
    border-color: rgba(45, 224, 192, 0.45);
    box-shadow: 0 6px 20px -8px rgba(0, 191, 165, 0.5);
}

.duel-rank {
    font-size: 0.95rem;
    font-weight: 800;
    text-align: center;
    color: rgba(226, 251, 249, 0.5);
}

.duel-rank-1 { color: #FFD54F; }
.duel-rank-2 { color: #D8E2E6; }
.duel-rank-3 { color: #E3A06B; }

.duel-ava {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: #FFFFFF;
    background: var(--ava, #00897B);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.duel-who { min-width: 0; }

.duel-name {
    display: block;
    font-weight: 700;
    font-size: 0.98rem;
    color: #FFFFFF;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.duel-tag {
    display: block;
    font-size: 0.74rem;
    color: rgba(226, 251, 249, 0.5);
}

.is-you .duel-tag { color: #7FE8D8; }

.duel-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.05rem;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.duel-crown i {
    font-size: 17px;
    color: #FFD54F;
    transform: translateY(1px);
}

.duel-card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 13px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    color: rgba(226, 251, 249, 0.72);
    font-weight: 600;
    font-size: 0.92rem;
    opacity: 0;
    transform: translateY(12px);
}

.duel-add {
    display: grid;
    place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(0, 191, 165, 0.2);
    color: #5FE3CF;
}

.duel-add i { font-size: 18px; }

@media (prefers-reduced-motion: reduce) {
    .duel-dot,
    .duel-live-pip,
    .duel-card { animation: none; transition: none; }
    .duel-row,
    .duel-card-foot { opacity: 1; transform: none; animation: none; }
}

/* === Download / QR section === */
.download-section {
    padding: 80px 0;
    background: linear-gradient(180deg, var(--teal-bg) 0%, var(--surface) 100%);
}

.download-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

@media (min-width: 720px) {
    .download-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

.download-text h2 {
    text-align: left;
    margin-bottom: 16px;
}

.download-text p {
    color: var(--ink-soft);
    margin-bottom: 24px;
    font-size: 1.05rem;
}

.btn-playstore {
    display: inline-flex;
    background: #000;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s ease;
    cursor: pointer;
}

.btn-playstore:hover {
    transform: translateY(-2px);
}

.badge-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-playstore svg {
    flex-shrink: 0;
}

.badge-line-1 {
    display: block;
    font-size: 0.7rem;
    opacity: 0.85;
    letter-spacing: 0.5px;
}

.badge-line-2 {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: -2px;
}

/* === QR code === */
.qr-card {
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--teal-light);
    max-width: 280px;
    margin: 0 auto;
}

.qr-link {
    display: block;
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    background: white;
    border-radius: var(--radius-sm);
    padding: 12px;
    box-sizing: border-box;
    transition: transform 0.15s ease;
}

.qr-link:hover,
.qr-link:focus-visible {
    transform: scale(1.03);
}

.qr-image {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated; /* keep the QR crisp at any zoom */
}

.qr-caption {
    color: var(--ink);
    font-weight: 700;
    margin-bottom: 4px;
}

.qr-caption-sub {
    color: var(--ink-faint);
    font-size: 0.85rem;
}

/* === Features section === */
.features-section {
    padding: 80px 0;
    background: var(--surface);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.feature {
    text-align: center;
    padding: 24px;
}

.feature-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.feature h3 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.feature p {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

/* === Footer === */
.site-footer {
    background: var(--ink);
    color: rgba(255, 255, 255, 0.85);
    padding: 48px 0 32px;
    margin-top: 64px;
}

.footer-grid {
    display: grid;
    gap: 32px;
    grid-template-columns: 1fr;
}

@media (min-width: 720px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr 1fr;
        align-items: center;
    }
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    width: 48px;
    height: 48px;
}

.footer-name {
    font-weight: 800;
    font-size: 1.1rem;
    color: white;
}

.footer-tagline {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

@media (min-width: 720px) {
    .footer-nav {
        text-align: center;
    }
}

.footer-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.15s ease;
}

.footer-nav a:hover {
    color: var(--teal-light);
}

.footer-copyright {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: left;
}

@media (min-width: 720px) {
    .footer-copyright {
        text-align: right;
    }
}

/* === Beta signup form === */
.beta-signup {
    margin-top: 28px;
    padding: 20px 22px;
    background: var(--surface-elevated, #ffffff);
    border-radius: var(--radius-md, 16px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
    max-width: 460px;
}

.beta-signup h3 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    color: var(--ink, #1A1A1A);
}

.beta-signup-intro {
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: var(--ink-soft, #555);
}

.beta-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.beta-form input[type="email"] {
    flex: 1 1 220px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.beta-form input[type="email"]:focus {
    outline: 2px solid var(--teal, #00897B);
    outline-offset: 1px;
    border-color: var(--teal, #00897B);
}

.beta-form button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--teal, #00897B);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.beta-form button:hover:not(:disabled) {
    background: var(--teal-dark, #00695C);
}

.beta-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.beta-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--ink-soft, #555);
    line-height: 1.4;
}

.beta-consent input {
    margin-top: 3px;
    flex-shrink: 0;
}

.beta-consent a {
    color: var(--teal, #00897B);
    text-decoration: underline;
}

.beta-status {
    margin: 10px 0 0;
    font-size: 0.88rem;
    min-height: 1.2em;
}

.beta-status[data-kind="ok"] { color: #1B7A6A; }
.beta-status[data-kind="error"] { color: #C53030; }
.beta-status[data-kind="pending"] { color: var(--ink-soft, #555); }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    border: 0;
}

/* Honeypot — off-screen so accessibility tools ignore it visually but it's
   still in the DOM where naive bots find and fill it. */
.beta-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.beta-signup-note {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--teal-bg, #E0F2F1);
    border-left: 3px solid var(--teal, #00897B);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--ink, #1A1A1A);
    line-height: 1.45;
}

.beta-signup-note strong {
    color: var(--teal-dark, #00695C);
}

/* === Platform selector (Android / iOS) ==============================
   Two tactile, brand-tinted choice cards side by side. The active card lifts
   off the surface with a coloured glow, a tinted glyph chip, and a check
   badge; the inactive one stays calm and recessed. Selection is driven by the
   .is-selected class on each card + [data-active] on the wrapper. Each card
   carries its own brand accent via a per-card --accent custom property. */

.platform-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0 0 18px;
}

.platform-card {
    --accent: var(--teal, #00897B);
    --accent-soft: rgba(0, 137, 123, 0.10);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    /* Clear the top-right check badge so the text never tucks under it. */
    padding-right: 18px;
    text-align: left;
    background: var(--surface-elevated, #FFFFFF);
    border: 1.5px solid rgba(0, 0, 0, 0.07);
    border-radius: 18px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition:
        transform 0.34s cubic-bezier(0.34, 1.3, 0.5, 1),
        border-color 0.28s ease,
        box-shadow 0.34s ease,
        background 0.28s ease;
}

/* Per-card brand accents. Android = its signature green; iOS = graphite ink. */
.platform-card[data-platform="android"] {
    --accent: #689F38;
    --accent-soft: rgba(149, 207, 0, 0.14);
}

.platform-card[data-platform="ios"] {
    --accent: #1A1A1A;
    --accent-soft: rgba(26, 26, 26, 0.07);
}

/* A whisper-soft accent wash that fades in on the active card. */
.platform-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 140% at 18% 0%, var(--accent-soft), transparent 60%);
    opacity: 0;
    transition: opacity 0.32s ease;
    pointer-events: none;
}

.platform-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.08));
}

.platform-card:active {
    transform: translateY(0) scale(0.985);
    transition-duration: 0.12s;
}

.platform-card.is-selected {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow:
        0 10px 26px -10px color-mix(in srgb, var(--accent) 60%, transparent),
        0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent) inset;
    transform: translateY(-3px);
}

.platform-card.is-selected::before { opacity: 1; }

.platform-card:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Rounded chip that frames the brand glyph. */
.platform-card-glyph {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(160deg, #F4F4F2 0%, #ECECEA 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    transition:
        background 0.3s ease,
        transform 0.34s cubic-bezier(0.34, 1.4, 0.64, 1),
        box-shadow 0.3s ease;
}

.platform-card.is-selected .platform-card-glyph {
    background:
        linear-gradient(160deg,
            color-mix(in srgb, var(--accent) 16%, #FFFFFF) 0%,
            color-mix(in srgb, var(--accent) 7%, #FFFFFF) 100%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
    transform: scale(1.04);
}

/* The brand marks themselves. */
.platform-glyph {
    transition:
        opacity 0.28s ease,
        color 0.28s ease,
        transform 0.34s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Optical balancing: the Android robot fills less of its viewBox, the Apple
   mark fills more — nudge sizes so they look identical at a glance. */
.platform-glyph-android { width: 26px; height: 26px; opacity: 0.5; }
.platform-glyph-apple   { width: 21px; height: 21px; color: var(--ink-faint, #8A8A8A); }

.platform-card.is-selected .platform-glyph-android { opacity: 1; }
.platform-card.is-selected .platform-glyph-apple   { color: var(--ink, #1A1A1A); }

/* Text stack: a quiet eyebrow over the platform name. */
.platform-card-text {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.platform-card-eyebrow {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--ink-faint, #8A8A8A);
    transition: color 0.28s ease;
}

.platform-card-name {
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink-soft, #5C5C5C);
    transition: color 0.28s ease;
}

.platform-card.is-selected .platform-card-eyebrow {
    color: color-mix(in srgb, var(--accent) 75%, var(--ink-soft));
}

.platform-card.is-selected .platform-card-name {
    color: var(--ink, #1A1A1A);
}

/* Check badge: tucked top-right, springs in only on the active card. */
.platform-check {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #FFFFFF;
    background: var(--accent);
    box-shadow: 0 2px 6px -1px color-mix(in srgb, var(--accent) 60%, transparent);
    opacity: 0;
    transform: scale(0.4) rotate(-12deg);
    transition: transform 0.36s cubic-bezier(0.34, 1.7, 0.5, 1), opacity 0.22s ease;
}

.platform-check svg { width: 13px; height: 13px; }

.platform-card.is-selected .platform-check {
    opacity: 1;
    transform: scale(1) rotate(0);
}

@media (prefers-reduced-motion: reduce) {
    .platform-card,
    .platform-card-glyph,
    .platform-glyph,
    .platform-check { transition: none; }
}

/* === Flip card (BinaryLab tile preview) ============================== */

/* The flippable card sits on top of the existing .game-card visuals.
   The .flip-inner is the rotating container; the two .flip-face's stack
   on top of each other via absolute positioning. Backface visibility is
   hidden so the back doesn't bleed through during the transition. */
.game-card-flip {
    perspective: 1200px;
    /* Override the default game-card padding — content lives inside .flip-face. */
    padding: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    min-height: 240px;
    position: relative;
}

/* Cancel the inherited hover lift so the flip is the only motion. */
.game-card-flip:hover {
    transform: none;
    box-shadow: none;
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Flip on hover (desktop) AND when .is-flipped is added by JS (touch). */
.game-card-flip:hover .flip-inner,
.game-card-flip:focus-within .flip-inner,
.game-card-flip.is-flipped .flip-inner {
    transform: rotateY(-180deg);
}

.flip-face {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.flip-front {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.flip-front img {
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.flip-front h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 6px;
}

.flip-front p {
    color: rgba(26, 26, 26, 0.75);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

/* Back face — rotated so it shows when the inner flips. */
.flip-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #FFB74D, #FF9800);
    color: white;
    gap: 14px;
}


/* === Mini-board (BinaryLab 6x6 preview on the flipped face) ============
   Visual mirrors lib/features/game/presentation/widgets/tango_grid.dart 1:1:
   - paper #FFFFFF background
   - frame #2A2A2A (1.6px) with 10px radius
   - hairlines #B8B0A0 at 0.8px between cells
   - fixed-cell tint #F1ECE0 (matches TangoCellWidget.fixed bg)
   - sun color #FFB74D, moon color #5C6BC0 (TangoColors)
   - Material Icons Round glyphs at ~62% of the cell side
============================================================ */

.mini-board {
    --board-size: 198px;
    --frame-color: #2A2A2A;
    --hairline-color: #B8B0A0;
    width: var(--board-size);
    height: var(--board-size);
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    background: #FFFFFF;
    border: 1.6px solid var(--frame-color);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    position: relative;
}

.mini-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
}

.mini-cell {
    aspect-ratio: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    box-shadow:
        inset -0.8px 0 0 0 var(--hairline-color),
        inset 0 -0.8px 0 0 var(--hairline-color);
    opacity: 0;
    transform: scale(0.4);
    animation: miniReveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(0.35s + var(--i) * 0.022s);
    animation-play-state: paused;
}

/* Drop the outer hairline on the right column / bottom row — the frame
   already provides those edges. */
.mini-row .mini-cell:last-child { box-shadow: inset 0 -0.8px 0 0 var(--hairline-color); }
.mini-row:last-child .mini-cell { box-shadow: inset -0.8px 0 0 0 var(--hairline-color); }
.mini-row:last-child .mini-cell:last-child { box-shadow: none; }

.mini-cell.fixed { background: #F1ECE0; }

.mini-cell .material-icons-round {
    font-size: calc((var(--board-size) - 4px) / 6 * 0.62);
    line-height: 1;
    animation: glyphPulse 2.6s ease-in-out infinite;
    animation-play-state: paused;
}
.mini-cell.sun  .material-icons-round { color: #FFB74D; }
.mini-cell.moon .material-icons-round { color: #5C6BC0; animation-delay: 1.3s; }

/* === Constraint glyphs (= / ×) on the rules between cells ============
   --r, --c are 1..5 (rule index). .v sits on a vertical rule, .h on a
   horizontal rule. The white background "erases" the hairline below the
   glyph just like _GridBackgroundPainter does with its gap.
============================================================ */
.mini-constraint {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: constraintReveal 0.35s ease-out forwards;
    animation-delay: 1.2s;
    animation-play-state: paused;
    z-index: 2;
}
.mini-constraint.v {
    left: calc(var(--c) * (100% / 6));
    top:  calc((var(--r) - 0.5) * (100% / 6));
}
.mini-constraint.h {
    left: calc((var(--c) - 0.5) * (100% / 6));
    top:  calc(var(--r) * (100% / 6));
}
/* "=" — two short horizontal bars */
.mini-constraint.eq::before,
.mini-constraint.eq::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 1.6px;
    background: #2A2A2A;
    border-radius: 1px;
}
.mini-constraint.eq::before { transform: translateY(-2.5px); }
.mini-constraint.eq::after  { transform: translateY(2.5px); }
/* "×" — two diagonal bars */
.mini-constraint.neq::before,
.mini-constraint.neq::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 1.6px;
    background: #2A2A2A;
    border-radius: 1px;
}
.mini-constraint.neq::before { transform: rotate(45deg); }
.mini-constraint.neq::after  { transform: rotate(-45deg); }

/* Kick everything off once the back face is visible. */
.game-card-flip:hover .mini-cell,
.game-card-flip:focus-within .mini-cell,
.game-card-flip.is-flipped .mini-cell,
.game-card-flip:hover .mini-cell .material-icons-round,
.game-card-flip:focus-within .mini-cell .material-icons-round,
.game-card-flip.is-flipped .mini-cell .material-icons-round,
.game-card-flip:hover .mini-constraint,
.game-card-flip:focus-within .mini-constraint,
.game-card-flip.is-flipped .mini-constraint {
    animation-play-state: running;
}

@keyframes miniReveal {
    0%   { transform: scale(0.4) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.08) rotate(4deg);  opacity: 1; }
    100% { transform: scale(1)    rotate(0);     opacity: 1; }
}

@keyframes constraintReveal {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes glyphPulse {
    0%, 100% { transform: scale(1);    filter: none; }
    50%      { transform: scale(1.08); filter: drop-shadow(0 0 3px currentColor); }
}

/* Accessibility: respect reduced-motion users. */
@media (prefers-reduced-motion: reduce) {
    .flip-inner,
    .mini-cell,
    .mini-cell::after {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    .game-card-flip:hover .flip-inner,
    .game-card-flip.is-flipped .flip-inner {
        transform: rotateY(-180deg) !important;
    }
}
