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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
    position: relative;
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.lang-button {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.lang-arrow {
    width: 12px;
    height: 8px;
    transition: transform 0.2s ease;
}

.lang-button.open .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 140px;
    overflow: hidden;
    display: none;
}

.lang-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.lang-option {
    padding: 10px 16px;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f5f5f5;
}

.lang-option:last-child {
    border-bottom: none;
}

.lang-option:hover {
    background: #f8f9fa;
}

.lang-option.active {
    background: #e9ecef;
    font-weight: 600;
}

.container {
    width: 100%;
    max-width: 1000px;
    animation: fadeIn 0.6s ease-in;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 4rem;
    font-weight: 300;
    color: white;
    margin-bottom: 20px;
    letter-spacing: -2px;
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

/* Input Section */
.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    position: relative;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.country-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.9rem;
    border: 2px solid #444;
    border-radius: 50px;
    background: #2d2d2d;
    color: white;
    outline: none;
    transition: all 0.3s ease;
}

.country-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.country-input:focus {
    background: #333;
    border-color: #666;
}

.guess-button {
    background: #007BFF;
    color: white;
    border: 2px solid transparent;
    padding: 12px 20px;
    width: auto;
    height: auto;
    font-size: 0.9rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.guess-button:hover {
    border-color: white;
    background: #007BFF;
}

.guess-button:active {
    background: #0056b3;
}

.globe-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    animation: earthRotationOnce 2s ease-in-out 3s;
}

@keyframes earthRotationOnce {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* Guess Counter */
.guess-counter {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 20px;
}

/* Emoji Container */
.emoji-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 40px;
    perspective: 1000px;
}

.emoji-hint {
    background: white;
    border-radius: 16px;
    padding: 30px;
    font-size: 2.5rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.4s ease;
    transform-style: preserve-3d;
}

.emoji-hint.revealed {
    animation: flipReveal 0.6s ease;
}

/* Guessing History */
.guessing-history {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    margin-top: 20px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-item .flag {
    font-size: 1.5rem;
}

.history-item .country-name {
    flex: 1;
    font-weight: 400;
}

/* Success Card */
.success-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
}

.success-card-content {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: cardSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #333;
    transform: rotate(90deg);
}

.success-header {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.flag-large {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: flagWave 1s ease-in-out infinite;
}

.country-name-large {
    font-size: 2rem;
    color: #1a1a1a;
    font-weight: 400;
    margin: 0;
}

.map-container {
    width: 100%;
    height: 300px;
    background: #e0e0e0;
    position: relative;
    overflow: hidden;
}

.country-map {
    width: 100%;
    height: 100%;
    border: none;
}

.success-stats {
    padding: 20px 30px;
    text-align: center;
    background: white;
}

.success-text {
    font-size: 1rem;
    color: #666;
    margin: 0;
    font-weight: 300;
}

.success-text span {
    font-weight: 600;
    color: #1a1a1a;
}

.play-again-button {
    background: #007BFF;
    color: white;
    border: 2px solid transparent;
    padding: 16px;
    font-size: 1rem;
    width: calc(100% - 60px);
    margin: 0 30px 30px 30px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.play-again-button:hover {
    border-color: white;
    background: #007BFF;
}

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

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flipReveal {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

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

@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes flagWave {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* Custom Autocomplete */
.autocomplete-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-top: 8px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    width: calc(100% - 90px);
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    color: #333;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    border-bottom: 1px solid #f5f5f5;
}

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

.autocomplete-item:hover {
    background: #f8f9fa;
}

.autocomplete-item:active {
    background: #e9ecef;
}

.autocomplete-item .flag {
    font-size: 1.3rem;
    min-width: 24px;
}

.autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 3px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #bdbdbd;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.mode-button {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mode-button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.mode-button.active {
    background: #007BFF;
    color: white;
    border-color: #007BFF;
}

.game-mode {
    animation: fadeIn 0.4s ease-in;
}

/* Comparison Table */
.comparison-table-container {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px;
    overflow: visible;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    color: white;
    table-layout: fixed;
}

.comparison-table th {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 6px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    white-space: normal;
    overflow: hidden;
    word-wrap: break-word;
    line-height: 1.2;
}

.comparison-table td {
    padding: 14px 6px;
    text-align: center;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    white-space: normal;
    overflow: hidden;
    word-wrap: break-word;
    opacity: 0;
    transform: translateX(-20px);
}

.comparison-table td.country-cell {
    font-weight: 600;
    font-size: 1rem;
    width: 13%;
}

.comparison-table td.green {
    background: rgba(34, 197, 94, 0.3);
    color: #a7f3d0;
}

.comparison-table td.yellow {
    background: rgba(234, 179, 8, 0.3);
    color: #fde047;
}

.comparison-table td.red {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Cell reveal animation - staggered from left to right */
.comparison-table td.reveal {
    animation: revealCell 0.4s ease forwards;
}

.comparison-table td:nth-child(1).reveal {
    animation-delay: 0s;
}

.comparison-table td:nth-child(2).reveal {
    animation-delay: 0.1s;
}

.comparison-table td:nth-child(3).reveal {
    animation-delay: 0.2s;
}

.comparison-table td:nth-child(4).reveal {
    animation-delay: 0.3s;
}

.comparison-table td:nth-child(5).reveal {
    animation-delay: 0.4s;
}

.comparison-table td:nth-child(6).reveal {
    animation-delay: 0.5s;
}

.comparison-table td:nth-child(7).reveal {
    animation-delay: 0.6s;
}

.comparison-table td:nth-child(8).reveal {
    animation-delay: 0.7s;
}

@keyframes revealCell {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.comparison-table tr.win-row {
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid #22c55e;
}

/* Comparison Win Page */
.comparison-win-page {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease;
}

.win-page-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
}

.win-flag {
    font-size: 6rem;
    margin-bottom: 30px;
    animation: flagWave 1s ease-in-out infinite;
}

.win-title {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 15px;
    font-weight: 400;
}

.win-text {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.win-text span {
    font-weight: 600;
    color: white;
}

.win-guesses {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
}

.win-guesses span {
    font-weight: 600;
    color: #007BFF;
    font-size: 1.3rem;
}

.win-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

.share-button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 16px;
    font-size: 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.share-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: white;
}

.share-button svg {
    width: 20px;
    height: 20px;
}

/* Tips Game */
.tips-container {
    max-width: 800px;
    margin: 40px auto;
}

.tip-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.tip-card.tip-reveal {
    animation: tipReveal 0.5s ease;
}

.tip-number {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tip-number span {
    color: #007BFF;
    font-weight: 600;
}

.tip-text {
    font-size: 1.3rem;
    color: white;
    line-height: 1.8;
    font-weight: 300;
}

@keyframes tipReveal {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive */
/* Small mobile - 480px */
@media (max-width: 480px) {
    .input-section {
        max-width: 280px;
        flex-direction: column;
    }

    .title {
        font-size: 2.5rem;
    }

    .emoji-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .emoji-hint {
        padding: 18px;
        font-size: 1.8rem;
    }

    .comparison-table th {
        font-size: 0.55rem;
        padding: 5px 2px;
    }

    .comparison-table td {
        font-size: 0.6rem;
        padding: 7px 2px;
    }

    .comparison-table td.country-cell {
        font-size: 0.65rem;
    }

    .mode-selector {
        flex-direction: column;
        gap: 6px;
    }

    .mode-button {
        padding: 8px 16px;
    }

    .tip-card {
        padding: 30px 20px;
    }

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

/* Mobile - 600px */
@media (min-width: 481px) and (max-width: 600px) {
    .input-section {
        max-width: 350px;
        flex-direction: column;
    }

    .title {
        font-size: 3rem;
    }

    .emoji-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .emoji-hint {
        padding: 20px;
        font-size: 2rem;
    }

    .comparison-table th {
        font-size: 0.55rem;
        padding: 6px 1px;
        line-height: 1.1;
    }

    .comparison-table td {
        font-size: 0.6rem;
        padding: 8px 1px;
        line-height: 1.2;
    }

    .comparison-table td.country-cell {
        font-size: 0.65rem;
    }

    .mode-selector {
        flex-direction: column;
        gap: 8px;
    }

    .mode-button {
        padding: 10px 20px;
    }
}

/* Tablet - 768px */
@media (min-width: 601px) and (max-width: 768px) {
    .input-section {
        max-width: 420px;
    }

    .title {
        font-size: 3.5rem;
    }
}

/* Small desktop - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .input-section {
        max-width: 480px;
    }
}

/* Large desktop - 1440px and above */
@media (min-width: 1025px) {
    .input-section {
        max-width: 500px;
    }
}
