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

body {
    font-family: 'Walter Turncoat', cursive;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('img/fond-ecran.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 2rem;
    padding: 2rem;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(5px);
}

h1 {
    text-align: center;
    color: #2d8e47;
    margin-bottom: 2rem;
    font-size: 2.1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #202124;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.5rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tables-selection {
    text-align: center;
    width: 100%;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.tables-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.tables-grid label:hover {
    background-color: #e8f0fe;
    border-color: #1a73e8;
}

.tables-grid input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
}

.tables-grid label.random-option {
    background: linear-gradient(180deg, #fff9e8 0%, #fff2cc 100%);
    border-color: #f3d16a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    font-weight: 700;
}

.tables-grid label.random-option:hover {
    background: linear-gradient(180deg, #fff6dc 0%, #ffeaa3 100%);
    border-color: #e9b949;
}

.exercise-container {
    text-align: center;
    width: 100%;
    max-width: 600px;
}

.progress {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #5f6368;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    width: 10%;
    height: 100%;
    background-color: #2d8e47;
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
}

.progress-text {
    font-size: 1.2rem;
    color: #666;
}

.question-container {
    background-color: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}


.time-period-indicator {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a73e8;
    background-color: #e8f0fe;
    border-radius: 999px;
    padding: 0.35rem 1rem;
}

.question {
    font-size: 2.1rem;
    margin-bottom: 1rem;
    font-family: 'Walter Turncoat', cursive;
}

.question input {
    width: 120px;
    font-size: 2.1rem;
    text-align: center;
    padding: 0.5rem;
    border: 2px solid #dadce0;
    border-radius: 6px;
    margin-left: 0.5rem;
    transition: border-color 0.2s;
    font-family: 'Walter Turncoat', cursive;
}

.question input:focus {
    outline: none;
    border-color: #2d8e47;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 2rem;
    max-width: 320px;
    width: 100%;
    padding: 0.65rem;
    background: linear-gradient(180deg, #eef2f7 0%, #e4e9f0 100%);
    border: 1px solid #cfd8e3;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 10px rgba(0, 0, 0, 0.08);
    margin-left: auto;
    margin-right: auto;
}

.key {
    padding: 0.95rem;
    font-size: 1.1rem;
    font-weight: 700;
    border: 1px solid #c8d1db;
    background: linear-gradient(180deg, #ffffff 0%, #f2f5f9 100%);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 2px 0 #c5ced8, 0 4px 8px rgba(0, 0, 0, 0.06);
    font-family: 'Walter Turncoat', cursive;
}

.key:hover {
    border-color: #8db2e8;
    box-shadow: 0 2px 0 #b8c4d3, 0 5px 10px rgba(0, 0, 0, 0.08);
}

.key:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #b8c4d3;
}

.key.symbol {
    background: linear-gradient(180deg, #f3f8ff 0%, #e6effc 100%);
    border-color: #b9cdee;
    color: #1a4b8f;
}

.key.symbol:hover {
    border-color: #8db2e8;
}

.key.delete {
    background: linear-gradient(180deg, #feeceb 0%, #fbd6d2 100%);
    border-color: #efb7b0;
    color: #b42318;
}

.key.delete:hover {
    border-color: #2d8e47;
    box-shadow: 0 2px 0 #dfaca6, 0 5px 10px rgba(0, 0, 0, 0.08);
}

.key.zero {
    grid-column: span 2;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    border: none;
    background-color: #2d8e47;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
    font-family: 'Walter Turncoat', cursive;
}

a.btn {
    border: 1px solid #98a4b3;
    border-radius: 10px;
    background: linear-gradient(180deg, #f6f8fb 0%, #e8edf4 100%);
    color: #233042;
    box-shadow: 0 2px 0 #c7d0db, 0 4px 8px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

a.btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #edf2f8 100%);
    color: #1b2736;
    box-shadow: 0 2px 0 #c7d0db, 0 5px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

a.btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

a.btn:focus-visible {
    outline: 3px solid rgba(26, 115, 232, 0.3);
    outline-offset: 2px;
}

.btn:hover {
    background-color: #237a3a;
    transform: translateY(-2px);
}

button#startButton,
button#restartButton {
    border: 1px solid #1d5fa8;
    border-radius: 10px;
    background: linear-gradient(180deg, #4290f4 0%, #1a73e8 100%);
    box-shadow: 0 2px 0 #145cb9, 0 5px 10px rgba(0, 0, 0, 0.12);
}

button#startButton:hover,
button#restartButton:hover {
    background: linear-gradient(180deg, #5aa0fa 0%, #2d7feb 100%);
    box-shadow: 0 2px 0 #145cb9, 0 6px 12px rgba(0, 0, 0, 0.14);
    transform: translateY(-1px);
}

button#startButton:active,
button#restartButton:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}

button#startButton:focus-visible,
button#restartButton:focus-visible {
    outline: 3px solid rgba(26, 115, 232, 0.3);
    outline-offset: 2px;
}

.results {
    text-align: center;
    width: 100%;
    max-width: 600px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 1rem;
}

.results h2 {
    color: #2d8e47;
    margin-bottom: 1.5rem;
}

.results .score-time {
    font-size: 1em;
    margin-bottom: 2rem;
    color: #202124;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

.results .score-time p {
    margin: 0;
    font-weight: 700;
    font-size: 1.2em;
}

.results .score-time p span {
    font-weight: bold;
    color: #2d8e47;
    font-size: 1.2em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    padding: 0 0.3rem;
}

.results .detailed-results {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
    position: relative;
    z-index: 0;
}

.results .detailed-results h3 {
    color: #2d8e47;
    margin-bottom: 1rem;
}

.results #answersList {
    text-align: left;
    padding: 0 1rem;
}

.results .score-display {
    font-size: 1.5rem;
    color: #2d8e47;
    margin-bottom: 1rem;
    font-weight: bold;
}

.results .time-display {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #e8f0fe;
    border-radius: 8px;
    display: inline-block;
}

.hidden {
    display: none;
}

.error-message, .success-message {
    font-size: 1rem;
    display: none;
}

.error-message {
    color: #d93025;
}

.success-message {
    color: #2d8e47;
}

.error-message.show {
    display: block;
}

.success-message.show {
    display: block;
}

.detailed-results {
    margin: 2rem 0;
    text-align: left;
    width: 100%;
}

.detailed-results h3 {
    color: #202124;
    margin-bottom: 1rem;
    text-align: center;
}

.answer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    color: white;
    transition: all 0.2s;
}

.answer-item:hover {
    transform: translateX(5px);
}

.answer-item.correct {
    background-color: #2d8e47;
}

.answer-item.incorrect {
    background-color: #d93025;
}

.answer-item .question {
    font-size: 1.1rem;
    margin: 0;
    color: white;
}

.answer-item .user-answer {
    color: white;
    font-weight: bold;
}

.answer-item.incorrect .user-answer {
    color: white;
}

.answer-item .correct-answer {
    color: white;
    margin-left: 1rem;
    font-style: italic;
}

.validate-btn {
    padding: 0.85rem 1.8rem;
    font-size: 1.05rem;
    min-width: 150px;
    border: 1px solid #2f8f49;
    border-radius: 10px;
    background: linear-gradient(180deg, #45bc65 0%, #2f9a4f 100%);
    box-shadow: 0 2px 0 #257a3f, 0 5px 10px rgba(0, 0, 0, 0.12);
}

.validate-btn:hover {
    background: linear-gradient(180deg, #50c870 0%, #35a756 100%);
    box-shadow: 0 2px 0 #257a3f, 0 6px 12px rgba(0, 0, 0, 0.14);
}

.buttons-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
    width: 100%;
}

.next-btn {
    min-width: 150px;
    border: 1px solid #1d5fa8;
    border-radius: 10px;
    background: linear-gradient(180deg, #4290f4 0%, #1a73e8 100%);
    box-shadow: 0 2px 0 #145cb9, 0 5px 10px rgba(0, 0, 0, 0.12);
}

.next-btn:active,
.validate-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}

.validate-btn:hover,
.next-btn:hover {
    transform: translateY(-1px);
}

.validate-btn:focus-visible,
.next-btn:focus-visible {
    outline: 3px solid rgba(26, 115, 232, 0.3);
    outline-offset: 2px;
}

.next-btn:hover {
    background: linear-gradient(180deg, #5aa0fa 0%, #2d7feb 100%);
    box-shadow: 0 2px 0 #145cb9, 0 6px 12px rgba(0, 0, 0, 0.14);
}

.difficulty-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.difficulty-selection label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.difficulty-selection label:hover {
    background-color: #e8f0fe;
    border-color: #2d8e47;
}

.difficulty-selection input[type="radio"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #2d8e47;
}


.featured-links {
    width: 100%;
    margin: 0 0 1rem;
    padding: 1rem 1.5rem;
    border: 2px dashed #2d8e47;
    border-radius: 10px;
    background-color: rgba(232, 240, 254, 0.85);
    text-align: center;
}

.featured-links h2 {
    margin-bottom: 0.5rem;
    color: #2d8e47;
    font-size: 1.4rem;
}

.featured-links p {
    color: #202124;
    font-size: 1rem;
}

.featured-links a {
    color: #1a73e8;
    font-weight: 700;
}

.featured-links a:hover,
.featured-links a:focus {
    color: #1558b0;
    text-decoration: underline;
}

/* Styles du menu principal */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 1.5rem auto;
    max-width: 1200px;
    padding: 0 1rem;
    width: 100%;
}

.home-container {
    max-width: 1200px;
}

.menu-item {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    width: 100%;
}

.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #2d8e47;
}

.menu-item h2 {
    color: #2d8e47;
    margin: 1rem 0;
    font-size: 1.4rem;
    width: 100%;
}

.menu-item p {
    color: #5f6368;
    font-size: 1rem;
    margin: 0;
    line-height: 1.4;
    width: 100%;
}

.menu-item img {
    width: 80px;
    height: 80px;
    margin-bottom: 0.5rem;
    object-fit: contain;
}

@media (max-width: 768px) {
    .container {
        margin: 1rem;
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .featured-links {
        padding: 0.8rem 1rem;
    }

    .menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        margin: 1rem auto;
    }

    .menu-item {
        padding: 1.2rem;
        min-height: 180px;
    }

    .menu-item h2 {
        font-size: 1.3rem;
    }

    .menu-item p {
        font-size: 0.95rem;
    }

    .menu-item img {
        width: 64px;
        height: 64px;
    }

    .tables-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.8rem;
    }

    .question {
        font-size: 1.8rem;
    }

    .question input {
        width: 100px;
        font-size: 1.8rem;
    }

    .keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
        max-width: 300px;
        padding: 0.55rem;
    }

    .key {
        padding: 0.8rem;
        font-size: 1rem;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        min-width: 180px;
    }

    .validate-btn,
    .next-btn {
        min-width: 140px;
        padding: 0.75rem 1.3rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0.5rem;
        padding: 0.8rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        margin: 0.8rem auto;
    }

    .menu-item {
        padding: 1rem;
        min-height: 160px;
    }

    .menu-item h2 {
        font-size: 1.2rem;
    }

    .menu-item p {
        font-size: 0.9rem;
    }

    .menu-item img {
        width: 56px;
        height: 56px;
    }

    .question {
        font-size: 1.5rem;
    }

    .question input {
        width: 80px;
        font-size: 1.5rem;
    }

    .keypad {
        grid-template-columns: repeat(3, 1fr);
        max-width: 280px;
        padding: 0.5rem;
    }

    .key {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
        min-width: 150px;
    }

    .buttons-container {
        gap: 0.7rem;
        margin: 0.8rem 0;
    }

    .validate-btn,
    .next-btn {
        min-width: 120px;
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }

    .progress {
        font-size: 1rem;
    }

    .answer-item {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 320px) {
    .container {
        margin: 0.3rem;
        padding: 0.6rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    .menu-grid {
        gap: 0.6rem;
        margin: 0.6rem auto;
    }

    .menu-item {
        padding: 0.8rem;
        min-height: 140px;
    }

    .menu-item h2 {
        font-size: 1.1rem;
    }

    .menu-item p {
        font-size: 0.85rem;
    }

    .menu-item img {
        width: 48px;
        height: 48px;
    }

    .question {
        font-size: 1.3rem;
    }

    .question input {
        width: 70px;
        font-size: 1.3rem;
    }

    .keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
        max-width: 260px;
        padding: 0.45rem;
    }

    .key {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-width: 130px;
    }

    .buttons-container {
        gap: 0.5rem;
    }

    .validate-btn,
    .next-btn {
        min-width: 104px;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
}

.stats-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-weight: bold;
    color: #2d8e47;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.final-time {
    text-align: center;
    font-size: 1.2rem;
    color: #2d8e47;
    margin: 1rem 0;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}
.exercise-prompt {
    font-size: 1.2rem;
    color: #202124;
    margin-bottom: 0.5rem;
}

.text-question {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.text-question input {
    width: 160px;
    font-size: 1.8rem;
}

.currency-suffix {
    font-size: 1.6rem;
    color: #2d8e47;
}

.clock {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}


.clock-image {
    width: 220px;
    height: 220px;
    border: 6px solid #2d8e47;
    border-radius: 50%;
    background-color: #fff;
    object-fit: cover;
}
.clock-face {
    position: relative;
    width: 220px;
    height: 220px;
    border: 6px solid #2d8e47;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 60%, #eef6ee 100%);
}

.clock-face::before {
    content: '12';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
}

.clock-face::after {
    content: '6';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
}

.hand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: 50% 100%;
    border-radius: 999px;
}

.hour-hand {
    width: 8px;
    height: 62px;
    margin-top: -62px;
    background-color: #202124;
}

.minute-hand {
    width: 4px;
    height: 84px;
    margin-top: -84px;
    background-color: #2d8e47;
}

.clock-center {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #202124;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.keypad-time,
.keypad-money {
    max-width: 320px;
}
