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

html, body {
    height: 100%;
    scroll-behavior: smooth;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    /* Prevent browser default scaling on touch */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background-color: rgb(248, 250, 252);
    max-width: 672px;
    margin: 0 auto;
    color: #000000;
    line-height: 1.4;
    min-height: 100vh;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Inter', sans-serif;
}

.loading-text {
    font-size: 18px;
    color: #636363;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Inter', sans-serif;
    padding: 20px;
}

.error-text {
    font-size: 16px;
    color: #ff4444;
    text-align: center;
    line-height: 1.5;
}

/* Vertical Carousel Container - Preserving magneting scroll */
.cards-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    max-width: 672px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Individual Card as Slide - New design matching HTML test */
.container {
    position: relative;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    height: auto;
    min-height: 373px;
    scroll-snap-align: start;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    /* Prevent any scaling or transformations */
    transform: none !important;
    transition: none !important;
    -webkit-transform: none !important;
    -webkit-transition: none !important;
    touch-action: manipulation;
}

.container:not(:last-child) {
    border-bottom: 1px solid rgb(229, 231, 235);
}

/* Top section */
.top-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    color: rgb(107, 114, 128);
    font-size: 12px;
    font-weight: 500;
}

.word-type {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.view-count {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgb(156, 163, 175);
}

.eye-icon {
    width: 12px;
    height: 12px;
    color: rgb(156, 163, 175);
}

/* Main content */
.main-content {
    flex: 1;
    margin-bottom: 24px;
}

.word {
    font-size: 30px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 16px;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.definition {
    font-size: 18px;
    font-weight: 500;
    color: rgb(55, 65, 81);
    margin-bottom: 16px;
    line-height: 1.4;
}

.example {
    font-size: 16px;
    font-weight: 400;
    color: rgb(107, 114, 128);
    line-height: 1.5;
    font-style: normal;
}

/* Tags section */
.tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tag {
    background-color: rgb(243, 244, 246);
    color: rgb(75, 85, 99);
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 400;
    border: none;
    display: inline-block;
}

/* Bottom action bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    margin-top: auto;
}

.like-section {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgb(156, 163, 175);
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

.like-section:hover {
    color: rgb(239, 68, 68);
}

.heart-icon {
    width: 16px;
    height: 16px;
    color: inherit;
}

.action-icons {
    display: flex;
    gap: 22px;
    align-items: center;
}

.share-icon,
.bookmark-icon {
    width: 16px;
    height: 16px;
    color: rgb(156, 163, 175);
    cursor: pointer;
    transition: color 0.2s;
}

.share-icon:hover,
.bookmark-icon:hover {
    color: rgb(75, 85, 99);
}

/* Heart animation styling */
.heart-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff4757;
    pointer-events: none;
    z-index: 1000;
    animation: heartBeat 1s ease-out forwards;
}

@keyframes heartBeat {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Flash Card Flip Animation - Preserving existing functionality */
.flash-card {
    perspective: 1000px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background-color: transparent !important;
    /* Override the main card transform rules for flash cards */
    transform: unset !important;
    transition: unset !important;
    -webkit-transform: unset !important;
    -webkit-transition: unset !important;
}

.flash-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s ease-in-out;
    transform-style: preserve-3d;
    background-color: transparent;
}

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

.flash-card-front-face,
.flash-card-back-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    padding: 0;
}

.flash-card-front-face {
    background-color: transparent;
    border: none;
    border-radius: 0;
}

.flash-card-back-face {
    transform: rotateY(180deg);
    background-color: transparent;
    border: none;
    border-radius: 0;
}

.word-only {
    font-family: 'EB Garamond', serif;
    font-style: normal;
    font-weight: 500;
    font-size: 48px;
    line-height: 63px;
    color: #000000;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .word {
        font-size: 30px;
        letter-spacing: 0.01em;
    }
    
    .definition {
        font-size: 18px;
    }
    
    .example {
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    body {
        padding: 12px;
    }
    
    .word {
        font-size: 24px;
    }
    
    .definition {
        font-size: 15px;
    }
    
    .tags {
        gap: 6px;
    }
    
    .tag {
        padding: 5px 10px;
        font-size: 13px;
    }
}

/* Mobile optimizations for flash cards */
@media (max-width: 768px) {
    .word-only {
        font-size: 36px;
        line-height: 48px;
    }
}
