:root {
    --bg-error: #F1D4D4; 
    --white: #FFFFFF;
    --black: #000000;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --bg-tint: #E6E6FA;
    --arrow-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="black" d="M7 10l5 5 5-5z"/></svg>');
}
[data-theme="dark"] {
    --bg-tint: #100808;
    --white: #0e0e0e;
    --black: #e0e0e0;
    --arrow-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="white" d="M7 10l5 5 5-5z"/></svg>');
}
::-webkit-scrollbar { display: none; }
html, body, #view-quiz, .ms-content, #view-focus-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-tint);
    margin: 0;
    padding: 20px;
    color: var(--black);
}
#splash-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-tint); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease; pointer-events: none;
}
.splash-icon { width: 100px; height: auto; animation: zoom-through 1.2s ease-in forwards; }
@keyframes zoom-through {
    0% { opacity: 0; transform: scale(0.5); }
    10% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(50); }
}
.header-container {
    background: linear-gradient(
        90deg, 
        var(--primary-dark) 0%, 
        var(--brand-primary) 20%, 
        var(--brand-primary) 80%, 
        var(--primary-dark) 100%
    );
    border-radius: 10px;
    border: 2px solid var(--black);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
    text-align: center;
    padding: 10px 20px 0 20px; 
    margin-bottom: 20px;
    overflow: hidden;
    color: var(--white);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 5;
}
.header-title { color: var(--brand-accent); font-weight: bold; font-size: 1.5em; margin: 0; }
.header-subtitle { color: var(--bg-error); font-size: 1.3em; margin: 0; font-weight: normal; }
.header-tagline-bar {
    width: calc(100% + 40px); 
    margin-left: -20px;       
    margin-top: 10px;         
    background: linear-gradient(
        90deg, 
        rgba(0, 0, 0, 0.6) 0%, 
        rgba(0, 0, 0, 0.4) 20%, 
        rgba(0, 0, 0, 0.4) 80%, 
        rgba(0, 0, 0, 0.6) 100%
    );
    color: var(--white);
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 4px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.delta-symbol {
    color: var(--brand-accent); 
    font-weight: bold;
    font-family: serif; 
}
.card {
    background-color: var(--white); border-radius: 10px; border: 2px solid var(--black);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.45); padding: 20px; margin-bottom: 20px;
    max-width: 800px; margin-left: auto; margin-right: auto;
    padding-top: 40px; 
}
h3 { margin-top: 0; border-bottom: 2px solid var(--bg-tint); padding-bottom: 10px; color: var(--brand-primary); }
#manual-loader {
    display: none; background-color: var(--bg-error); border: 2px dashed var(--brand-primary);
    padding: 15px; margin-bottom: 20px; border-radius: 8px; text-align: center;
}
.filter-group { margin-bottom: 15px; position: relative; }
.filter-group label { display: block; font-weight: bold; margin-bottom: 5px; }
.ms-button {
    width: 100%; padding: 10px; border: 2px solid var(--black); border-radius: 5px; 
    font-size: 1rem; background: var(--white); font-family: inherit; text-align: left; cursor: pointer; position: relative;
    background-image: var(--arrow-icon); 
    background-repeat: no-repeat; background-position: right 10px center;
    color: var(--black);
}
.ms-content {
    display: none; position: absolute; top: 100%; left: 5%; width: 90%; 
    background: var(--white); border: 2px solid var(--black); border-radius: 5px;
    max-height: 250px; overflow-y: auto; z-index: 100; margin-top: 5px;
    box-shadow: 6px 6px 12px rgba(0,0,0,0.4); 
}
.ms-content.show { display: block; }
.ms-item { display: flex; align-items: center; padding: 6px 10px; border-bottom: 1px solid #eee; cursor: pointer; }
.ms-item:hover { background-color: var(--bg-tint); }
.ms-item input { margin-right: 10px; width: 18px; height: 18px; accent-color: var(--brand-primary); }
.checkbox-wrapper { display: flex; align-items: center; gap: 10px; margin: 20px 0; font-weight: bold; cursor: pointer; }
.checkbox-wrapper input { width: 18px; height: 18px; accent-color: var(--brand-primary); }
.nav-btn {
    background: linear-gradient(
        180deg, 
        var(--primary-light) 0%, 
        var(--brand-primary) 30%, 
        var(--brand-primary) 65%, 
        var(--primary-dark) 100%
    );
    color: var(--white);
    border: none;
    border-top: 2px solid rgba(255,255,255,0.3);
    border-bottom: 2px solid rgba(0,0,0,0.2);
    box-shadow: 4px 4px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    text-shadow: 0 -1px 1px rgba(0,0,0,0.3);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    transition: all 0.1s ease;
}
.nav-btn:disabled {
    background: #ccc;
    border: none;
    box-shadow: none;
    text-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none !important;
}
.nav-btn:hover:not(:disabled) { background: var(--primary-dark); }
.exit-btn {
    background-color: var(--brand-accent); color: var(--brand-primary); font-weight: bold; border: 1px solid var(--brand-primary);
    padding: 8px 10px; border-radius: 5px; cursor: pointer; transition: all 0.3s ease; box-shadow: 3px 3px 4px rgba(0, 0, 0, 0.3);
}
.exit-btn:hover { background-color: #e6ac00; }
.sketch-btn {
    background-color: var(--white); color: var(--brand-primary); font-weight: bold; border: 1px solid var(--brand-primary);
    padding: 8px 10px; border-radius: 5px; cursor: pointer; transition: all 0.3s ease; box-shadow: 3px 3px 4px rgba(0, 0, 0, 0.3);
}
.sketch-btn:hover { background-color: #e6ac00; }
.danger-btn {
    background-color: var(--white); color: var(--danger-red); border: 2px solid var(--danger-red);
    padding: 10px; border-radius: 5px; font-weight: bold; cursor: pointer; width: 100%; margin-top: 20px;
}
.danger-btn:hover { background-color: var(--danger-red); color: white; }
.question-img { display: block; max-width: 100%; height: auto; margin: 15px auto; border-radius: 5px; }
.option-img { max-width: 100%; max-height: auto; display: block; margin: 0 auto; }
.options-grid { display: grid; gap: 12px; margin-top: 20px; }
.center-text { text-align: center; margin: 15px 0; }
.stmt-container { margin: 15px 0; margin-left: 40px; display: flex; flex-direction: column; gap: 7px; }
.stmt-row { display: flex; align-items: baseline; gap: 30px; }
.stmt-num { font-weight: bold; min-width: 25px; text-align: right; flex-shrink: 0; }
.stmt-text { flex-grow: 1; }
.option-btn { 
    padding: 15px; background: var(--white); border: 2px solid var(--black); border-radius: 8px; cursor: pointer; 
    font-size: 1rem; display: flex; align-items: center; width: 100%; box-sizing: border-box;
    box-shadow: 3px 3px 4px rgba(0,0,0,0.3);
}
.option-btn:hover { background-color: var(--bg-tint); border-color: var(--brand-primary); }
.option-btn.correct { background-color: #d4edda; border-color: var(--success-green); color: #155724; }
.option-btn.wrong { background-color: var(--bg-error); border-color: var(--brand-primary); color: var(--brand-primary); }
.table-row { display: grid; gap: 0; border: 2px solid var(--black); border-radius: 8px; overflow: hidden; background: var(--white); cursor: pointer; margin-bottom: 8px; }
.table-row:hover { background-color: var(--bg-tint); }
.table-row.correct { background-color: #d4edda; }
.table-row.wrong { background-color: var(--bg-error); }
.table-header { display: grid; background-color: white; color: black; font-weight: bold; border: 2px solid var(--black); border-bottom: none; border-radius: 8px 8px 0 0; padding: 10px 0; }
.table-cell { padding: 10px; border-right: 1px solid #ccc; display: flex; align-items: center; justify-content: center; text-align: center; }
.view-section { display: none; }
.active-view { display: block; animation: fadeIn 0.4s; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes shake { 0%, 100% { transform:translateX(0); } 25%, 75% { transform:translateX(-5px); } 50% { transform:translateX(5px); } }
.shake { animation: shake 0.4s ease-in-out; }
@keyframes pop { 0%, 100% { transform:scale(1); } 50% { transform:scale(1.05); } }
.pop { animation: pop 0.4s ease-in-out; z-index: 10; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 10px; }
.hud-container { display: flex; gap: 10px; justify-content: center; flex-grow: 1; }
.hud-box {
    background: var(--bg-tint); color: var(--brand-primary); padding: 8px 10px; border-radius: 5px;
    border: 1px solid var(--brand-primary); text-align: center; font-weight: bold; font-size: 1em;
    box-shadow: 3px 3px 4px rgba(0, 0, 0, 0.3); white-space: nowrap;
}
#q-progress { font-size: 0.9rem; font-weight: bold; white-space: nowrap; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-card { background: var(--white); width: 90%; max-width: 450px; border-radius: 10px; padding: 20px; border: 2px solid var(--black); box-shadow: 0 4px 15px rgba(0,0,0,0.5); max-height: 90vh; overflow-y: auto; }
.stat-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #eee; }
.stat-val { font-weight: bold; color: var(--brand-primary); }
.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px; 
    margin-top: 15px;
    text-align: center;
    padding: 10px; 
}
.badge-item { opacity: 0.3; filter: grayscale(100%); transition: all 0.3s; }
.badge-item.unlocked {
    opacity: 1; 
    filter: grayscale(0%); 
    transform: scale(1.05);
    box-shadow: 0 0 8px 1px var(--brand-accent);
    background-color: rgba(255, 255, 255, 0.95); 
    border-radius: 8px; 
    position: relative;
    z-index: 2;
}
.badge-icon { font-size: 2rem; display: block; }
.badge-name { font-size: 0.7rem; display: block; margin-top: 2px; line-height: 1.1; }
.preview-table { width: 75%; margin: 10px auto; border-collapse: collapse; font-size: 0.9em; }
.preview-table th { background-color: white; color: black; padding: 8px; border: 1px solid black; }
.preview-table td { padding: 8px; border: 1px solid black; text-align: center; }
.combined-table-container { border: 2px solid var(--black); border-radius: 8px; overflow: hidden; background-color: var(--white); margin-top: 20px; }
.table-row-item { display: grid; border-bottom: 1px solid black; cursor: pointer; transition: background 0.1s; }
.table-row-item:last-child { border-bottom: none; }
.table-row-item:hover { background-color: var(--bg-tint); }
.table-row-item.correct { background-color: #d4edda; color: #155724; } 
.table-row-item.wrong { background-color: #f8d7da; color: #721c24; }
.table-header-row { display: grid; border-bottom: 2px solid var(--black); background-color: var(--white); font-weight: bold; }
.table-letter-cell { background-color: white; color: var(--brand-primary); font-weight: bold; display: flex; align-items: center; justify-content: center; border-right: 1px solid black; }
.table-data-cell { padding: 10px; display: flex; align-items: center; justify-content: center; text-align: center; border-right: 1px solid black; }
.table-data-cell:last-child { border-right: none; }
.header-content-cell { background-color: white; color: black; padding: 10px; display: flex; align-items: center; justify-content: center; text-align: center; border-right: 1px solid black; }
.header-content-cell:last-child { border-right: none; }
.header-empty-cell { background-color: transparent; }
.table-data-cell .katex {
    position: relative;
    top: 1px; 
}
#notepad-drawer {
    position: fixed; bottom: -35vh; left: 0; width: 100%; height: 33vh; background-color: #fff;
    border-top: 4px solid var(--brand-primary); box-shadow: 0 -5px 15px rgba(0,0,0,0.3); z-index: 3000;
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); display: flex; flex-direction: column;
    background-image: linear-gradient(rgba(200, 200, 200, 0.3) 1px, transparent 1px), linear-gradient(90deg, rgba(200, 200, 200, 0.3) 1px, transparent 1px);
    background-size: 20px 20px;
}
#notepad-drawer.open { bottom: 0; }
#view-quiz { position: relative; transition: height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
#view-quiz.shrunk { height: 67vh; overflow-y: auto; padding-bottom: 20px; box-sizing: border-box; }
#view-quiz.frozen { overflow-y: hidden !important; }
#overlay-canvas {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 50; 
    pointer-events: none; 
    touch-action: none; 
}
.annotating #overlay-canvas { pointer-events: auto; background-color: rgba(0,0,0,0.02); }
.notepad-toolbar-new { background-color: var(--white); padding: 5px; display: flex; gap: 8px; border-bottom: 1px solid #ccc; align-items: center; justify-content: flex-end; }
.notepad-canvas-container { flex-grow: 1; position: relative; overflow: hidden; width: 100%; touch-action: none; }
.tool-icon-btn {
    width: 32px; height: 32px; border-radius: 5px; border: 1px solid #ccc; cursor: pointer;
    display: flex; justify-content: center; align-items: center; font-size: 1.2rem; background: white;
}
.tool-icon-btn img {
    pointer-events: none;
}
.tool-icon-btn:hover { background: #f0f0f0; }
.tool-icon-btn.active { border-color: black; background: #eee; transform: scale(1.1); }
.about-meta-header {
    text-align: center; margin-bottom: 20px;  padding-bottom: 15px;
}
.about-title {
    color: var(--brand-primary); text-decoration: underline; margin: 0 0 10px 0; font-size: 1.4rem;
}
.about-details {
    font-size: 0.9rem; color: var(--black); line-height: 1.4;
}
.manual-content {
    text-align: left; font-size: 0.9rem; line-height: 1.5; color: var(--black);
}
.manual-content h4 {
    color: var(--brand-primary); margin: 15px 0 5px 0; border-bottom: 1px solid #ccc; font-size: 1rem;
}
.manual-icon {
    width: 20px; height: 20px; vertical-align: text-bottom; margin: 0 2px; display: inline-block;
}
#toast-container {
    position: fixed; bottom: 40%; left: 50%; transform: translateX(-50%);
    width: 200px; background: var(--white); color: var(--black);
    border: 2px solid var(--brand-primary); border-radius: 15px; padding: 15px;
    font-weight: bold; text-align: center; z-index: 5000; opacity: 0; pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center;
}
@keyframes floatUpFade {
    0% { opacity: 0; transform: translate(-50%, 0); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -30vh); }
}
.toast-active { animation: floatUpFade 2.5s ease-out forwards; }
#view-focus-list {
    height: 100vh;
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
}
.focus-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}
.focus-select {
    padding: 8px;
    border: 2px solid var(--black);
    border-radius: 5px;
    flex-grow: 1;
    font-size: 1rem;
}
.focus-list-container {
    background: white;
    border: 2px solid var(--black);
    border-radius: 8px;
    overflow: hidden;
}
.focus-header-row {
    display: grid;
    grid-template-columns: 40px 30px 1fr 60px 30px;
    background: var(--brand-primary);
    color: white;
    font-weight: bold;
    padding: 7px;
    font-size: 0.9em;
    gap: 5px;
}
.focus-item-row {
    display: grid;
    grid-template-columns: 40px 30px 1fr 60px 30px;
    border-bottom: 1px solid #ccc;
    padding: 12px 6px;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    gap: 4px;
}
.focus-item-row:hover { background-color: var(--bg-tint); }
.focus-item-row:last-child { border-bottom: none; }
.focus-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-bin { cursor: pointer; display: flex; justify-content: center; align-items: center; opacity: 0.7; }
.focus-bin:hover { opacity: 1; transform: scale(1.1); }
.fab-wrapper {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    z-index: 2000;
}
.fab-main-btn {
    background-color: black;
    color: var(--primary-accent);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
    border: none;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 2020;
    display: flex;
    justify-content: center;
    align-items: center;
}
.fab-main-btn .app-logo {
    width: 40px;
    height: 40px;
    filter: none; 
    margin-top: -6px;
}
.fab-main-btn:hover { background-color: var(--primary-accent); color: black; }
.fab-wrapper.open .fab-main-btn {
    background-color: var(--primary-accent);
    color: black;
    opacity: 1;
    transform: rotate(90deg);
    box-shadow: 0 6px 12px rgba(128, 0, 0, 0.4);
}
.fab-items {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.fab-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--brand-primary);
    background-color: white;
    color: var(--brand-primary);
    cursor: pointer;
    box-shadow: 4px 4px 6px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 6px; 
    right: 6px;
    opacity: 0;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.215, 0.610, 0.355, 1.000); 
}
.fab-action-btn:hover { 
    background-color: var(--bg-tint); 
}
.fab-wrapper.open .fab-action-btn {
    opacity: 1;
    pointer-events: auto;
}
.fab-action-btn:nth-child(1) { z-index: 2010; }
.fab-wrapper.open .fab-action-btn:nth-child(1) { transform: translateY(-75px); }
.fab-wrapper.open .fab-action-btn:nth-child(1):hover { transform: translateY(-75px) scale(1.1); }
.fab-action-btn:nth-child(2) { z-index: 2009; }
.fab-wrapper.open .fab-action-btn:nth-child(2) { transform: translateY(-135px); }
.fab-wrapper.open .fab-action-btn:nth-child(2):hover { transform: translateY(-135px) scale(1.1); }
.fab-action-btn:nth-child(3) { z-index: 2008; }
.fab-wrapper.open .fab-action-btn:nth-child(3) { transform: translateY(-195px); }
.fab-wrapper.open .fab-action-btn:nth-child(3):hover { transform: translateY(-195px) scale(1.1); }
.fab-action-btn:nth-child(4) { z-index: 2007; }
.fab-wrapper.open .fab-action-btn:nth-child(4) { transform: translateY(-255px); }
.fab-wrapper.open .fab-action-btn:nth-child(4):hover { transform: translateY(-255px) scale(1.1); }
.fab-action-btn:nth-child(5) { z-index: 2006; }
.fab-wrapper.open .fab-action-btn:nth-child(5) { transform: translateY(-315px); }
.fab-wrapper.open .fab-action-btn:nth-child(5):hover { transform: translateY(-315px) scale(1.1); }
.fab-action-btn:nth-child(6) { z-index: 2005; }
.fab-wrapper.open .fab-action-btn:nth-child(6) { transform: translateY(-375px); }
.fab-wrapper.open .fab-action-btn:nth-child(6):hover { transform: translateY(-375px) scale(1.1); }            
.image-modal-card {
    width: 95%;
    height: 90vh; 
    max-width: 800px;
    padding: 0; 
    display: flex;
    flex-direction: column;
    background: var(--white);
    overflow: hidden; 
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--white);
    border-bottom: 2px solid var(--brand-primary);
    flex-shrink: 0; 
    z-index: 10;
}
.modal-header h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--brand-primary);
}
.modal-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--black);
    padding: 0 10px;
}
.zoom-container {
    flex-grow: 1;
    overflow: auto; 
    -webkit-overflow-scrolling: touch; 
    background-color: #f0f0f0; 
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}
.sheet-image {
    display: block;
    max-width: 100%; 
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: 0 0;
}
@media (max-width: 600px) {
    .sheet-image {
        max-width: none; 
        width: 160%; 
    }
}
[data-theme="dark"] .sketch-btn img,
[data-theme="dark"] .fab-action-btn img,
[data-theme="dark"] .tool-icon-btn img,
[data-theme="dark"] .exit-btn img {
    filter: invert(1);
}
[data-theme="dark"] .fab-main-btn {
    color: white;
}
[data-theme="dark"] .exit-btn {
    background-color: #4e3e00; 
    color: var(--brand-accent);       
    border-color: var(--brand-accent);
}
[data-theme="dark"] .exit-btn:hover {
    background-color: #665200; 
}
[data-theme="dark"] .question-img, 
[data-theme="dark"] .option-img {
    filter: invert(1) hue-rotate(180deg);
    mix-blend-mode: screen;  
}
.heatmap-unit-label {
    font-size: 1rem; font-weight: bold; color: var(--brand-primary); 
    margin-top: 15px; margin-bottom: 8px; border-bottom: 2px solid var(--bg-tint);
    padding-bottom: 4px;
}
.heatmap-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 5px;
}
.heatmap-item {
    padding: 5px 5px; border-radius: 8px; text-align: center; 
    border: 1px solid rgba(0,0,0,0.1); font-size: 0.85rem;
    display: flex; flex-direction: column; justify-content: center;
    box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
    height: 55px;
}
.hm-topic { 
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hm-score { font-size: 0.8rem; opacity: 0.9; }
.hm-80 { background-color: #00B050; color: white; border-color: #00703f; }
[data-theme="dark"] .hm-80 { background-color: #00693e; color: #f1f1f1; border-color: #004d2e; }
.hm-70 { background-color: #41D852; color: #33691e; border-color: #9cc600; }
[data-theme="dark"] .hm-70 { background-color: #39B245; color: #1a3300; border-color: #6d9300; }
.hm-60 { background-color: #00C1A5; color: #004d40; border-color: #00b8d4; }
[data-theme="dark"] .hm-60 { background-color: #00967F; color: #e0f7fa; border-color: #00838f; }
.hm-50 { background-color: #ffd700; color: #3e2723; border-color: #ffc107; }
[data-theme="dark"] .hm-50 { background-color: #ffb300; color: #3e2723; border-color: #ffa000; }
.hm-40 { background-color: #ff9100; color: #3e2723; border-color: #ff6d00; }
[data-theme="dark"] .hm-40 { background-color: #e65100; color: #fff3e0; border-color: #ef6c00; }
.hm-fail { background-color: #ff5252; color: white; border-color: #ff1744; }
[data-theme="dark"] .hm-fail { background-color: #c62828; color: #ffebee; border-color: #b71c1c; }
.hm-none { background-color: #f2f2f2; color: #666; border-color: #ddd; }
[data-theme="dark"] .hm-none { background-color: #333; color: #aaa; border-color: #444; }
.legend-grid {
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 5px; margin-bottom: 10px;
    padding-bottom: 10px; border-bottom: 2px solid #ccc;
}
.legend-item {
    font-size: 0.75rem; padding: 4px; border-radius: 4px; 
    text-align: center; border: 1px solid rgba(0,0,0,0.1); font-weight: bold;
}
.heatmap-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #ccc;
}
.hm-btn {
    width: 90px;
    background-color: var(--white);
    color: var(--brand-primary);
    font-weight: bold;
    border: 1px solid var(--brand-primary);
    padding: 8px 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 3px 3px 4px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    white-space: nowrap;
}
.hm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.25);
}
.hm-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.hm-btn.active {
    background-color: var(--brand-accent);
    border-color: #b38600; 
    color: var(--black);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    transform: none;
}
.sticky-modal-card {
    display: flex; flex-direction: column;
    max-height: 90vh; overflow: hidden; 
}
.scrollable-content {
    flex-grow: 1;
    overflow-y: auto; 
    padding-right: 5px; 
}
.timer-box {
    background-color: var(--black); 
    color: var(--white);
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
    display: none; 
}
.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 8px;
    margin-top: 15px; margin-bottom: 20px;
}
.review-item {
    padding: 10px 5px;
    border: 1px solid var(--black);
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    background: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
}
.review-item.correct { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.review-item.wrong   { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
[data-theme="dark"] .review-item.correct { background-color: #1b4d2e; color: #d4edda; border-color: #2f6f44; }
[data-theme="dark"] .review-item.wrong   { background-color: #5c1e23; color: #f8d7da; border-color: #8a2e34; }
@keyframes card-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); border-color: var(--black); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); border-color: var(--danger-red); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); border-color: var(--black); }
}
.card-warning {
    animation: card-pulse 2.0s infinite;
    border-color: var(--danger-red) !important;
}
.timer-warning-low {
    background-color: #ffc107 !important; 
    color: black !important;
}
.timer-warning-critical {
    background-color: #dc3545 !important; 
    animation: card-pulse 2.0s infinite;
    border-color: var(--danger-red) !important;            }
.option-btn.recorded {
    background-color: #e0e0e0;
    border-color: #999;
    color: #555;
}
[data-theme="dark"] .option-btn.recorded {
    background-color: #444;
    border-color: #666;
    color: #ccc;
}
#sel-limit-count {
    background-color: var(--white);
    color: var(--black);
    border: 2px solid var(--black);
}
.nav-btn:active:not(:disabled),
.exit-btn:active,
.sketch-btn:active,
.option-btn:active,
.fab-action-btn:active,
.tool-icon-btn:active {
    transform: scale(0.96);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2); 
}
.split-btn-container {
    display: flex;
    position: relative; 
    width: 100%;
    margin-top: 20px;
    box-shadow: 4px 4px 6px rgba(0,0,0,0.3); 
    border-radius: 6px;
}
.split-main {
    flex-grow: 1; 
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin: 0; 
    box-shadow: none; 
    text-align: center;
}
.split-trigger {
    width: 50px; 
    flex-shrink: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-left: 2px solid rgba(0,0,0,0.3); 
}
.split-main:active:not(:disabled) { transform: scale(0.98); }
.split-trigger:active:not(:disabled) { transform: scale(0.96); }
.mode-dropdown {
    display: none;
    position: absolute;
    top: 105%; 
    right: 0;
    width: 100%; 
    background-color: var(--white);
    border: 2px solid var(--black);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    animation: slideDown 0.2s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.mode-option {
    padding: 5px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}
.mode-option:last-child { border-bottom: none; }
.mode-option:hover { background-color: var(--bg-tint); }
.mode-option.selected {
    background-color: #f0f0f0;
    border-left: 4px solid var(--brand-primary);
}
.mode-title {
    display: block;
    font-weight: bold;
    color: var(--brand-primary);
    font-size: 1rem;
    margin-bottom: 4px;
}
.mode-desc {
    display: block;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.3;
}
.mode-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f9f9f9;
}
.bottom-spacer {
    height: 40px;
    width: 100%;
    pointer-events: none; 
}
.lifeline-bar {
    display: none; 
    justify-content: center;
    gap: 25px; 
    margin-bottom: 25px;
    position: relative;
}
.lifeline-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; 
}
.lifeline-btn:hover {
    transform: scale(1.15); 
}
.lifeline-icon {
    width: 48px; 
    height: 48px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(4px 4px 4px rgba(0,0,0,0.3)); 
}
.lifeline-label {
    font-size: 0.65rem; 
    font-weight: bold;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1;
}
.lifeline-btn.used {
    opacity: 0.2; 
    filter: grayscale(100%);
    pointer-events: none;
    transform: scale(0.9);
}
.lifeline-btn.active .lifeline-icon {
    filter: drop-shadow(0 0 8px var(--brand-primary)) brightness(1.2);
    animation: pulse-icon 1.5s infinite;
}
.lifeline-btn.active .lifeline-label {
    color: var(--brand-primary);
}
@keyframes pulse-icon {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.count-label {
    color: color-mix(in srgb, var(--brand-primary), white 40%);
    font-weight: normal;
    font-size: 0.9em;
    margin-left: 5px;
}
.modal-nav-btn {
    background: var(--brand-primary);
    color: var(--white);
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s;
}
.modal-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.modal-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}
.logo-wrapper {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-75%);
    width: 65px;
    height: 65px;
    z-index: 10;
    color: var(--primary-light); 
}
.app-logo {
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.header-container:hover .app-logo {
    transform: scale(1.1);
}
.modal-card {
    position: relative !important;
    overflow: hidden !important; 
    z-index: 1;
    display: flex !important;    
    flex-direction: column !important;
    max-height: 90vh !important; 
}
.modal-scroll-area {
    flex: 1;                
    overflow-y: auto;       
    z-index: 2;             
    padding-right: 5px;     
    scrollbar-width: thin;  
}
.modal-watermark {
    position: absolute !important; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: auto;
    opacity: 0.05;      
    pointer-events: none;
    z-index: -1;        
    display: block; 
}
.modal-watermark svg {
    display: block;
    width: 100%;
    height: auto;
}
.modal-brand-strip {
    background: linear-gradient(
        90deg, 
        var(--primary-dark) 0%, 
        var(--brand-primary) 20%, 
        var(--brand-primary) 80%, 
        var(--primary-dark) 100%
    );
    color: var(--white);
    padding: 5px;
    text-align: center;
    border-bottom: 2px solid var(--black);
    margin-top: -20px;
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: 20px;
    border-radius: 8px 8px 0 0;
}
.modal-brand-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--brand-accent);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    font-weight: bold;
}
@media (max-width: 600px) {
    .logo-wrapper {
        width: 45px; 
        height: 45px;
    }
}
