/* ============================================
   gabs.games - Flat Design Game UI
   Colors: #E8F0F5, #4A9BD9, #F0C040, #E05050, #4CAF50, #2D2D3A, #7B68AE
   Fonts: Indie Flower, Quicksand, Chakra Petch
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.7;
    color: #2D2D3A;
    background: #E8F0F5;
    overflow-x: hidden;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E8F0F5;
    overflow: hidden;
}

.hero-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(74, 155, 217, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 70% 60%, rgba(123, 104, 174, 0.03) 0%, transparent 70%),
        radial-gradient(ellipse 700px 700px at 50% 80%, rgba(240, 192, 64, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 400px 400px at 80% 20%, rgba(76, 175, 80, 0.03) 0%, transparent 70%),
        radial-gradient(ellipse 550px 550px at 30% 70%, rgba(224, 80, 80, 0.02) 0%, transparent 70%);
    opacity: 0;
    animation: meshFadeIn 400ms ease-out forwards;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: 'Indie Flower', cursive;
    font-weight: 400;
    font-size: clamp(60px, 15vw, 180px);
    color: #2D2D3A;
    letter-spacing: 0.05em;
    clip-path: inset(0 100% 0 0);
    animation: revealTitle 600ms linear 400ms forwards;
}

.hero-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 5vw, 64px);
    color: #4A9BD9;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0;
    transform: scale(1.05);
    animation: popIn 200ms linear 1000ms forwards;
}

.hero-tagline {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(14px, 2vw, 22px);
    color: #7B68AE;
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 300ms ease-out 1300ms forwards;
}

/* ============================================
   BENTO GRID INVENTORY
   ============================================ */

.inventory-section {
    padding: 60px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    grid-auto-rows: minmax(180px, auto);
}

/* Cell sizing */
.cell-large {
    grid-column: span 2;
    grid-row: span 2;
}

.cell-wide {
    grid-column: span 2;
}

.cell-tall {
    grid-row: span 2;
}

.cell-small {
    grid-column: span 1;
    grid-row: span 1;
}

/* Base cell styling: flat design - no shadows, no gradients */
.bento-cell {
    position: relative;
    border: 1px solid #2D2D3A;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 300ms linear, transform 300ms linear;
    overflow: hidden;
}

.bento-cell.visible {
    opacity: 1;
    transform: scale(1);
}

/* Cell color fills - flat, solid backgrounds */
.cell-blue {
    background: #4A9BD9;
    color: #E8F0F5;
}

.cell-red {
    background: #E05050;
    color: #E8F0F5;
}

.cell-green {
    background: #4CAF50;
    color: #E8F0F5;
}

.cell-gold {
    background: #F0C040;
    color: #2D2D3A;
}

.cell-purple {
    background: #7B68AE;
    color: #E8F0F5;
}

.cell-dark {
    background: #2D2D3A;
    color: #E8F0F5;
}

/* Cell icons: 16x16 geometric shapes */
.cell-icon {
    width: 16px;
    height: 16px;
    position: absolute;
    top: 12px;
    left: 12px;
}

.cell-icon-circle {
    border-radius: 50%;
}

.cell-icon-square {
    border-radius: 0;
}

.cell-icon-triangle {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid #4CAF50;
}

/* Cell content */
.cell-label {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.7;
    margin-left: 24px;
}

.cell-title {
    font-family: 'Indie Flower', cursive;
    font-weight: 400;
    font-size: clamp(20px, 3vw, 32px);
    line-height: 1.2;
}

.cell-body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(13px, 1.3vw, 16px);
    line-height: 1.6;
    opacity: 0.9;
}

/* Health/Progress meter bars */
.cell-meter {
    margin-top: auto;
}

.meter-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.meter-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #E8F0F5;
    transition: width 1s linear;
}

.cell-gold .meter-bar::after {
    background: #2D2D3A;
}

.cell-dark .meter-bar::after {
    background: #E05050;
}

.meter-bar.filled::after {
    width: var(--fill-width);
}

.meter-label {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 13px;
    margin-top: 4px;
    display: inline-block;
}

/* Score display */
.cell-score {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 36px);
    margin-top: auto;
}

.score-prefix,
.score-suffix {
    font-weight: 400;
    font-size: 0.6em;
    opacity: 0.7;
}

/* Economy indicators */
.economy-indicators {
    display: flex;
    gap: 16px;
    margin-top: auto;
    flex-wrap: wrap;
}

.indicator {
    flex: 1;
    min-width: 80px;
}

.indicator-label {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 4px;
}

.indicator-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.indicator-fill {
    height: 100%;
    width: 0%;
    background: #E8F0F5;
    transition: width 1s linear;
}

.indicator-fill.filled {
    width: var(--fill-width);
}

/* Loot box slots */
.loot-slots {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.loot-slot {
    width: 48px;
    height: 48px;
    border: 1px solid #2D2D3A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #2D2D3A;
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background 150ms linear;
}

.loot-slot.revealed[data-rarity="common"] {
    background: #E8F0F5;
    color: #2D2D3A;
}

.loot-slot.revealed[data-rarity="rare"] {
    background: #4A9BD9;
    color: #E8F0F5;
}

.loot-slot.revealed[data-rarity="legendary"] {
    background: #F0C040;
    color: #2D2D3A;
}

/* Shake animation for high-cost items */
@keyframes shakeError {
    0% { transform: translateX(0); }
    15% { transform: translateX(-3px); }
    30% { transform: translateX(3px); }
    45% { transform: translateX(-2px); }
    60% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shakeError 300ms linear;
}

/* ============================================
   SCOREBOARD / FOOTER
   ============================================ */

.scoreboard-section {
    background: #2D2D3A;
    padding: 60px 24px 40px;
    color: #E8F0F5;
}

.scoreboard-title {
    font-family: 'Indie Flower', cursive;
    font-weight: 400;
    font-size: clamp(28px, 5vw, 60px);
    text-align: center;
    color: #F0C040;
    margin-bottom: 40px;
}

.scoreboard-table {
    max-width: 800px;
    margin: 0 auto;
}

.score-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 60px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(232, 240, 245, 0.1);
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 400;
    font-size: 16px;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 300ms linear, transform 300ms linear;
}

.score-row.visible {
    opacity: 1;
    transform: translateX(0);
}

.score-header {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #7B68AE;
    border-bottom: 1px solid rgba(232, 240, 245, 0.3);
    opacity: 1;
    transform: none;
}

.score-rank {
    font-weight: 700;
    color: #F0C040;
}

.score-header .score-rank {
    color: #7B68AE;
}

.score-name {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
}

.score-value {
    text-align: right;
    font-weight: 700;
    font-size: 18px;
}

.score-trend {
    text-align: center;
    font-size: 14px;
}

.trend-up {
    color: #4CAF50;
}

.trend-down {
    color: #E05050;
}

.trend-neutral {
    color: #F0C040;
}

.scoreboard-footer {
    max-width: 800px;
    margin: 40px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(232, 240, 245, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: rgba(232, 240, 245, 0.6);
}

.footer-korean {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: rgba(232, 240, 245, 0.4);
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

@keyframes meshFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes revealTitle {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0% 0 0); }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(1.05);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cell-large {
        grid-column: span 2;
        grid-row: span 2;
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .cell-large {
        grid-column: span 2;
        grid-row: span 1;
    }

    .cell-wide {
        grid-column: span 2;
    }

    .cell-tall {
        grid-row: span 1;
    }

    .bento-cell {
        padding: 16px;
    }

    .score-row {
        grid-template-columns: 40px 1fr 80px 40px;
        font-size: 14px;
        padding: 10px 12px;
    }
}

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

    .cell-large,
    .cell-wide {
        grid-column: span 1;
    }

    .inventory-section {
        padding: 40px 16px 60px;
    }

    .scoreboard-section {
        padding: 40px 16px 30px;
    }

    .scoreboard-footer {
        flex-direction: column;
        text-align: center;
    }
}
