@font-face {
    font-family: 'OpenDyslexic';
    src: url('/files/fonts/opendyslexic/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/files/fonts/opendyslexic/OpenDyslexic-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/files/fonts/opendyslexic/OpenDyslexic-Italic.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
}

.a11y-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 3.5rem;
    height: 3.5rem;
    background: #6d28d9;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, width 0.2s, height 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.a11y-toggle:hover {
    transform: scale(1.1);
}

.a11y-toggle span {
    color: white;
    font-size: 1.75rem !important;
    font-family: 'Material Symbols Rounded' !important;
}

.a11y-panel {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: white;
    border-radius: 1.25rem;
    padding: 1.5rem;
    width: 22rem;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    border: 2px solid #e2e8f0;
    z-index: 9999;
    font-family: 'Fredoka', sans-serif !important;

    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    box-sizing: border-box;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.a11y-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@media (max-width: 400px) {
    .a11y-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 100px;
        max-height: calc(100vh - 160px);
    }

    .a11y-toggle {
        bottom: 80px;
        right: 10px;
    }
}

.a11y-panel h3 {
    font-size: 1.25em;
    color: #6d28d9;
    margin: 0 0 1em 0;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.a11y-panel h3 span {
    font-family: 'Material Symbols Rounded';
    font-size: 1.25em;
}

.a11y-section {
    margin-bottom: 1.25em;
}

.a11y-section:last-child {
    margin-bottom: 0;
}

.a11y-label {
    font-size: 0.95em;
    color: #64748b;
    margin-bottom: 0.5em;
    display: block;
}

.a11y-size-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.a11y-size-btn {
    flex: 1;
    min-width: 4.5rem;
    padding: 0.75rem 0.25rem 0.5rem;
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    color: #334155;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 3.75em;
    gap: 0.25em;
    transition: border-color 0.2s, background 0.2s, min-height 0.2s;
}

.a11y-size-btn:hover {
    background: #e2e8f0;
}

.a11y-size-btn.active {
    border-color: #6d28d9;
    background: #f5f3ff;
}

.a11y-size-btn .a11y-size-icon {
    font-weight: 700;
    flex: 1;
    display: flex;
    align-items: center;
}

.a11y-size-btn .a11y-size-icon.small {
    font-size: 0.9em;
}

.a11y-size-btn .a11y-size-icon.normal {
    font-size: 1.1em;
}

.a11y-size-btn .a11y-size-icon.large {
    font-size: 1.4em;
}

.a11y-size-btn .a11y-size-label {
    font-size: 0.7em;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.a11y-dyslexia-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 0.75rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
    flex-wrap: wrap;
}

.a11y-dyslexia-toggle:hover {
    background: #e2e8f0;
}

.a11y-dyslexia-toggle.active {
    border-color: #6d28d9;
    background: #f5f3ff;
}

.a11y-dyslexia-toggle .a11y-toggle-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95em;
    color: #334155;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#dyslexiaToggle .a11y-toggle-text {
    font-family: 'OpenDyslexic', sans-serif;
}

.a11y-dyslexia-toggle .a11y-toggle-switch {
    width: 40px;
    min-width: 40px;
    flex-shrink: 0;
    height: 22px;
    background: #cbd5e1;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.a11y-dyslexia-toggle.active .a11y-toggle-switch {
    background: #6d28d9;
}

.a11y-dyslexia-toggle .a11y-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: left 0.2s;
}

.a11y-dyslexia-toggle.active .a11y-toggle-switch::after {
    left: 21px;
}

.a11y-desc {
    font-size: 0.85em;
    color: #94a3b8;
    margin-top: 0.5em;
    line-height: 1.4;
}

.a11y-size-btn,
.a11y-dyslexia-toggle {
    font-size: inherit;
}

#motionToggle .a11y-toggle-text,
#linksToggle .a11y-toggle-text,
#motionDesc,
#linksDesc {
    font-family: 'Fredoka', sans-serif;
}

body.dyslexia-mode #motionToggle .a11y-toggle-text,
body.dyslexia-mode #linksToggle .a11y-toggle-text,
body.dyslexia-mode .a11y-desc,
body.dyslexia-mode .a11y-size-label {
    font-family: 'OpenDyslexic', sans-serif;
}

html.font-small {
    font-size: 85%;
}

html.font-normal {
    font-size: 100%;
}

html.font-large {
    font-size: 125%;
}


body.dyslexia-mode,
body.dyslexia-mode *:not(.material-symbols-rounded):not(.icon):not([class*="material"]):not([class*="a11y"]) {
    font-family: 'OpenDyslexic', sans-serif !important;
}

body.dyslexia-mode .material-symbols-rounded,
body.dyslexia-mode .icon {
    font-family: 'Material Symbols Rounded' !important;
}

body.dyslexia-mode .a11y-panel .material-symbols-rounded {
    font-family: 'Material Symbols Rounded' !important;
}

body.dyslexia-mode h1,
body.dyslexia-mode h2,
body.dyslexia-mode h3,
body.dyslexia-mode h4,
body.dyslexia-mode p,
body.dyslexia-mode a,
body.dyslexia-mode span,
body.dyslexia-mode div {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

body.highlight-links a,
body.highlight-links .filter-btn {
    text-decoration: none !important;
}

body.highlight-links a:not(:has(.icon)):not(:has(.material-symbols-rounded)),
body.highlight-links .filter-btn:not(:has(.icon)):not(:has(.material-symbols-rounded)) {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 2px !important;
}

body.highlight-links a.a11y-no-icon,
body.highlight-links .filter-btn.a11y-no-icon {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 2px !important;
}

body.highlight-links .a11y-text-ref {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 2px !important;
}

.beta-badge {
    display: inline-block;
    background: #f97316;
    color: white;
    font-size: 0.65em;
    padding: 0.15em 0.5em;
    border-radius: 99px;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
    position: relative;
    cursor: help;
}

.beta-badge:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #1e293b;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    width: max-content;
    max-width: 180px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    z-index: 10000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.beta-badge:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    border: 5px solid transparent;
    border-top-color: #1e293b;
    z-index: 10000;
    pointer-events: none;
}

body.dark-mode {
    --c-bg: #0f172a;
    --c-primary: #8b5cf6;
    --c-primary-dark: #a78bfa;
    --c-text-main: #ffffff;
    --c-text-sub: #cbd5e1;
    background-image: radial-gradient(#1e293b 20%, transparent 20%);
}

body.dark-mode .kids-header {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .navbar,
body.dark-mode .game-card,
body.dark-mode .res-card,
body.dark-mode .info-grid>div {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}


body.dark-mode #parents,
body.dark-mode .parents-panel,
body.dark-mode #blog,
body.dark-mode .blog-theme {
    background-color: transparent !important;
    color: var(--c-text-main);
}

body.dark-mode #parents h2,
body.dark-mode .parents-panel h2,
body.dark-mode #blog h2,
body.dark-mode .blog-theme h2 {
    color: var(--c-primary-dark);
}


body.dark-mode #parents div[style*="border-top"],
body.dark-mode .parents-panel div[style*="border-top"] {
    border-top-color: #334155 !important;
}

body.dark-mode .navbar {
    background: rgba(30, 41, 59, 0.95);
}

body.dark-mode .nav-item {
    color: #f8fafc;
}

body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {}

body.dark-mode h2,
body.dark-mode h3 {
    color: var(--c-primary-dark);
}

body.dark-mode p {
    color: #e2e8f0;
}

body.dark-mode .res-card p {
    color: #cbd5e1 !important;
}

body.dark-mode .btn-outline {
    background: #1e293b;
    border: 2px solid #a78bfa;
    color: var(--c-text-main);
}

body.dark-mode .a11y-panel {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .a11y-toggle-text {
    color: #f8fafc;
}

body.dark-mode .a11y-label {
    color: #cbd5e1;
}

body.dark-mode .a11y-size-btn {
    background: #0f172a;
    color: #f8fafc;
}

body.dark-mode .a11y-size-btn.active {
    background: #334155;
    border-color: #a78bfa;
}

body.dark-mode .a11y-dyslexia-toggle {
    background: #0f172a;
}

body.dark-mode .a11y-dyslexia-toggle:hover {
    background: #334155;
}

body.dark-mode .a11y-dyslexia-toggle.active {
    background: #334155;
    border-color: #a78bfa;
}