/**
 * Animal Game - Simplified Retro Styling
 * Classic 8-bit terminal aesthetic
 */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #00ff41;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .title {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: #000;
        color: #fff;
    }
    
    #game-container {
        border-color: #fff;
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
    
    .big-button, .choice-button, .small-button {
        border: 2px solid #fff;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid #ff0055;
    outline-offset: 2px;
}

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

/* Scanline effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 65, 0.03) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 3px
    );
    pointer-events: none;
    z-index: 1000;
}

#game-container {
    max-width: 800px;
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    border: clamp(2px, 0.5vw, 4px) solid #00ff41;
    border-radius: clamp(8px, 2vw, 10px);
    padding: clamp(20px, 5vw, 40px);
    box-shadow: 0 0 clamp(20px, 5vw, 40px) rgba(0, 255, 65, 0.6);
    position: relative;
    margin: clamp(10px, 2vw, 20px);
    backdrop-filter: blur(10px);
}

/* Title */
.title {
    font-size: clamp(2em, 5vw, 3em);
    text-align: center;
    margin-bottom: 10px;
    color: #00ff41;
    text-shadow: 0 0 20px #00ff41;
    animation: pulse 2s infinite;
    word-wrap: break-word;
    line-height: 1.2;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.subtitle {
    text-align: center;
    font-size: 0.7em;
    color: #00cc33;
    margin-bottom: 40px;
}

/* Caption Area */
#caption-area {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 65, 0.05);
    border: 2px dashed #00ff41;
    margin: 30px 0;
    padding: 30px;
    border-radius: 5px;
    transition: all 0.3s ease;
    position: relative;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

#caption-area:focus-within {
    border-color: #ff0055;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.3);
    outline: none;
}

#caption {
    font-size: clamp(0.9em, 2.5vw, 1.1em);
    text-align: center;
    line-height: 1.8;
    color: #00ff41;
    text-shadow: 0 0 5px #00ff41;
    max-width: 100%;
}

#caption {
    font-size: 1.1em;
    text-align: center;
    line-height: 1.8;
    color: #00ff41;
    text-shadow: 0 0 5px #00ff41;
}

/* Microphone Indicator */
#mic-indicator {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
}

.mic-pulse {
    width: 60px;
    height: 60px;
    background: #ff0055;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: micPulse 1s infinite;
}

@keyframes micPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 40px rgba(255, 0, 85, 0.8);
    }
}

#mic-indicator p {
    font-size: 0.8em;
    color: #ff0055;
}

/* Buttons */
.big-button {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.9em, 2.5vw, 1.2em);
    padding: clamp(15px, 3vw, 20px) clamp(20px, 4vw, 40px);
    margin: 10px;
    background: #00ff41;
    color: #000;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 6px 0 #00cc33;
    transition: all 0.1s ease;
    display: block;
    width: 100%;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    min-height: 44px; /* Accessibility minimum touch target */
}

/* Accessibility improvements */
.big-button:focus {
    outline: 3px solid #ff0055;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(255, 0, 85, 0.5);
}

.big-button:hover {
    background: #00cc33;
    transform: translateY(2px);
    box-shadow: 0 4px 0 #009922;
}

.big-button:active {
    transform: translateY(6px);
    box-shadow: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .big-button {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .big-button {
        transition: none;
    }
    
    .big-button:hover {
        transform: none;
    }
}

.big-button:hover {
    background: #00cc33;
    transform: translateY(2px);
    box-shadow: 0 4px 0 #009922;
}

.big-button:active {
    transform: translateY(6px);
    box-shadow: none;
}

.small-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7em;
    padding: 10px 20px;
    margin: 10px;
    background: #00ff41;
    color: #000;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 0 #00cc33;
    transition: all 0.1s;
    display: inline-block;
}

.small-button:hover {
    background: #00cc33;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #009922;
}

.small-button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* YES/NO Choice Buttons */
#yesno-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.choice-button {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1.2em, 4vw, 1.8em);
    padding: clamp(15px, 4vw, 25px) clamp(30px, 6vw, 60px);
    border: clamp(2px, 0.5vw, 4px) solid;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 clamp(4px, 1vw, 8px) 0;
    transition: all 0.1s ease;
    min-width: 120px;
    min-height: 44px; /* Accessibility minimum */
    flex: 1;
    max-width: 200px;
}

.choice-button:focus {
    outline: 3px solid #ff0055;
    outline-offset: 2px;
}

.choice-button:hover {
    transform: translateY(2px);
    box-shadow: 0 clamp(2px, 0.5vw, 6px) 0;
}

.choice-button:active {
    transform: translateY(clamp(4px, 1vw, 8px));
    box-shadow: none;
}

.yes-button {
    background: #00ff41;
    color: #000;
    border-color: #00cc33;
    box-shadow: 0 8px 0 #00cc33;
}

.yes-button:hover {
    background: #00cc33;
    transform: translateY(3px);
    box-shadow: 0 5px 0 #009922;
}

.yes-button:active {
    transform: translateY(8px);
    box-shadow: none;
}

.no-button {
    background: #ff0055;
    color: #fff;
    border-color: #cc0044;
    box-shadow: 0 8px 0 #cc0044;
}

.no-button:hover {
    background: #cc0044;
    transform: translateY(3px);
    box-shadow: 0 5px 0 #990033;
}

.no-button:active {
    transform: translateY(8px);
    box-shadow: none;
}

/* Text Input */
#text-input-area {
    text-align: center;
    margin: 30px 0;
}

.text-field {
    width: 90%;
    max-width: 500px;
    padding: 15px;
    background: #000;
    border: 3px solid #00ff41;
    color: #00ff41;
    font-family: 'Press Start 2P', monospace;
    font-size: 1em;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.text-field:focus {
    outline: none;
    border-color: #00ff41;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

.submit-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 1em;
    padding: 15px 40px;
    background: #00ff41;
    color: #000;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 0 #00cc33;
}

.submit-button:hover {
    background: #00cc33;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #009922;
}

.submit-button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Stats */
#stats {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid #00ff41;
    border-radius: 5px;
}

#stats p {
    font-size: 0.7em;
    color: #00cc33;
}

#stats span {
    color: #00ff41;
    text-shadow: 0 0 5px #00ff41;
}

/* Settings */
#settings {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    filter: grayscale(100%) brightness(0.7);
    transition: all 0.2s;
}

.icon-button:hover {
    filter: grayscale(0%) brightness(1);
    transform: scale(1.1);
}

/* Settings Modal & About Modal */
#settings-modal,
#about-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #000;
    border: 4px solid #00ff41;
    padding: 40px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 50px rgba(0, 255, 65, 0.7);
}

.modal-content h2 {
    color: #00ff41;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.modal-content label {
    display: block;
    color: #00ff41;
    font-size: 0.7em;
    margin-bottom: 10px;
}

.modal-content input[type="password"] {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 2px solid #00ff41;
    color: #00ff41;
    font-family: monospace;
    font-size: 0.9em;
    margin-bottom: 20px;
}

/* Controls */
#controls {
    text-align: center;
    margin: 20px 0;
}

/* AR Mode Compatibility - Ensure UI works in AR */
#controls,
#yesno-buttons,
#text-input-area,
#caption-area,
#stats,
#settings,
#mic-indicator {
    position: relative;
    z-index: 150; /* Above AR canvas (z-index: 1) but below buttons (z-index: 200) */
    pointer-events: auto; /* Ensure clickable */
}

/* Ensure all buttons are clickable in AR mode */
button,
input,
select {
    pointer-events: auto;
    position: relative;
    z-index: 150;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    #game-container {
        padding: 20px;
        margin: 10px;
    }
    
    #caption {
        font-size: clamp(0.8em, 2.5vw, 1.1em);
        line-height: 1.6;
    }
    
    #yesno-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .choice-button {
        width: 100%;
        font-size: clamp(1.2em, 4vw, 1.8em);
        padding: clamp(15px, 4vw, 25px);
    }
    
    .subtitle {
        font-size: clamp(0.5em, 1.5vw, 0.7em);
    }
    
    #stats {
        font-size: clamp(0.6em, 2vw, 0.9em);
    }
}

@media (max-width: 480px) {
    #game-container {
        padding: 15px;
        margin: 5px;
    }
    
    .title {
        font-size: clamp(1.5em, 6vw, 2em);
        margin-bottom: 5px;
    }
    
    #caption-area {
        min-height: 120px;
        padding: 20px;
        margin: 15px 0;
    }
    
    .big-button {
        font-size: clamp(0.8em, 3vw, 1em);
        padding: clamp(12px, 3vw, 15px) clamp(15px, 4vw, 20px);
    }
    
    .choice-button {
        font-size: clamp(1em, 5vw, 1.5em);
        padding: clamp(12px, 3vw, 20px);
    }
    
    #yesno-buttons {
        gap: 10px;
    }
}

@media (max-width: 320px) {
    #game-container {
        padding: 10px;
        margin: 2px;
    }
    
    .title {
        font-size: clamp(1.2em, 8vw, 1.5em);
    }
    
    #caption-area {
        min-height: 100px;
        padding: 15px;
        margin: 10px 0;
    }
    
    #caption {
        font-size: clamp(0.7em, 3vw, 0.9em);
    }
}
