@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'EB Garamond', serif;
    background: #F5F5F5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1400px;
}

header {
    display: none;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding: 20px 24px;
    background: #ffffff;
    border-radius: 3px;
    border: 1px solid #f1f1f1;
    flex-wrap: wrap;
    gap: 20px;
    width: 424px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.info-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.9375rem;
}

.label {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.875rem;
}

.info-item span:not(.label):not(.total) {
    font-weight: 700;
    color: #312e2b;
    font-size: 1.5rem;
}

.total {
    color: #9ca3af;
    font-size: 1rem;
    font-weight: 400;
}

.new-game-btn {
    background: #312e2b;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 3px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'EB Garamond', serif;
}

.new-game-btn:hover {
    background: #1a1816;
    transform: translateY(-1px);
}

.new-game-btn:active {
    transform: translateY(0);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.card {
    width: 100px;
    height: 100px;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    perspective: 1200px;
    flex-shrink: 0;
    transition: transform 100ms cubic-bezier(0, 0, 0.4, 1);
}

.card:hover:not(.flipped):not(.matched) {
    transform: scale(1.03);
    transition: transform 100ms cubic-bezier(0, 0, 0.4, 1);
}

.card.flipped,
.card.matched {
    pointer-events: none;
}

.card.flipped:hover,
.card.matched:hover {
    transform: none;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    opacity: 0;
    border-radius: 3px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 100ms cubic-bezier(0, 0, 0.4, 1);
}

.card:hover:not(.flipped):not(.matched):not([style*="transform"])::after {
    opacity: 0.05;
    transition: opacity 100ms cubic-bezier(0, 0, 0.4, 1);
}

.card:not(:hover)::after,
.card.flipped::after,
.card[style*="transform"]::after {
    transition: opacity 100ms cubic-bezier(0, 0, 0.4, 1);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: 3px;
    pointer-events: none;
}

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

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

.card.matched {
    cursor: default;
    pointer-events: none;
}

.card.matched .card-inner {
    animation: matchSuccess 0.6s ease;
}

@keyframes matchSuccess {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.card-back,
.card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card:hover:not(.flipped):not(.matched) .card-back,
.card:hover:not(.flipped):not(.matched) .card-front {
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.05);
}

.card-back {
    background: #ffffff;
    border: 1px solid #f1f1f1;
}

.card-back::before {
    content: '★';
    font-size: 24px;
    color: #312e2b;
}

.card-front {
    transform: rotateY(180deg);
    padding: 8px;
}

.card.color-card .card-front {
    background: var(--card-color);
    border: 1px solid #f1f1f1;
}

.card.name-card .card-front {
    background: #ffffff;
    color: #312e2b;
    border: 1px solid #f1f1f1;
    font-size: 16px;
    font-weight: 700;
    font-family: 'EB Garamond', serif;
    text-align: center;
    line-height: normal;
}

.card.flipped.name-card .card-front {
    border-color: #f1f1f1;
}

.card.matched .card-front {
    border: 1px solid #f1f1f1 !important;
}

.card.matched .card-front.matched-text {
    /* Keep same typography as name cards */
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    padding: 8px;
    line-height: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1f1f1 !important;
    text-shadow: none;
    transition: background 1000ms cubic-bezier(0, 0, 0.2, 1), 
                color 1000ms cubic-bezier(0, 0, 0.2, 1);
}

.win-message {
    text-align: center;
    padding: 56px 40px;
    background: #312e2b;
    color: white;
    border-radius: 12px;
    margin-top: 32px;
}

.win-message.hidden {
    display: none;
}

.win-message h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.win-message p {
    font-size: 1.125rem;
    margin-bottom: 8px;
    color: #d1d5db;
    font-weight: 400;
}

.win-message .new-game-btn {
    background: #ffffff;
    color: #312e2b;
    margin-top: 8px;
}

.win-message .new-game-btn:hover {
    background: #f3f4f6;
}

/* Responsive grid - cards always 100px x 100px */
@media (max-width: 1024px) {
    .game-board {
        grid-template-columns: repeat(6, 100px);
    }
}

@media (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(4, 100px);
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(3, 100px);
    }
}

/* FTUE Modal */
.ftue-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ftue-modal.hidden {
    display: none;
}

.ftue-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.ftue-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.ftue-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 32px;
    color: #6b7280;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
    font-family: 'EB Garamond', serif;
}

.ftue-modal-close:hover {
    color: #312e2b;
}

.ftue-modal-title {
    font-size: 2rem;
    font-weight: 700;
    color: #312e2b;
    margin-bottom: 24px;
    font-family: 'EB Garamond', serif;
}

.ftue-modal-body {
    margin-bottom: 24px;
}

.ftue-instruction {
    font-size: 1.125rem;
    color: #312e2b;
    margin-bottom: 20px;
    font-weight: 500;
    line-height: 1.6;
}

.ftue-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 32px 0;
}

.ftue-steps li {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 12px;
    padding-left: 24px;
    position: relative;
    line-height: 1.6;
}

.ftue-steps li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #312e2b;
    font-size: 1.5rem;
    line-height: 1;
}

.ftue-example {
    background: #f9fafb;
    border-radius: 6px;
    padding: 20px;
    border: 1px solid #f1f1f1;
}

.ftue-example-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #312e2b;
    margin-bottom: 16px;
}

.ftue-example-cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.ftue-example-card {
    width: 80px;
    height: 80px;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    perspective: 1200px;
    transition: transform 100ms cubic-bezier(0, 0, 0.4, 1);
}

.ftue-example-card:hover:not(.ftue-flipped):not(.ftue-matched) {
    transform: scale(1.03);
}

.ftue-example-card.ftue-flipped {
    cursor: default;
}

.ftue-example-card.ftue-matched {
    cursor: default;
    pointer-events: none;
}

.ftue-example-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    border-radius: 3px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    will-change: transform;
}

.ftue-example-card.ftue-flipped .ftue-example-card-inner,
.ftue-example-card.ftue-matched .ftue-example-card-inner {
    transform: rotateY(180deg);
}

.ftue-example-card-back,
.ftue-example-card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1f1f1;
}

.ftue-example-card-back {
    background: #ffffff;
}

.ftue-example-card-back::before {
    content: '★';
    font-size: 20px;
    color: #312e2b;
}

.ftue-example-card-front {
    transform: rotateY(180deg);
    background: var(--card-color, #ffffff);
    font-size: 12px;
    font-weight: 700;
    color: #312e2b;
    font-family: 'EB Garamond', serif;
    padding: 4px;
    text-align: center;
}

.ftue-example-card.ftue-matched .ftue-example-card-front {
    background: var(--ftue-matched-color, #FF6B6B);
    color: var(--ftue-matched-text-color, #312e2b);
}

.ftue-example-text {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 12px;
}

.ftue-modal-button {
    width: 100%;
    background: #312e2b;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 3px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'EB Garamond', serif;
}

.ftue-modal-button:hover:not(:disabled) {
    background: #1a1816;
    transform: translateY(-1px);
}

.ftue-modal-button:active:not(:disabled) {
    transform: translateY(0);
}

.ftue-modal-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

@media (max-width: 480px) {
    .ftue-modal-content {
        padding: 24px;
    }
    
    .ftue-modal-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .ftue-example-cards {
        gap: 8px;
    }
    
    .ftue-example-card {
        width: 60px;
        height: 60px;
    }
}


