@import url('https://fonts.googleapis.com/css2?family=Arbutus+Slab&family=Poppins:wght@400;600&display=swap');

:root {
    --primary: #de6a1c;          /* Sunset coral */
    --secondary: #375E58;        /* Rich teal */
    --accent: #FBE3D4;           /* Creamy blush */
    --text: #00371a;             /* deep green */
    --light: #fee4ab;          /* light yellow */
    --lighter: #ffe5ac;          /* lighter yellow */
    --success: #A0E8AF;          /* Minty green */
    --button-hover: #FF7F5C;     /* Saturated coral for hover */
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    --purple: #9B59B6;  /* used for un-sponsored */
    --sponsored: #cba328;  /* used for sponsored */
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(to bottom, var(--light), var(--lighter));
    color: var(--text);
    line-height: 1.6;
    padding: 14px 0;
    min-height: 100vh;
    margin: 0;
}

.container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 15px 30px;
    text-align: center;
}

header {
    margin-bottom: 0;
    padding-top: 50px; /* Add more space at the top for the fixed menu */
    position: relative;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary);
}

.legend-symbol {
    font-size: 1.2rem;
    line-height: 1;
}

/* First legend item's symbol (sponsored) */
.legend-item:first-child .legend-symbol {
    color: var(--sponsored);
}

/* Second legend item's symbol (unsponsored) */
.legend-item:last-child .legend-symbol {
    color: var(--purple);
}

/* User Menu */
.user-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    height: 30px;
    display: inline-block;
}

.help-button {
    position: fixed;
    top: 20px;
    left: 20px;
    height: 24px;
    width: 24px;
    border-radius: 999px;
    border: 2px solid currentColor;
    background: transparent;
    color: var(--secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    z-index: 1000;
    padding: 0;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.help-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.help-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.user-greeting:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-caret {
    font-size: 0.8em;
    opacity: 0.7;
    transition: transform 0.2s;
}

/* Removed duplicate .user-menu rule */

.user-menu:hover .dropdown-caret {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    min-width: 120px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1001;
    text-align: left;
}

.dropdown-menu:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-menu .user-greeting {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text);
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    margin: 4px 0;
}
    
h1 {
    font-size: 2.5rem;
    color: var(--primary);  
    margin-top: 0.6rem;
    margin-bottom: 0rem;
    /* text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); */
    font-family: 'Arbutus Slab', serif;
}

.streak-display {
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary);
    margin-top: 0.25rem;
  }
  
.subtitle {
    color: rgba(255, 255, 255, 0.8);  /* Semi-transparent white */
    font-size: 1.1rem;
}

#game-container {
    background-color: transparent;
    border-radius: 0;
    padding: 5px 0;
    box-shadow: none;
    margin: 0 -20px 1rem -20px;
    border: none;
}

.bingo-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin: 0 auto 8px;
    padding: 0.2rem;
    max-width: 420px;
}

.bingo-square {
    aspect-ratio: 1;
    background-color: rgba(255, 255, 255, 0.8); /* instead of 0.1 */
    border: 1px solid rgba(0, 0, 0, 0.05); /* subtle taupe/gray */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* very light shadow */
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 6px;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    line-height: 1.3;
    user-select: none;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
}

.bingo-square:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bingo-square.checked {
    background-color: var(--primary) !important;  /* Coral color for checked squares */
    border-color: rgba(255, 255, 255, 0.3);
    position: relative;
    color: white;
}

.bingo-square.checked::after {
    content: '✓';
    position: absolute;
    top: 1px;
    right: 4px;
    font-size: 12px;
    color: #2D5D5B;
}

/* sponsored: a soft gold border + subtle badge */
.bingo-square.sponsored {
    border: 2px solid #cba328;         /* warm gold */
    position: relative;
    /* background-color: rgba(203,163,40,0.15); */
  }
  
  /* .bingo-square.sponsored::after {
    content: "★";                      /* simple star badge */
    /* color: #cba328;
    font-size: 0.8rem;
    position: absolute;
    top: 4px;
    right: 6px;
  }  */
  
  /* un-sponsored: cool teal outline */
  .bingo-square.unsponsored {
    border: 2px solid var(--purple);         /* teal */
    position: relative;
  }
  
  /* .bingo-square.unsponsored::after {
    content: "♡";                      /* heart outline badge */
   /* color: #2a8c82;
    font-size: 0.8rem;
    position: absolute;
    top: 4px;
    right: 6px;
  }
 */
  /* ----------  RIBBON BADGES  ---------- */

/* shared ribbon basics */
.bingo-square.sponsored::before,
.bingo-square.unsponsored::before {
  content: attr(data-badge);          /* we’ll set this via the class */
  position: absolute;
  top: -11px;                           /* adjust to taste */
  right: -20px;                        /* pull left so the ribbon’s centre sits on the corner */
  display: block;
  padding: 2px 11px 1px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  line-height: 1;
  transform: rotate(45deg);
  transform-origin: 0 0;              /* rotate around top-left */
  pointer-events: none;               /* click passes through */
  z-index: 2;                         /* above borders */
}

/* sponsored = gold star */
.bingo-square.sponsored::before {
  background: #cba328;
  content: "★";
}

/* un-sponsored = teal heart */
.bingo-square.unsponsored::before {
    background: var(--purple);
    /* background: #2a8c82; */
    content: "♥";
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.submit-btn {
    background-color: var(--primary);  /* Coral color */
    color: white;
    border: none;
}


.submit-btn:disabled {
    background-color: #E0E0E0;
    color: #A0A0A0;
    cursor: not-allowed;
    opacity: 0.7;
  }
  

.submit-btn:not(:disabled):hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.share-btn {
    background-color: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

#shareBoard {
    display: none !important;
}

.share-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.new-game-btn {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    transition: all 0.3s ease;
}

.new-game-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bingo-message {
    min-height: 24px;
    margin-top: 15px;
    font-weight: 600;
    color: #F28A80;  /* Coral color */
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bingo-message.visible {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .bingo-square {
        font-size: 0.75rem;
        padding: 4px 6px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .modal {
        padding: 1.5rem 1.25rem max(2rem, env(safe-area-inset-bottom));
        max-height: calc(100dvh - 20px);
    }

    .modal-content h2 {
        font-size: 1.9rem;
        line-height: 1.4;
    }

    .modal-content p {
        margin-bottom: 1rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    .container {
      padding: 10px 0;
    }
  
    #game-container {
      /* max-width: 440px; */
      margin: 0 auto;
      padding: 0 9px;
    
    }
    
    .bingo-board {
      max-width: 100%; /* previously 420px */
      gap: 2px;
    }
  
    .bingo-square {
      font-size: 0.6rem;
      padding: 2px;
    }
  }
  
/* ====== Modal Base Styles ====== */

.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.modal-wrapper.hidden {
    display: none;
}

.modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--lighter);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    padding: 2rem 1.5rem max(2.5rem, env(safe-area-inset-bottom));
    z-index: 1000;
    text-align: center;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
  
  /* Removed sun effect pseudo-element */

  /* Show the modal with the "show" class */
  .modal-wrapper.show {
    opacity: 1;
    visibility: visible;
  }
  
  .modal-wrapper.show .modal {
    transform: translateY(0%);
    opacity: 1;
  }
  
  
  /* ====== Modal Content ====== */
  .modal-content h2 {
    font-family: 'Arbutus Slab', serif;
    color: var(--primary);
    margin-bottom: 0rem;
    font-size: 2.3rem;
    line-height: 1.8;
  }
  
  .modal-content p {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1.5rem;
    line-height: 1.4;
  }
  
  .modal-content p.tagline {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    font-weight: 600;
    color: var(--primary);
    margin: -0.5rem 0 1rem 0;
    line-height: 1.3;
    text-align: center;
  }
  
  .modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .modal-buttons button {
    width: 100%;
  }

  /* ===== Modal Input Styles ===== */
  .modal-buttons input[type="email"],
  .modal-buttons input[type="password"],
  .modal-buttons input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .modal-buttons input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(222, 106, 28, 0.25);
  }

  .modal-buttons input::placeholder {
    color: rgba(0, 0, 0, 0.6);
  }
  
/* Animation for bingo win */
@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    opacity: 0;
    animation: confetti 3s ease-out forwards;
    z-index: 1000;
}
