/* ===== BASE ===== */
body {
    font-family: Arial, sans-serif;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    background-color: #f1e6cc;
    background-image: url('img/textures.png');
    background-size: cover;
    background-repeat: repeat;
}

.game-container {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 20%;
    pointer-events: none;
    z-index: 2;
    background-image:
        linear-gradient(to right, #a77b61 1px, transparent 1px),
        linear-gradient(to bottom, #8b6956 1px, transparent 1px);
    background-size: 180px 180px;
}

/* ===== TOP LEFT – Country name + flag ===== */
#title-container {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    z-index: 3;
}

#country-title {
    margin-right: 10px;
    font-size: 32px;
    font-weight: bold;
}

#country-flag {
    font-size: 32px;
}

/* ===== TOP CENTER – Progress ===== */
#progress-container {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 3;
}

#progress-dots {
    display: flex;
    gap: 10px;
}

.dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background-color: #d4c4aa;
    border: 2px solid #8c644d;
    transition: all 0.3s ease;
}

.dot.completed {
    background-color: #8c644d;
}

.dot.current {
    background-color: #c9b150;
    border-color: #7a6a2e;
    transform: scale(1.3);
}

#progress-text {
    font-size: 13px;
    color: #5a3e2b;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* ===== TOP RIGHT – Score ===== */
#score-panel {
    position: absolute;
    top: 10px;
    right: 12px;
    text-align: right;
    z-index: 3;
}

#cumulative-degrees {
    font-size: 20px;
    color: #000;
}

#cumulative-degrees-value {
    font-weight: bold;
    font-size: 32px;
    margin-left: 4px;
}

#high-score-display {
    font-size: 13px;
    color: #5a3e2b;
    margin-top: 2px;
}

#high-score-value {
    font-weight: bold;
}

/* ===== COUNTRY IMAGE ===== */
#country-image {
    display: none;
    max-width: 50%;
    max-height: 55vh;
    margin-bottom: 20px;
    transition: transform 0.2s ease-in-out, opacity 0.35s ease;
    user-select: none;
    cursor: grab;
    touch-action: none;
    z-index: 3;
    position: relative;
}

#country-image:active {
    cursor: grabbing;
}

/* ===== GHOST (player's answer, shown after Done) ===== */
#default-country-image-container {
    position: fixed;
    display: none;
    pointer-events: none;
    z-index: 2;
}

#default-country-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.82;
    filter: grayscale(1) brightness(0.75);
}

/* Correct map → blue when result is shown */
#country-image.result-mode {
    filter: sepia(1) saturate(2.8) hue-rotate(195deg) brightness(1.05);
}

/* ===== VIEW TOGGLE (Both / Correct / Your rotation) ===== */
#view-toggle {
    display: none;
    gap: 16px;
    justify-content: center;
    margin-bottom: 8px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    transition: color 0.15s;
}

.view-btn::before {
    content: '';
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #aaa;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.view-btn.active {
    color: #4a9eda;
}

.view-btn.active::before {
    background: #4a9eda;
    border-color: #4a9eda;
}

/* ===== RESULT POPUP ===== */
#result-popup {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    text-align: center;
    z-index: 4;
    display: none;
    white-space: nowrap;
}

#round-points {
    font-size: 22px;
    font-weight: bold;
    margin: 2px 0;
    color: #222;
}

#result-text {
    font-size: 16px;
    margin: 2px 0;
    font-weight: 600;
}

#result-text.good { color: #2a7a2a; }
#result-text.ok   { color: #b07a00; }
#result-text.bad  { color: #b02a2a; }

#streak-text {
    font-size: 14px;
    color: #b07a00;
    font-weight: bold;
    margin: 2px 0;
}

/* ===== ACTION BUTTONS ===== */
#done-button,
#next-country-button,
#final-result-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 44px;
    font-size: 22px;
    background-color: #8c644d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 5;
    transition: background-color 0.15s;
}

#done-button         { display: none; }
#next-country-button { display: none; }
#final-result-button { display: none; }

#done-button:hover,
#next-country-button:hover,
#final-result-button:hover {
    background-color: #a77b61;
}

#done-button:active,
#next-country-button:active,
#final-result-button:active {
    background-color: #c9b150;
}

/* ===== FINAL SCREEN OVERLAY ===== */
#final-screen {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 900;
    align-items: center;
    justify-content: center;
}

#final-score-box {
    background: white;
    padding: 40px 48px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

#final-score-box h2 {
    margin-top: 0;
    font-size: 28px;
    color: #5a3e2b;
}

#final-stars {
    font-size: 42px;
    letter-spacing: 6px;
    margin: 10px 0;
}

#final-score-text {
    font-size: 22px;
    font-weight: bold;
    color: #222;
    margin: 8px 0;
}

#final-streak-bonus {
    font-size: 16px;
    color: #b07a00;
    font-weight: bold;
    margin: 4px 0;
    min-height: 22px;
}

#new-high-score-text {
    font-size: 18px;
    color: #2a7a2a;
    font-weight: bold;
    margin: 6px 0;
    min-height: 26px;
}

#final-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

#share-button,
#play-again-button {
    padding: 12px 26px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s;
}

#share-button {
    background-color: #3b8bc4;
    color: white;
}
#share-button:hover { background-color: #2e72a6; }

#play-again-button {
    background-color: #8c644d;
    color: white;
}
#play-again-button:hover { background-color: #a77b61; }

/* ===== INSTRUCTIONS POPUP ===== */
#instructions-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px 36px;
    border: 2px solid #444;
    border-radius: 12px;
    z-index: 999;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

#instructions-popup h1 {
    margin-top: 0;
    font-size: 28px;
    color: #3a2518;
}

#instructions-popup p {
    margin: 8px 0;
    color: #333;
}

#difficulty-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 18px 0 6px;
}

.diff-label {
    font-weight: bold;
    color: #5a3e2b;
}

.diff-btn {
    padding: 8px 22px;
    font-size: 15px;
    border: 2px solid #8c644d;
    border-radius: 6px;
    cursor: pointer;
    background: white;
    color: #8c644d;
    transition: all 0.15s;
}

.diff-btn.active {
    background-color: #8c644d;
    color: white;
}

.diff-btn:hover {
    background-color: #a77b61;
    color: white;
}

#difficulty-hint {
    font-size: 12px;
    color: #888;
    margin: 0 0 10px;
}

#best-score-hint {
    font-size: 14px;
    color: #5a3e2b;
    margin: 10px 0 18px;
    font-weight: bold;
}

#start-button {
    padding: 13px 30px;
    font-size: 18px;
    background-color: #8c644d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}

#start-button:hover { background-color: #a77b61; }
