/* Custom High Contrast & Accessibility Styles */
:root {
    color-scheme: dark;
    --bg-color: #121212;
    --text-color: #fefefe;
    --accent-yellow: #fbbf24;
    --accent-red: #ef4444;
    --accent-green: #16a34a;
    --border-color: #ffffff;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Focus states for keyboard navigation - Critical for accessibility */
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--accent-yellow);
    outline-offset: 2px;
}

/* Updated: Border reduced to 2px */
.high-contrast-border {
    border: 2px solid var(--border-color);
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.log-entry {
    border-bottom: 1px solid #333;
    padding: 0.25rem 0;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-in;
}

.collapsed .log-entry:not(:first-child) {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Accessible Progress Bar */
progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 1.25rem;
}
progress::-webkit-progress-bar {
    background-color: #333;
    /* Updated: Border reduced to 1px */
    border: 1px solid white;
}
progress::-webkit-progress-value {
    background-color: var(--accent-green);
}

progress.hp-warning::-webkit-progress-value {
    background-color: var(--accent-yellow);
}
progress.hp-critical::-webkit-progress-value {
    background-color: var(--accent-red);
}

progress::-moz-progress-bar {
    background-color: var(--accent-green);
}
progress.hp-warning::-moz-progress-bar {
    background-color: var(--accent-yellow);
}
progress.hp-critical::-moz-progress-bar {
    background-color: var(--accent-red);
}

/* Custom High Contrast Select Arrow Styling */
.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
    padding-right: 2.5rem !important;
}

/* Custom High Contrast Checkbox */
.custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    background-color: black;
    border: 2px solid white;
    border-radius: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    position: relative;
}

.custom-checkbox:checked {
    background-color: #16a34a; /* accent-green-600 */
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 80%;
}

/* Matches the CoA Apps site's own .back-link styling (green link, underline
   on hover/focus), reusing this game's own theme colors instead of pulling
   in the whole site stylesheet and its unrelated rules. Same approach used
   by Math Collapse's play.html for its own back link. */
.back-link-game {
    display: inline-block;
    color: var(--accent-green);
    font-weight: bold;
    font-size: 16px;
    text-decoration: none;
}
.back-link-game:hover,
.back-link-game:focus-visible {
    text-decoration: underline;
    outline: 3px solid var(--accent-yellow);
    outline-offset: 2px;
}
