
        /* 1. Η κανονική (Regular) γραμματοσειρά που ξέρουμε ότι είναι τέλεια στα Ελληνικά */
        @font-face {
            font-family: 'OpenDyslexic';
            src: url('../../shared/fonts/opendyslexic/OpenDyslexic-Kidmedia.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }

        /* 2. Η έντονη (Bold) γραμματοσειρά Alta */
        @font-face {
            font-family: 'OpenDyslexic';
            src: url('../../shared/fonts/opendyslexic/OpenDyslexicAlta-Bold.ttf') format('truetype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 3. Kidmedia 2.000 (SIL OFL 1.1, βασισμένη στην Playpen Sans) - η οικογένεια λέγεται 'Kids' όπως πριν (μενού, συνδέσμοι) */
        @font-face {
            font-family: 'Kids';
            src: url('../../shared/fonts/kidmedia/Kidmedia-Regular.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }

        /* 4. Comic Neue */
        @font-face {
            font-family: 'Comic Neue';
            src: url('../../shared/fonts/Greek/ComicNeue-Regular.ttf') format('truetype'),
                 url('../../shared/fonts/Latin/ComicNeue-Regular.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Comic Neue';
            src: url('../../shared/fonts/Greek/ComicNeue-Bold.ttf') format('truetype'),
                 url('../../shared/fonts/Latin/ComicNeue-Bold.ttf') format('truetype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 5. Vollkorn */
        @font-face {
            font-family: 'Vollkorn';
            src: url('../../shared/fonts/Vollkorn[wght].ttf') format('truetype');
            font-weight: 100 900;
            font-style: normal;
            font-display: swap;
        }

        /* 6. Playpen Sans */
        @font-face {
            font-family: 'Playpen Sans';
            src: url('../../shared/fonts/PlaypenSans[wght].ttf') format('truetype');
            font-weight: 100 800;
            font-style: normal;
            font-display: swap;
        }

        /* 7. Libertinus Sans & Serif */
        @font-face {
            font-family: 'Libertinus Sans';
            src: url('../../shared/fonts/LibertinusSans-Regular.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Libertinus Sans';
            src: url('../../shared/fonts/LibertinusSans-Bold.otf') format('opentype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Libertinus Serif';
            src: url('../../shared/fonts/LibertinusSerif-Regular.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Libertinus Serif';
            src: url('../../shared/fonts/LibertinusSerif-Bold.otf') format('opentype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 8. Open Sans & Roboto (Google Sans) */
        @font-face {
            font-family: 'Open Sans';
            src: url('../../shared/fonts/OpenSans[wdth,wght].ttf') format('truetype');
            font-weight: 300 800;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Roboto';
            src: url('../../shared/fonts/Roboto[wdth,wght].ttf') format('truetype');
            font-weight: 100 900;
            font-style: normal;
            font-display: swap;
        }

        /* 9. Adys (Cyrillic Dyslexia) */
        @font-face {
            font-family: 'Adys';
            src: url('../../shared/fonts/Cyrillic/ADYS-Regular-V5-4.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Adys';
            src: url('../../shared/fonts/Cyrillic/ADYS-Bold-V5-4.otf') format('opentype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 10. PT Sans */
        @font-face {
            font-family: 'PT Sans';
            src: url('../../shared/fonts/Cyrillic/PT_Sans-Web-Regular.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'PT Sans';
            src: url('../../shared/fonts/Cyrillic/PT_Sans-Web-Bold.ttf') format('truetype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 11. Lexend (Latin Dyslexia) */
        @font-face {
            font-family: 'Lexend';
            src: url('../../shared/fonts/Latin/Lexend[wght].ttf') format('truetype');
            font-weight: 100 900;
            font-style: normal;
            font-display: swap;
        }

        /* 12. CMU Sans Serif */
        @font-face {
            font-family: 'CMU Sans Serif';
            src: url('../../shared/fonts/cmunss.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'CMU Sans Serif';
            src: url('../../shared/fonts/cmunsx.otf') format('opentype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 13. Noto Sans & Fira Sans */
        @font-face {
            font-family: 'Noto Sans';
            src: url('../../shared/fonts/NotoSans[wdth,wght].ttf') format('truetype');
            font-weight: 100 900;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Fira Sans';
            src: url('../../shared/fonts/FiraSans-Regular.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'Fira Sans';
            src: url('../../shared/fonts/FiraSans-Bold.ttf') format('truetype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }

        /* 14. Επίσημη OpenDyslexic (Official Free OpenDyslexic για όλες τις άλλες γλώσσες εκτός Ελληνικών) */
        @font-face {
            font-family: 'OpenDyslexicOfficial';
            src: url('../../shared/fonts/OpenDyslexic-Regular.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'OpenDyslexicOfficial';
            src: url('../../shared/fonts/OpenDyslexic-Bold.otf') format('opentype');
            font-weight: bold;
            font-style: normal;
            font-display: swap;
        }
        @font-face {
            font-family: 'OpenDyslexicOfficial';
            src: url('../../shared/fonts/OpenDyslexic-Italic.otf') format('opentype');
            font-weight: normal;
            font-style: italic;
            font-display: swap;
        }
        @font-face {
            font-family: 'OpenDyslexicOfficial';
            src: url('../../shared/fonts/OpenDyslexic-BoldItalic.otf') format('opentype');
            font-weight: bold;
            font-style: italic;
            font-display: swap;
        }
    
        :root {
            --bg-color: #E8ECEF; 
            --primary-btn: #4fc3f7;
            --primary-btn-hover: #039be5;
            --secondary-btn: #ffab91;
            --accent-dark: #1A2B4C;
            
            /* Dynamic Variables controlled by JS */
            --dynamic-font-family: 'OpenDyslexic', 'OpenDyslexicRegular', 'Comic Sans MS', 'Verdana', sans-serif;
            --dynamic-font-size: 3rem;
            --dynamic-font-weight: normal;
            --dynamic-text-color: #333333;
            --dynamic-text-bg-color: #FDF9E3;
            --dynamic-app-bg-color: #E8ECEF;
            --veil-color-rgb: 0, 0, 0; 
            --veil-opacity: 0.5;
            
            /* Smart Highlight Colors */
            --highlight-text-color: #e53935;
            --highlight-shadow: rgba(229, 57, 53, 0.3);
        }

        * { box-sizing: border-box; }

        body {
            margin: 0;
            padding: 0;
            font-family: 'Open Sans', sans-serif; 
            background-color: var(--dynamic-app-bg-color, var(--bg-color));
            color: #1A2B4C;
            height: 100vh;
            height: 100dvh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
            transition: background-color 0.3s ease;
        }

        /* --- UI Components --- */
        button {
            font-family: inherit;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 0 4px 6px rgba(0,0,0,0.15);
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
        }

        button:active { transform: scale(0.96); box-shadow: 0 2px 3px rgba(0,0,0,0.1); }
        button:disabled { opacity: 0.6; cursor: not-allowed; }

        .btn-icon-only { width: 50px; height: 50px; font-size: 1.5rem; color: #333; }
        
        .btn-icon-small {
            width: 40px; height: 40px; font-size: 1.2rem;
            border-radius: 8px; color: #333; background: #fff;
        }
        .btn-icon-small:hover:not(:disabled) { background: #f0f0f0; }

        .container {
            max-width: 1200px; margin: 0 auto; padding: 20px;
            width: 100%; flex-grow: 1; display: flex; flex-direction: column;
        }

        label { font-weight: bold; font-size: 0.9rem; margin-bottom: 4px; display: block; }
        
        select, input[type="range"] {
            width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #ccc;
        }
        
        input[type="password"], input[type="text"].api-input {
            width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #ccc;
            font-family: 'Open Sans', sans-serif;
        }
        input:disabled { background-color: #f5f5f5; color: #888; }

        input[type="color"] {
            -webkit-appearance: none; border: none; width: 40px; height: 40px;
            padding: 0; border-radius: 8px; cursor: pointer; overflow: hidden;
        }
        input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
        input[type="color"]::-webkit-color-swatch { border: none; }

        /* --- Top Left Actions (Screen 1) --- */
        #top-left-actions {
            position: absolute;
            top: 15px;
            left: 15px;
            z-index: 50;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        #btn-fullscreen-toggle {
            width: 46px;
            height: 46px;
            font-size: 1.25rem;
            border-radius: 50%;
            background-color: #fff;
            color: #333;
            box-shadow: 0 4px 10px rgba(0,0,0,0.15);
            cursor: pointer;
            transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        #btn-fullscreen-toggle:hover {
            transform: translateY(-2px) scale(1.05);
            background-color: #f5f5f5;
            box-shadow: 0 6px 14px rgba(0,0,0,0.2);
        }
        #btn-fullscreen-toggle:active {
            transform: translateY(1px) scale(0.98);
        }

        .exit-btn {
            width: 46px;
            height: 46px;
            font-size: 1.3rem;
            font-weight: 900;
            border-radius: 50%;
            background-color: #e53935 !important;
            color: #ffffff !important;
            border: 2px solid #ffffff;
            box-shadow: 0 4px 10px rgba(229, 57, 53, 0.35);
            cursor: pointer;
            transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .exit-btn:hover {
            background-color: #c62828 !important;
            transform: translateY(-2px) scale(1.06);
            box-shadow: 0 6px 14px rgba(229, 57, 53, 0.45);
        }
        .exit-btn:active {
            transform: translateY(1px) scale(0.98);
        }

        /* --- Top Right Actions (Language & PWA Install) --- */
        #top-right-actions {
            position: absolute;
            top: 15px;
            right: 20px;
            z-index: 50;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .top-action-circle-btn {
            width: 46px;
            height: 46px;
            font-size: 1.25rem;
            border-radius: 50%;
            background-color: #fff;
            color: #1976d2;
            box-shadow: 0 4px 10px rgba(0,0,0,0.15);
            transition: transform 0.2s, background-color 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .top-action-circle-btn:hover {
            transform: scale(1.08);
            background-color: #f0f7ff;
        }

        /* --- Language Button (Top Right) --- */
        #btn-lang-selector {
            width: 46px;
            height: 46px;
            font-size: 1.5rem;
            border-radius: 50%;
            background-color: #fff;
            box-shadow: 0 4px 10px rgba(0,0,0,0.15);
            transition: transform 0.2s;
            overflow: hidden; 
            display: flex;
            align-items: center;
            justify-content: center;
            border: none;
            cursor: pointer;
        }
        #btn-lang-selector:hover { transform: scale(1.08); }
        .fi { border-radius: 4px; } 
        #btn-lang-selector .fi { border-radius: 50%; width: 1.2em; line-height: 1.2em; height: 1.2em; } 

        /* --- Persistent Erasmus+ Footer (Screen 1) --- */
        .persistent-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(255, 255, 255, 0.85);
            backdrop-filter: blur(5px);
            border-top: 1px solid rgba(0, 0, 0, 0.08);
            border-radius: 8px;
            padding: 4px 14px;
            margin-top: 6px;
            gap: 14px;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
            flex-shrink: 0;
        }
        .persistent-footer .footer-left img {
            height: 26px;
            max-height: 26px;
            object-fit: contain;
            display: block;
        }
        .persistent-footer .footer-right {
            text-align: right;
            font-size: 0.63rem;
            line-height: 1.2;
            color: #555;
            max-width: 82%;
        }
        .persistent-footer .footer-right p {
            margin: 0;
        }
        @media (max-width: 768px) {
            .persistent-footer {
                flex-direction: column;
                align-items: center;
                text-align: center;
                gap: 4px;
                padding: 4px 8px;
            }
            .persistent-footer .footer-right {
                text-align: center;
                max-width: 100%;
                font-size: 0.60rem;
            }
            .persistent-footer .footer-left img {
                height: 22px;
                max-height: 22px;
            }
        }

        /* --- Screen 1: Teacher Input & Settings --- */
        #screen-teacher {
            display: flex; flex-direction: column; height: 100%; overflow: hidden; 
            padding-top: 15px; /* Aligns exactly with top action buttons */
        }

        .header-title {
            text-align: center;
            margin: 0 0 4px 0;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .header-title h1 {
            color: #2c3e50;
            margin: 0 0 1px 0;
            font-size: 1.55rem;
            line-height: 1.15;
            font-family: 'OpenDyslexic', sans-serif;
        }

        .header-title p {
            margin: 0 0 4px 0;
            opacity: 0.75;
            font-size: 0.88rem;
            line-height: 1.15;
        }

        /* Two separate logos (owner decision 2026-10-16): KIDMEDIA left of the
           title, SESAT right of it, both linking to kidmedia.net. No white frame:
           both PNGs have a transparent background. On a phone see below. */
        .header-brand-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 18px;
            margin-bottom: 2px;
        }
        .header-title-text {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 0;
        }
        .header-logo-link {
            display: block;
            flex-shrink: 0;
            line-height: 0;
        }
        .header-logo-link img {
            display: block;
            width: auto;
            transition: transform 0.2s ease;
        }
        .header-logo-kidmedia img { height: 44px; }
        .header-logo-sesat img { height: 58px; }
        .header-logo-link:hover img,
        .header-logo-link:focus-visible img {
            transform: scale(1.04);
        }

        @media (min-width: 768px) {
            .settings-panel {
                margin-top: 48px; /* Clearance for top-right action buttons */
            }
        }

        @media (max-width: 767px) {
            #screen-teacher {
                padding-top: 12px;
            }
            /* Phone: no room beside the title (round buttons in both top
               corners), so the two logos share one row above it, between the
               buttons (46px + 15px margin each side), and the title goes below. */
            .header-title {
                align-self: stretch;
            }
            .header-brand-row {
                display: grid;
                grid-template-columns: 1fr 1fr;
                grid-template-areas: "kidmedia sesat" "title title";
                align-items: center;
                gap: 2px 8px;
                margin-bottom: 0;
            }
            .header-logo-kidmedia { grid-area: kidmedia; justify-self: start; margin-left: 66px; }
            .header-logo-sesat { grid-area: sesat; justify-self: end; margin-right: 66px; }
            .header-title-text { grid-area: title; }
            .header-logo-kidmedia img { height: 26px; }
            .header-logo-sesat img { height: 40px; }
            .header-title h1 {
                font-size: 1.3rem;
            }
            .header-title p {
                font-size: 0.8rem;
            }
        }
        h1 { color: #2c3e50; margin: 0 0 10px 0; font-family: 'OpenDyslexic', sans-serif; }
        
        .main-layout {
            display: grid; grid-template-columns: 2fr 1fr; gap: 20px; flex-grow: 1;
            min-height: 0;
        }

        .input-section { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
        
        textarea {
            flex-grow: 1; width: 100%; padding: 15px; font-size: 1.1rem;
            border: 2px solid #ccc; border-radius: 12px; resize: none;
            font-family: var(--dynamic-font-family, 'OpenDyslexic', sans-serif);
            font-weight: var(--dynamic-font-weight, normal);
            color: var(--dynamic-text-color, #333333);
            background-color: var(--dynamic-text-bg-color, #FDF9E3);
            min-height: 0; overflow-y: auto;
            transition: background-color 0.2s, color 0.2s, font-family 0.2s;
        }
        
        .textarea-actions { 
            display: flex; justify-content: center; gap: 15px; padding: 10px 0; flex-wrap: wrap;
        }

        .big-action-btn {
            width: 70px; height: 70px; font-size: 2rem; border-radius: 15px;
            color: white; display: flex; align-items: center; justify-content: center;
        }
        
        #btn-help { background-color: #0288d1; }
        #btn-print { background-color: #00897b; }
        #btn-load-txt { background-color: #42a5f5; }
        #btn-save-txt { background-color: #ffca28; color: #333;}
        #btn-share { background-color: #9c27b0; }
        #btn-start { background-color: #66bb6a; }

        #btn-help:hover { background-color: #0277bd; }
        #btn-print:hover { background-color: #00695c; }
        #btn-load-txt:hover { background-color: #1e88e5; }
        #btn-save-txt:hover { background-color: #ffb300; }
        #btn-share:hover { background-color: #7b1fa2; }
        #btn-start:hover { background-color: #43a047; }

        .big-action-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0,0,0,0.2);
        }

        /* Cloud Story Fetcher Styles */
        .story-fetch-container {
            display: flex; align-items: center; background: #fff;
            border: 2px solid #ccc; border-radius: 15px; padding: 0 5px 0 15px;
            height: 70px; box-shadow: 0 4px 6px rgba(0,0,0,0.15); transition: all 0.2s;
        }
        .story-fetch-container:focus-within {
            border-color: #42a5f5; box-shadow: 0 4px 12px rgba(66, 165, 245, 0.3);
        }
        .story-fetch-container input {
            border: none; width: 60px; font-size: 1.5rem; text-align: center;
            outline: none; font-family: 'Open Sans', sans-serif; font-weight: bold;
            color: #333; background: transparent;
        }
        .story-fetch-container input::-webkit-outer-spin-button,
        .story-fetch-container input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
        .story-fetch-container input[type=number] { -moz-appearance: textfield; }
        .story-fetch-container span { font-size: 1.2rem; color: #888; font-weight: bold; margin-right: 10px; }

        /* Step D6 (2026-10-04, owner: "the 6 buttons below could be in one
           line"): on phones the "1 / 301" box gets its own row and the six
           action buttons (help, print, load, save, share, start) share ONE
           row - square, as wide as the row allows (max 70px as on the PC):
           52px at 390px, 47px at 360px, 40px at 320px. PC unchanged.
           tests/smoke/browser-action-buttons.js checks it. */
        @media (max-width: 767px) {
            .textarea-actions {
                gap: 8px;
            }
            .textarea-actions .story-fetch-container {
                flex: 1 0 100%;
                justify-content: center;
                box-sizing: border-box;
            }
            .textarea-actions .big-action-btn {
                width: calc((100% - 40px) / 6);
                max-width: 70px;
                height: auto;
                aspect-ratio: 1 / 1;
                font-size: 1.5rem;
                border-radius: 12px;
            }
            @supports not (aspect-ratio: 1 / 1) {
                .textarea-actions .big-action-btn { height: 48px; }
            }
        }

        /* Settings Panel */
        .settings-panel {
            background-color: rgba(255,255,255,0.7); padding: 20px;
            border-radius: 12px; display: flex; flex-direction: column;
            gap: 20px; overflow-y: auto;
        }

        .setting-group { border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 15px; }
        .setting-group:last-child { border-bottom: none; }
        .setting-group h3 { margin: 0 0 10px 0; font-size: 1.1rem; color: #444; }

        .controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
        .full-width { grid-column: span 2; }
        
        .color-row {
            display: flex; align-items: center; justify-content: space-between;
            background: rgba(255,255,255,0.5); padding: 8px; border-radius: 8px;
        }
        .color-row label { margin: 0; }

        /* Color Button Cards (Screen 1) */
        .color-btn-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            background: #ffffff;
            border: 1.5px solid #d0d0d0;
            border-radius: 12px;
            padding: 10px 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.06);
            transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
            cursor: pointer;
        }
        .color-btn-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 10px rgba(0,0,0,0.12);
            border-color: #999;
        }
        .color-btn-card label {
            margin: 0;
            cursor: pointer;
        }
        .color-btn-card input[type="color"] {
            width: 55px;
            height: 38px;
            border: 2px solid #ccc;
            border-radius: 8px;
            cursor: pointer;
            padding: 2px;
            background: #ffffff;
            box-shadow: inset 0 0 3px rgba(0,0,0,0.1);
        }

        /* Reset to the dyslexia-friendly default colours */
        .reset-colors-btn {
            display: inline-flex; align-items: center; gap: 6px;
            margin-top: 10px; padding: 6px 12px;
            background: #ffffff; color: #334155;
            border: 1.5px solid #cbd5e1; border-radius: 8px;
            font-size: 0.9rem; cursor: pointer;
        }
        .reset-colors-btn:hover { border-color: #64748b; background: #f8fafc; }
        .reset-colors-btn:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

        .checkbox-wrapper { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
        input[type="checkbox"] { width: 20px; height: 20px; }

        #voice-warning {
            color: #d32f2f; font-size: 0.8rem; margin-top: 8px; 
            font-style: italic; background: rgba(255,235,238,0.7); 
            padding: 8px; border-radius: 4px; border-left: 3px solid #d32f2f;
        }

        /* Usage Tracker Styles */
        .usage-tracker {
            font-size: 0.8rem;
            color: #555;
            background: #e3f2fd;
            padding: 8px;
            border-radius: 6px;
            margin-top: 8px;
            display: flex; 
            align-items: center;
            justify-content: space-between;
            border-left: 3px solid #1976d2;
        }
        .usage-tracker button {
            font-size: 0.75rem; background: none; border: none; color: #d32f2f;
            box-shadow: none; text-decoration: underline; padding: 0;
        }
        .usage-tracker button:hover { background: none; color: #b71c1c; }

        /* Premium Voice Controls Container */
        #premium-voice-container {
            display: flex; gap: 5px; align-items: center; margin-top: 8px;
        }

        /* --- Modals --- */
        .modal-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.6); display: none;
            justify-content: center; align-items: center; z-index: 1000;
            overflow-y: auto;
            padding: 20px 10px;
            box-sizing: border-box;
        }
        #pin-modal {
            z-index: 2000;
        }
        .modal-content {
            background: white; padding: 30px; border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.3); width: 90%; max-width: 450px; text-align: center;
            max-height: calc(100vh - 40px);
            max-height: calc(100dvh - 40px);
            overflow-y: auto;
            box-sizing: border-box;
            margin: auto;
        }
        .modal-content input[type="text"], .modal-content input[type="password"] { 
            width: 100%; padding: 12px; margin: 20px 0; 
            border: 2px solid #eee; border-radius: 8px; font-size: 1.2rem; text-align: center;
        }
        .btn-secondary { background: #e0e0e0; color: #333; padding: 10px 20px;}
        .btn-primary { background: #42a5f5; color: white; padding: 10px 20px;}

        /* Flag Grid for Language Modal */
        .flag-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 12px;
            margin-top: 15px;
            margin-bottom: 20px;
            max-height: 50vh;
            max-height: 50dvh;
            overflow-y: auto;
            padding: 8px;
        }
        
        @media (max-width: 600px) {
            .flag-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 8px;
                padding: 4px;
            }
        }

        .lang-flag {
            width: 100%;
            max-width: 72px;
            margin: 0 auto;
            display: block;
            aspect-ratio: 4 / 3;
            object-fit: cover;
            border-radius: 6px;
            border: 1px solid #ccc;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
            cursor: pointer;
            transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
        }
        .lang-flag:hover {
            transform: scale(1.08);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
            border-color: #777;
        }
        .lang-flag.active {
            border: 3px solid #42a5f5;
            box-shadow: 0 0 8px rgba(66, 165, 245, 0.6);
        }

        .flag-btn {
            width: 100%;
            aspect-ratio: 1;
            font-size: 2rem;
            border-radius: 15px;
            color: #333;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s, box-shadow 0.2s;
            background-color: #f5f5f5;
            border: 2px solid #ddd;
        }
        .flag-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 12px rgba(0,0,0,0.15);
            border-color: #aaa;
        }

        /* --- Screen 2: Student View --- */
        #screen-student {
            display: none;
            flex-direction: column;
            height: 100%;
            height: 100dvh;
            max-height: 100dvh;
            overflow: hidden;
            box-sizing: border-box;
        }

        .top-bar {
            display: flex; justify-content: space-between; align-items: center;
            padding: 10px 20px; background-color: rgba(255,255,255,0.85);
            border-radius: 0 0 15px 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); gap: 12px;
            flex-shrink: 0;
        }

        #btn-fullscreen-student, #btn-back { flex-shrink: 0; }
        /* step C3: the 🎙️ (Cloud STT) button after #btn-back was removed */
        #btn-back { margin-right: auto; }
        .veil-controls { 
            display: flex; align-items: center; gap: 10px; background: #fff; 
            padding: 5px 15px; border-radius: 50px; box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
            margin: 0 auto; flex-shrink: 0;
        }
        #btn-flow-toggle { margin-left: auto; flex-shrink: 0; }
        .flow-companion-slot { flex-shrink: 0; }

        .student-btn {
            width: 50px; height: 50px; border-radius: 12px; font-size: 1.4rem;
            display: flex; align-items: center; justify-content: center;
            border: 2px solid rgba(0,0,0,0.05); color: #444;
            cursor: pointer;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, filter 0.2s ease;
        }
        .student-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(0,0,0,0.18);
        }
        .student-btn:active {
            transform: translateY(1px) scale(0.98);
            box-shadow: 0 2px 4px rgba(0,0,0,0.12);
        }
        
        #btn-back, #btn-fullscreen-student {
            background-color: #e0e0e0;
            color: #444;
        }
        #btn-back:hover, #btn-fullscreen-student:hover {
            background-color: #d5d5d5;
            color: #111;
        }
        
        #btn-toggle-veil {
            color: white; width: 45px; height: 45px; border-radius: 50%; font-size: 1.2rem;
            cursor: pointer;
            border: none;
            box-shadow: 0 2px 6px rgba(0,0,0,0.15);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
        }
        #btn-toggle-veil:hover {
            transform: translateY(-2px) scale(1.05);
            box-shadow: 0 5px 12px rgba(0,0,0,0.22);
            filter: brightness(0.92);
        }
        #btn-toggle-veil:active {
            transform: translateY(1px) scale(0.98);
            box-shadow: 0 2px 4px rgba(0,0,0,0.15);
        }
        .veil-on { background-color: #4caf50; } 
        .veil-off { background-color: #f44336; }
        .veil-on:hover { background-color: #388e3c; }
        .veil-off:hover { background-color: #d32f2f; }

        .flow-companion-slot {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 105px;
            height: 50px;
        }

        #btn-read-all {
            background-color: #ffd54f;
            color: #333;
            width: 100%;
            height: 50px;
            font-size: 1.3rem;
            cursor: pointer;
            border: 2px solid rgba(0,0,0,0.05);
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
        }
        #btn-read-all:hover {
            background-color: #ffca28;
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(0,0,0,0.18);
        }
        #btn-read-all:active {
            transform: translateY(1px) scale(0.98);
            box-shadow: 0 2px 4px rgba(0,0,0,0.12);
        }
        #btn-read-all.reading {
            background-color: #ff7043; color: white; animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }

        .student-btn-wide {
            padding: 0 15px; width: auto; min-width: 105px; height: 50px; color: white; font-size: 0.95rem;
            cursor: pointer;
            border: 2px solid rgba(0,0,0,0.05);
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
        }
        .student-btn-wide:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(0,0,0,0.18);
            filter: brightness(0.92);
        }
        .student-btn-wide:active {
            transform: translateY(1px) scale(0.98);
            box-shadow: 0 2px 4px rgba(0,0,0,0.12);
        }
        .mode-word { background-color: #9c27b0; } 
        .mode-syllable { background-color: #ff9800; } 
        .mode-sentence { background-color: #2196f3; } 

        .flow-step { background-color: #29b6f6; }
        .flow-continuous { background-color: #66bb6a; }

        #reading-area {
            flex: 1 1 auto;
            min-height: 0;
            display: flex; 
            flex-direction: column; 
            align-items: center; 
            padding: 20px 20px 40px 20px; 
            overflow-y: auto; 
            position: relative; 
            width: 100%;
            box-sizing: border-box;
        }

        #text-display {
            background-color: var(--dynamic-text-bg-color, #FDF9E3); 
            padding: 40px; 
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
            font-family: var(--dynamic-font-family);
            font-size: var(--dynamic-font-size); 
            font-weight: var(--dynamic-font-weight);
            color: var(--dynamic-text-color, #333333); 
            line-height: 2; 
            letter-spacing: 0.05em;
            text-align: center; 
            width: 100%; 
            max-width: 1000px;
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            box-sizing: border-box; 
            transition: all 0.3s ease;
        }

        .paragraph-block { 
            display: flex; 
            flex-direction: column;
            align-items: flex-start;
            margin-bottom: 2rem; 
        }
        .paragraph-block:last-child { margin-bottom: 0; }

        .word { 
            display: inline-flex; 
            align-items: flex-end;
            margin: 0 0.35em; 
            padding: 2px 4px; 
            border-radius: 5px; 
            line-height: 1.2;
        }
        .syllable { display: inline-block; padding: 2px; border-radius: 4px; }

        .word-image-wrapper {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-end;
            margin: 0 0.35em;
            line-height: 1.2;
            padding: 2px 4px;
            border-radius: 10px;
        }

        .word-image-wrapper .word {
            margin: 0;
            padding: 0;
        }

        .word-image-text {
            display: inline-flex;
            align-items: baseline;
            gap: 0.35em;
        }

        .word-image {
            max-height: var(--dynamic-image-size, 50px);
            width: auto;
            object-fit: contain;
            margin-bottom: 2px;
            pointer-events: none;
            user-select: none;
            display: block;
        }

        @media print {
            .word-image-wrapper {
                display: inline-flex;
                flex-direction: column;
                align-items: center;
                vertical-align: bottom;
                page-break-inside: avoid;
            }
            .word-image {
                max-height: 38px;
                object-fit: contain;
                margin-bottom: 2px;
            }
        }

        .focus-highlight {
            position: relative; z-index: 100; background-color: var(--dynamic-text-bg-color, #FDF9E3); 
            box-shadow: 0 0 0 200vmax rgba(var(--veil-color-rgb), var(--veil-opacity));
            border-radius: 8px; outline: 3px solid #ffeb3b; 
        }

        .syllable.focus-highlight {
            display: inline-block;
            padding: 2px 5px;
            border-radius: 6px;
            background-color: var(--dynamic-text-bg-color, #FDF9E3);
        }
        
        /* Red (or Black) text highlight for synchronized continuous reading */
        .spoken-highlight {
            color: var(--highlight-text-color) !important;
            text-shadow: 0 0 2px var(--highlight-shadow);
            transition: color 0.1s ease;
        }

        body.veil-active { overflow: hidden; }

        .bottom-nav {
            display: flex; justify-content: center; align-items: center; gap: 15px;
            padding: 10px 20px; background-color: rgba(255,255,255,0.8); border-radius: 15px 15px 0 0;
            z-index: 10;
            flex-shrink: 0;
        }

        .nav-btn {
            width: 52px; height: 50px; font-size: 1.4rem; color: #555;
            background: #fff; border: 2px solid #ddd; border-radius: 12px;
            cursor: pointer;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            position: relative;
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
        }
        .nav-btn:hover {
            background-color: #f0f7ff;
            border-color: #90caf9;
            color: #1565c0;
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(0,0,0,0.15);
        }
        .nav-btn:active {
            transform: translateY(1px) scale(0.98);
            box-shadow: 0 2px 4px rgba(0,0,0,0.12);
        }

        .btn-speaker { 
            background-color: var(--accent-dark); color: #ffffff;
            width: 50px; height: 50px; border-radius: 50%; font-size: 1.4rem;
            box-shadow: 0 4px 10px rgba(0,0,0,0.25); border: 2px solid white;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
        }
        .btn-speaker:hover {
            background-color: #000000;
            transform: translateY(-2px) scale(1.05);
            box-shadow: 0 6px 14px rgba(0,0,0,0.3);
        }
        .btn-speaker:active {
            transform: translateY(1px) scale(0.98);
        }

        .btn-listener { 
            background-color: #9c27b0; color: #ffffff;
            width: 50px; height: 50px; border-radius: 50%; font-size: 1.4rem;
            box-shadow: 0 4px 10px rgba(0,0,0,0.25); border: 2px solid white;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
        }
        .btn-listener:hover {
            background-color: #7b1fa2;
            transform: translateY(-2px) scale(1.05);
            box-shadow: 0 6px 14px rgba(0,0,0,0.3);
        }
        .btn-listener:active {
            transform: translateY(1px) scale(0.98);
        }
        .btn-listener.listening {
            background-color: #e53935; color: white; animation: pulse 1.5s infinite;
        }
        .btn-listener.processing {
            background-color: #f57c00; color: white;
        }

        /* --- Reset Button Long-Press (>1.5s) Countdown Styles --- */
        #btn-reset {
            position: relative;
            overflow: visible;
            user-select: none;
            -webkit-user-select: none;
            touch-action: manipulation;
        }
        .reset-progress-svg {
            position: absolute;
            top: -2px;
            left: -2px;
            width: 52px;
            height: 50px;
            pointer-events: none;
            overflow: visible;
        }
        .reset-progress-bar {
            fill: none;
            stroke: #e53935;
            stroke-width: 3.5;
            stroke-linecap: round;
            stroke-dasharray: 140;
            stroke-dashoffset: 140;
            transform-origin: 26px 25px;
            transform: rotate(-90deg);
            transition: none;
        }
        #btn-reset.holding .reset-progress-bar {
            stroke-dashoffset: 0;
            transition: stroke-dashoffset 1.5s linear;
        }
        #btn-reset.holding i {
            color: #e53935;
            transform: scale(0.9) rotate(-35deg);
            transition: transform 1.5s ease-out, color 0.3s;
        }
        #btn-reset.reset-complete {
            animation: resetCompletePulse 0.5s ease;
        }
        @keyframes resetCompletePulse {
            0% { transform: scale(1); background-color: #fff; }
            50% { transform: scale(1.15); background-color: #e8f5e9; border-color: #4caf50; color: #2e7d32; }
            100% { transform: scale(1); }
        }

        /* --- Responsive Styles --- */

        /* 1. General Tablet & Mobile (max-width: 900px) */
        @media (max-width: 900px) {
            #screen-teacher { height: auto; overflow-y: auto; }
            .main-layout { grid-template-columns: 1fr; min-height: auto; }
            .settings-panel { max-height: none; overflow: visible; }
            
            /* Screen 1 top buttons */
            #btn-fullscreen-toggle { top: 10px; left: 10px; width: 44px; height: 44px; font-size: 1.15rem; }
            #top-right-actions { top: 10px; right: 10px; gap: 8px; }
            .top-action-circle-btn, #btn-lang-selector { width: 44px; height: 44px; font-size: 1.3rem; }

            /* Screen 2 Buttons: slightly smaller, legible & comfortable */
            .student-btn { width: 44px; height: 44px; font-size: 1.25rem; border-radius: 10px; }
            .student-btn-wide { height: 44px; min-width: 88px; padding: 0 10px; font-size: 0.88rem; border-radius: 10px; }
            .flow-companion-slot { height: 44px; min-width: 88px; }
            #btn-read-all { height: 44px; font-size: 1.15rem; }

            .veil-controls { padding: 3px 10px; gap: 8px; }
            #btn-toggle-veil { width: 36px; height: 36px; font-size: 1rem; }
            #veil-opacity-slider { width: 70px; }

            .bottom-nav { gap: 8px; padding: 8px 10px; flex-wrap: nowrap; justify-content: space-evenly; width: 100%; } 
            .nav-btn { width: 46px; height: 44px; font-size: 1.25rem; border-radius: 10px; }
            .nav-spacer { display: none; }
            .btn-speaker, .btn-listener { width: 48px; height: 48px; font-size: 1.35rem; flex-shrink: 0; }
            
            textarea { min-height: 160px; }
            #text-display { font-size: calc(var(--dynamic-font-size) * 0.75); padding: 20px; }
        }

        /* 2. Mobile Portrait (max-width: 650px) */
        @media (max-width: 650px) and (orientation: portrait) {
            #screen-student.container {
                padding: 4px 8px !important;
                height: 100vh;
                height: 100dvh;
                max-height: 100vh;
                max-height: 100dvh;
                overflow: hidden;
            }
            .top-bar { justify-content: center; flex-wrap: wrap; gap: 6px; padding: 6px 10px; flex-shrink: 0; }
            #btn-back { margin-right: 0; }
            #btn-flow-toggle { margin-left: 0; }
            .veil-controls { order: 4; width: auto; justify-content: center; margin: 4px auto 0 auto; flex-shrink: 0; }
            #reading-area { padding: 8px 10px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
            #text-display { padding: 14px 12px; font-size: calc(var(--dynamic-font-size) * 0.7); flex: 1 1 auto; min-height: 0; overflow-y: auto; }
            .bottom-nav { padding: 6px 10px; gap: 6px; flex-shrink: 0; }
        }

        /* 3. Mobile Landscape & Compact Vertical Viewports (Fix for Issue 2) */
        @media (orientation: landscape) and (max-height: 600px), (max-height: 520px) {
            #screen-student.container {
                padding: 2px 10px !important;
                height: 100vh !important;
                height: 100dvh !important;
                max-height: 100vh !important;
                max-height: 100dvh !important;
                overflow: hidden !important;
            }

            /* Single-line Top Bar: NO 2nd row for veil! */
            .top-bar {
                flex-wrap: nowrap !important;
                justify-content: space-between !important;
                padding: 3px 8px !important;
                gap: 5px !important;
                border-radius: 0 0 10px 10px !important;
                flex-shrink: 0 !important;
            }

            #btn-back { margin-right: 0 !important; }
            #btn-flow-toggle { margin-left: 0 !important; }

            .veil-controls {
                order: initial !important;
                width: auto !important;
                margin: 0 !important;
                padding: 2px 6px !important;
                gap: 4px !important;
                flex-shrink: 0 !important;
            }

            #btn-toggle-veil {
                width: 30px !important;
                height: 30px !important;
                font-size: 0.9rem !important;
            }

            #veil-opacity-slider {
                width: 50px !important;
                height: 12px !important;
            }

            /* Proportional, slightly smaller buttons */
            .student-btn {
                width: 36px !important;
                height: 36px !important;
                font-size: 1.1rem !important;
                border-radius: 8px !important;
                flex-shrink: 0 !important;
            }

            .student-btn-wide {
                height: 36px !important;
                min-width: 74px !important;
                padding: 0 6px !important;
                font-size: 0.8rem !important;
                border-radius: 8px !important;
                flex-shrink: 0 !important;
            }

            .flow-companion-slot {
                height: 36px !important;
                min-width: 74px !important;
                flex-shrink: 0 !important;
            }

            #btn-read-all {
                height: 36px !important;
                font-size: 1rem !important;
            }

            /* Reading Area & Text Display: Maximum breathing room */
            #reading-area {
                padding: 4px 8px !important;
                justify-content: center !important;
                flex: 1 1 auto !important;
                min-height: 0 !important;
                overflow-y: auto !important;
            }

            #text-display {
                padding: 6px 14px !important;
                border-radius: 12px !important;
                line-height: 1.35 !important;
                letter-spacing: 0.03em !important;
                font-size: var(--dynamic-font-size) !important;
                box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
                max-height: calc(100vh - 80px) !important;
                max-height: calc(100dvh - 80px) !important;
                flex: 1 1 auto !important;
                min-height: 0 !important;
                overflow-y: auto !important;
            }

            /* 2026-11-22 (owner): no cap here any more — the pictures follow
               «Μέγεθος Εικόνων» on every screen (was clamp(22px, 6.5dvh, 38px)) */

            .paragraph-block {
                margin-bottom: 0.5rem !important;
            }

            /* Bottom Nav: Compact height without sacrificing touchability */
            .bottom-nav {
                padding: 3px 8px !important;
                gap: 8px !important;
                border-radius: 10px 10px 0 0 !important;
            }

            .nav-btn {
                width: 42px !important;
                height: 36px !important;
                font-size: 1.2rem !important;
                border-radius: 8px !important;
            }

            .nav-spacer {
                display: none !important;
            }

            .btn-speaker, .btn-listener {
                width: 42px !important;
                height: 42px !important;
                font-size: 1.2rem !important;
            }

            .restore-hand {
                top: -26px !important;
                font-size: 1.3rem !important;
            }
        }

        /* Auto-Scanning focus style */
        .scan-focus {
            outline: 6px solid #ff9f43 !important;
            box-shadow: 0 0 25px #ff9f43 !important;
            transform: scale(1.02);
            transition: transform 0.15s ease, outline 0.15s ease, box-shadow 0.15s ease;
        }

        /* Full screen scanning overlay */
        #scan-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 9999;
            background: transparent;
            cursor: pointer;
        }

        /* --- Dyslexia Reader Enhancements --- */

        .sentence {
            display: inline-flex;
            flex-wrap: wrap;
            align-items: flex-end;
            vertical-align: bottom;
            padding: 4px 6px;
            border-radius: 8px;
            margin: 2px 4px;
            transition: all 0.2s ease;
        }

        .sentence.focus-highlight {
            position: relative;
            z-index: 100;
            /* the text's own background colour, as for a word (was #fff:
               owner 2026-10-12, the sentence box was white on a cream text) */
            background-color: var(--dynamic-text-bg-color, #FDF9E3);
            box-shadow: 0 0 0 200vmax rgba(var(--veil-color-rgb), var(--veil-opacity));
            border-radius: 8px;
            outline: 3px solid #ffeb3b;
        }

        .word-correct {
            color: #1b5e20 !important; /* Dark Green */
            font-weight: bold !important;
            text-shadow: 0 0 1px rgba(27, 94, 32, 0.3);
        }

        .word-incorrect {
            color: #d50000 !important; /* Red */
            font-weight: bold !important;
            text-shadow: 0 0 1px rgba(213, 0, 0, 0.3);
        }

        /* Restore hand pointer animation */
        .restore-hand {
            position: absolute;
            top: -38px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 1.8rem;
            color: #e53935;
            z-index: 15;
            pointer-events: none;
            animation: hand-bounce 0.8s infinite alternate;
        }

        @keyframes hand-bounce {
            0% {
                transform: translateX(-50%) scale(0.9) translateY(0);
                opacity: 0.8;
            }
            100% {
                transform: translateX(-50%) scale(1.2) translateY(-8px);
                opacity: 1;
            }
        }

        /* Success emoji animations */
        #emoji-animation-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            pointer-events: none;
            z-index: 9999;
            overflow: hidden;
            display: none;
        }

        .emoji-particle {
            position: absolute;
            font-size: 3rem;
            will-change: transform, opacity;
        }

        /* 1. Confetti explosion */
        .confetti-explosion {
            animation: confetti-explode-anim 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
        }
        @keyframes confetti-explode-anim {
            0% {
                transform: translate(-50%, -50%) scale(0.3);
                opacity: 1;
            }
            80% {
                opacity: 0.8;
            }
            100% {
                transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(360deg);
                opacity: 0;
            }
        }

        /* 2. Star shower */
        .star-shower {
            animation: star-shower-anim 2s linear forwards;
        }
        @keyframes star-shower-anim {
            0% {
                transform: translateY(0) rotate(0deg);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateY(110vh) rotate(360deg);
                opacity: 0;
            }
        }

        /* 3. Giant thumb */
        .giant-thumb {
            font-size: 8rem;
            animation: giant-thumb-anim 2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }
        @keyframes giant-thumb-anim {
            0% {
                transform: translate(-50%, -50%) scale(0) rotate(-45deg);
                opacity: 0;
            }
            30% {
                transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
                opacity: 1;
            }
            50% {
                transform: translate(-50%, -50%) scale(1) rotate(0deg);
                opacity: 1;
            }
            80% {
                opacity: 1;
            }
            100% {
                transform: translate(-50%, -100%) scale(0.8);
                opacity: 0;
            }
        }

        /* 4. Clap cascade */
        .clap-cascade {
            animation: clap-cascade-anim 2.5s ease-out forwards;
        }
        @keyframes clap-cascade-anim {
            0% {
                transform: translateY(0) scale(0.8);
                opacity: 0;
            }
            20% {
                opacity: 1;
            }
            100% {
                transform: translateY(-110vh) scale(1.2) translateX(30px);
                opacity: 0;
            }
        }

        /* 5. Rocket launch */
        .rocket-launch {
            font-size: 3.5rem;
            animation: rocket-launch-anim 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        @keyframes rocket-launch-anim {
            0% {
                transform: translate(0, 0) rotate(45deg) scale(0.8);
                opacity: 0;
            }
            15% {
                opacity: 1;
            }
            100% {
                transform: translate(200px, -110vh) rotate(45deg) scale(1.3);
                opacity: 0;
            }
        }

        /* 6. Sparkle burst */
        .sparkle-burst {
            animation: sparkle-burst-anim 1.2s ease-in-out forwards;
        }
        @keyframes sparkle-burst-anim {
            0% {
                transform: scale(0) rotate(0deg);
                opacity: 0;
            }
            50% {
                transform: scale(1.4) rotate(180deg);
                opacity: 1;
            }
            100% {
                transform: scale(0) rotate(360deg);
                opacity: 0;
            }
        }

        /* 7. Rising balloon */
        .rising-balloon {
            font-size: 3.5rem;
            animation: rising-balloon-anim 4s ease-in-out forwards;
        }
        @keyframes rising-balloon-anim {
            0% {
                transform: translateY(0) translateX(0);
                opacity: 0;
            }
            15% {
                opacity: 1;
            }
            50% {
                transform: translateY(-50vh) translateX(30px);
            }
            100% {
                transform: translateY(-110vh) translateX(-20px);
                opacity: 0;
            }
        }

        /* 8. Trophy spin */
        .trophy-spin {
            font-size: 7rem;
            animation: trophy-spin-anim 2.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }
        @keyframes trophy-spin-anim {
            0% {
                transform: translate(-50%, -50%) scale(0) rotate(-180deg);
                opacity: 0;
            }
            30% {
                transform: translate(-50%, -50%) scale(1) rotate(0deg);
                opacity: 1;
            }
            70% {
                transform: translate(-50%, -50%) scale(1.1) rotate(360deg);
                opacity: 1;
            }
            100% {
                transform: translate(-50%, -50%) scale(0) rotate(720deg);
                opacity: 0;
            }
        }
        .trophy-star {
            font-size: 1.5rem;
            animation: trophy-star-anim 2.2s ease-out forwards;
        }
        @keyframes trophy-star-anim {
            0% {
                transform: translate(-50%, -50%) scale(0);
                opacity: 0;
            }
            30% {
                transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1);
                opacity: 1;
            }
            100% {
                transform: translate(calc(-50% + var(--tx) * 1.3), calc(-50% + var(--ty) * 1.3)) scale(0);
                opacity: 0;
            }
        }

        /* 9. Rainbow dash */
        .rainbow-dash {
            font-size: 4rem;
            animation: rainbow-dash-anim 2.5s linear forwards;
        }
        @keyframes rainbow-dash-anim {
            0% {
                transform: translateX(0) scaleX(1);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateX(calc(100vw + 200px)) scaleX(1);
                opacity: 0;
            }
        }

        /* 10. Fireworks */
        .firework-spark {
            font-size: 1.8rem;
            animation: firework-spark-anim 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
        }
        @keyframes firework-spark-anim {
            0% {
                transform: translate(-50%, -50%) scale(0.2);
                opacity: 0;
            }
            15% {
                opacity: 1;
            }
            100% {
                transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1);
                opacity: 0;
            }
        }

        /* 11. Heart shower */
        .heart-shower {
            animation: heart-shower-anim 2.5s ease-in-out forwards;
        }
        @keyframes heart-shower-anim {
            0% {
                transform: translateY(0) scale(0.5);
                opacity: 0;
            }
            20% {
                opacity: 1;
            }
            100% {
                transform: translateY(110vh) scale(1.2) translateX(40px);
                opacity: 0;
            }
        }

        /* 12. Medal drop */
        .medal-drop {
            font-size: 6rem;
            animation: medal-drop-anim 3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
        }
        @keyframes medal-drop-anim {
            0% {
                transform: translate(-50%, -100px);
                opacity: 0;
            }
            30% {
                transform: translate(-50%, 40vh) rotate(15deg);
                opacity: 1;
            }
            40% {
                transform: translate(-50%, 40vh) rotate(-15deg);
            }
            50% {
                transform: translate(-50%, 40vh) rotate(10deg);
            }
            60% {
                transform: translate(-50%, 40vh) rotate(-10deg);
            }
            70% {
                transform: translate(-50%, 40vh) rotate(0deg);
                opacity: 1;
            }
            100% {
                transform: translate(-50%, 100vh);
                opacity: 0;
            }
        }

        /* 13. Image Dictionary Manager Modal & Cards */
        /* Step D5 (2026-10-04): the picture-dictionary dialog looks like
           Rapid Naming Activity's (same rules, copied from here in RN B8).
           On phones its fields were huge: the Reader's general dialog rule
           ".modal-content input[type=text]" (1.2rem, padding 12px, margin
           20px 0, centred) was stronger than the dictionary's own rules,
           which RN does not have to fight. The dictionary's field rules are
           therefore written with #image-dict-modal in front (same values as
           RN), and the general rule's margin / font are undone here.
           Font (owner, 2026-10-04): RN's interface font Verdana when the
           device has it, otherwise the Reader's Open Sans - at sizes that do
           not cost a row of cards: Open Sans has a taller line, so the card
           lines are set to 1.15 here and, on phones, the dialog's small texts
           are a little smaller (see the max-width: 650px block below).
           tests/smoke/browser-dict-layout.js checks it (the test machine has
           no Verdana, so it measures the Open Sans case). */
        #image-dict-modal .modal-content {
            font-family: 'Verdana', 'Open Sans', sans-serif;
        }
        #image-dict-modal .dict-word-input,
        #image-dict-modal .dict-card-header {
            line-height: 1.15;
        }
        #image-dict-modal .modal-content input[type="text"] {
            margin: 0;
            font-family: inherit;
        }

        .dict-card {
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
            transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
        }
        .dict-card:hover {
            border-color: #3b82f6;
            box-shadow: 0 4px 8px -2px rgba(0,0,0,0.1);
            transform: translateY(-2px);
        }
        .dict-card-img-wrap {
            width: 100%;
            height: 75px;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #f8fafc;
            border-radius: 6px;
            overflow: hidden;
            border: 1px solid #f1f5f9;
        }
        .dict-card-img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }
        .dict-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            font-size: 0.75rem;
            color: #64748b;
            font-weight: 600;
            gap: 4px;
        }
        .dict-card-id {
            color: #334155;
            font-weight: 700;
            flex-shrink: 0;
        }
        .dict-card-cat {
            font-size: 0.68rem;
            color: #94a3b8;
            font-weight: normal;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 75px;
            text-align: right;
        }
        #image-dict-modal .dict-word-input {
            width: 100%;
            padding: 6px 6px;
            font-size: 0.85rem;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            text-align: center;
            font-weight: 500;
            box-sizing: border-box;
            background: #ffffff;
            color: #1e293b;
        }
        #image-dict-modal .dict-word-input:focus {
            outline: none;
            border-color: #2563eb;
            box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
        }

        /* Dict Action Buttons & Hover Effects */
        .dict-action-btn {
            height: 34px;
            padding: 0 14px;
            font-size: 0.82rem;
            font-weight: 600;
            border-radius: 6px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            box-sizing: border-box;
            cursor: pointer;
            border: 1px solid transparent;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            white-space: nowrap;
            user-select: none;
        }
        .dict-btn-primary {
            background-color: #2563eb;
            color: #ffffff;
            border-color: #1d4ed8;
        }
        .dict-btn-primary:hover {
            background-color: #1d4ed8;
            transform: translateY(-1px);
            box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
        }
        .dict-btn-primary:active {
            transform: translateY(0);
            box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
        }
        .dict-btn-secondary {
            background-color: #f1f5f9;
            color: #334155;
            border-color: #cbd5e1;
        }
        .dict-btn-secondary:hover {
            background-color: #e2e8f0;
            color: #0f172a;
            border-color: #94a3b8;
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
        }
        .dict-btn-secondary:active {
            transform: translateY(0);
        }
        .dict-btn-copy {
            background-color: #f0fdf4;
            color: #166534;
            border-color: #bbf7d0;
        }
        .dict-btn-copy:hover {
            background-color: #dcfce7;
            color: #14532d;
            border-color: #86efac;
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(22, 101, 52, 0.18);
        }
        .dict-btn-copy:active {
            transform: translateY(0);
        }
        .dict-btn-export {
            background-color: #f8fafc;
            color: #334155;
            border-color: #cbd5e1;
        }
        .dict-btn-export:hover {
            background-color: #f1f5f9;
            color: #0f172a;
            border-color: #94a3b8;
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
        }
        .dict-btn-export:active {
            transform: translateY(0);
        }

        /* Modal Layout Structure */
        #image-dict-modal .modal-content {
            max-width: 960px;
            width: 95%;
            max-height: 92vh;
            display: flex;
            flex-direction: column;
            text-align: left;
            padding: 18px 22px;
            position: relative;
            box-sizing: border-box;
            overflow: hidden;
        }
        .dict-modal-header {
            flex-shrink: 0;
        }
        .dict-url-row {
            display: flex;
            gap: 8px;
            align-items: center;
        }
        #image-dict-modal .dict-url-row input {
            height: 34px;
            text-align: left;
            flex: 1;
            min-width: 0;
            padding: 0 10px;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
            font-size: 0.85rem;
            box-sizing: border-box;
        }
        #image-dict-modal .dict-url-row input:focus {
            outline: none;
            border-color: #2563eb;
            box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
        }
        .dict-url-btns {
            display: flex;
            gap: 6px;
            flex-shrink: 0;
        }
        .dict-filter-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
            flex-shrink: 0;
        }
        .dict-search-wrap {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
            min-width: 0;
        }
        .dict-search-box {
            position: relative;
            flex: 1;
        }
        #image-dict-modal .dict-search-box input {
            height: 34px;
            text-align: left;
            width: 100%;
            padding: 0 10px 0 30px;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
            font-size: 0.85rem;
            box-sizing: border-box;
        }
        #image-dict-modal .dict-search-box input:focus {
            outline: none;
            border-color: #2563eb;
            box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
        }
        .dict-filter-btns {
            display: flex;
            gap: 6px;
            flex-shrink: 0;
        }
        .dict-modal-footer {
            display: flex;
            justify-content: flex-end;
            margin-top: 8px;
            flex-shrink: 0;
        }

        /* Responsive: Mobile Screens (<650px) */
        @media (max-width: 650px) {
            /* Step D5: like RN - on phones the dialog uses 96% of the screen
               (the Reader's dialogs keep a 10px / 20px frame elsewhere). */
            #image-dict-modal.modal-overlay {
                padding: 0;
            }
            #image-dict-modal .modal-content {
                width: 96%;
                max-height: 96vh;
                padding: 12px 14px;
            }
            #image-dict-modal h2 {
                font-size: 1.1rem !important;
            }
            .dict-subtitle-text {
                font-size: 0.78rem !important;
                margin-bottom: 6px !important;
                line-height: 1.3 !important;
            }
            /* Step D5: a little smaller on phones, so the Open Sans texts
               (when the device has no Verdana) keep 3 rows of cards visible. */
            #image-dict-modal .dict-subtitle-text {
                font-size: 0.72rem !important;
                line-height: 1.25 !important;
            }
            #image-dict-modal label[data-i18n="dict_sheet_label"] {
                font-size: 0.72rem !important;
            }
            #dict-guide-header span {
                font-size: 0.74rem !important;
            }
            #image-dict-modal h2 {
                font-size: 1.02rem !important;
            }
            .dict-url-row {
                flex-direction: column;
                align-items: stretch;
                gap: 6px;
            }
            #image-dict-modal .dict-url-row input {
                width: 100%;
            }
            .dict-url-btns {
                width: 100%;
            }
            .dict-url-btns .dict-action-btn {
                flex: 1;
            }
            .dict-filter-row {
                flex-direction: column;
                align-items: stretch;
                gap: 6px;
            }
            .dict-filter-btns {
                width: 100%;
            }
            .dict-filter-btns .dict-action-btn {
                flex: 1;
            }
            #dict-grid-container {
                grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)) !important;
                gap: 8px !important;
                padding: 8px !important;
            }
            .dict-card-img-wrap {
                height: 60px !important;
            }
        }

        /* Responsive: Short Screens (height < 700px, e.g. landscape phones/tablets) */
        @media (max-height: 700px) {
            #image-dict-modal .modal-content {
                padding: 8px 16px;
                max-height: 96vh;
            }
            .dict-subtitle-text {
                display: none !important;
            }
            .dict-modal-header {
                margin-bottom: 4px !important;
            }
            #dict-guide-accordion {
                margin-bottom: 4px !important;
            }
            .dict-filter-row {
                margin-bottom: 4px !important;
            }
            .dict-card-img-wrap {
                height: 55px !important;
            }
            #image-dict-modal .dict-word-input {
                padding: 3px 4px !important;
                font-size: 0.78rem !important;
            }
            #dict-grid-container {
                min-height: 100px !important;
            }
        }

        /* ==========================================================================
           REWARDS SYSTEM, STUDENT PROFILES, POPOVER & STICKER MODAL
           ========================================================================== */

        /* --- Student Rewards Pill (Screen 2 Top Bar) --- */
        .reward-pill-container {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        .student-reward-pill {
            display: inline-flex;
            align-items: center;
            height: 44px;
            background: #ffffff;
            border: 2px solid #cbd5e1;
            border-radius: 50px;
            padding: 0 12px;
            font-size: 0.92rem;
            font-weight: 700;
            color: #334155;
            cursor: pointer !important;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
            transition: all 0.2s ease;
            user-select: none;
            gap: 8px;
        }
        .student-reward-pill * {
            cursor: pointer !important;
        }
        .student-reward-pill:hover {
            border-color: #94a3b8;
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(0,0,0,0.12);
        }
        .student-reward-pill:active {
            transform: translateY(1px) scale(0.98);
        }
        .student-reward-pill .pill-name {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            color: #1e40af;
            max-width: 100px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: pointer !important;
        }
        .student-reward-pill .pill-divider {
            width: 1px;
            height: 18px;
            background: #cbd5e1;
        }
        .student-reward-pill .pill-points {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            color: #b45309;
        }
        .student-reward-pill .pill-max {
            font-size: 0.72rem;
            color: #94a3b8;
            font-weight: 500;
        }

        .reward-pill-container.can-claim .student-reward-pill {
            border-color: #f59e0b;
            background: #fffbeb;
            animation: rewardGlowPulse 2s infinite;
        }
        @keyframes rewardGlowPulse {
            0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
            100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
        }

        .btn-claim-sticker {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: linear-gradient(135deg, #f59e0b, #d97706);
            color: #ffffff;
            font-size: 1.25rem;
            border: 2px solid #ffffff;
            cursor: pointer;
            box-shadow: 0 4px 10px rgba(217, 119, 6, 0.4);
            animation: giftBounce 1.2s infinite ease-in-out;
            transition: transform 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .btn-claim-sticker:hover {
            transform: scale(1.15) rotate(5deg);
        }
        @keyframes giftBounce {
            0%, 100% { transform: translateY(0) scale(1); }
            50% { transform: translateY(-4px) scale(1.08); }
        }

        /* --- Quick-Switch Student Popover --- */
        .student-popover {
            position: absolute;
            top: 52px;
            left: 0;
            width: 230px;
            background: #ffffff;
            border: 1px solid #cbd5e1;
            border-radius: 12px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.15);
            z-index: 120;
            padding: 10px;
            text-align: left;
        }
        .popover-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.82rem;
            color: #475569;
            margin-bottom: 8px;
            padding-bottom: 4px;
            border-bottom: 1px solid #f1f5f9;
        }
        .popover-close-btn {
            background: none;
            border: none;
            font-size: 1.2rem;
            cursor: pointer;
            color: #94a3b8;
            padding: 0 4px;
            line-height: 1;
        }
        .popover-close-btn:hover { color: #334155; }
        .popover-list {
            max-height: 150px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin-bottom: 8px;
        }
        .popover-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 10px;
            border-radius: 6px;
            font-size: 0.88rem;
            cursor: pointer;
            border: 1px solid transparent;
            background: #f8fafc;
            transition: all 0.15s;
        }
        .popover-item:hover {
            background: #e0f2fe;
            border-color: #bae6fd;
            color: #0369a1;
        }
        .popover-item.active {
            background: #eff6ff;
            border-color: #93c5fd;
            font-weight: bold;
            color: #1d4ed8;
        }
        .popover-item .item-score {
            font-size: 0.8rem;
            color: #d97706;
            font-weight: 600;
        }
        .popover-add-row {
            display: flex;
            gap: 5px;
            padding-top: 6px;
            border-top: 1px solid #f1f5f9;
        }
        .popover-add-row input {
            flex: 1;
            padding: 5px 8px;
            font-size: 0.82rem;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
        }
        .popover-add-row button {
            background: #2563eb;
            color: white;
            border: none;
            border-radius: 6px;
            padding: 0 10px;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .popover-add-row button:hover { background: #1d4ed8; }

        /* --- Settings Student Chips --- */
        .student-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            background: #ffffff;
            border: 1px solid #cbd5e1;
            border-radius: 20px;
            font-size: 0.85rem;
            color: #1e293b;
            font-weight: 500;
            cursor: pointer !important;
            user-select: none;
            transition: all 0.15s ease;
        }
        .student-chip * {
            cursor: pointer !important;
        }
        .student-chip:hover {
            border-color: #94a3b8;
            transform: translateY(-1px);
        }
        .student-chip.current {
            border-color: #3b82f6;
            background: #eff6ff;
            font-weight: 700;
            color: #1d4ed8;
        }
        .student-chip .chip-score {
            font-size: 0.78rem;
            color: #d97706;
            background: #fef3c7;
            padding: 1px 6px;
            border-radius: 10px;
        }
        .student-chip .btn-edit-chip {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            font-size: 0.75rem;
            padding: 0 3px;
            margin-left: 2px;
            line-height: 1;
            transition: color 0.15s ease;
        }
        .student-chip .btn-edit-chip:hover { color: #2563eb; }
        .student-chip .btn-del-chip {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            font-size: 0.85rem;
            padding: 0;
            margin-left: 2px;
            line-height: 1;
            transition: color 0.15s ease;
        }
        .student-chip .btn-del-chip:hover { color: #dc2626; }
        .popover-item .btn-popover-edit:hover { color: #2563eb !important; }

        /* --- Flying Points Animation --- */
        .flying-point-tag {
            position: fixed;
            z-index: 9999;
            font-size: 1.5rem;
            font-weight: 900;
            color: #f59e0b;
            text-shadow: 0 2px 5px rgba(0,0,0,0.35);
            pointer-events: none;
            animation: floatPointsUp 1.2s ease-out forwards;
        }
        @keyframes floatPointsUp {
            0% { transform: translateY(0) scale(0.6); opacity: 0; }
            20% { transform: translateY(-12px) scale(1.3); opacity: 1; }
            70% { transform: translateY(-38px) scale(1.1); opacity: 1; }
            100% { transform: translateY(-60px) scale(0.9); opacity: 0; }
        }

        /* --- Sticker Modal Styles --- */
        .sticker-emoji-bar {
            display: flex;
            gap: 8px;
            justify-content: center;
            flex-wrap: wrap;
            margin-bottom: 12px;
        }
        .sticker-emoji-btn {
            width: 40px;
            height: 40px;
            font-size: 1.3rem;
            border: 2px solid #e2e8f0;
            border-radius: 10px;
            background: #ffffff;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .sticker-emoji-btn:hover {
            transform: scale(1.15);
            border-color: #f59e0b;
            background: #fffbeb;
        }
        .sticker-emoji-btn.active {
            border-color: #d97706;
            background: #fef3c7;
            transform: scale(1.12);
            box-shadow: 0 4px 8px rgba(217, 119, 6, 0.2);
        }
        .sticker-emoji-btn .emoji-img {
            width: 26px;
            height: 26px;
            display: block;
            pointer-events: none;
        }
        .sticker-emoji-btn.dice-btn {
            color: #7c3aed;
            font-size: 1.1rem;
        }

        .sticker-canvas-wrapper {
            position: relative;
            width: 300px;
            height: 300px;
            margin: 0 auto;
            border-radius: 50%;
            box-shadow: 0 8px 24px rgba(0,0,0,0.15);
            overflow: hidden;
            background: #f8fafc;
        }
        #sticker-canvas {
            width: 100%;
            height: 100%;
            display: block;
        }
        #camera-preview-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.85);
            border-radius: 50%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 10;
        }
        #camera-stream-video {
            width: 180px;
            height: 180px;
            object-fit: cover;
            border-radius: 50%;
            border: 3px solid #ffffff;
        }

        /* Print Media Style for Sticker */
        @media print {
            body.printing-sticker * {
                visibility: hidden !important;
            }
            body.printing-sticker #sticker-canvas {
                visibility: visible !important;
                position: fixed !important;
                left: 50% !important;
                top: 50% !important;
                transform: translate(-50%, -50%) scale(1.5) !important;
                width: 120mm !important;
                height: 120mm !important;
                box-shadow: none !important;
            }
        }

/* ==========================================================================
   API key PIN dialog (step A6, 2026-10-02) - same look as the PIN dialog of
   Rapid Naming Activity (its css/styles.css: .modal-overlay, .modal-content,
   .modal-content h2, .modal-footer-center, .modal-btn-wide, #modal-pin).
   Scoped to #pin-modal so the Reader's other dialogs are unchanged.
   ========================================================================== */
#pin-modal {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
#pin-modal .pin-modal-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px 28px;
    max-width: 380px;
    width: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    text-align: left;
}
#pin-modal h2 {
    margin: 0 0 16px 0;
    text-align: center;
    color: #2c3e50;
    font-size: 1.4rem;
}
#pin-modal .pin-modal-desc {
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
    margin: -8px 0 16px 0;
}
#pin-modal input.pin-modal-input {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    letter-spacing: 3px;
    font-size: 1.1rem;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin: 10px 0 0 0;
}
#pin-modal input.pin-modal-input-confirm {
    margin-top: 8px;
}
#pin-modal .pin-modal-error {
    color: #dc2626;
    font-size: 0.8rem;
    text-align: center;
    min-height: 1.1em;
    margin: 8px 0 0 0;
}
#pin-modal .pin-modal-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 10px;
    flex-wrap: wrap;
}
#pin-modal .pin-modal-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s;
}
#pin-modal .pin-modal-btn-cancel { background: #e2e8f0; color: #334155; }
#pin-modal .pin-modal-btn-cancel:hover { background: #cbd5e1; }
#pin-modal .pin-modal-btn-ok { background: #0ea5e9; color: #ffffff; }

/* Locked key fields: same visual cue as Rapid Naming Activity (the real key
   is not in the page at all while locked). */
#google-api-key:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Key status line under the API key fields (step A6) */
.key-status {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
    padding: 6px 10px;
    border-radius: 8px;
    text-align: left;
}
.key-status.ok   { background: #ecfdf5; color: #166534; border: 1px solid #bbf7d0; }
.key-status.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.key-status.edit { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
#pin-modal .pin-modal-forgot {
    align-self: center;
    background: none;
    border: none;
    box-shadow: none;
    color: #64748b;
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    margin: 4px 0 0 0;
    padding: 2px 6px;
}
.api-key-restrict-tip {
    text-align: left;
    background: #fff7ed;
    border-left: 4px solid #f97316;
    border-radius: 4px;
    padding: 10px 14px;
    margin-top: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #1e293b;
}

/* No-internet microphone notice + dimmed mic button (step A7) */
.mic-offline-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1500;
    /* max-content: otherwise left:50% leaves only half the screen width and
       the message is squeezed into a narrow column on phones (step C2) */
    width: max-content;
    max-width: min(92vw, 560px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #fff7ed;
    color: #7c2d12;
    border: 2px solid #fb923c;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    pointer-events: none; /* never blocks taps or switch-scanning */
    animation: fadeIn 0.2s ease-in-out;
}
#btn-listen.mic-offline {
    opacity: 0.55;
    filter: grayscale(0.6);
}

/* ==== Data backup: export / import (step A8) - same look as Rapid Naming Activity ==== */
.backup-hint {
    margin: 0 0 10px 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #475569;
}
.backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.backup-actions .backup-btn {
    flex: 1 1 140px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #ffffff;
}
.backup-actions .backup-btn-export { background: #16a34a; }
.backup-actions .backup-btn-import { background: #2563eb; }

/* ==== App update banner (step A10) - same look as Rapid Naming Activity ==== */
.update-banner {
    position: fixed;
    left: 50%;
    top: 12px; /* 2026-10-19 (owner): at the top - at the bottom it covered the buttons */
    transform: translateX(-50%);
    z-index: 5000;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: calc(100% - 24px);
    padding: 10px 10px 10px 16px;
    background: #1e293b;
    color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font-size: 0.9rem;
    line-height: 1.3;
}
.update-banner-text { flex: 1 1 auto; min-width: 0; }
.update-banner .update-banner-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 10px;
    background: #22c55e;
    color: #ffffff;
    font-weight: bold;
    white-space: nowrap;
}
.update-banner .update-banner-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: #cbd5e1;
    font-size: 1rem;
    box-shadow: none;
}

/* ==== GUIDE-CONTENT-CSS START ====
   Shared by the Help dialog (index.html) and the stand-alone guide pages
   (guide/reader-guide-*.html): tools/build-guide.js copies everything between
   START and END into the pages, so edit it only here. Everything is scoped
   under .gd; the replica buttons use the exact colours / icons of the real
   buttons (tests/smoke/browser-help-guide.js compares them with the app). */
.gd {
    --gd-ink: #1f2937;
    --gd-muted: #4b5563;
    --gd-line: #d5dee8;
    --gd-soft: #f3f8fc;
    --gd-accent: #0277bd;
    font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 1.06rem;
    line-height: 1.7;
    color: var(--gd-ink);
    text-align: left;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.gd *, .gd *::before, .gd *::after { box-sizing: border-box; }
.gd a { color: var(--gd-accent); }
/* links inside the text ("δείτε …"): clearly clickable, also on paper/PDF */
.gd-content a { color: #0277bd; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.gd-content a:hover, .gd-content a:focus-visible { color: #01579b; background: #e1f5fe; outline: none; }
.gd p { margin: 0 0 0.85em; }
.gd ul, .gd ol { margin: 0 0 1em; padding-left: 1.4em; }
.gd li { margin-bottom: 0.35em; }
.gd strong { font-weight: 700; }
.gd kbd {
    display: inline-block; min-width: 1.9em; padding: 0.05em 0.5em; text-align: center;
    font: 700 0.9em/1.5 'Open Sans', system-ui, sans-serif; color: #111827;
    background: #f9fafb; border: 1px solid #9ca3af; border-bottom-width: 3px; border-radius: 6px;
}
.gd code { font-family: Consolas, 'Courier New', monospace; background: #eef2f7; padding: 0.05em 0.35em; border-radius: 4px; font-size: 0.95em; }

/* ---- layout: contents on the left (sticky) on wide screens, above the text on narrow ones ---- */
.gd-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.gd-toc {
    position: sticky; top: 0; align-self: start; max-height: calc(100vh - 160px); overflow-y: auto;
    background: var(--gd-soft); border: 1px solid var(--gd-line); border-radius: 14px; padding: 16px 16px 10px;
    font-size: 0.97rem; line-height: 1.4;
}
.gd-toc-title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; color: #0f3b5f; }
.gd-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.gd-toc li { counter-increment: toc; margin: 0; }
.gd-toc a {
    display: flex; gap: 8px; align-items: baseline; padding: 7px 8px; border-radius: 8px;
    color: #0f3b5f; text-decoration: none; font-weight: 600;
}
.gd-toc a::before { content: counter(toc); flex: none; min-width: 1.5em; text-align: center; font-weight: 800; color: #fff; background: #0288d1; border-radius: 50%; font-size: 0.8rem; line-height: 1.5em; height: 1.5em; }
.gd-toc a:hover, .gd-toc a:focus-visible { background: #dbeafe; outline: none; }
.gd-content { min-width: 0; }

/* ---- lead + sections ---- */
.gd-lead { margin: 0 0 28px; padding: 22px 24px; border-radius: 16px; background: linear-gradient(135deg, #e1f5fe, #f1f8e9); border: 1px solid #b3e5fc; }
.gd-lead h2 { margin: 0 0 8px; font-size: 1.7rem; line-height: 1.25; color: #0d3b66; }
.gd-lead p { margin: 0 0 0.6em; }
.gd-lead p:last-child { margin-bottom: 0; }
.gd-sec { margin: 0 0 40px; scroll-margin-top: 12px; }
.gd-sec > h3 {
    display: flex; gap: 12px; align-items: center; margin: 0 0 14px; padding-bottom: 10px;
    font-size: 1.6rem; line-height: 1.25; color: #0d3b66; border-bottom: 3px solid #b3e5fc;
}
.gd-num {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 2.1rem; height: 2.1rem; border-radius: 50%; background: #0288d1; color: #fff; font-size: 1.1rem; font-weight: 800;
}
.gd h4 { margin: 1.5em 0 0.5em; font-size: 1.22rem; line-height: 1.3; color: #0f3b5f; }
.gd-sec > h3 + h4, .gd-sec > p + h4:first-child { margin-top: 0.6em; }

/* ---- call-out boxes ---- */
.gd-note { margin: 1.1em 0; padding: 14px 18px; border-radius: 12px; border-left: 7px solid; }
.gd-note > :last-child { margin-bottom: 0; }
.gd-note-t { display: flex; gap: 8px; align-items: center; margin: 0 0 6px; font-weight: 800; font-size: 1.02rem; }
.gd-tip { background: #ecfdf3; border-color: #22a355; }
.gd-tip .gd-note-t { color: #166534; }
.gd-warn { background: #fff7e0; border-color: #f59e0b; }
.gd-warn .gd-note-t { color: #92400e; }
.gd-teacher { background: #eaf3ff; border-color: #2563eb; }
.gd-teacher .gd-note-t { color: #1e40af; }
.gd-priv { background: #f5efff; border-color: #7c3aed; }
.gd-priv .gd-note-t { color: #5b21b6; }

/* ---- numbered steps ---- */
.gd-steps { list-style: none; margin: 1em 0 1.2em; padding: 0; counter-reset: gdstep; }
.gd-steps > li { position: relative; counter-increment: gdstep; margin: 0 0 14px; padding: 4px 0 4px 58px; min-height: 44px; }
.gd-steps > li::before {
    content: counter(gdstep); position: absolute; left: 0; top: 0; width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.25rem; color: #fff; background: #0288d1;
}

/* ---- tables ---- */
.gd-table { width: 100%; border-collapse: collapse; margin: 1em 0 1.3em; font-size: 1rem; }
.gd-table th, .gd-table td { padding: 9px 12px; border: 1px solid var(--gd-line); text-align: left; vertical-align: top; }
.gd-table th { background: #e8f1f9; color: #0f3b5f; }
.gd-table th, .gd-table td, .gd code { overflow-wrap: anywhere; }

/* ---- REPLICA BUTTONS: same colours and icons as the real ones ---- */
.gd-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 72px; height: 72px; border-radius: 16px; font-size: 2rem; line-height: 1; font-weight: 600;
    font-family: 'Open Sans', system-ui, sans-serif; color: #fff; background: #9e9e9e;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); border: 2px solid rgba(0, 0, 0, 0.08);
    user-select: none; -webkit-user-select: none; pointer-events: none; text-align: center; text-decoration: none;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.gd-btn i { font-style: normal; line-height: 1; }
/* Screen 1: the six big buttons */
.gd .gd-b-help { background: #0288d1; }
.gd .gd-b-print { background: #00897b; }
.gd .gd-b-load { background: #42a5f5; }
.gd .gd-b-save { background: #ffca28; color: #333; }
.gd .gd-b-share { background: #9c27b0; }
.gd .gd-b-start { background: #66bb6a; }
/* Screen 1: small and round buttons */
.gd .gd-b-sheet { background: #e8f5e9; color: #2e7d32; width: 64px; height: 64px; border-radius: 12px; font-size: 1.6rem; }
.gd .gd-b-link { background: #e3f2fd; color: #1976d2; width: 64px; height: 64px; border-radius: 12px; font-size: 1.6rem; }
.gd .gd-b-font { background: #fff; color: #333; width: 64px; height: 64px; border-radius: 12px; font-size: 1.6rem; }
.gd .gd-b-install { background: #fff; color: #1976d2; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; }
.gd .gd-b-full { background: #fff; color: #333; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; }
.gd .gd-b-lang { background: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.9rem; overflow: hidden; }
.gd .gd-b-lang .fi { border-radius: 50%; width: 1.2em; height: 1.2em; line-height: 1.2em; }
.gd .gd-b-exit { background: #e53935; color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; border: 2px solid #fff; }
.gd .gd-b-dict { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; width: auto; height: 56px; padding: 0 20px; border-radius: 8px; font-size: 1.05rem; box-shadow: none; }
.gd .gd-b-ppnew { background: #f3f8fc; color: #0277bd; border: 2px dashed #0277bd; width: auto; height: 56px; padding: 0 20px; border-radius: 14px; font-size: 1.05rem; box-shadow: none; }
.gd .gd-b-export { background: #16a34a; width: auto; height: 52px; padding: 0 22px; border-radius: 10px; font-size: 1.05rem; }
.gd .gd-b-import { background: #2563eb; width: auto; height: 52px; padding: 0 22px; border-radius: 10px; font-size: 1.05rem; }
.gd .gd-b-act { background: #15803d; width: auto; height: 52px; padding: 0 22px; border-radius: 10px; font-size: 1.05rem; }
/* replica buttons never stick out of their column (e.g. «Αντιγραφή Συνδέσμου») */
.gd-item-btn .gd-btn { max-width: 100%; }
.gd .gd-b-act { white-space: normal; text-align: center; line-height: 1.2; min-height: 52px; height: auto; padding: 8px 18px; }
.gd .gd-b-copy { background: #9c27b0; }
.gd .gd-b-send { background: #2e7d32; }
.gd .gd-b-gray { background: #e0e0e0; color: #333; width: auto; height: 52px; padding: 0 22px; border-radius: 10px; font-size: 1.05rem; box-shadow: none; }
.gd .gd-b-cam { background: #ec4899; width: auto; height: 52px; padding: 0 20px; border-radius: 10px; font-size: 1.05rem; gap: 8px; }
.gd .gd-b-sprint { background: #00897b; width: auto; height: 52px; padding: 0 20px; border-radius: 10px; font-size: 1.05rem; gap: 8px; }
.gd .gd-b-sdown { background: #2563eb; width: auto; height: 52px; padding: 0 20px; border-radius: 10px; font-size: 1.05rem; gap: 8px; }
.gd .gd-b-dice { background: #fff; color: #333; width: 52px; height: 52px; border-radius: 12px; font-size: 1.4rem; border: 2px solid #ddd; }
/* Screen 2: the reading screen */
.gd .gd-b-gear, .gd .gd-b-fs2 { background: #e0e0e0; color: #444; width: 64px; height: 64px; border-radius: 12px; font-size: 1.7rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-veil-on { background: #4caf50; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; border: none; }
.gd .gd-b-veil-off { background: #f44336; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; border: none; }
.gd .gd-b-flow-step { background: #29b6f6; width: auto; min-width: 130px; height: 64px; padding: 0 18px; border-radius: 12px; font-size: 1.05rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-flow-nat { background: #66bb6a; width: auto; min-width: 130px; height: 64px; padding: 0 18px; border-radius: 12px; font-size: 1.05rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-mode-word { background: #9c27b0; width: auto; min-width: 110px; height: 64px; padding: 0 18px; border-radius: 12px; font-size: 1.05rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-mode-syl { background: #ff9800; width: auto; min-width: 110px; height: 64px; padding: 0 18px; border-radius: 12px; font-size: 1.05rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-mode-sen { background: #2196f3; width: auto; min-width: 110px; height: 64px; padding: 0 18px; border-radius: 12px; font-size: 1.05rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-readall { background: #ffd54f; color: #333; width: 110px; height: 64px; border-radius: 12px; font-size: 1.6rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-readall-on { background: #ff7043; color: #fff; width: 110px; height: 64px; border-radius: 12px; font-size: 1.6rem; border: 2px solid rgba(0, 0, 0, 0.05); }
.gd .gd-b-nav { background: #fff; color: #555; width: 68px; height: 64px; border-radius: 12px; font-size: 1.7rem; border: 2px solid #ddd; }
.gd .gd-b-speak { background: #1a2b4c; color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.7rem; border: 2px solid #fff; }
.gd .gd-b-listen { background: #9c27b0; color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.7rem; border: 2px solid #fff; }
.gd .gd-b-listen-on { background: #e53935; color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.7rem; border: 2px solid #fff; }
.gd .gd-b-listen-off { background: #9c27b0; color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.7rem; border: 2px solid #fff; opacity: 0.6; }
.gd .gd-b-gift { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; border: 2px solid #fff; }
/* the student pill: name + points */
.gd-pill {
    display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 18px; flex: none;
    background: #fff; border: 2px solid #cbd5e1; border-radius: 50px; font-size: 1.02rem; font-weight: 700; color: #334155;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); user-select: none; pointer-events: none; white-space: nowrap;
}
.gd-pill-name { display: inline-flex; align-items: center; gap: 6px; color: #1e40af; }
.gd-pill-div { width: 1px; height: 22px; background: #cbd5e1; }
.gd-pill-pts { display: inline-flex; align-items: center; gap: 5px; color: #b45309; }
.gd-pill-pts small { font-size: 0.75em; color: #94a3b8; font-weight: 500; }
/* the "1 / 301" story box */
.gd-storybox {
    display: inline-flex; align-items: center; gap: 6px; flex: none; height: 64px; padding: 0 18px; background: #fff;
    border: 2px solid #ccc; border-radius: 15px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    font-weight: 700; pointer-events: none; user-select: none;
}
.gd-storybox b { font-size: 1.5rem; color: #333; }
.gd-storybox i { font-style: normal; font-size: 1.15rem; color: #888; }
/* a small replica inside a sentence */
.gd .gd-btn.gd-mini {
    width: 1.9em; height: 1.9em; min-width: 0; padding: 0; margin: 0 0.1em; font-size: 1rem; border-radius: 0.5em;
    vertical-align: middle; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); gap: 0;
}
.gd .gd-btn.gd-mini.gd-b-lang { font-size: 1.15rem; }
.gd .gd-btn.gd-mini.gd-wide { width: auto; min-width: 0; padding: 0 0.55em; font-size: 0.85rem; font-weight: 700; }

/* ---- one button explained: big replica on the left, text on the right ---- */
.gd-item { display: flex; gap: 22px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--gd-line); }
.gd-item:first-of-type { border-top: 0; }
.gd-item-btn { flex: 0 0 170px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; }
.gd-item-text { flex: 1 1 auto; min-width: 0; }
.gd-item-text > :last-child { margin-bottom: 0; }
.gd-item-text h4 { margin: 0 0 0.35em; font-size: 1.15rem; }
.gd-item-no { display: inline-flex; align-items: center; justify-content: center; width: 1.7em; height: 1.7em; margin-right: 0.45em; border-radius: 50%; background: #e11d48; color: #fff; font-size: 0.85em; font-weight: 800; vertical-align: 0.08em; }
.gd-pair { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---- screen maps: mini replicas of the real screens with numbered markers ---- */
.gd-mock { margin: 1.2em 0 1.6em; padding: 18px; background: #e8ecef; border: 2px solid #c5ced6; border-radius: 18px; }
.gd-mock-cap { margin: 0 0 12px; font-weight: 800; color: #0f3b5f; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; }
.gd-mock-bar { display: flex; flex-wrap: wrap; gap: 20px 14px; align-items: center; justify-content: center; padding: 16px 12px 12px; background: rgba(255, 255, 255, 0.78); border-radius: 14px; }
.gd-mock-text {
    margin: 14px 0; padding: 22px 24px; background: #fdf9e3; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    font-family: 'OpenDyslexic', 'Comic Neue', 'Comic Sans MS', 'Open Sans', sans-serif; font-size: 1.7rem; line-height: 1.6; text-align: center; color: #333;
}
.gd-mock-text .hl { background: #fdf9e3; outline: 3px solid #ffeb3b; border-radius: 8px; padding: 0 6px; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.18); }
.gd-mock-text .red { color: #e53935; }
/* the reading veil in a drawing: the rest of the text is darkened, the lit piece stays bright */
.gd-mock-text.gd-veiled { background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), #fdf9e3; color: #3a3a3a; }
.gd-mock-text.gd-veiled .hl { color: #1f2937; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.18), 0 0 18px rgba(255, 235, 59, 0.6); }
.gd-mock-text .ok { color: #1b8f3a; font-weight: 700; }
.gd-mock-text .bad { color: #d50000; font-weight: 700; text-shadow: 0 0 1px rgba(213, 0, 0, 0.3); }
.gd-pinwrap { position: relative; display: inline-flex; }
.gd-pin {
    position: absolute; z-index: 3; top: -13px; left: -11px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; background: #e11d48; color: #fff; border: 2px solid #fff;
    font: 800 0.85rem/1 'Open Sans', system-ui, sans-serif; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.gd-hand { color: #e53935; font-size: 1.6rem; position: absolute; top: -36px; left: 50%; transform: translateX(-50%); }

/* ---- small helpers ---- */
.gd-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 1em 0; }
.gd-card { padding: 14px 16px; border: 1px solid var(--gd-line); border-radius: 12px; background: #fff; }
.gd-card h4 { margin-top: 0; }
.gd-card > :last-child { margin-bottom: 0; }
.gd-colorrow { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0.6em 0 1em; }
.gd-dot { display: inline-block; width: 1em; height: 1em; border-radius: 50%; margin-right: 0.4em; vertical-align: -0.12em; border: 1px solid rgba(0, 0, 0, 0.3); }
.gd-faq h4 { margin-top: 1.2em; }
.gd-end { margin-top: 36px; padding-top: 18px; border-top: 3px solid #b3e5fc; font-size: 0.92rem; color: var(--gd-muted); }

/* ---- narrow screens (phones) ---- */
@media (max-width: 860px) {
    .gd-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .gd-toc { position: static; max-height: none; }
}
@media (max-width: 600px) {
    .gd { font-size: 1.02rem; }
    .gd-lead { padding: 16px 16px; }
    .gd-lead h2 { font-size: 1.4rem; }
    .gd-sec > h3 { font-size: 1.32rem; }
    .gd-item { flex-direction: column; gap: 10px; }
    .gd-item-btn { flex: none; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding-top: 0; }
    .gd-grid2 { grid-template-columns: minmax(0, 1fr); }
    .gd-mock { padding: 12px; }
    .gd-mock-text { font-size: 1.3rem; padding: 14px; }
    .gd-steps > li { padding-left: 52px; }
    .gd-table th, .gd-table td { padding: 7px 8px; }
}

/* small utility buttons (key row, colour pickers), chips, radios, slider */
.gd .gd-b-small { background: #e0e0e0; color: #333; width: 52px; height: 52px; border-radius: 10px; font-size: 1.3rem; box-shadow: none; }
.gd .gd-b-small.gd-b-small-blue { background: #e3f2fd; color: #1976d2; }
.gd .gd-b-card { background: #fff; color: #333; width: 64px; height: 64px; border-radius: 12px; font-size: 1.6rem; border: 2px solid #cbd5e1; box-shadow: none; }
.gd-chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.gd-chip i { font-size: 0.85em; color: #64748b; }
.gd-radio { display: inline-flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.gd-radio-dot { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #64748b; background: #fff; position: relative; flex: none; }
.gd-radio-dot.on { border-color: #1976d2; }
.gd-radio-dot.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #1976d2; }
.gd-slider { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: #cbd5e1; position: relative; flex: none; margin-left: 12px; vertical-align: middle; }
.gd-slider > span { position: absolute; left: 55%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #1976d2; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.gd-or { color: #64748b; font-weight: 700; margin: 0 8px; }

/* ---- on paper ---- */
@media print {
    .gd { font-size: 11pt; line-height: 1.55; color: #000; }
    .gd-layout { display: block; }
    .gd-toc { position: static; max-height: none; overflow: visible; margin-bottom: 18pt; break-inside: avoid; }
    .gd-sec { margin-bottom: 20pt; }
    .gd-sec > h3 { break-after: avoid; page-break-after: avoid; font-size: 16pt; }
    .gd h4 { break-after: avoid; page-break-after: avoid; }
    .gd-item, .gd-note, .gd-card, .gd-mock, .gd-steps > li, .gd-table tr { break-inside: avoid; page-break-inside: avoid; }
    .gd-toc a { color: inherit; text-decoration: none; }
    .gd-content a { color: #0277bd; }
    .gd-mock { background: #eef0f2; }
    .gd-lead, .gd-grid2 { break-inside: avoid; page-break-inside: avoid; }
}
/* ==== GUIDE-CONTENT-CSS END ==== */

/* ==========================================================================
   Help dialog = user guide (index.html #help-modal). The text is styled by the
   shared block above; this part only builds the dialog around it and the
   "print the guide" layout (body.printing-guide, set by js/events.js).
   ========================================================================== */
#help-modal.modal-overlay { padding: 12px 8px; }
#help-modal .modal-content.gd-modal {
    width: 96%; max-width: 1040px; padding: 0; margin: auto; text-align: left;
    display: flex; flex-direction: column; overflow: hidden; position: relative;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
}
.gd-modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex: none; padding: 12px 14px 12px 20px; border-bottom: 1px solid #e2e8f0; background: #fff;
}
.gd-modal-head h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; color: #0f3b5f; }
.gd-modal-x {
    flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: #f1f5f9;
    color: #475569; font-size: 1.5rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.gd-modal-x:hover { background: #e2e8f0; }
.gd-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 20px 28px; background: #fff; }
.gd-partner {
    margin: 0 0 16px; padding: 10px 12px; background: #fff3cd; border: 1px solid #ffeeba;
    border-radius: 6px; color: #856404; font-size: 0.95rem; text-align: left;
}
.gd-modal-foot { display: flex; gap: 10px; flex: none; padding: 12px 16px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.gd-modal-foot button { flex: 1; min-height: 48px; font-size: 1rem; font-weight: 700; border-radius: 10px; cursor: pointer; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (max-width: 600px) {
    #help-modal.modal-overlay { padding: 0; }
    #help-modal .modal-content.gd-modal { width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
    .gd-scroll { padding: 12px 12px 24px; }
    .gd-modal-head h2 { font-size: 1.15rem; }
}
@media print {
    body.printing-guide {
        display: block !important; height: auto !important; min-height: 0 !important;
        overflow: visible !important; background: #fff !important;
    }
    body.printing-guide > *:not(#help-modal) { display: none !important; }
    body.printing-guide #help-modal {
        display: block !important; position: static !important; height: auto !important;
        overflow: visible !important; padding: 0 !important; background: none !important;
    }
    body.printing-guide #help-modal .modal-content.gd-modal {
        display: block !important; width: 100% !important; max-width: none !important; max-height: none !important;
        overflow: visible !important; margin: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    }
    body.printing-guide .gd-scroll { overflow: visible !important; max-height: none !important; padding: 0 !important; }
    body.printing-guide .gd-modal-head { border: 0; padding: 0 0 10pt; }
    body.printing-guide .gd-modal-x,
    body.printing-guide .gd-modal-foot,
    body.printing-guide .gd-partner { display: none !important; }
}

/* "My words" in the picture dictionary window (js/picture-picker.js,
   2026-10-11); the shared look is in css/picture-picker.css. */
.pp-er-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.pp-er-section .pp-sec-title { font-size: 1rem; }
.pp-er-section .pp-sec-hint { font-size: 0.84rem; margin-bottom: 8px; color: #555; }
.pp-er-section .pp-new { min-height: 52px; }
.pp-er-section .pp-mine { max-height: 300px; overflow-y: auto; }
.pp-preview .pp-card.pp-er-line { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 8px 10px; font-family: 'OpenDyslexic', 'Open Sans', sans-serif; font-size: 1.6rem; color: #333; }
.pp-er-wi { display: inline-flex; flex-direction: column; align-items: center; }
.pp-er-wi img { width: 110px; height: 110px; object-fit: contain; }
.pp-preview .pp-card .pp-er-ph { width: 100%; height: auto; min-height: 90px; margin-bottom: 8px; }
@media (max-width: 700px) {
    .pp-preview .pp-card.pp-er-line { font-size: 1.25rem; justify-content: flex-start; }
    .pp-er-wi img { width: 64px; height: 64px; }
    .pp-preview .pp-card .pp-er-ph { display: none; }
}

/* Emoji as pictures (js/emoji-images.js): the emoji text stays inside,
   transparent, so texts, copy/paste and screen readers are unchanged. */
.emoji-pic {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    line-height: 1.2em;
    vertical-align: -0.22em;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
    overflow: hidden;
    text-align: center;
    font-style: normal;
    white-space: nowrap;
    user-select: text;
}

/* ==== Scoring by the teacher (owner, 2026-10-19) - js/teacher-mark.js ====
   Settings: who scores (microphone / teacher). Reading screen: the
   teacher's two buttons (as Rapid Naming's manual mode) and the lines under
   the scored words. Same as in the «Βοηθός Ανάγνωσης». */
.scoring-row { margin-top: 4px; }
.scoring-label { font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 5px; }
.scoring-cards { display: flex; gap: 8px; }
.scoring-card {
    flex: 1; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
    border: 2px solid #e2e8f0; background: #fff; border-radius: 10px; padding: 7px 9px;
    font-size: 0.78rem; line-height: 1.3; color: #475569; user-select: none;
}
.scoring-card b { font-size: 0.9rem; color: #1e293b; }
.scoring-card.active { border-color: #7c3aed; background: #f5f3ff; }
.scoring-card.disabled { opacity: 0.45; cursor: not-allowed; }
.scoring-card:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.scoring-no-mic { margin-top: 5px; font-size: 0.78rem; color: #9a3412; }

.teacher-mark { gap: 10px; align-items: center; }
.tm-btn {
    width: 56px; height: 56px; border: none; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18); touch-action: manipulation;
}
.tm-btn img { width: 32px; height: 32px; pointer-events: none; }
.tm-circle { border-radius: 50%; }
.tm-square { border-radius: 12px; }
.tm-btn.tm-pop { animation: tm-pop 0.32s ease; }
@keyframes tm-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.18) rotate(-6deg); }
    100% { transform: scale(1); }
}
#text-display .pm-ok, #text-display .pm-bad, #text-display .tm-tapped {
    text-decoration-line: underline; text-decoration-thickness: 0.12em; text-underline-offset: 0.22em;
    text-decoration-skip-ink: none;
}
#text-display .pm-ok { text-decoration-color: #86efac; }
#text-display .pm-bad, #text-display .tm-tapped { text-decoration-color: #f97316; }
#text-display .tm-tapped { box-shadow: inset 0 0 0 3px #fdba74; border-radius: 8px; }


/* the message about the teacher's two buttons (2026-10-19) */
.tm-hint {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 900;
    max-width: min(640px, calc(100vw - 24px)); box-sizing: border-box;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #fff7ed; color: #7c2d12; border: 2px solid #fdba74; border-radius: 12px;
    padding: 10px 12px; font-size: 0.95rem; line-height: 1.35; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.tm-hint-text { flex: 1 1 260px; }
.tm-hint-hide {
    background: #fff; border: 1px solid #fdba74; color: #9a3412; border-radius: 8px;
    padding: 4px 10px; cursor: pointer; font-size: 0.85rem;
}
.tm-hint-x { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #9a3412; line-height: 1; }

/* 2026-10-19: on a phone, under the round corner buttons (full screen, language) */
@media (max-width: 600px) {
    .update-banner { top: 64px; }
}

/* Settings per student (2026-11-01, js/student-settings.js) */
.ss-bar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; background: #f8fafc; border: 1px solid #e2e8f0; }
.ss-for { font-weight: bold; font-size: 0.95rem; color: #334155; }
.ss-seg { display: inline-flex; border: 2px solid #cbd5e1; border-radius: 999px; overflow: hidden; background: #fff; max-width: 100%; }
.ss-seg-btn { border: 0; background: transparent; padding: 8px 16px; min-height: 40px; font: inherit; font-weight: bold; font-size: 0.95rem; color: #475569; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.ss-seg-btn.on { background: #334155; color: #fff; }
.ss-seg-btn.ss-seg-kid.on { background: #be185d; }
.ss-seg-btn:focus-visible { outline: 3px solid #0277bd; outline-offset: -3px; }
.ss-note { flex-basis: 100%; color: #475569; font-size: 0.85rem; }
.ss-extras { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: #334155; }
.ss-extra { display: inline-flex; align-items: center; }
.settings-panel.ss-kid { box-shadow: inset 0 0 0 3px rgba(190, 24, 93, 0.35); }
.settings-panel.ss-kid > .ss-bar { background: #fdf2f8; border-color: #f9a8d4; }
.ss-mark { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; vertical-align: middle; flex-wrap: wrap; }
.color-btn-card .ss-mark { margin: 4px 0 0; justify-content: center; }
.ss-badge { padding: 1px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: bold; background: #fce7f3; color: #9d174d; white-space: nowrap; }
.ss-back { border: 0; background: none; padding: 4px 2px; min-height: 32px; font: inherit; font-size: 0.78rem; font-weight: normal; color: #0f5f99; text-decoration: underline; cursor: pointer; white-space: nowrap; box-shadow: none; }
.chip-own-settings { margin-left: 6px; font-size: 0.72rem; font-weight: bold; color: #9d174d; white-space: nowrap; }
@media (max-width: 500px) {
    .ss-seg-btn { padding: 7px 10px; font-size: 0.85rem; }
    .ss-bar { gap: 8px; }
}

/* Backup: the whole class / one child (2026-11-02) */
.backup-block { margin: 12px 0 0; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.backup-block[hidden] { display: none; }
.backup-block-title { margin: 0 0 4px; font-size: 1rem; color: #1e293b; }
.backup-sub { margin: 0 0 8px; font-size: 0.85rem; color: #475569; line-height: 1.4; }
.backup-child-row { align-items: stretch; }
.backup-child-row select { flex: 1 1 100%; min-width: 0; min-height: 44px; font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid #94a3b8; background: #fff; }

/* the award levels: js/award-levels.js adds its own styles (2026-11-04) */

/* «💾 Αποθήκευση»: where the file will go (js/save-file.js, 2026-11-05) */
.save-where { margin: -4px 0 14px; font-size: 0.9rem; color: #475569; line-height: 1.4; }
.save-where:empty { display: none; }
