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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.4;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

header {
    text-align: center;
    padding: 10px 0;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    color: #666;
    font-size: 0.95rem;
}

/* Main quiz container */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Quiz Section */
#quiz {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Quiz Top Bar */
.quiz-top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Progress Bar */
.progress-bar {
    flex: 1;
    height: 4px;
    background: #eee;
}

/* Menu Button */
.menu-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    color: #666;
}

.menu-btn:hover {
    border-color: #000;
    color: #000;
}

/* Hints Button */
.hints-btn {
    background: #fff;
    border: 1px solid #000;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.hints-btn:hover {
    background: #000;
    color: #fff;
}

.hints-btn.hidden {
    display: none;
}

.progress-fill {
    height: 100%;
    background: #000;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    padding: 5px 0;
    flex-shrink: 0;
}

/* Question */
#question-text {
    font-size: 1.3rem;
    text-align: center;
    padding: 10px 0;
    font-weight: 600;
    flex-shrink: 0;
}

/* Answers Grid - fills remaining space */
.answers-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 10px;
    padding: 8px;
    min-height: 0;
}

.answer-btn {
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 8px;
    color: #000;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
    line-height: 1.2;
    font-weight: 500;
}

/* hover handled below with animations */

/* Results Section */
.hidden {
    display: none !important;
}

#results {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 10px;
}

.results-top-bar {
    flex-shrink: 0;
    padding: 5px 0;
}

.results-title {
    font-size: 1.5rem;
    margin: 10px 0;
    text-align: center;
}

.result-message {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.results-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.results-map-col {
    flex-shrink: 0;
}

.results-answers-col {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.results-answers-col h3 {
    text-align: center;
    margin-bottom: 10px;
}

/* Two-column layout on wider screens */
@media (min-width: 900px) {
    .results-content {
        flex-direction: row;
        align-items: flex-start;
    }

    .results-map-col {
        flex: 1;
        max-width: 55%;
    }

    .results-answers-col {
        flex: 1;
        max-width: 45%;
    }

    .results-answers-col h3 {
        text-align: left;
    }
}

/* Map Container */
.map-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto 20px;
    border: 2px solid #000;
    padding: 15px;
}

.map-container svg {
    width: 100%;
    height: auto;
}

.map-container svg path {
    fill: #fff;
    stroke: #000;
    stroke-width: 0.5;
    transition: fill 0.3s ease;
}

/* Crosshairs */
.crosshairs {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.crosshairs-h,
.crosshairs-v {
    position: absolute;
    background: #000;
}

.crosshairs-h {
    width: 30px;
    height: 2px;
    left: -15px;
    top: -1px;
}

.crosshairs-v {
    width: 2px;
    height: 30px;
    left: -1px;
    top: -15px;
}

.crosshairs-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #000;
    border: 2px solid #fff;
    border-radius: 50%;
    left: -5px;
    top: -5px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Results Details */
.results-details {
    margin-bottom: 20px;
    text-align: center;
}

.results-details h3 {
    margin-bottom: 8px;
}

.results-details p {
    color: #666;
}

/* Button */
.btn {
    background: #000;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 12px 35px;
    font-size: 1rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #fff;
    color: #000;
}

/* Breakdown Section */
.breakdown-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.breakdown-row {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-question {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.breakdown-answer {
    font-size: 1rem;
    font-weight: 600;
}

.breakdown-state {
    font-weight: 400;
    color: #666;
}

/* Landing Section */
#landing {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.landing-content {
    max-width: 500px;
    width: 100%;
}

.game-title {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.game-tagline {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
}

.mode-selection {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mode-btn {
    background: #fff;
    border: 2px solid #000;
    border-radius: 12px;
    padding: 20px 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mode-btn:hover {
    background: #000;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mode-name {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.mode-description {
    display: block;
    font-size: 0.95rem;
    opacity: 0.7;
}

/* Challenge Section */
.challenge-section {
    background: #fff;
    border: 2px solid #000;
    border-radius: 12px;
    padding: 20px 30px;
    text-align: left;
}

.challenge-label {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.challenge-description {
    font-size: 0.95rem;
    opacity: 0.7;
    margin-bottom: 15px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
}

.difficulty-btn {
    flex: 1;
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.difficulty-btn:hover {
    background: #000;
    color: #fff;
    transform: translateY(-2px);
}

.difficulty-btn.hardcore {
    border-color: #c00;
    color: #c00;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.difficulty-btn.hardcore:hover {
    background: #c00;
    color: #fff;
}

.difficulty-btn.hardcore:hover .no-hints-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.no-hints-badge {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(204, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Copyright */
.copyright {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.85rem;
    color: #999;
}

.copyright a {
    color: #666;
    text-decoration: none;
}

.copyright a:hover {
    text-decoration: underline;
}

/* Lives Display */
.lives-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.lives-label {
    font-weight: 600;
}

.lives-display {
    display: flex;
    gap: 5px;
    transition: transform 0.3s ease;
}

.life {
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.life.lost {
    opacity: 0.3;
    transform: scale(0.8);
}

.lives-display.pulse-red {
    animation: pulseRed 0.5s ease;
}

@keyframes pulseRed {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); color: #ff0000; }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.1); color: #ff0000; }
}

/* Fade Transitions */
.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.fade-out {
    animation: fadeOut 0.2s ease forwards;
}

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

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

/* Shake Animation for Wrong Answer */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Enhanced Button Animations */
.answer-btn:hover {
    background: #000;
    color: #fff;
    transform: scale(1.02);
}

.answer-btn:active {
    transform: scale(0.98);
}

/* Progress Bar Animation Enhancement */
.progress-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fadeInOverlay 0.3s ease;
}

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

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-content {
    text-align: center;
    color: #fff;
}

.game-over-x {
    font-size: 8rem;
    color: #c00;
    animation: gameOverX 0.5s ease;
    line-height: 1;
}

@keyframes gameOverX {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.game-over-title {
    font-size: 2.5rem;
    margin-top: 20px;
    animation: gameOverTitle 0.5s ease 0.3s both;
}

@keyframes gameOverTitle {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hints Panel */
.hints-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 90%;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 90;
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.hints-panel.hidden {
    display: none !important;
}

.hints-panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hints-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.hints-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.hints-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #666;
}

.hints-close-btn:hover {
    color: #000;
}

.hints-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.hint-item {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.hint-item:last-child {
    border-bottom: none;
}

.hint-question {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.hint-answer {
    font-size: 1rem;
    font-weight: 600;
}

.hint-rank {
    font-weight: 400;
    color: #666;
}

.hint-empty {
    color: #999;
    font-style: italic;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.5;
}

.modal.success .modal-content h2 {
    color: #000;
}

.modal.error .modal-content h2 {
    color: #c00;
}

/* Confirm Modal Buttons */
.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-secondary {
    background: #fff;
    color: #000;
}

.btn-secondary:hover {
    background: #eee;
    color: #000;
}

/* Modal Direction Indicator */
.modal-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.modal-indicator.hidden {
    display: none;
}

.arrow-up, .arrow-down {
    font-size: 3rem;
    line-height: 1;
}

.arrow-up {
    color: #2a2;
}

.arrow-down {
    color: #c00;
}

.direction-text {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 5px;
}

/* Eliminated answer buttons */
.answer-btn.eliminated {
    opacity: 0.3;
    background: #eee;
    color: #999;
    cursor: not-allowed;
    text-decoration: line-through;
}

.answer-btn.eliminated:hover {
    background: #eee;
    color: #999;
    transform: none;
}

/* Mobile Styles */
@media (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    .container {
        height: auto;
        min-height: 100vh;
    }

    /* Landing page mobile */
    .game-title {
        font-size: 3rem;
    }

    .game-tagline {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }

    .landing-content {
        padding: 0 15px;
    }

    .mode-btn {
        padding: 18px 20px;
    }

    .mode-name {
        font-size: 1.3rem;
    }

    .mode-description {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .challenge-section {
        padding: 18px 20px;
    }

    .challenge-label {
        font-size: 1.3rem;
    }

    .challenge-description {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .difficulty-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .difficulty-btn {
        padding: 14px 15px;
        font-size: 1.1rem;
    }

    .no-hints-badge {
        font-size: 0.7rem;
    }

    .copyright {
        position: relative;
        bottom: auto;
        margin-top: 30px;
        padding-bottom: 20px;
        font-size: 0.9rem;
    }

    /* Quiz section mobile */
    #quiz {
        height: auto;
        min-height: 0;
    }

    .quiz-top-bar {
        gap: 8px;
    }

    .menu-btn,
    .hints-btn {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .progress-text {
        font-size: 0.95rem;
        padding: 8px 0;
    }

    #question-text {
        font-size: 1.25rem;
        padding: 12px 10px;
        line-height: 1.4;
    }

    /* Lives display mobile */
    .lives-container {
        font-size: 1.1rem;
        padding: 8px 0;
    }

    .life {
        font-size: 1.4rem;
    }

    /* Mobile answers grid - 2 columns, 25 rows, scrollable */
    .answers-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(25, auto);
        gap: 10px;
        padding: 10px;
        flex: none;
        max-height: none;
        overflow-y: visible;
    }

    .answer-btn {
        padding: 14px 10px;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Results section mobile */
    .results-title {
        font-size: 1.4rem;
    }

    .result-message {
        font-size: 1.2rem;
    }

    .map-container {
        padding: 10px;
        margin-bottom: 15px;
    }

    .results-answers-col h3 {
        font-size: 1.2rem;
    }

    .breakdown-question {
        font-size: 0.95rem;
    }

    .breakdown-answer {
        font-size: 1.1rem;
    }

    /* Hints panel mobile */
    .hints-panel {
        width: 100%;
        max-width: 100%;
    }

    .hints-panel-header h3 {
        font-size: 1.15rem;
    }

    .hint-question {
        font-size: 0.95rem;
    }

    .hint-answer {
        font-size: 1.1rem;
    }

    /* Modal mobile */
    .modal-content {
        padding: 25px;
        margin: 15px;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .modal-content p {
        font-size: 1.05rem;
        line-height: 1.5;
    }

    .btn {
        font-size: 1.05rem;
        padding: 14px 30px;
    }

    .direction-text {
        font-size: 1.1rem;
    }

    /* Game over mobile */
    .game-over-x {
        font-size: 6rem;
    }

    .game-over-title {
        font-size: 2rem;
    }
}
