@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@500;700;800;900&display=swap');

:root {
    --bg-sky: #eaf6ff;
    --bg-edu: #f1ecff;
    --card: #ffffff;
    --ink: #1d2f4f;
    --muted: #4a628f;
    --line: #d8e4f8;
    --primary: #4f62d8;
    --primary-hover: #3d4fbf;
    --accent: #2d9bcf;
    --accent-soft: #e8f7ff;
    --good: #27a36b;
    --warn: #f7c75f;
    --bad: #ea5e5e;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 18px 46px rgba(29, 47, 79, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    color: var(--ink);
    font-family: 'Rubik', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background:
        radial-gradient(circle at 12% 15%, #ffffff 0 18%, transparent 18%),
        radial-gradient(circle at 88% 85%, #d8edff 0 20%, transparent 20%),
        linear-gradient(160deg, var(--bg-sky) 0%, var(--bg-edu) 100%);
}

.container {
    width: min(100%, 760px);
    max-height: 95vh;
    overflow: auto;
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: clamp(0.9rem, 3vw, 1.8rem);
    animation: rise-in 320ms ease;
}

.top-section {
    background: linear-gradient(145deg, #f7fbff 0%, #eef5ff 100%);
    border: 2px solid #d8e6fb;
    border-radius: var(--radius-md);
    padding: 1rem;
}

.top-section h1,
#start-game h1,
#in-game h1,
#end-game h1,
.question-card h1 {
    font-family: 'Rubik', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 900;
    letter-spacing: 0.01em;
}

#start-game h1,
#in-game h1 {
    color: #2f4276;
    line-height: 1.2;
    font-size: clamp(1.75rem, 5vw, 2.35rem);
}

#start-game,
#end-game {
    display: flex;
    flex-direction: column;
    text-align: center;
    row-gap: 0.65rem;
}

#end-game {
    position: relative;
    border: 2px solid #d8e6fb;
    border-radius: var(--radius-md);
    padding: 1.15rem 1rem 1.05rem;
    background: linear-gradient(180deg, #fafdff 0%, #f3f7ff 100%);
}

#end-game::before {
    content: "Резултат";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #e4efff;
    color: #33578f;
    border: 1px solid #c5d9fb;
    border-radius: 999px;
    padding: 0.18rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

#start-game > p {
    margin: 0.35rem auto;
    color: var(--muted);
    max-width: 56ch;
    font-size: 1.04rem;
    line-height: 1.55;
}

#start-game a:not(#start-btn),
#end-game a:not(#restart-btn) {
    color: var(--accent);
    font-weight: 700;
}

#start-btn,
#restart-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    text-decoration: none;
    border-radius: 14px;
    margin: 1rem auto 0.7rem;
    padding: 0.9rem 2rem;
    font-size: clamp(1.1rem, 3.7vw, 1.55rem);
    font-weight: 800;
    color: #ffffff;
    font-family: 'Rubik', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #6074ea 0%, var(--primary) 100%);
    box-shadow: 0 12px 24px rgba(79, 98, 216, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
}

#start-btn:hover,
#restart-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #5569e2 0%, var(--primary-hover) 100%);
}

#start-btn:active,
#restart-btn:active {
    transform: translateY(0);
}

#in-game,
#end-game {
    display: none;
}

.game-data {
    margin: 0.8rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.game-data p {
    font-size: 1.04rem;
    font-weight: 700;
    color: #3d5688;
}

#timer {
    display: none;
    width: 100%;
    height: 0.72rem;
    background: #e5eefc;
    overflow: hidden;
    border-radius: 999px;
}

#progress {
    height: 100%;
    transition: width 120ms linear;
    background: linear-gradient(90deg, var(--good) 0%, var(--warn) 62%, var(--bad) 100%);
}

.question-card {
    margin: 1.1rem 0;
    padding: 1rem;
    text-align: center;
    border: 2px solid #dce9ff;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #fbfdff 0%, var(--accent-soft) 100%);
}

.question-card h1,
#question {
    margin: 0;
    color: #2c4176;
    font-size: clamp(1.85rem, 6vw, 2.65rem);
}

h3 {
    font-family: 'Rubik', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 800;
    font-size: 1.22rem;
    margin: 0.35rem 0 0.1rem;
    color: #3b5185;
}

.answer-card {
    padding-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

button {
    cursor: pointer;
    min-height: 60px;
    border: 2px solid #d8e4f8;
    border-radius: 14px;
    background: #ffffff;
    color: #24395f;
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
    transition: transform 0.18s ease, background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
    border-color: #b6c9eb;
    background: #f5f9ff;
}

#end-game h1 {
    font-size: clamp(1.7rem, 5.5vw, 2.5rem);
    line-height: 1.2;
    color: #2f467d;
    margin-top: 0.15rem;
}

#end-game span,
#end-game p {
    color: var(--muted);
}

#end-game > span {
    font-size: 0.98rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

#end-game h2 {
    font-family: 'Rubik', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 900;
    margin: 0.2rem auto 0.65rem;
    color: #334d84;
    background: #ffffff;
    border: 2px solid #dbe8ff;
    border-radius: 14px;
    min-width: min(100%, 360px);
    padding: 0.45rem 0.8rem;
    box-shadow: 0 6px 16px rgba(61, 88, 138, 0.08);
}

#end-game h2 > div {
    display: inline-flex;
    align-items: center;
}

#message {
    max-width: 42ch;
    margin: 0.25rem auto 0.45rem;
    font-size: 1.12rem;
    color: #345184;
    line-height: 1.5;
    background: #eef6ff;
    border: 2px dashed #c4d8ff;
    border-radius: 14px;
    padding: 0.7rem 0.85rem;
}

#correct-answers {
    padding-top: 3px;
    padding-bottom: 3px;
}

.dot {
    height: 22px;
    width: 22px;
    background-color: var(--good);
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

#restart-btn {
    margin-top: 0.5rem;
}

.result-image {
    width: min(280px, 80%);
    margin-top: 0.6rem;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid #ff9f1c;
    outline-offset: 2px;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    body {
        padding: 0.6rem;
    }

    .container {
        border-radius: 16px;
        padding: 0.85rem;
    }

    .answer-card {
        grid-template-columns: 1fr;
    }

    button {
        min-height: 56px;
        font-size: 1.12rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
