@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

:root {
    color-scheme: light;
    --ink: #17324d;
    --muted-ink: #49627a;
    --ocean: #087e8b;
    --ocean-dark: #06616b;
    --sunshine: #ffca55;
    --paper: #ffffff;
    --sky: #eef8ff;
    --line: #c9deeb;
}

html,
body {
    min-height: 100%;
    background: var(--sky);
    color: var(--ink);
    font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.55;
}

body {
    margin: 0;
}

.content.px-4 {
    padding-right: clamp(0.75rem, 3vw, 1.5rem) !important;
    padding-left: clamp(0.75rem, 3vw, 1.5rem) !important;
}

a,
.btn-link {
    color: var(--ocean-dark);
}

a:hover {
    color: var(--ocean);
}

button,
input {
    font: inherit;
}

:focus-visible {
    outline: 3px solid #e79b16;
    outline-offset: 3px;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdp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NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Game Styles */
.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.game-setup {
    text-align: center;
}

.setup-form {
    background: #f5f5f5;
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    margin: 2rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

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

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

.btn-start, .btn-next, .btn-restart, .btn-expand {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #1b6ec2;
    color: white;
    transition: background-color 0.3s ease;
}

.btn-start:hover, .btn-next:hover, .btn-restart:hover, .btn-expand:hover {
    background-color: #1561ac;
}

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

.progress {
    font-size: 1.1rem;
    color: #666;
    margin-top: 0.5rem;
}

.question-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.flag-container {
    text-align: center;
    margin-bottom: 2rem;
}

.flag-image {
    max-width: 300px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.map-image {
    max-width: 100%;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.map-preview-button {
    display: block;
    max-width: 100%;
    padding: 0;
    border: 0;
    margin: 0 auto;
    background: transparent;
    cursor: zoom-in;
}

.map-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.75);
}

.map-modal-frame {
    max-width: 95vw;
    max-height: 95vh;
    overflow: auto;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.map-modal-header h3 {
    margin: 0;
}

.map-modal-close {
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 4px;
    background: #1b6ec2;
    color: white;
    cursor: pointer;
}

.map-modal-image {
    display: block;
    max-width: calc(95vw - 2rem);
    max-height: calc(95vh - 6rem);
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

.options-container {
    margin: 2rem 0;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
}

.options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.option-btn {
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-weight: 500;
}

.option-btn:hover:not(:disabled) {
    border-color: #1b6ec2;
    background-color: #f0f8ff;
}

.option-btn:disabled {
    cursor: not-allowed;
}

.option-btn.correct-answer {
    border-color: #26b050;
    background-color: #e8f5e9;
    color: #1b5e20;
}

.feedback {
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-weight: 500;
    font-size: 1.1rem;
}

.feedback.correct {
    background-color: #e8f5e9;
    color: #1b5e20;
    border-left: 4px solid #26b050;
}

.feedback.incorrect {
    background-color: #ffebee;
    color: #b71c1c;
    border-left: 4px solid #f44336;
}

.details-section {
    margin: 1.5rem 0;
}

.btn-expand {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background-color: #666;
}

.btn-expand:hover {
    background-color: #555;
}

.country-details {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.info-box {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #1b6ec2;
}

.info-box p {
    margin: 0.75rem 0;
    font-size: 1rem;
}

.btn-next {
    width: 100%;
    margin-top: 1rem;
}

.results-section {
    text-align: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.results-box {
    background: #f5f5f5;
    padding: 2rem;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.results-box p {
    font-size: 1.2rem;
    margin: 0.75rem 0;
}

.btn-restart {
    margin-top: 1rem;
}

/* World explorer game theme */
.game-container {
    width: min(100%, 960px);
    box-sizing: border-box;
    padding: clamp(1rem, 4vw, 2.5rem) clamp(0.25rem, 1vw, 0.75rem);
}

.game-setup,
.question-section,
.results-section {
    border: 2px solid rgba(8, 126, 139, 0.14);
    border-radius: 1.5rem;
    background: var(--paper);
    box-shadow: 0 12px 30px rgba(23, 66, 91, 0.1);
}

.game-setup {
    padding: clamp(1.25rem, 4vw, 2.75rem);
    background: linear-gradient(145deg, #fffdf5 0%, #ffffff 72%);
}

.game-setup h1,
.game-header h2,
.results-section h2 {
    color: var(--ink);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.game-setup h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 5vw, 3.25rem);
}

.game-setup > p {
    max-width: 40rem;
    margin: 0 auto 1.5rem;
    color: var(--muted-ink);
    font-size: clamp(1rem, 2vw, 1.2rem);
}

.game-setup nav ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: fit-content;
    margin: 1.5rem auto 0;
    padding: 0;
    list-style: none;
}

.game-setup nav li {
    display: flex;
    justify-content: center;
    width: 100%;
}

.game-setup nav a {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    background: var(--ocean);
    color: white;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 0 var(--ocean-dark);
    transition: transform 160ms ease, background-color 160ms ease;
}
.game-setup nav a {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    background: var(--ocean);
    color: white;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 0 var(--ocean-dark);
    transition: transform 160ms ease, background-color 160ms ease;
}

.game-setup nav a:hover {
    transform: translateY(-2px);
    background: var(--ocean-dark);
    color: white;
}

.setup-form {
    width: min(100%, 28rem);
    box-sizing: border-box;
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid #f1dda8;
    border-radius: 1.25rem;
    background: #fff8e7;
    box-shadow: 0 6px 16px rgba(95, 76, 30, 0.08);
}

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

.form-group label {
    color: var(--ink);
    font-weight: 700;
}

.form-group input {
    min-height: 3rem;
    box-sizing: border-box;
    border: 2px solid var(--line);
    border-radius: 0.75rem;
    background: white;
    color: var(--ink);
}

.form-group input:focus {
    border-color: var(--ocean);
    outline: 3px solid rgba(8, 126, 139, 0.18);
}

.btn-start,
.btn-next,
.btn-restart,
.btn-expand,
.map-modal-close {
    min-height: 3rem;
    border: 0;
    border-radius: 0.85rem;
    background: var(--ocean);
    color: white;
    font-weight: 800;
    box-shadow: 0 4px 0 var(--ocean-dark);
    transition: transform 160ms ease, background-color 160ms ease;
}

.btn-start:hover,
.btn-next:hover,
.btn-restart:hover,
.btn-expand:hover,
.map-modal-close:hover {
    transform: translateY(-1px);
    background: var(--ocean-dark);
    color: white;
}

.game-header {
    position: relative;
    margin-bottom: 1.5rem;
}

.game-page-frame {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.game-page-frame > .exit-game-btn {
    top: 2.5rem;
    right: 2rem;
    z-index: 1;
}

.exit-game-btn {
    position: absolute;
    top: 0.5rem;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: rgba(13, 78, 89, 0.08);
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease;
}

.exit-game-btn:hover {
    transform: translateY(-1px);
    background: rgba(13, 78, 89, 0.14);
}

.game-header h2,
.results-section h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.6rem, 4vw, 2.25rem);
}

.progress {
    display: inline-flex;
    min-height: 3rem;
    box-sizing: border-box;
    align-items: center;
    margin: 0.25rem;
    padding: 0.65rem 1rem;
    border: 1px solid #c7e7e8;
    border-radius: 999px;
    background: #e9f8f7;
    color: #245760;
    font-size: 0.95rem;
    font-weight: 700;
}

.question-section {
    padding: clamp(1rem, 4vw, 2rem);
}

.flag-container {
    margin-bottom: 1.25rem;
}

.flag-image {
    width: min(100%, 360px);
    max-height: 230px;
    object-fit: contain;
    border: 1px solid #e4edf2;
    border-radius: 1rem;
    background: white;
    box-shadow: 0 8px 20px rgba(23, 66, 91, 0.15);
}

.options-container {
    margin: 1.5rem 0;
}

.question-text {
    color: var(--ink);
    font-size: clamp(1.15rem, 3vw, 1.45rem);
    font-weight: 800;
}

.options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.option-btn {
    min-height: 3.5rem;
    padding: 0.85rem 1rem;
    border: 2px solid var(--line);
    border-radius: 1rem;
    background: #fafdff;
    color: var(--ink);
    font-weight: 700;
    overflow-wrap: anywhere;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.option-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: var(--ocean);
    background: #eaf8fa;
}

.option-btn.correct-answer {
    border-color: #2b9863;
    background: #e6f7ed;
    color: #175b3a;
}

.feedback {
    border-radius: 1rem;
    font-size: 1.05rem;
}

.feedback p {
    margin: 0;
}

.feedback.correct {
    border-left-color: #2b9863;
    background: #e6f7ed;
    color: #175b3a;
}

.feedback.incorrect {
    border-left-color: #df6b55;
    background: #fff0ec;
    color: #8f3025;
}

.details-section {
    margin: 1.25rem 0 0.5rem;
}

.country-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    padding: clamp(0.85rem, 3vw, 1.5rem);
    border: 1px solid #d8e8ef;
    border-radius: 1.25rem;
    background: #f3faff;
}

.map-image {
    max-height: 240px;
    margin: 0;
    object-fit: contain;
}

.prompt-map-image {
    width: min(100%, 420px);
    max-height: 360px;
}

.country-flag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
}

.details-flag-image {
    display: block;
    width: min(100%, 180px);
    max-height: 110px;
    object-fit: contain;
    border: 1px solid #e4edf2;
    border-radius: 0.5rem;
    background: white;
}

.info-box {
    border-left: 4px solid var(--sunshine);
    border-radius: 0.75rem;
    background: white;
    color: var(--ink);
}

.info-box p {
    margin: 0.5rem 0;
    overflow-wrap: anywhere;
}

.details-intro {
    margin: 0.75rem 0 1rem;
    color: var(--muted-ink);
    text-align: center;
    font-style: italic;
}

.map-modal-frame {
    width: min(100%, 900px);
    box-sizing: border-box;
    border-radius: 1.25rem;
}

.map-modal-close {
    flex: 0 0 auto;
    padding: 0.45rem 0.9rem;
}

.map-modal-image {
    max-width: 100%;
}

.results-section {
    padding: clamp(1.25rem, 4vw, 2.5rem);
    background: linear-gradient(145deg, #fffdf5 0%, #ffffff 72%);
}

.results-box {
    border: 1px solid #f1dda8;
    border-radius: 1.25rem;
    background: #fff8e7;
}

.results-box p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    html,
    body {
        font-size: 16px;
    }

    .game-container {
        padding-top: 0.75rem;
        padding-bottom: 1.25rem;
    }

    .game-setup,
    .question-section,
    .results-section {
        border-radius: 1.1rem;
    }

    .options {
        grid-template-columns: minmax(0, 1fr);
    }

    .country-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .map-image {
        max-height: 190px;
    }

    .prompt-map-image {
        max-height: 280px;
    }

    .map-modal-backdrop {
        padding: 0.5rem;
    }

    .map-modal-frame {
        max-width: 100%;
        max-height: 96dvh;
        padding: 0.75rem;
    }

    .map-modal-header {
        align-items: flex-start;
        gap: 0.5rem;
    }

    .map-modal-header h3 {
        font-size: 1.1rem;
        overflow-wrap: anywhere;
    }

    .map-modal-image {
        max-height: calc(96dvh - 6rem);
    }

    .progress {
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
