* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #ff6b35;
    --secondary: #f7931e;
    --dark: #1a1a2e;
    --light: #fffef2;
    --accent: #00d9ff;
    --success: #4ecdc4;
    --danger: #ff3864;
}

body {
    font-family: 'Karla', sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, #2E2E42 100%);
    color: var(--light);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
    radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 217, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.hero {
    text-align: center;
    margin-bottom: 60px;
}

h1 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 400;
    font-style: italic;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    animation: fadeInDown 0.8s ease-out;
}

.tagline {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: rgba(255, 254, 242, 0.8);
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.feature {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease-out backwards;
}

.feature:nth-child(1) { animation-delay: 0.3s; }
.feature:nth-child(2) { animation-delay: 0.4s; }
.feature:nth-child(3) { animation-delay: 0.5s; }

.feature:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.feature h3 {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--secondary);
}

.feature p {
    color: rgba(255, 254, 242, 0.7);
    line-height: 1.2;
}

.cta-section {
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.6s backwards;
}

.download-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--light);
    font-family: 'Karla', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 20px 50px;
    border-radius: 50px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.3);
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(255, 107, 53, 0.4);
}

.install-note {
    margin-top: 20px;
    color: rgba(255, 254, 242, 0.6);
    font-size: 0.9rem;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 768px) {
    .features {
        grid-template-columns: 1fr;
    }
}

.app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    max-height: 900px;
    padding: 20px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* Page d'accueil */
.home-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.logo {
    font-family: "Instrument Serif", serif;
    font-size: clamp(3rem, 10vw, 4.5rem);
    font-style: italic;
    margin-bottom: 15px;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--secondary),
        var(--accent)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 254, 242, 0.7);
    margin-bottom: 50px;
    max-width: 350px;
}

.levels {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.level-btn {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    color: var(--light);
    font-family: "Karla", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.level-btn:hover {
    transform: translateX(5px);
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.level-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s;
}

.level-btn:hover::before {
    left: 100%;
}

.level-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.level-letters {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--light);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
}

.level-desc {
    color: rgba(255, 254, 242, 0.6);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Page de jeu */
.game-screen {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    animation: fadeIn 0.5s ease-out;
}

.game-screen.active {
    display: flex;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--light);
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.level-indicator {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--light);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 700;
}

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

.timer-container {
    position: relative;
    width: 150px;
    height: 150px;
}

.timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

.timer-progress.warning {
    stroke: var(--secondary);
}

.timer-progress.danger {
    stroke: var(--danger);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 800;
    color: var(--light);
}

.theme-display {
    text-align: center;
}

.theme-label {
    font-size: 1rem;
    color: rgba(255, 254, 242, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.theme-name {
    font-family: "Instrument Serif", serif;
    font-size: 2rem;
    font-style: italic;
    color: var(--secondary);
}

.letters-display {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.letter-box {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--light);
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.3);
    animation: popIn 0.5s ease-out backwards;
}

.letter-box:nth-child(1) {
    animation-delay: 0.1s;
}
.letter-box:nth-child(2) {
    animation-delay: 0.2s;
}
.letter-box:nth-child(3) {
    animation-delay: 0.3s;
}
.letter-box:nth-child(4) {
    animation-delay: 0.4s;
}
.letter-box:nth-child(5) {
    animation-delay: 0.5s;
}

.answer-input {
    width: 100%;
    max-width: 350px;
    padding: 18px 25px;
    font-family: "Karla", sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: var(--light);
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.answer-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.answer-input::placeholder {
    color: rgba(255, 254, 242, 0.4);
    text-transform: none;
}

.next-btn {
    display: none;
    background: linear-gradient(135deg, var(--success), var(--accent));
    color: var(--light);
    font-family: "Karla", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 18px 50px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.3);
}

.next-btn.show {
    display: inline-block;
    animation: popIn 0.5s ease-out;
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(78, 205, 196, 0.4);
}

.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    display: none;
    z-index: 100;
    min-width: 300px;
    border: 2px solid var(--success);
    animation: popInWithTranslate 0.5s ease-out;
}

.feedback.show {
    display: block;
}

.feedback-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.feedback-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--light);
    margin-bottom: 10px;
}

.feedback-answer {
    font-family: "Instrument Serif", serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popInWithTranslate {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    70% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 480px) {
    .letter-box {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .timer-container {
        width: 120px;
        height: 120px;
    }
    
    .timer-text {
        font-size: 2.5rem;
    }
}