/* ============================================================
   BBATTL.com - Board Game Neomorphic Design
   Colors from DESIGN.md:
     Primary bg:      #F5E6D0
     Neumorphic light: #FFF3E4
     Neumorphic shadow: #D4C4AE
     Deep shadow:     #B8A48C
     Text primary:    #4A3728
     Text secondary:  #7D6B5D
     Accent warm:     #C4723A
     Accent gold:     #D4A853
     Card face:       #FAF0E3
     Danger/alert:    #A0522D
   Fonts: Lilita One, Nunito, Permanent Marker, Share Tech Mono
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    color: #4A3728;
    background-color: #F5E6D0;
    overflow-x: hidden;
    /* subtle linen texture via repeating gradient */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(180, 164, 140, 0.03) 2px,
            rgba(180, 164, 140, 0.03) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(180, 164, 140, 0.03) 2px,
            rgba(180, 164, 140, 0.03) 4px
        );
}

h1, h2, h3 {
    font-family: 'Lilita One', cursive;
    color: #4A3728;
    line-height: 1.2;
}

/* === Score Strip === */
#score-strip {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #F5E6D0;
    box-shadow: 0 4px 12px rgba(74, 55, 40, 0.15);
    border-bottom: 2px solid #D4C4AE;
}

.score-strip-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 10px 20px;
    max-width: 700px;
    margin: 0 auto;
}

.score-label {
    font-family: 'Permanent Marker', cursive;
    font-size: 0.75rem;
    color: #7D6B5D;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.score-counter {
    display: flex;
    gap: 4px;
}

.digit-box {
    width: 32px;
    height: 40px;
    background: #FAF0E3;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 2px 2px 4px #D4C4AE, inset -2px -2px 4px #FFF3E4;
    position: relative;
    overflow: hidden;
}

.digit-current {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.25rem;
    color: #4A3728;
    display: block;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.digit-box.flipping .digit-current {
    transform: rotateX(90deg);
    opacity: 0;
}

.digit-box.flipping .digit-next {
    transform: rotateX(0deg);
    opacity: 1;
}

.digit-next {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.25rem;
    color: #4A3728;
    position: absolute;
    transform: rotateX(-90deg);
    opacity: 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.score-divider {
    font-size: 1.2rem;
    color: #D4A853;
    padding: 0 4px;
}

/* === Hero Zone === */
.hero-zone {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px 24px 40px;
    overflow: hidden;
    /* felt surface feel */
    background: #F5E6D0;
}

.felt-texture {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(212, 168, 83, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(196, 114, 58, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.stitched-border {
    position: absolute;
    inset: 16px;
    border: 2px dashed #D4C4AE;
    border-radius: 24px;
    pointer-events: none;
    opacity: 0.6;
}

.game-path-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.5;
}

.game-path {
    stroke-dashoffset: 0;
    animation: pathDash 20s linear infinite;
}

@keyframes pathDash {
    to {
        stroke-dashoffset: -200;
    }
}

/* === Hero Card === */
.hero-card {
    position: relative;
    background: #FAF0E3;
    border-radius: 20px;
    padding: 3rem 2.5rem;
    max-width: 560px;
    width: 100%;
    text-align: center;
    box-shadow: 10px 10px 20px #D4C4AE, -10px -10px 20px #FFF3E4;
    z-index: 1;
}

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

.hero-card h1 {
    font-size: 4rem;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    color: #4A3728;
}

.hero-tagline {
    font-family: 'Permanent Marker', cursive;
    font-size: 1.3rem;
    color: #C4723A;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: 1rem;
    color: #7D6B5D;
    margin-bottom: 1.5rem;
}

/* === Card Corner Decorations === */
.card-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.card-corner-tl {
    top: 12px;
    left: 12px;
    border-top: 2px solid #D4A853;
    border-left: 2px solid #D4A853;
    border-top-left-radius: 4px;
}

.card-corner-tr {
    top: 12px;
    right: 12px;
    border-top: 2px solid #D4A853;
    border-right: 2px solid #D4A853;
    border-top-right-radius: 4px;
}

.card-corner-bl {
    bottom: 12px;
    left: 12px;
    border-bottom: 2px solid #D4A853;
    border-left: 2px solid #D4A853;
    border-bottom-left-radius: 4px;
}

.card-corner-br {
    bottom: 12px;
    right: 12px;
    border-bottom: 2px solid #D4A853;
    border-right: 2px solid #D4A853;
    border-bottom-right-radius: 4px;
}

/* === Suit Divider === */
.suit-divider {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 1.3rem;
    color: #D4A853;
    opacity: 0.7;
}

/* === Scroll Hint === */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
    animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid #C4723A;
    border-bottom: 2px solid #C4723A;
    transform: rotate(45deg);
    opacity: 0.7;
}

.scroll-text {
    font-family: 'Permanent Marker', cursive;
    font-size: 0.85rem;
    color: #7D6B5D;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* === Section Dividers === */
.section-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 24px 0;
}

.suit-emboss {
    font-size: 1.5rem;
    color: #D4C4AE;
    text-shadow: 1px 1px 2px #FFF3E4, -1px -1px 2px #B8A48C;
    opacity: 0.5;
}

/* === Card Grid Zone === */
.card-grid-zone {
    padding: 40px 24px 60px;
    max-width: 1100px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 40px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #D4A853;
    margin: 12px auto 0;
    border-radius: 2px;
}

/* === Card Grid === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

/* === Flip Card === */
.flip-card {
    perspective: 1000px;
    height: 360px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px) rotate(2deg);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.flip-card.card-visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Slight alternating rotation */
.flip-card:nth-child(even) {
    transform: translateY(30px) rotate(-1.5deg);
}

.flip-card:nth-child(even).card-visible {
    transform: translateY(0) rotate(-0.5deg);
}

.flip-card:nth-child(odd).card-visible {
    transform: translateY(0) rotate(0.5deg);
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s ease-in-out;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

/* Scale pulse on flip */
.flip-card.flipping .flip-card-inner {
    animation: cardPulse 0.5s ease-in-out;
}

@keyframes cardPulse {
    0% { transform: scale(1) rotateY(0deg); }
    50% { transform: scale(1.03) rotateY(90deg); }
    100% { transform: scale(1) rotateY(180deg); }
}

@keyframes cardPulseReverse {
    0% { transform: scale(1) rotateY(180deg); }
    50% { transform: scale(1.03) rotateY(90deg); }
    100% { transform: scale(1) rotateY(0deg); }
}

.flip-card.flipping.unflipping .flip-card-inner {
    animation: cardPulseReverse 0.5s ease-in-out;
}

/* Card Front */
.flip-card-front {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    background: #FAF0E3;
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 8px 8px 16px #D4C4AE, -8px -8px 16px #FFF3E4;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.flip-card:hover .flip-card-front {
    box-shadow: 10px 10px 20px #D4C4AE, -10px -10px 20px #FFF3E4;
    transform: translateY(-2px);
}

.flip-card-front h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #4A3728;
}

.flip-card-front p {
    font-size: 0.95rem;
    color: #7D6B5D;
    flex: 1;
}

.card-tag {
    font-family: 'Permanent Marker', cursive;
    font-size: 0.8rem;
    color: #C4723A;
    background: #F5E6D0;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: auto;
    box-shadow: inset 2px 2px 4px #D4C4AE, inset -2px -2px 4px #FFF3E4;
}

/* Card Back */
.flip-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 8px 8px 16px #D4C4AE, -8px -8px 16px #FFF3E4;
}

.card-back-pattern {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            #4A3728 0px,
            #4A3728 10px,
            transparent 10px,
            transparent 11px
        ),
        repeating-linear-gradient(
            -45deg,
            #4A3728 0px,
            #4A3728 10px,
            transparent 10px,
            transparent 11px
        );
    background-color: #4A3728;
    opacity: 1;
}

.card-back-pattern::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 14px,
            rgba(196, 114, 58, 0.15) 14px,
            rgba(196, 114, 58, 0.15) 15px,
            transparent 15px,
            transparent 29px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 14px,
            rgba(212, 168, 83, 0.15) 14px,
            rgba(212, 168, 83, 0.15) 15px,
            transparent 15px,
            transparent 29px
        );
}

.card-back-content {
    position: relative;
    z-index: 1;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 2px solid #D4A853;
    border-radius: 16px;
    margin: 8px;
    background: rgba(74, 55, 40, 0.85);
}

.card-back-content h3 {
    font-family: 'Permanent Marker', cursive;
    color: #D4A853;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.card-back-content p {
    color: #FAF0E3;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-stat {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #D4A853;
    display: inline-block;
    margin-right: 12px;
    padding: 2px 8px;
    border: 1px solid rgba(212, 168, 83, 0.4);
    border-radius: 4px;
}

/* === Dice Icons === */
.dice-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.hero-dice {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.2rem;
}

.dice-face {
    width: 100%;
    height: 100%;
    background: #FAF0E3;
    border-radius: 10px;
    box-shadow: 4px 4px 8px #D4C4AE, -4px -4px 8px #FFF3E4;
    position: relative;
}

.hero-dice .dice-face {
    box-shadow: 6px 6px 12px #D4C4AE, -6px -6px 12px #FFF3E4;
}

.pip {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #4A3728;
    border-radius: 50%;
}

.hero-dice .pip {
    width: 10px;
    height: 10px;
}

.pip-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pip-tl {
    top: 20%;
    left: 20%;
}

.pip-tr {
    top: 20%;
    right: 20%;
}

.pip-bl {
    bottom: 20%;
    left: 20%;
}

.pip-br {
    bottom: 20%;
    right: 20%;
}

.pip-ml {
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
}

.pip-mr {
    top: 50%;
    right: 20%;
    transform: translateY(-50%);
}

/* === Footer: Box Lid === */
.box-lid-footer {
    position: relative;
    background: #4A3728;
    margin-top: 40px;
    padding: 3rem 2rem;
    border-top: 4px solid #D4A853;
    overflow: hidden;
}

.box-lid-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 30px,
            rgba(212, 168, 83, 0.03) 30px,
            rgba(212, 168, 83, 0.03) 31px
        );
    pointer-events: none;
}

.footer-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    pointer-events: none;
}

.footer-corner-tl {
    top: 16px;
    left: 16px;
    border-top: 2px solid #D4A853;
    border-left: 2px solid #D4A853;
    border-top-left-radius: 4px;
    opacity: 0.5;
}

.footer-corner-tr {
    top: 16px;
    right: 16px;
    border-top: 2px solid #D4A853;
    border-right: 2px solid #D4A853;
    border-top-right-radius: 4px;
    opacity: 0.5;
}

.footer-corner-bl {
    bottom: 16px;
    left: 16px;
    border-bottom: 2px solid #D4A853;
    border-left: 2px solid #D4A853;
    border-bottom-left-radius: 4px;
    opacity: 0.5;
}

.footer-corner-br {
    bottom: 16px;
    right: 16px;
    border-bottom: 2px solid #D4A853;
    border-right: 2px solid #D4A853;
    border-bottom-right-radius: 4px;
    opacity: 0.5;
}

.footer-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.footer-title {
    font-family: 'Lilita One', cursive;
    color: #D4A853;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.footer-rules {
    text-align: left;
    margin-bottom: 2rem;
}

.rule-item {
    display: flex;
    gap: 10px;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(212, 168, 83, 0.2);
}

.rule-number {
    font-family: 'Share Tech Mono', monospace;
    color: #D4A853;
    font-size: 1rem;
    flex-shrink: 0;
    width: 24px;
}

.rule-text {
    color: #D4C4AE;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-bottom {
    padding-top: 1rem;
}

.footer-bottom .suit-divider {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.footer-copy {
    font-family: 'Permanent Marker', cursive;
    color: #B8A48C;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.footer-fine-print {
    color: #7D6B5D;
    font-size: 0.75rem;
}

/* === Responsive === */
@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-card h1 {
        font-size: 3rem;
    }
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .hero-card {
        padding: 2rem 1.5rem;
    }

    .hero-card h1 {
        font-size: 2.5rem;
    }

    .score-strip-inner {
        gap: 10px;
        padding: 8px 12px;
    }

    .score-label {
        font-size: 0.6rem;
    }

    .flip-card {
        height: 300px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .card-grid-zone {
        padding: 30px 16px 40px;
    }

    .stitched-border {
        inset: 8px;
    }
}
