/* === LICENSE HEADER START ===
Copyright (c) 2025 Robert Brake
This file is part of a proprietary software project.
Unauthorized use, modification, or distribution is strictly prohibited.
=== LICENSE HEADER END === */

/* Prevent mobile zooming and improve touch handling */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f0f2f5;
    color: #2c3e50;
}

/* Allow text selection for input fields and important text */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Prevent zoom on double-tap for interactive elements */
.num-btn, button, .difficulty-btn, .sound-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on answer display */
#answer-display {
    touch-action: manipulation;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Enhanced styling and touch handling */
    -webkit-tap-highlight-color: transparent;
    cursor: default;
    font-size: 2rem;
    font-weight: bold;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: #f8f9fa;
    color: #2c3e50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
}

.screen {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

h1, h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #0d47a1;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button {
    background-color: #0d47a1;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #002171;
}

button:focus, 
input:focus, 
select:focus, 
textarea:focus {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
}

.activity-link {
    display: inline-block;
    background: #0d47a1;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s ease;
}


/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #4A90E2;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Improved focus styles for interactive elements */
.difficulty-btn:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px white;
}

.sound-btn:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
    background-color: #e0e7ef;
}

/* Improved contrast for disabled states */
button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

/* Improved focus styles for accordion buttons */
.accordion-toggle:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
    background-color: #e3f2fd;
}

/* Improved table accessibility */
#scores-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    padding: 12px 8px;
}

#scores-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #ddd;
}

/* Improved form field accessibility */
input[type="text"],
input[type="number"],
input[type="email"],
textarea {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: #0d47a1;
}

/* Improved error state visibility */
input.invalid {
    border-color: #b71c1c;
    background-color: #fff8f8;
}

input.invalid:focus {
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.25);
}

/* Improved loading state */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Improved mobile touch targets */
@media (max-width: 700px) {
    button, 
    .difficulty-btn,
    .sound-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="email"],
    textarea {
        min-height: 44px;
    }
}

.game-header {
    margin-bottom: 2rem;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.progress {
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    background-color: #0d47a1;
    width: 0%;
    transition: width 0.3s;
}

.problem {
    font-size: 2rem;
    text-align: center;
    margin: 2rem 0;
    /* Prevent zoom on problem display */
    touch-action: manipulation;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.numpad {
    display: grid;
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
}

.numpad-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.num-btn {
    padding: 1.8rem 0;
    font-size: 1.5rem;
    min-width: 70px;
    min-height: 90px;
    border-radius: 8px;
    margin: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease, transform 0.1s ease;
    will-change: background-color, transform;
    /* Enhanced touch handling */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: pointer;
}

#backspace {
    background-color: #b71c1c;
}

#backspace:hover {
    background-color: #7f0000;
}

#enter {
    background-color: #1b5e20;
}

#enter:hover {
    background-color: #003300;
}

#scores-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

#scores-table th,
#scores-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#scores-table tr:hover {
    background-color: #f8f9fa;
}

#leaderboard {
    max-height: none;
    overflow-y: visible;
}

.feedback-message {
    text-align: center;
    font-size: 1.3rem;
    margin: 0.5rem 0 1rem 0;
    color: #0d47a1;
    min-height: 1.5em;
    opacity: 0;
    transition: opacity 0.5s;
    font-weight: bold;
}

@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
  100% { transform: translateX(0); }
}
.shake {
  animation: shake 0.4s;
}
.emoji-feedback {
  display: inline-block;
  font-size: 2rem;
  vertical-align: middle;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s, transform 0.3s;
}
.emoji-feedback.show {
  opacity: 1;
  transform: scale(1.2);
}

.difficulty-btn {
    background-color: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #0d47a1;
    border-radius: 4px;
    padding: 0.5rem 1.2rem;
    margin: 0 0.3rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.difficulty-btn.selected, .difficulty-btn:active {
    background-color: #0d47a1;
    color: #ffffff;
}

.sound-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sound-btn:hover {
    background-color: #e0e7ef;
}

.sound-btn.muted {
    opacity: 0.5;
}

.input-help {
    display: block;
    color: #b71c1c;
    font-size: 0.8rem;
    margin-top: 0rem;
}

.input-help.hidden {
    display: none;
}

.nickname-row {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto 0 auto;
    width: 100%;
    gap: 0.5rem;
}
.nickname-row input {
    flex: 1 1 auto;
    min-width: 0;
}
.nickname-row .sound-btn {
    flex: 0 0 auto;
    margin-left: 0.5rem;
}

.options-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 500px;
    margin: 0 auto 2rem auto;
    width: 100%;
}
.difficulty-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: nowrap;
    margin-top: 0.5rem;
}
.options-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 2.5rem;
    width: 100%;
    margin-top: 1.5rem;
}
.sample-problem-block, .display-style-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}
@media (max-width: 700px) {
    .options-block {
        max-width: 98vw;
    }.game-header
    .options-row {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    .difficulty-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}
.main-options-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 2.5rem;
    width: 100%;
    margin-top: 1.5rem;
}
.main-options-left, .main-options-right {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.main-options-left {
    min-width: 220px;
    align-items: flex-end;
}
.main-options-right {
    min-width: 220px;
    align-items: flex-start;
    gap: 0.5rem;
}
.main-options-right .option-group {
    margin-bottom: 0.25rem;
}
.main-options-right .option-group:last-child {
    margin-bottom: 0;
}
.display-style-row {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 0.5rem;
    margin-bottom: 0;
}
.display-style-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-weight: normal;
    text-align: center;
    gap: 0.2em;
}
.display-style-option input[type="radio"] {
    margin: 0;
    accent-color: #0d47a1;
    width: 1.5em;
    height: 1.5em;
}
.display-style-option input[type="radio"]:checked {
}
.sample-problem-block {
    margin-top: 0.2rem;
}
@media (max-width: 700px) {
    .main-options-row {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    .main-options-left, .main-options-right {
        min-width: 0;
        align-items: center;
    }
}
.main-options-left .form-group,
.main-options-right .form-group,
.sample-problem-block,
.display-style-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.main-options-left label,
.main-options-right label {
    text-align: center;
    width: 100%;
}
.range-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}
.main-options-left input[type="number"],
.main-options-left input[type="text"],
.main-options-left input[type="password"] {
    text-align: center;
}
#start-button {
    display: block;
    margin: 0 auto;
}
.main-options-left .option-group {
    margin-bottom: 0.5rem;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .emoji-feedback {
        transition: none;
    }
    
    .feedback-message {
        transition: none;
    }
    
    #progress-bar {
        transition: none;
    }
}

/* Improved animation accessibility */
@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shake 0.4s;
}

/* Improved focus ring for high contrast mode */
@media (forced-colors: active) {
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid CanvasText;
    }
    
    .difficulty-btn.selected {
        border: 2px solid CanvasText;
    }
}

/* Improved text scaling */
html {
    font-size: 16px;
}

@media screen and (min-width: 1200px) {
    html {
        font-size: 18px;
    }
}

/* Improved form field sizing */
input[type="text"],
input[type="number"],
input[type="email"],
textarea {
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.5rem;
    min-height: 2.5rem;
}

/* Improved button text scaling */
button {
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.5rem 1rem;
    min-height: 2.5rem;
}

/* Improved table text scaling */
#scores-table {
    font-size: 1rem;
    line-height: 1.5;
}

/* Improved error message visibility */
.error-message {
    color: #b71c1c;
    background-color: #fff8f8;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid #b71c1c;
}

/* Improved success message visibility */
.success-message {
    color: #1b5e20;
    background-color: #f1f8e9;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid #1b5e20;
}

/* Improved loading indicator */
.loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #0d47a1;
    font-weight: bold;
}

/* Improved focus styles for custom elements */
[role="button"],
[role="tab"],
[role="link"] {
    cursor: pointer;
}

[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="link"]:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
}

/* Improved table header contrast */
#scores-table th {
    background-color: #e3f2fd;
    color: #0d47a1;
    font-weight: bold;
}

/* Improved form field grouping */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

/* Improved help text visibility */
.input-help,
.input-note {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.input-help {
    color: #b71c1c;
}

.input-note {
    color: #424242;
}

/* Improved focus styles for keyboard navigation */
:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px white;
}

/* Improved touch targets for mobile */
@media (max-width: 700px) {
    button,
    .difficulty-btn,
    .sound-btn,
    .num-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="email"],
    textarea {
        min-height: 44px;
        padding: 0.75rem;
    }
    
    .accordion-toggle {
        min-height: 44px;
        padding: 0.75rem 0;
    }
}

/* Improved error state visibility */
.error-state {
    border-color: #b71c1c !important;
    background-color: #fff8f8 !important;
}

.error-state:focus {
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.25) !important;
}

/* Improved success state visibility */
.success-state {
    border-color: #1b5e20 !important;
    background-color: #f1f8e9 !important;
}

.success-state:focus {
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.25) !important;
}

/* Improved loading state visibility */
.loading-state {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading-state::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #0d47a1;
    font-weight: bold;
}

/* Improved table accessibility */
#scores-table th,
#missed-table th {
    background-color: #e3f2fd;
    color: #0d47a1;
    font-weight: bold;
    padding: 1rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}

#scores-table td,
#missed-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ddd;
}

#scores-table tr:hover,
#missed-table tr:hover {
    background-color: #f5f5f5;
}

/* Improved form field accessibility */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #1a1a1a;
}

.form-group input:focus + label,
.form-group input:focus-visible + label {
    color: #0d47a1;
}

/* Improved button states */
button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Improved accordion accessibility */
.accordion-toggle {
    position: relative;
    padding: 1rem 0;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: #0d47a1;
}

.accordion-toggle:hover {
    background-color: #e3f2fd;
}

.accordion-toggle:focus-visible {
    outline: 3px solid #0d47a1;
    outline-offset: 2px;
    background-color: #e3f2fd;
}

/* Improved feedback message visibility */
.feedback-message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

.feedback-message.correct {
    background-color: #f1f8e9;
    color: #1b5e20;
    border: 1px solid #1b5e20;
}

.feedback-message.incorrect {
    background-color: #fff8f8;
    color: #b71c1c;
    border: 1px solid #b71c1c;
}

/* Improved progress bar accessibility */
.progress {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

#progress-bar {
    height: 100%;
    background-color: #0d47a1;
    transition: width 0.3s ease;
}

/* Improved skip link visibility */
.skip-link {
    position: absolute;
    left: 0;
    top: 0;
    transform: translateY(-200%);
    background: #0d47a1;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: transform 0.2s;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    font-weight: bold;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Improved mobile layout */
@media (max-width: 700px) {
    .container {
        padding: 1rem;
    }
    
    .screen {
        padding: 1rem;
    }
    
    .numpad {
        gap: 0.75rem;
    }
    
    .numpad-row {
        gap: 0.75rem;
    }
    
    .num-btn {
        padding: 1.3rem 0;
        font-size: 1.2rem;
        min-width: 56px;
        min-height: 72px;
    }
    
    .problem {
        font-size: 1.5rem;
        margin: 1rem 0;
    }
    
    .feedback-message {
        font-size: 1.1rem;
    }
}

/* Base styles for all interactive elements */
button, 
input[type="text"],
input[type="number"],
input[type="checkbox"],
input[type="radio"],
select,
textarea {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
}

/* Specific styles for number pad buttons */
.numpad .num-btn {
    min-width: 70px;
    min-height: 90px;
    font-size: 1.5rem;
    padding: 1.8rem 0;
    margin: 0.25rem;
}

/* Styles for difficulty buttons */
.difficulty-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 16px;
    margin: 4px;
}

/* Styles for form inputs */
.form-group input[type="text"],
.form-group input[type="number"] {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    margin: 4px 0;
}

/* Styles for radio buttons and checkboxes */
input[type="radio"],
input[type="checkbox"] {
    min-width: 44px;
    min-height: 44px;
    margin: 4px;
}

/* Styles for the sound toggle button */
.sound-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
    margin: 4px;
}

/* Styles for the accessibility test button */
.accessibility-test-button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 16px;
    margin: 4px;
}

/* Styles for accordion toggles */
.accordion-toggle {
    min-height: 44px;
    padding: 8px 16px;
    margin: 4px 0;
}

/* Start Game button specific styles */
#start-button {
    display: block;
    margin: 2rem auto;
    min-height: 44px;
    min-width: 44px;
    padding: 8px 16px;
}

/* Media query for mobile devices */
@media (max-width: 700px) {
    button, 
    input[type="text"],
    input[type="number"],
    input[type="checkbox"],
    input[type="radio"],
    select,
    textarea {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
    }

    /* Specific mobile styles for number pad */
    .numpad .num-btn {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
        margin: 4px;
    }

    /* Specific mobile styles for form inputs */
    .form-group input[type="text"],
    .form-group input[type="number"] {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
        margin: 4px 0;
    }

    /* Specific mobile styles for radio buttons and checkboxes */
    input[type="radio"],
    input[type="checkbox"] {
        min-width: 48px;
        min-height: 48px;
        margin: 4px;
    }

    /* Specific mobile styles for buttons */
    .difficulty-btn,
    .sound-btn,
    .accessibility-test-button,
    .accordion-toggle {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
        margin: 4px;
    }

    /* Mobile styles for Start Game button */
    #start-button {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 24px;
    }
}

/* Ensure all interactive elements in the game screen have proper touch targets */
#game-screen button,
#game-screen input {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
}

/* Ensure all interactive elements in the start screen have proper touch targets */
#start-screen button,
#start-screen input {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
}

/* Ensure all interactive elements in the game over screen have proper touch targets */
#game-over-screen button,
#game-over-screen input {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
}

#game-over-screen.hidden {
    display: none !important;
}

.timer-checkbox-label input[type='checkbox'] {
    accent-color: #0d47a1;
    width: 1.5em;
    height: 1.5em;
}

@media (max-width: 700px) {
    .timer-checkbox-label input[type='checkbox'],
    .display-style-option input[type="radio"] {
        width: 1.1em !important;
        height: 1.1em !important;
    }
}

/* Number preview links */
#factor1-preview a,
#factor2-preview a {
    color: #0d47a1;
    text-decoration: underline;
}
#factor1-preview,
#factor2-preview {
    color: #0d47a1;
    font-weight: 500;
}

.site-footer {
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 0 0.5rem 0;
}
.footer-content {
    text-align: center;
    margin: 0 auto;
}

.back-button {
    font-size: 1.2rem;
    text-decoration: none;
    color: #0d47a1;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1;
    font-weight: 500;
    border-radius: 6px;
    background: none;
    transition: color 0.2s, background 0.2s;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}
.back-arrow {
    font-size: 1.8rem;
    line-height: 1;
    font-weight: bold;
}
.back-text {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.back-button:hover, .back-button:focus {
    color: #1565c0;
    background: #e3f2fd;
    text-decoration: none;
}
@media (max-width: 700px) {
    .back-button {
        width: 100%;
        justify-content: center;
        margin-bottom: 1.2rem;
        margin-top: 0.5rem;
    }
    .header-content {
        flex-direction: column;
        align-items: center;
    }
}

.about-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.section-block {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.section-block h2 {
    color: #0d47a1;
    margin-top: 0;
    margin-bottom: 1rem;
}
.section-block p {
    line-height: 1.6;
    margin-bottom: 1rem;
}
.section-block:last-child {
    margin-bottom: 0;
}

.scores-table-container {
    max-height: 400px;
    overflow-y: auto;
}

/* Feedback animations */
.correct-feedback {
    background-color: #c8f7c5;
    transition: background-color 0.2s ease;
}

.wrong-feedback {
    background-color: #f7c5c5;
    transition: background-color 0.2s ease;
}

/* Optimize number pad button transitions */
.num-btn:active {
    transform: scale(0.95);
}

/* Logo Navigation */
.logo-nav {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.logo-nav:hover, .logo-nav:focus {
    background: #e3f2fd;
    text-decoration: none;
}

.nav-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 700px) {
    .logo-nav {
        width: 100%;
        justify-content: center;
        margin-bottom: 1.2rem;
        margin-top: 0.5rem;
    }
} 