@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

.zapalki-wrapper {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    font-family: 'Outfit', sans-serif;
    text-align: center;
    color: #2c3e50;
    overflow: hidden;
}

.zapalki-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.zapalki-header .description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #636e72;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.zapalki-table {
    position: relative;
    width: 100%;
    height: 450px;
    background: radial-gradient(circle, #3d2b1f 0%, #1a120b 100%);
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 8px solid #2d1e13;
}

/* Matchbox styling */
.matchbox {
    position: absolute;
    width: 130px;
    height: 190px;
    z-index: 10;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.matchbox-tray {
    position: absolute;
    top: -40px; /* Slid out */
    left: 10px;
    width: 110px;
    height: 170px;
    background: #e5c08d;
    border-radius: 2px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
    display: flex;
    justify-content: space-around;
    padding: 0 5px;
    border: 1px solid #c9a67a;
}

.inner-matches {
    display: flex;
    width: 100%;
    justify-content: space-between;
}

.inner-match {
    width: 4px;
    height: 40px;
    background: #f3e5ab;
    position: relative;
}

.inner-match::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -2px;
    width: 8px;
    height: 10px;
    background: #e74c3c;
    border-radius: 50% 50% 30% 30%;
}

.matchbox-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 130px;
    height: 190px;
    background: #f1c40f;
    border-radius: 4px;
    box-shadow: 10px 10px 20px rgba(0,0,0,0.3);
    border: 2px solid #d4ac0d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.matchbox.open {
    transform: translateY(-50px) scale(0.8);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.matchbox-label {
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.matchbox-label img {
    max-width: 90%;
    max-height: 120px;
    object-fit: contain;
    margin-bottom: 0;
}

.matchbox-label span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7f8c8d;
}

/* Matchstick animation */
.matchstick {
    position: absolute;
    width: 4px;
    height: 80px;
    background: #f3e5ab;
    border-radius: 2px;
    transform-origin: center;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.4);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.matchstick::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -2px;
    width: 8px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50% 50% 40% 40%;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.3);
}

/* Controls */
.zapalki-btn {
    padding: 14px 34px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
    margin: 0 10px;
}

.zapalki-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(52, 152, 219, 0.4);
}

.zapalki-btn.secondary {
    background: #ecf0f1;
    color: #2c3e50;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.zapalki-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results */
.zapalki-result {
    margin-top: 30px;
    min-height: 80px;
    font-size: 1.3rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.zapalki-result.show {
    opacity: 1;
    transform: translateY(0);
}

.result-success { color: #27ae60; }
.result-fail { color: #e74c3c; }

.count-info {
    font-size: 1rem;
    color: #7f8c8d;
    font-weight: 400;
    margin-bottom: 5px;
}

/* Rules section */
.zapalki-rules {
    margin-top: 30px;
    padding: 20px;
    background: #fdfdfd;
    border-radius: 12px;
    text-align: left;
}

.zapalki-rules h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #1a1a1a;
    text-align: center;
}

.zapalki-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

.zapalki-rules li {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #636e72;
}

.zapalki-rules li strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 2px;
}
