#studenttoolWrapper{
position: absolute;
    left: 100%;
    top: 1rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.studenttools{
    
    background: white;border-radius: 0 5px 5px 0;
    font-size: 2rem;
    height: 3rem;
    width: calc(3rem + 5px);
    background: var(--panel-color);
    padding: 0;
    
}

/* Hide student tool buttons when a tool is open (prevents reappearing on zoom/resize) */
body[data-forcesmallcornericons="true"] .studenttools {
    display: none !important;
}

.notepad-canvas{
    position: absolute;
   
}

.notepad-draw-canvas{
   background-color: var(--contrast-color);
   border-radius:  0 var(--border-radius) var(--border-radius) 0;
   border: 1px solid black;
   
}

.notepad-draw-canvas[data-tool="pen"]{
    cursor:crosshair;
}

.notepad-draw-canvas[data-tool="marker"]{
    cursor:crosshair;
}

.notepad-draw-canvas[data-tool="eraser"]{
    cursor:cell;
}

.notepad-toolbox{
    position: absolute;
    top: 0;
    padding: 3px;
}

.notepad-toolbox>button{

    margin-right: 3px;
    background-color: transparent;
    border: 1px solid var(--color);
    
}

.notepad-toolbox>button[data-active="true"]{

    margin-right: 3px;
    background-color: var(--bgcolor);
    border: 1px solid var(--color);
    
}


.notepad-toolbox>button:hover{
    background-color: var(--panel-color);
    cursor: pointer;
}

/* ============================================
   CALCULATOR STYLES
   ============================================ */

.calculator-container {
    position: absolute;
    background: var(--panel-color);
    border-radius: var(--border-radius, 12px);
    padding: 15px;
    padding-top: 35px;
    width: 280px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    user-select: none;
    
}

/* Close button at top right */
.calc-close-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #999;
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.calc-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Display wrapper */
.calc-display-wrapper {
    background: var(--contrast-color);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 12px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Expression display (small, shows full expression) */
.calc-expression {
    font-size: 0.9rem;
    color: var(--color);
    min-height: 1.2em;
    word-break: break-all;
    text-align: right;
    width: 100%;
    margin-bottom: 4px;
}

/* Main display (large, shows current value/result) */
.calc-display {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--color);
    text-align: right;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.1;
}

/* Button grid */
.calc-button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* Base button style */
.calc-btn {
    padding: 0;
    height: 52px;
    font-size: 1.3rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #3d3d3d;
    color: #fff;
    box-shadow: 
        0 3px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-btn:hover {
    background: #4a4a4a;
    transform: translateY(-1px);
}

.calc-btn:active {
    transform: translateY(1px);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Number buttons - slightly lighter */
.calculator-container .calc-btn[data-action="number"] {
    background: #4a4a4a;
}

/* Function buttons (parentheses, pi, power) - cyan/teal accent */
.calculator-container .calc-btn.calc-btn-function {
    background: #00796b;
    color: #fff;
}

.calculator-container .calc-btn.calc-btn-function:hover {
    background: #00897b;
}

/* Pi button - use serif font for proper pi symbol */
.calculator-container .calc-btn.calc-btn-pi {
    font-family: "Times New Roman", "DejaVu Serif", Georgia, serif;
    font-size: 1.5rem;
    font-style: italic;
}

/* Operator buttons - blue accent */
.calculator-container .calc-btn.calc-btn-operator {
    background: #0277bd;
    color: #fff;
}

.calculator-container .calc-btn.calc-btn-operator:hover {
    background: #0288d1;
}

/* Clear and backspace buttons - red/orange accent */
.calculator-container .calc-btn.calc-btn-clear {
    background: #c62828;
    color: #fff;
}

.calculator-container .calc-btn.calc-btn-clear:hover {
    background: #d32f2f;
}

/* Equals button - green accent */
.calculator-container .calc-btn.calc-btn-equals {
    background: #2e7d32;
    color: #fff;
}

.calculator-container .calc-btn.calc-btn-equals:hover {
    background: #388e3c;
}

/* Wide equals button spans 2 columns */
.calculator-container .calc-btn.calc-btn-equals-wide {
    grid-column: span 2;
}

/* Zero button */
.calc-btn-zero {
    grid-column: span 1;
}






/*--------------
Ganim styles
--------------*/

#animationContainer {
    position: fixed;
    top: var(--header-height, 2rem);
    bottom: var(--header-height, 2rem);
    left: calc(50% + 10px);
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--panel-color);
    border: 1px solid var(--color);
    border-radius: var(--border-radius);
    z-index: 10;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

#canvasInfoBar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-family: var(--font-family);
    color: var(--color);
    background: linear-gradient(to bottom, var(--panel-color) 0%, transparent 100%);
    border-bottom: none;
    user-select: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

#ganimCanvasWrapper:hover #canvasInfoBar,
#animationContainer.controls-visible #canvasInfoBar {
    opacity: 1;
    pointer-events: auto;
}

#canvasInfoBar span {
    padding: 0 0.2rem;
}

#canvasInfoBar .canvasInfoSpacer {
    flex: 1;
}


#ganimCanvasWrapper{
    position: relative;
    display: inline-block;
}

/* Canvas styling */
#animationCanvas {
    display: block;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
    /* width/height set by JS fitCanvas() */
}

/* Native 1:1 mode – no scaling, allow scrolling if needed */
#animationContainer.native-size #canvasWrapper {
    overflow: auto;
}

/* Ganim Timeline Controls */
#ganimControls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem 0.75rem 0.5rem;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(to top, var(--panel-color) 0%, transparent 100%);
    border-top: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

#ganimControlsRow1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

#ganimControlsRow2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding-left: 0.1rem;
}

#ganimCanvasWrapper:hover #ganimControls,
#animationContainer.controls-visible #ganimControls {
    opacity: 1;
    pointer-events: auto;
}

#ganimPlayBtn {
    background: none;
    border: 1px solid var(--color);
    color: var(--color);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1;
    flex-shrink: 0;
}

#ganimPlayBtn:hover {
    background-color: var(--color);
    color: var(--bgcolor);
}

#ganimTime {
    color: var(--color);
    font-size: 0.75rem;
}

#ganimTracker {
    flex: 1;
    cursor: pointer;
    accent-color: #007bff;
    height: 4px;
}

#ganimMuteBtn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

#ganimMuteBtn:hover {
    opacity: 1;
}

#ganimVolumeSlider {
    flex: 1;
    max-width: 90px;
    cursor: pointer;
    accent-color: #007bff;
    height: 2px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

#ganimVolumeSlider:hover,
#ganimControlsRow2:hover #ganimVolumeSlider {
    opacity: 1;
}

/* Ganim audio loading progress overlay (shown centered while audio preloads) */
#ganimAudioProgressOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    z-index: 10;
    pointer-events: none;
    backdrop-filter: blur(4px);
    min-width: 160px;
}

#ganimAudioProgressLabel {
    font-size: 0.85rem;
    font-family: var(--font-family, sans-serif);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

#ganimAudioProgressTrack {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    overflow: hidden;
}

#ganimAudioProgressBar {
    height: 100%;
    width: 0%;
    background: var(--highlight-color, #4a90e2);
    transition: width 0.1s linear;
    border-radius: 2px;
}

/* Ganim close button */
.ganim-close-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--color);
    background: none;
    color: var(--color);
    font-size: 20px;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    margin-left: auto;
}

.ganim-close-btn:hover {
    background: var(--color);
    color: var(--bgcolor);
}


/* Responsive adjustments */
@media (max-width: 320px) {
    .calculator-container {
        width: 260px;
        padding: 10px;
    }
    
    .calc-btn {
        height: 45px;
        font-size: 1.1rem;
    }
    
    .calc-display {
        font-size: 2rem;
    }
}

/* Mobile / phone layout */
@media screen and (max-width: 768px) {
    /* Move student tool buttons to bottom of the task square (tabs on bottom instead of right) */
    #studenttoolWrapper {
        left: 1rem;
        top: 100%;
        flex-direction: row;
    }

    .studenttools {
        /* Tab shape: rounded on bottom instead of right */
        border-radius: 0 0 5px 5px;
        /* Swap dimensions for horizontal tabs */
        width: 3rem;
        height: calc(3rem + 5px);
    }

    /* Hide cornerWrapper and other bottom UI when animation is open on mobile */
    body[data-forcesmallcornericons="true"] #cornerWrapper,
    body[data-forcesmallcornericons="true"] #taskMenuBarCollapserIcon,
    body[data-forcesmallcornericons="true"] #footer {
        display: none !important;
    }

    /* Fullscreen animation container on mobile */
    #animationContainer {
        position: fixed;
        top: var(--header-height, 2rem);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: calc(100vh - var(--header-height, 2rem));
        max-height: none;
        border-radius: 0;
        border: none;
        z-index: 9999; /* Above cornerWrapper and other UI */
    }

    #ganimCanvasWrapper {
        flex: 1;
        padding: 0;
    }

    #animationCanvas {
        border-radius: 0;
    }

    /* Ensure controls are visible at bottom and above all other UI */
    #ganimControls {
        padding: 0.4rem 1rem 0.5rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        position: relative;
        z-index: 10000;
        background-color: var(--panel-color);
        flex-direction: column;
    }

    #canvasInfoBar {
        position: relative;
        z-index: 10000;
        background-color: var(--panel-color);
    }
}
/* A hint is available only after a wrong answer on the current task. */
#hintButton[hidden] { display: none !important; }
#studentHintDialog {
    width: min(380px, calc(100vw - 48px));
    border: 1px solid #9ebfc4;
    border-radius: 16px;
    padding: 24px;
    background: #f5fcfc;
    color: #153b40;
    box-shadow: 0 12px 50px #0004;
}
#studentHintDialog::backdrop { background: #122b3444; }
#studentHintDialog h2 { margin-top: 0; font-size: 1.2rem; }
#studentHintText { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
#studentHintDialog button { padding: 8px 20px; border-radius: 8px; cursor: pointer; }
#studentHintSpeak { margin-right: 8px; }
#studentHintSpeechStatus:empty { display: none; }
