* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; }

body {
    background:
        radial-gradient(circle at top left, rgba(42, 115, 232, 0.18), transparent 20%),
        linear-gradient(180deg, #0d2f70 0%, #0a2557 100%);
    color: #333;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

body.no-animation, body.no-animation * {
    animation: none !important;
    transition: none !important;
}

#presentationArea {
    flex: 1; display: flex; justify-content: center; align-items: center;
    padding: 15px; 
    position: relative;
}

.slide {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    width: 100%;
    max-width: 1100px;
    height: calc(100vh - 70px); 
    border-radius: 18px;
    box-shadow: 0 32px 70px rgba(3, 14, 37, 0.42);
    display: none; 
    position: relative;
    overflow-y: auto !important; 
    overflow-x: hidden; 
    border: 1px solid rgba(196, 216, 250, 0.55);
}

.slide-inner {
    padding: 40px 50px; 
    width: 100%;
    height: max-content;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.slide.active { display: block; animation: fadeInSlide 0.3s ease-out; }
@keyframes fadeInSlide { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

.annotation-indicator {
    position: absolute; top: 15px; right: 15px;
    background: #eff6ff; color: #0b5ed7;
    padding: 4px 10px; border-radius: 4px;
    font-size: 11px; font-weight: 800;
    display: flex; align-items: center; gap: 4px;
    border: 1px solid #bfd6ff; z-index: 50; transition: opacity 0.3s;
    text-transform: uppercase; letter-spacing: 0.5px; opacity: 0; 
}

.drawing-canvas { position: absolute; top: 0; left: 0; z-index: 100; pointer-events: none; }
.drawing-canvas.pen-active { pointer-events: auto; cursor: crosshair; }

/* --- ELEMENTOS DA QUESTÃO --- */
.q-header { 
    font-weight: 800; font-size: 16px; color: #35517f; 
    margin-bottom: 15px; border-bottom: 1px solid #d9e5f8; padding-bottom: 10px; 
}
.q-text { 
    font-size: 1em; line-height: 1.6; margin-bottom: 25px; text-align: left; color: #1e293b;
}

.q-text span:not([class*="katex"]), .q-text p, .q-text font, .q-text div:not([class*="katex"]),
.alt-content span:not([class*="katex"]), .alt-content p, .alt-content font, .alt-content div:not([class*="katex"]) {
    font-size: inherit !important;
}

.q-text img { max-width: 100%; max-height: 300px; object-fit: contain; display: block; margin: 10px auto; border-radius: 4px;}

.alts-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; transition: opacity 0.3s; }
.alts-container.two-columns { display: block; column-count: 2; column-gap: 20px; }
.alts-container.two-columns .alt-item { margin-bottom: 10px; break-inside: avoid; }

.alt-item { 
    display: flex; gap: 15px; align-items: center; 
    background: #f7faff; padding: 12px 15px; 
    border-radius: 12px; border: 1px solid #dce7f8; 
    transition: all 0.2s; font-size: 0.95em; color: #334155;
}
.alt-letter { 
    font-weight: bold; background: #ffffff; color: #0b3d91; 
    width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; 
    border-radius: 50%; border: 1px solid #c7d8f5; flex-shrink: 0; font-size: 14px; transition: all 0.2s;
}
.alt-content { flex: 1; }
.alt-content img { max-width: 100%; max-height: 150px; object-fit: contain; border-radius: 4px; }

/* --- GABARITO COMENTADO --- */
.gabarito-box { 
    background: linear-gradient(180deg, #eef5ff, #f7fbff); border-left: 4px solid #0b5ed7;
    padding: 15px 20px; border-radius: 10px; margin-top: 15px; 
    display: none; font-size: 1em; line-height: 1.6;
}
.gabarito-box h4 { 
    color: #0b4fb3; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; 
    font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.9;
}
.gabarito-box > div p,
.gabarito-box > div ul,
.gabarito-box > div ol,
.gabarito-box > div h1,
.gabarito-box > div h2,
.gabarito-box > div h3,
.gabarito-box > div h4,
.gabarito-box > div h5,
.gabarito-box > div h6 {
    margin: 0 0 10px;
}
.gabarito-box > div p:last-child,
.gabarito-box > div ul:last-child,
.gabarito-box > div ol:last-child,
.gabarito-box > div h1:last-child,
.gabarito-box > div h2:last-child,
.gabarito-box > div h3:last-child,
.gabarito-box > div h4:last-child,
.gabarito-box > div h5:last-child,
.gabarito-box > div h6:last-child {
    margin-bottom: 0;
}
.gabarito-box > div ul,
.gabarito-box > div ol {
    padding-left: 22px;
}
.gabarito-box > div li + li {
    margin-top: 6px;
}

/* --- CAIXA DE TEXTO TRANSPARENTE E COM CORES --- */
.pres-text-box {
    position: absolute; min-width: 150px; min-height: 40px; background: transparent; 
    border-radius: 6px; z-index: 200; border: 1px dashed transparent; transform-origin: top left;
}
.pres-text-box:hover, .pres-text-box:focus-within { border: 1px dashed #7ea8eb; }
.pres-text-box .text-content {
    width: 100%; height: 100%; padding: 10px; outline: none; font-weight: bold; 
    word-wrap: break-word; text-align: left; resize: both; overflow: hidden; font-size: 20px; color: #0f172a;
}

/* O SEGREDO DO DELAY AQUI */
.tb-controls {
    position: absolute; top: -35px; left: 0; background: linear-gradient(135deg, #123a84, #0b5ed7); border-radius: 10px; padding: 4px 6px; 
    display: flex; gap: 6px; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    opacity: 0; visibility: hidden; 
    transition: opacity 0.2s ease, visibility 0.2s ease;
    transition-delay: 0.6s; /* Fica visível por mais 0.6s após tirar o mouse */
}
.pres-text-box:focus-within .tb-controls, 
.pres-text-box:hover .tb-controls { 
    opacity: 1; visibility: visible; 
    transition-delay: 0s; /* Aparece instantaneamente */
}

.tb-btn { background: transparent; border: none; color: white; cursor: pointer; padding: 4px; display: flex; align-items: center; border-radius: 4px;}
.tb-btn:hover { background: rgba(255,255,255,0.12); }
.tb-drag { cursor: grab; } .tb-drag:active { cursor: grabbing; }
.tb-delete { color: #ef4444; } .tb-delete:hover { background: #ef4444; color: white; }
.tb-divider { width: 1px; height: 16px; background: rgba(255,255,255,0.24); margin: 0 2px; }
.tb-color { width: 16px; height: 16px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.tb-color:hover { transform: scale(1.2); border-color: white;}

/* --- CONTROLE DE PASSOS --- */
.step-hidden { opacity: 0; visibility: hidden; position: absolute; } 
.step-visible { opacity: 1; visibility: visible; position: relative; animation: fadeStep 0.4s ease; }
@keyframes fadeStep { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.alt-item.is-correct-highlight { border-color: #0b5ed7; background: #edf4ff; box-shadow: 0 4px 15px -3px rgba(11, 94, 215, 0.18); z-index: 10;}
.alt-item.is-correct-highlight .alt-letter { background: #0b5ed7; color: white; border-color: #0b5ed7;}

/* --- LASER E TOOLBAR --- */
#laserPointer { width: 12px; height: 12px; background: #ef4444; border-radius: 50%; position: fixed; pointer-events: none; z-index: 99999; box-shadow: 0 0 15px 5px rgba(239, 68, 68, 0.8); display: none; transform: translate(-50%, -50%); transition: width 0.1s, height 0.1s; }
body.laser-active { cursor: none; }
body.laser-active #laserPointer { display: block; }
body.laser-active.mouse-down #laserPointer { width: 8px; height: 8px; box-shadow: 0 0 20px 8px rgba(239, 68, 68, 1); }

#presenterToolbar { 
    position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); 
    background: rgba(8, 34, 82, 0.92); backdrop-filter: blur(12px); 
    padding: 6px 15px; border-radius: 50px; display: flex; gap: 8px; flex-wrap: nowrap; justify-content: center;
    box-shadow: 0 20px 40px rgba(3, 14, 37, 0.3); z-index: 1000; border: 1px solid rgba(164, 194, 245, 0.22); 
}
.tool-group { display: flex; gap: 4px; align-items: center; }
.tool-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.2); margin: 0 2px; }
#presenterToolbar button { background: transparent; border: none; color: #f8fafc; cursor: pointer; padding: 6px; border-radius: 50px; transition: 0.2s; display: flex; align-items: center; gap: 6px; font-weight: bold; font-size: 13px;}
#presenterToolbar button:hover { background: rgba(255,255,255,0.1); }
#presenterToolbar button.active-tool { background: #3b82f6; color: white; box-shadow: 0 10px 18px rgba(59,130,246,0.24); }
#presenterToolbar .btn-icon i { font-size: 18px; } 

.color-picker { display: flex; gap: 4px; background: rgba(255,255,255,0.1); padding: 4px; border-radius: 20px; }
.color-dot { width: 16px; height: 16px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.color-dot.active { border-color: white; transform: scale(1.2); }

.btn-highlight { background: linear-gradient(135deg, #0b5ed7, #3b82f6) !important; color: white !important; padding: 6px 12px !important; border-radius: 20px !important; box-shadow: 0 10px 18px rgba(11,94,215,0.24);}
.btn-highlight:hover { background: linear-gradient(135deg, #0a54bf, #2f74e8) !important; }
.btn-edit { color: #7dd3fc !important; } .btn-edit:hover{ background: rgba(125,211,252,0.16) !important; }
.btn-pdf { color: #fbbf24 !important; } .btn-pdf:hover{ background: rgba(251,191,36,0.14) !important; }
.btn-close { color: #fda4af !important; } .btn-close:hover{ background: rgba(253,164,175,0.14) !important; }
.counter-badge { background: rgba(255,255,255,0.08); color: white; padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; border: 1px solid rgba(255,255,255,0.16); user-select: none;}
.step-badge { background: #3b82f6; border-color: #2563eb; }

/* --- MODAIS --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(6, 18, 42, 0.74); z-index: 99999; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-content { background: linear-gradient(180deg, #ffffff, #f5f9ff); padding: 30px; border-radius: 18px; max-width: 400px; text-align: center; border: 1px solid #d7e4fb; box-shadow: 0 28px 60px rgba(11,61,145,0.18); }
.btn-cancel { background: #eaf1ff; color: #19458e; border: 1px solid #cadefd; padding: 10px 15px; border-radius: 10px; cursor: pointer; font-weight: bold;}
.btn-normal { background: linear-gradient(135deg, #0b3d91, #0b5ed7); color: white; border: none; padding: 10px 15px; border-radius: 10px; cursor: pointer; font-weight: bold;}
.btn-action { background: linear-gradient(135deg, #1663d6, #4d8ff3); color: white; border: none; padding: 10px 15px; border-radius: 10px; cursor: pointer; font-weight: bold;}

/* --- MODO IMPRESSÃO VIA FOTOGRAFIA --- */
#printSequenceContainer { display: none; }
@media print {
    @page { size: landscape; margin: 0; } 
    body { background: white !important; height: auto; overflow: visible; margin: 0; padding: 0;}
    
    .no-print, #presentationArea, #presenterToolbar, #laserPointer, .modal-overlay, .annotation-indicator { display: none !important; }
    
    #printSequenceContainer { display: block !important; width: 100%; }
    
    .print-page-img {
        display: block !important; 
        width: 100vw;
        height: 100vh;
        object-fit: contain; 
        page-break-after: always;
        margin: auto;
    }
    .print-page-img:last-child { page-break-after: auto; }
}
