/* Game Header Styling */
.game-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.game-icon {
  width: 40px;
  height: 40px;
  margin-right: 12px;
}

.game-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
}

/* Popup Share Icons */
.share-icons {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  justify-content: center;
}
.share-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
}
.share-icon-btn img {
  width: 32px;
  height: 32px;
}

/* More Games Section */
.more-games-wrapper {
  margin-top: 20px;
}
.more-games-title {
  font-weight: bold;
  text-align: center;
  font-size: 1.2rem;
}
.game-card-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 24px; /* space between cards */
  flex-wrap: nowrap; /* prevent wrapping */
}

/* Mini Game Cards */
.game-card-mini {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  text-align: center;
  border-radius: 12px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.game-card-mini .game-info {
  padding: 16px;
}
.game-card-mini .game-icon img {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  display: inline-block;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
}
.game-card-mini h3 {
  margin: 8px 0;
  font-size: 1.1rem;
}
.game-card-mini .cta-button {
  margin-top: 10px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  background-color: #222;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9rem;
}
.game-card-mini .cta-button.cricket {
  color: var(--black);
}

.game-container {
    background: linear-gradient(135deg, var(--primary-medium) 0%, var(--primary-dark) 100%);
    border-radius: 15px;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary-light);
    max-width: calc(100% - 40px);  /* Leave 20px margin on each side */
    width: 100%;
    min-height: 350px;
    margin: 40px auto 0 auto;
    padding: 40px 40px;    /* Add horizontal padding for inner spacing */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box; /* Include padding and border in width calculation */
}

h1 {
    text-align: center;
    color: var(--off-white);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 30px;
    font-size: 36px;
    font-family: 'Oswald', sans-serif;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 15px;
    position: relative;
}

.input-container {
    margin-bottom: 30px;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    /* Remove max-width, margin-left, margin-right, and any padding */
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid var(--primary-light);
    border-radius: 12px;
    background-color: rgba(255,255,255,0.95);
    color: #333;
    font-family: 'Montserrat', sans-serif;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    box-sizing: border-box;
    /* Remove any margin or extra padding */
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30,136,229,0.3);
}

input[type="text"]::placeholder {
    color: #757575;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--light-gray);
    border-radius: 0 0 12px 12px;
    background-color: white;
    z-index: 10;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    margin-top: 5px;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    color: #333;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: var(--off-white);
}

.autocomplete-image {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    border: 1px solid var(--light-gray);
}

.autocomplete-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guess-grid {
    display: grid;
    gap: 20px;
    margin-top: 25px;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.guess-card {
    background: #121821;
    border-radius: 18px;
    margin-bottom: 24px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 0 2px 12px #0003;
    border-top: 5px solid var(--tennis-primary);
}

.guess-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.guess-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.guess-player-image {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 16px;
    border: 2px solid #333;
}

.guess-player-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}

.player-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(to bottom, var(--sport-primary), var(--primary-medium));
    padding: 12px;
    width: 120px;
    border-right: 1px solid var(--mid-gray);
    color: var(--white);
}

.player-image {
    width: 100px;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 2px solid var(--white);
    background-color: var(--light-gray);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name {
    margin-top: 8px;
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.player-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
    background-color: var(--white);
    box-sizing: border-box;
    overflow: hidden;
}

.guess-card-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.guess-card-details.custom-grid {
  display: grid;
  grid-template-areas:
    "nationality club position"
    "debut foot goals";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 18px 18px;
  width: 100%;
  margin-top: 8px;
}

.detail-area.nationality .detail-item,
.detail-area.club .detail-item,
.detail-area.position .detail-item,
.detail-area.debut .detail-item,
.detail-area.foot .detail-item,
.detail-area.goals .detail-item {
  height: 100%;
  min-height: 60px; /* Ensure all detail items have the same height */
  justify-content: center;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 6px;
    min-height: 60px;
    border-radius: 6px;
    background-color: var(--light-gray);
    border: 1px solid var(--mid-gray);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 0;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.detail-item {
  background: #232323;
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.detail-item.correct {
  background: #2e7d32;
  color: #fff;
}

.detail-item.number-clue {
  background: #bfae2e;
  color: #fff;
}

.detail-label {
    font-size: 0.7em;
    color: var(--dark-gray);
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 2px;
}

.detail-value {
    font-weight: 600;
    font-size: 0.85em;
    word-break: break-word;
    max-width: 100%;
    padding: 0 2px;
    text-align: center;
}

.detail-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.arrow {
  font-size: 1.1rem;
  margin-left: 2px;
}

.correct {
    background: var(--football-primary);
    color: white;
    border-color: transparent;
}

.game-result {
    text-align: center;
    font-weight: bold;
    margin-bottom: 25px;
    padding: 18px;
    border-radius: 12px;
    animation: fadeIn 0.5s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    background: var(--primary-light);
    color: var(--white);
}

.game-result.success {
    background: var(--football-primary);
}

.game-result.failure {
    background: #C62828;
}

.team-kit-container {
    height: 45px;
    overflow: hidden;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
}

.team-kit-container img {
    max-height: 100%;
}

.flag-container {
    width: 35px;
    height: 25px;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* container stays the same size */
}

.fi {
    font-size: 3em; /* keep this at 1em so it doesn't overflow the container */
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.fi span,
.fi svg {
    width: 150% !important;
    height: 150% !important;
    max-width: 150%;
    max-height: 150%;
    display: block;
}

/* Popup Overlay */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 24, 33, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Popup Modal */
.popup-content {
  background: var(--primary-dark);
  color: var(--off-white);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  padding: 36px 32px 28px 32px;
  max-width: 480px;
  width: 95vw;
  text-align: center;
  position: relative;
  animation: fadeIn 0.3s;
  border: 2px solid var(--primary-light);
}

.popup-content img {
  width: 140px;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 18px;
  border: 2px solid var(--primary-light);
  background: var(--light-gray);
}

.popup-content h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 2em;
  color: var(--football-primary);
  font-family: 'Oswald', sans-serif;
  letter-spacing: 1px;
}

.popup-content .close-button {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.7em;
  color: var(--off-white);
  cursor: pointer;
}

.popup-content .player-name {
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--off-white);
}

.popup-content .player-details {
  font-size: 1em;
  margin-bottom: 18px;
  color: var(--light-gray);
}

.popup-content .stats {
  margin: 18px 0 12px 0;
  text-align: center;
  background: var(--primary-medium);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 1.2em;
}

.popup-content .stats h3 {
  margin: 0 0 8px 0;
  font-size: 1.4em;
  color: var(--football-primary);
}

.popup-content .stats p {
  margin: 2px 0;
}

.popup-content .share-button {
  margin: 12px 0 0 0;
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  background: var(--primary-dark);
  color: #121821;
  font-weight: 700;
  font-size: 1.1em;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 1px;
}

.popup-content .share-button:hover {
  background: var(--football-hover);
}

.share-icon-btn {
  background: var(--primary-dark, #1a2332) !important;
  border: none !important;
  box-shadow: none !important;
}

.share-icon-btn img,
.share-icon-btn svg {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 50% !important;
  width: 32px;
  height: 32px;
  filter: none !important;
  padding: 0 !important;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ============================================ */

/* Large screens and tablets (landscape) */
@media (max-width: 1200px) {
    .game-container {
        margin: 30px auto 0 auto;
        padding: 30px 30px;
    }
    
    h1 {
        font-size: 32px;
        margin-bottom: 25px;
    }
    
    .guess-card-details {
        gap: 10px;
    }
    
    .guess-card-details.custom-grid {
        gap: 15px 15px;
    }
}

/* Tablets (portrait) and small laptops */
@media (max-width: 1024px) {
    .game-container {
        margin: 20px auto 0 auto;
        padding: 25px 20px;
        max-width: calc(100% - 20px);
    }
    
    h1 {
        font-size: 28px;
        margin-bottom: 20px;
        letter-spacing: 1px;
    }
    
    .guess-card {
        padding: 15px 18px;
        margin-bottom: 20px;
    }
    
    .guess-card-details.custom-grid {
        grid-template-areas:
            "nationality club position"
            "debut foot goals";
        grid-template-columns: 1fr 1fr 1fr;
        gap: 12px 12px;
    }
    
    .player-image {
        width: 80px;
        height: 110px;
    }
    
    .popup-content {
        padding: 28px 24px 20px 24px;
        width: 90vw;
    }
    
    .popup-content img {
        width: 120px;
        height: 170px;
    }
}

/* Mobile devices (large) */
@media (max-width: 768px) {
    .game-container {
        margin: 15px auto 0 auto;
        padding: 20px 15px;
        border-radius: 12px;
        max-width: calc(100% - 10px);
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 18px;
        letter-spacing: 1px;
    }
    
    input[type="text"] {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .guess-card {
        padding: 12px 15px;
        margin-bottom: 15px;
        border-radius: 12px;
    }
    
    .guess-card-header {
        margin-bottom: 10px;
    }
    
    .guess-player-image {
        width: 45px;
        height: 45px;
        margin-right: 12px;
    }
    
    .guess-player-name {
        font-size: 1.1rem;
    }
    
    .guess-card-details.custom-grid {
        grid-template-areas:
            "nationality club"
            "position debut"
            "foot goals";
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .detail-item {
        padding: 8px 6px;
        min-height: 50px;
    }
    
    .detail-label {
        font-size: 0.75rem;
    }
    
    .detail-value {
        font-size: 0.9rem;
    }
    
    .player-image {
        width: 70px;
        height: 95px;
    }
    
    .player-name {
        font-size: 0.9em;
    }
    
    /* More Games Section */
    .game-card-row {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .game-card-mini {
        width: 120px;
        min-width: 120px;
        max-width: 120px;
    }
    
    .game-card-mini .game-icon img {
        width: 40px;
        height: 40px;
    }
    
    .game-card-mini h3 {
        font-size: 1rem;
    }
    
    /* Popup adjustments */
    .popup-content {
        padding: 24px 20px 18px 20px;
        width: 92vw;
        max-width: 400px;
    }
    
    .popup-content img {
        width: 100px;
        height: 140px;
        margin-bottom: 15px;
    }
    
    .popup-content h2 {
        font-size: 1.6em;
        margin-bottom: 8px;
    }
    
    .popup-content .player-name {
        font-size: 1.1em;
    }
    
    .popup-content .stats {
        padding: 12px 15px;
        font-size: 1.1em;
    }
    
    .popup-content .stats h3 {
        font-size: 1.2em;
    }
}

/* Mobile devices (small) */
@media (max-width: 480px) {
    .game-container {
        margin: 5px auto 0 auto;
        padding: 12px 8px;
        max-width: calc(100% - 5px);
    }
    
    h1 {
        font-size: 18px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    input[type="text"] {
        padding: 8px;
        font-size: 16px;
    }
    
    .guess-card {
        padding: 8px 10px;
        margin-bottom: 10px;
    }
    
    .guess-player-image {
        width: 35px;
        height: 35px;
        margin-right: 8px;
    }
    
    .guess-player-name {
        font-size: 0.95rem;
    }
    
    .guess-card-details.custom-grid {
        grid-template-areas:
            "nationality club"
            "position debut"
            "foot goals";
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .detail-item {
        padding: 4px 3px;
        min-height: 35px;
    }
    
    .detail-label {
        font-size: 0.65rem;
        margin-bottom: 1px;
    }
    
    .detail-value {
        font-size: 0.8rem;
    }
    
    .player-image {
        width: 60px;
        height: 80px;
    }
    
    .player-name {
        font-size: 0.8em;
    }
    
    /* More Games Section */
    .game-card-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .game-card-mini {
        width: 140px;
        min-width: 140px;
        max-width: 140px;
    }
    
    /* Popup adjustments */
    .popup-content {
        padding: 20px 15px 15px 15px;
        width: 95vw;
        max-width: 350px;
    }
    
    .popup-content img {
        width: 80px;
        height: 110px;
        margin-bottom: 12px;
    }
    
    .popup-content h2 {
        font-size: 1.4em;
        margin-bottom: 6px;
    }
    
    .popup-content .player-name {
        font-size: 1em;
    }
    
    .popup-content .player-details {
        font-size: 0.9em;
        margin-bottom: 15px;
    }
    
    .popup-content .stats {
        padding: 10px 12px;
        font-size: 1em;
        margin: 15px 0 10px 0;
    }
    
    .popup-content .stats h3 {
        font-size: 1.1em;
    }
    
    .popup-content .share-button {
        padding: 8px 20px;
        font-size: 1em;
    }
    
    .share-icons {
        gap: 12px;
        margin-top: 12px;
    }
    
    .share-icon-btn img {
        width: 28px;
        height: 28px;
    }
}