/* Russian für Deutsche — Zettelkasten */

/* Card stack container */
#card-stack {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Individual card */
.card {
    position: absolute;
    width: min(calc(100% - 2rem), 22rem);
    height: 420px;
    border-radius: 1.5rem;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    will-change: transform;
}

.card:active {
    cursor: grabbing;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 1.5rem;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1.25rem;
    border-radius: 1.5rem;
    overflow: hidden;
}

.card-front {
    background: linear-gradient(145deg, #312e81 0%, #1e1b4b 100%);
}

.card-back {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    transform: rotateY(180deg);
}

/* Swipe indicators */
.card .swipe-indicator {
    position: absolute;
    top: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 10;
}

.card .swipe-indicator.left {
    right: 1.5rem;
    color: #ef4444;
    border: 3px solid #ef4444;
    transform: rotate(12deg);
}

.card .swipe-indicator.right {
    left: 1.5rem;
    color: #22c55e;
    border: 3px solid #22c55e;
    transform: rotate(-12deg);
}

/* Card animation */
.card.swiping-left {
    animation: swipeLeft 0.4s ease-in forwards;
}

.card.swiping-right {
    animation: swipeRight 0.4s ease-in forwards;
}

.card.entering {
    animation: cardEnter 0.3s ease-out;
}

@keyframes swipeLeft {
    to {
        transform: translateX(-150%) rotate(-20deg);
        opacity: 0;
    }
}

@keyframes swipeRight {
    to {
        transform: translateX(150%) rotate(20deg);
        opacity: 0;
    }
}

@keyframes cardEnter {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Card stack depth */
.card[data-stack="0"] { z-index: 10; }
.card[data-stack="1"] { z-index: 9; transform: scale(0.95) translateY(10px); opacity: 0.7; }
.card[data-stack="2"] { z-index: 8; transform: scale(0.9) translateY(20px); opacity: 0.4; }

/* Phonetic text */
.phonetic {
    font-family: 'Lucida Sans Unicode', 'DejaVu Sans', sans-serif;
    font-style: italic;
}

/* Nav active state */
.nav-btn.active {
    color: #818cf8;
}

/* View transitions */
.view {
    animation: viewEnter 0.3s ease-out;
}

@keyframes viewEnter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #3730a3;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4338ca;
}

/* Chapter card */
.chapter-card {
    transition: all 0.2s;
}

.chapter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(99, 102, 241, 0.2);
}

/* Audio button pulse */
.audio-btn.playing {
    animation: pulse 1s infinite;
}

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

/* Achievement animation */
@keyframes achievementPop {
    0% { transform: translate(-50%, -100px); opacity: 0; }
    20% { transform: translate(-50%, 0); opacity: 1; }
    80% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, -100px); opacity: 0; }
}

/* Progress ring */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring circle {
    transition: stroke-dashoffset 0.5s ease-out;
}

/* Glow effects */
.glow-success {
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
}

.glow-danger {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

/* Responsive: smaller cards on short screens */
@media (max-height: 700px) {
    .card {
        height: 340px;
    }
}

@media (max-height: 600px) {
    .card {
        height: 280px;
    }
}
