@import url('https://fonts.googleapis.com/css2?family=Gochi+Hand&display=swap');

:root {
    --wb-bg: #ffffff;
    --marker-blue: #003366;
    --marker-red: #cc0000;
    --marker-black: #1a1a1a;
    --marker-green: #006633;
    --wb-shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Gochi Hand', cursive;
    background-color: #e0e0e0;
    background-image: radial-gradient(#d1d1d1 1px, transparent 1px);
    background-size: 40px 40px;
    color: var(--marker-black);
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-size: 1.2rem;
    padding: 20px 0;
}

/* Help Button */
.btn-help {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--marker-blue);
    border: 2px solid var(--marker-blue);
    background: white;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-help:hover {
    background: var(--marker-blue);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

/* Help Section (In-flow) */
.help-section {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border: 2px dashed var(--marker-blue);
    border-radius: 4px;
    animation: fadeIn 0.3s ease-out;
    user-select: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
    white-space: nowrap;
}

th,
td {
    border: 1px solid #ccc;
    padding: 6px 4px;
    text-align: center;
}

th {
    background-color: #eee;
    color: var(--marker-blue);
    font-size: 0.9rem;
}

td {
    color: var(--marker-black);
}

tr:nth-child(even) {
    background-color: #fff;
}

@media (max-width: 600px) {
    .btn-help {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    table {
        font-size: 0.75rem;
    }

    th,
    td {
        padding: 4px 2px;
    }
}

.container {
    background-color: #ffffff;
    padding: 3rem 3rem 6rem 3rem;
    border-radius: 4px;
    box-shadow:
        0 4px 15px var(--wb-shadow),
        inset 0 0 50px rgba(0, 0, 0, 0.02);
    border: 8px solid #333;
    border-bottom: 20px solid #444;
    max-width: 700px;
    width: 95%;
    text-align: center;
    position: relative;
}

/* Marker Tray Styling */
.marker-tray {
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 30px;
    background: #555;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    border-top: 2px solid #666;
}

.eraser {
    width: 60px;
    height: 25px;
    background: #333;
    border-top: 8px solid #555;
    border-radius: 4px;
    position: absolute;
    bottom: 5px;
}

.marker {
    width: 10px;
    height: 60px;
    border-radius: 5px 5px 2px 2px;
    position: absolute;
    bottom: 0px;
    transform-origin: center;
}

.marker::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background: inherit;
    filter: brightness(0.8);
    border-radius: 5px 5px 0 0;
}

.marker.blue {
    background: #003366;
}

.marker.red {
    background: #cc0000;
}

.marker.black {
    background: #1a1a1a;
}

.marker.green {
    background: #006633;
}

h1 {
    font-size: 2.8rem;
    color: var(--marker-blue);
    margin-bottom: 2rem;
    user-select: none;
}

/* Hand-drawn underline effect for headers */
.underline {
    border-bottom: 4px solid var(--marker-red);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    display: inline-block;
    padding: 0 10px;
    transform: rotate(-1deg);
}

.mode-selector {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

button {
    font-family: 'Gochi Hand', cursive;
    font-size: 1.4rem;
    background: transparent;
    color: var(--marker-black);
    padding: 8px 18px;
    border: 2px solid var(--marker-black);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    transform: scale(1.05) rotate(-1deg);
    background: rgba(0, 0, 0, 0.02);
}

.btn-mode.active {
    color: var(--marker-blue);
    border-color: var(--marker-blue);
    border-width: 3px;
    background: rgba(0, 51, 102, 0.05);
}

.btn-check {
    color: var(--marker-green);
    border-color: var(--marker-green);
    margin-top: 1.5rem;
    font-size: 1.8rem;
}

.btn-next {
    color: var(--marker-blue);
    border-color: var(--marker-blue);
    margin-top: 1.5rem;
    font-size: 1.8rem;
    display: none;
}

.btn-training {
    color: var(--marker-red);
    border-color: var(--marker-red);
}

.btn-return-suivi {
    color: var(--marker-blue);
    border-color: var(--marker-blue);
    border-style: dashed;
}

.question-area {
    font-size: 2rem;
    margin: 2.5rem 0;
    line-height: 1.4;
    color: var(--marker-black);
}

.question-area strong {
    color: var(--marker-blue);
    font-size: 2.2rem;
}

.input-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

input {
    font-family: 'Gochi Hand', cursive;
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--marker-black);
    color: var(--marker-blue);
    padding: 5px;
    font-size: 2rem;
    width: 140px;
    text-align: center;
    outline: none;
}

input:focus {
    border-bottom-color: var(--marker-red);
}

.scientific-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.exponent {
    position: relative;
    top: -25px;
    font-size: 1.4rem;
    width: 70px;
    border-bottom-width: 2px;
}

#feedback {
    margin: 30px auto 0 auto;
    padding: 1.5rem;
    border: 1px solid #ddd;
    display: none;
    text-align: left;
    font-size: 1.3rem;
    border-radius: 2px;
    max-width: 600px;
    width: calc(90% - 1em);
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.1);
    transform: rotate(1deg);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) rotate(1deg);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotate(1deg);
    }
}

.correct {
    background-color: #fff9c4;
    border-left: 10px solid var(--marker-green) !important;
    color: var(--marker-green);
}

.incorrect {
    background-color: #fff9c4;
    border-left: 10px solid var(--marker-red) !important;
    color: var(--marker-red);
}

.explanation {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1.1rem;
    color: var(--marker-black);
}

.score-board {
    margin-top: 3rem;
    font-size: 1.4rem;
    color: var(--marker-black);
    border-top: 1px solid #ddd;
    padding-top: 1rem;
}

#score {
    color: var(--marker-green);
}

#total {
    color: var(--marker-blue);
}

#training-controls {
    margin-bottom: 2rem;
}

.credit-postit {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: #ffccff;
    /* Pinkish post-it */
    padding: 10px 15px;
    font-size: 0.9rem;
    line-height: 1.2;
    border: 1px solid #ddd;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
    transform: rotate(-2deg);
    z-index: 5;
    /* Behind the whiteboard container if overlapping */
}

@media (max-width: 800px) {
    .credit-postit {
        position: relative;
        bottom: 0;
        right: 0;
        margin-top: 20px;
        transform: rotate(1deg);
        z-index: 1;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 1.1rem;
        padding: 10px 0;
    }

    .container {
        padding: 1.5rem 1rem 5rem 1rem;
        border-width: 5px;
        border-bottom-width: 15px;
        width: 92%;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .question-area {
        font-size: 1.5rem;
        margin: 1.5rem 0;
    }

    .question-area strong {
        font-size: 1.7rem;
    }

    .mode-selector {
        gap: 8px;
        margin-bottom: 1.5rem;
    }

    button {
        font-size: 1.1rem;
        padding: 6px 12px;
    }

    .btn-check,
    .btn-next {
        font-size: 1.5rem;
        margin-top: 1rem;
    }

    input {
        font-size: 1.6rem;
        width: 110px;
    }

    .exponent {
        font-size: 1.2rem;
        width: 60px;
        top: -20px;
    }

    .score-board {
        margin-top: 2rem;
        font-size: 1.2rem;
    }

    .marker-tray {
        height: 20px;
        bottom: -15px;
    }

    .marker {
        height: 45px;
    }

    .eraser {
        width: 45px;
        height: 20px;
    }
}