@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: 5px;
    color: #1a1a1a;
}

.zapalki-instruction {
    background: #f8f9fa;
    border-left: 4px solid #f1c40f;
    padding: 15px 25px;
    margin: 10px auto 30px;
    max-width: 650px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.zapalki-instruction p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #444;
    margin: 0;
}

.zapalki-instruction strong {
    color: #d35400;
}

.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 styling - 3D Realistic Version */
.matchbox {
    position: absolute;
    width: 140px;
    height: 200px;
    z-index: 10;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.matchbox.open {
    transform: rotateX(10deg) rotateY(-5deg);
}

.matchbox-tray {
    position: absolute;
    top: -60px;
    left: 12px;
    width: 116px;
    height: 190px;
    background: #e2c9a1;
    background-image: 
        linear-gradient(90deg, rgba(0,0,0,0.1) 0%, transparent 5%, transparent 95%, rgba(0,0,0,0.1) 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.2'/%3E%3C/svg%3E");
    border-radius: 2px;
    box-shadow: 
        inset 0 10px 20px rgba(0,0,0,0.4),
        0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-around;
    padding: 10px 5px;
    border: 1px solid #c5a87a;
    transition: transform 0.5s ease;
    z-index: 9;
}

.matchbox.open .matchbox-tray {
    transform: translateY(-80px);
}

.inner-matches {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: flex-end;
}

.inner-match {
    width: 5px;
    height: 140px;
    background: #f1ebd1;
    background-image: linear-gradient(to right, #e8d1a7, #f3e5ab, #e8d1a7);
    position: relative;
    box-shadow: 1px 0 2px rgba(0,0,0,0.2);
    border-radius: 1px;
}

.inner-match::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -2px;
    width: 9px;
    height: 13px;
    background: radial-gradient(circle at 35% 35%, #ff3b3b, #8b0000);
    border-radius: 50% 50% 40% 40%;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.4);
}

.matchbox-striker {
    position: absolute;
    top: 5px;
    right: -12px;
    width: 22px;
    height: 190px;
    background: #3d2b1f;
    background-image: 
        repeating-linear-gradient(45deg, #4d3319 0, #4d3319 1px, #3d2b1f 1px, #3d2b1f 3px),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23f)' opacity='0.3'/%3E%3C/svg%3E");
    border-radius: 0 4px 4px 0;
    box-shadow: 
        inset 3px 0 10px rgba(0,0,0,0.8),
        2px 2px 5px rgba(0,0,0,0.3);
    z-index: 11;
    transform: rotateY(-20deg);
    transform-origin: left;
}

.matchbox-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 140px;
    height: 200px;
    background: #f1c40f;
    background-image: 
        linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 50%, rgba(0,0,0,0.2) 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");
    border-radius: 4px;
    box-shadow: 
        20px 30px 40px rgba(0,0,0,0.5),
        inset -1px -1px 3px rgba(0,0,0,0.3),
        inset 1px 1px 3px rgba(255,255,255,0.5);
    border: 1px solid #d4ac0d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 12;
    transform: translateZ(10px);
}

.matchbox-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 8px solid rgba(0,0,0,0.05);
    pointer-events: none;
}

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

.matchbox-label img {
    max-width: 95%;
    max-height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.matchbox-label span {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #4d3319;
    margin-top: 5px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

/* Matchstick animation */
.matchbox.shake {
    animation: shakeBox 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeBox {
    10%, 90% { transform: translate3d(-1px, 0, 0) rotateZ(-1deg); }
    20%, 80% { transform: translate3d(2px, 0, 0) rotateZ(1deg); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0) rotateZ(-2deg); }
    40%, 60% { transform: translate3d(4px, 0, 0) rotateZ(2deg); }
}

.matchstick {
    position: absolute;
    width: 4px;
    height: 80px;
    background: #f1ebd1;
    background-image: linear-gradient(to right, #e8d1a7, #f3e5ab, #e8d1a7);
    border-radius: 2px;
    transform-origin: center;
    box-shadow: 2px 5px 10px rgba(0,0,0,0.3);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 5;
}

.matchstick::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -2px;
    width: 8px;
    height: 12px;
    background: radial-gradient(circle at 30% 30%, #ff4d4d, #9e1a1a);
    border-radius: 50% 50% 40% 40%;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.4);
}

/* 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;
}

}
