@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap');

:root {
    /* Dark Mode Colors (Forced for testing) */
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-quaternary: #2f2f2f;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-tertiary: #b0b0b0;
    --accent: #337EA9;
    --accent-hover: #2a6a8a;
    --accent-light: rgba(51, 126, 169, 0.2);
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(51, 126, 169, 0.4);
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    scrollbar-width: none;
}

body {
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-primary);
}

select {
    -webkit-appearance: none; /* Chrome, Safari, Edge, Opera */
    -moz-appearance: none;    /* Firefox */
    appearance: none;         /* Standard property */
    /* If an arrow from a background image still appears (e.g., in some frameworks like Tailwind or older setups), also add this: */
}

.hidden-select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.container {
    width: 100%;
    max-width: 90%;
}

.hidden {
    display: none !important;
}

/* Landing Page Styling */
.landing-wrapper {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 60px 50px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.landing-title {
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.2;
}

.title-prefix {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2em;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.title-main {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5em;
    font-weight: 700;
    color: var(--accent);
}

.landing-content {
    margin-bottom: 40px;
}

.landing-content p {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1em;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 20px;
    text-align: left;
}

.landing-content p:last-of-type {
    margin-bottom: 0;
}


.start-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    color: white;
    border: 2px solid var(--accent);
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 400;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: block;
    margin-top: 30px;
}

.start-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Back Navigation Button */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    padding: 0;
}

.back-btn:hover {
    background: var(--bg-quaternary);
    transform: translateX(-2px);
}

.back-btn:active {
    transform: translateX(-4px);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

/* Form Styling */
.form-wrapper {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

h1, h2 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-align: center;
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.75em;
    margin-bottom: 20px;
}

.subtitle {
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1em;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95em;
    font-family: 'DM Sans', sans-serif;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    transition: border-color 0.3s ease, color 0s;
}

.form-group input:focus {
    border-color: var(--accent);
    outline: none;
}

/* Custom Select Styles */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    width: 100%;
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.custom-select-selected {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1em;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.custom-select-text {
    flex: 1;
}

.custom-select-text.placeholder {
    color: var(--text-tertiary);
}

.custom-select-arrow {
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
    color: var(--accent);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.custom-select.open .custom-select-options {
    max-height: 300px;
    opacity: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.custom-select-option {
    padding: 12px 15px;
    font-size: 1em;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.custom-select-option:hover,
.custom-select-option:focus {
    background: var(--bg-quaternary);
    color: var(--accent);
    outline: none;
}

.custom-select-option.selected {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}


.form-group input::placeholder {
    color: var(--text-tertiary);
}

.submit-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    background: var(--accent-hover);
}

/* Camera View Styling */
#camera-container {
    position: relative;
}

.game-wrapper {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
}

.camera-wrapper {
    background: var(--bg-primary);
    border-radius: 20px;
    flex: 1;
    min-width: 500px;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
}

.game-controls-wrapper {
    background: var(--bg-primary);
    border-radius: 20px;
    flex: 1;
    min-width: 500px;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    padding: 40px;
    position: relative;
}

.computer-choice-wrapper {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 30px;
    min-width: 300px;
    max-width: 400px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.computer-choice-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3em;
    color: var(--accent);
    text-align: center;
    margin-bottom: 20px;
}

.computer-choice-display {
    text-align: center;
    padding: 30px 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.computer-choice-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    color: var(--accent);
}

.computer-choice-icon svg {
    width: 100px;
    height: 100px;
}

.computer-choice-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.choice-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin: 40px 0;
}

.choice-btn {
    background: var(--bg-secondary);
    border: none;
    border-radius: 16px;
    padding: 50px 60px;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-family: 'DM Sans', sans-serif;
}

.choice-btn:not(:disabled):hover {
    background: var(--bg-tertiary);
}


.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-btn-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent);
    margin-bottom: 5px;
}

.choice-btn-icon svg {
    width: 100px;
    height: 100px;
}

.choice-btn-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}


.user-info-display {
    text-align: center;
    padding: 15px;
    background: var(--bg-quaternary);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Figtree', sans-serif;
}

.user-info-display p {
    margin: 8px 0;
    font-size: 0.95em;
}

.user-info-display strong {
    color: var(--accent);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .landing-wrapper {
        padding: 40px 25px;
    }

    .title-prefix {
        font-size: 1em;
    }

    .title-main {
        font-size: 1.8em;
    }

    .landing-content p {
        font-size: 1em;
    }

    .form-wrapper {
        padding: 30px 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.5em;
    }

    .game-wrapper {
        flex-direction: column;
        gap: 20px;
    }

    .camera-wrapper {
        padding: 20px 15px;
        min-width: unset;
        max-width: 100%;
    }

    .game-controls-wrapper {
        padding: 20px 15px;
        min-width: unset;
        max-width: 100%;
    }

    .choice-buttons-container {
        gap: 20px;
        margin: 30px 0;
    }

    .choice-btn {
        min-width: 150px;
        padding: 40px 50px;
    }

    .choice-btn-icon svg {
        width: 80px;
        height: 80px;
    }

    .choice-btn-text {
        font-size: 1.2em;
    }

    .computer-choice-wrapper {
        min-width: unset;
        max-width: 100%;
        padding: 20px 15px;
    }


    .back-btn {
        top: 15px;
        left: 15px;
        width: 36px;
        height: 36px;
    }

    .back-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Results Modal */
.results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.results-modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.results-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 30px;
}

.results-display {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.result-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.result-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    color: var(--accent);
}

.result-icon svg {
    width: 80px;
    height: 80px;
}

.result-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.result-vs {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-tertiary);
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 25px;
    background: var(--bg-secondary);
    border-radius: 12px;
    min-width: 120px;
    flex: 0 1 auto;
}

.score-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.score-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--accent);
}

.games-progress {
    font-family: 'DM Sans', sans-serif;
    font-size: 1em;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.games-progress span {
    font-weight: 600;
    color: var(--accent);
}

.play-again-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 400;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.play-again-btn:hover {
    background: var(--accent-hover);
}

@media (max-width: 768px) {
    .results-modal-content {
        padding: 20px 15px;
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .results-title {
        font-size: 1.5em;
        margin-bottom: 15px;
    }

    .results-display {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 15px;
    }

    .result-vs {
        font-size: 1em;
    }

    .result-icon svg {
        width: 50px;
        height: 50px;
    }

    .result-text {
        font-size: 1em;
    }

    .result-label {
        font-size: 0.75em;
        margin-bottom: 8px;
    }

    .score-display {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }

    .score-item {
        min-width: unset;
        width: 100%;
        padding: 15px 20px;
    }

    .score-label {
        font-size: 0.8em;
    }

    .score-value {
        font-size: 1.5em;
    }

    .games-progress {
        font-size: 0.9em;
        margin-bottom: 15px;
    }

    .play-again-btn {
        padding: 10px 14px;
        font-size: 0.9em;
    }
}

/* Instructions Modal */
.instructions-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.instructions-modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.instructions-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5em;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 30px;
}

.instructions-content {
    text-align: left;
    margin-bottom: 30px;
}

.instructions-content p {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1em;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 20px;
}

.instructions-gestures {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    gap: 20px;
}

.instruction-gesture {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.instruction-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    color: var(--accent);
}

.instruction-icon svg {
    width: 60px;
    height: 60px;
}

.instruction-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95em;
    color: var(--text-primary);
    text-align: center;
}

.instructions-note {
    font-family: 'DM Sans', sans-serif;
    font-size: 1em;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    margin-top: 20px;
}

.begin-game-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 400;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.begin-game-btn:hover {
    background: var(--accent-hover);
}

@media (max-width: 768px) {
    .instructions-modal-content {
        padding: 20px 15px;
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .instructions-title {
        font-size: 1.5em;
        margin-bottom: 15px;
    }

    .instructions-gestures {
        flex-direction: column;
        gap: 15px;
    }

    .instruction-gesture {
        gap: 10px;
    }

    .instruction-icon svg {
        width: 40px;
        height: 40px;
    }

    .instruction-text {
        font-size: 0.85em;
    }

    .begin-game-btn {
        padding: 10px 14px;
        font-size: 0.9em;
    }
}
