:root {
    /* Backgrounds & overlays */
    --bg-color: #f9f9f9;
    --bg-overlay: rgba(255, 255, 255, 0.4);
    --bg-rules-screen: rgba(255, 255, 255, 0.9);
    --progress-bg: #f0f0f0;

    /* Borders and shadows */
    --border-color: #000;
    --box-shadow-color: rgba(0, 0, 0, 0.2);
    --box-shadow-coin: rgba(255, 215, 0, 0.8);

    /* Text colors */
    --text-color-default: #333;
    --text-color-footer: #555;
    --text-color-progress-spot: #000;

    /* Button colors */
    --btn-bg-blue: #007BFF;
    --btn-bg-blue-hover: #0056b3;
    --btn-bg-green: #28a745;
    --btn-bg-green-hover: #218838;

    /* Progress spot active */
    --progress-spot-active: #ffd700;

    /* Neutral grays */
    --neutral-light-gray: #ccc;
    --neutral-white: #fff;
}

body {
    font-family: 'Patrick Hand', Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
    background-image: url('../img/field-water-victoria-lucero.JPG');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-blend-mode: overlay;
    background-color: var(--bg-overlay);
}

#game-container {
    width: 60%;
    margin: 2rem auto;
    border: 2px solid var(--border-color);
    position: relative;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    height: auto;
    min-height: 500px;
    padding: 20px;
    box-sizing: border-box;
    gap: 2rem;
}

#rules-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-rules-screen);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 1rem; /* reduce overall padding */
    overflow-y: auto; /* ensure scrolling if needed */
    box-sizing: border-box;
}

#rules-screen p {
  max-width: 600px;
  width: 100%;
  margin: 0 auto 1rem auto; /* centers and adds space below */
  text-align: center;         /* optional: makes it easier to read */
}

@media (max-width: 768px) {
  #rules-screen {
    justify-content: flex-start; /* push content to top for better fit */
    align-items: stretch;
    padding: 1rem 0.5rem;
    font-size: 0.95rem;
  }

  #rules-screen p, #rules-screen li {
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }
}

@media (max-width: 480px) {
  #rules-screen {
    padding: 0.5rem;
    font-size: 0.85rem;
  }

  #rules-screen p, #rules-screen li {
    margin-bottom: 0.5rem;
  }
}

#flash-card {
  width: 200px;
  height: 250px;
  margin: 40px auto;
  border-radius: 20px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  position: relative;
  font-size: 120px;
  text-align: center;
  line-height: 250px;
  user-select: none;
  background: white;
  z-index: 1;
}

#flash-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 3px;
  background: conic-gradient(
    red,
    orange,
    yellow,
    green,
    blue,
    indigo,
    violet,
    red
  );
  background-size: cover;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 0;
}

#flash-card p {
  position: relative;
  z-index: 1;
  margin: 0;
  letter-spacing: 8px;
}

.btn {
    font-family: 'Patrick Hand', Arial, sans-serif;
    padding: 16px 32px;
    font-size: 20px;
    cursor: pointer;
    margin: 0.75rem;
    border: none;
    color: var(--neutral-white);
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#remove-btn {
    background: var(--btn-bg-green);
}

#remove-btn:hover {
    background-color: var(--btn-bg-green-hover);
    transform: scale(1.1);
}

.btn:not(#remove-btn) {
    background: var(--btn-bg-blue);
}

.btn:not(#remove-btn):hover {
    background-color: var(--btn-bg-blue-hover);
    transform: scale(1.1);
}

#game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

footer {
    margin: 2rem 0;
    font-size: 0.6rem;
    color: var(--text-color-footer);
}

@media (max-width: 768px) {
    #game-container {
        width: 90%;
        padding: 15px;
        min-height: 400px;
        gap: 1.5rem;
    }

    #flash-card {
        font-size: 2.5rem;
        width: 70%;
    }

    .btn {
        font-size: 14px;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    #game-container {
        width: 100%;
        padding: 10px;
        min-height: 300px;
        gap: 1rem;
    }

    #flash-card {
        font-size: 2rem;
        width: 80%;
    }

    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 1080px) and (orientation: landscape) {
    #game-container {
        width: 100%;
        padding: 5px;
        min-height: 100vh;
        overflow-y: auto;
        transform: scale(0.8);
        transform-origin: top center;
    }
}

#progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto;
    width: 80%;
    max-width: 600px;
    height: 50px;
    background-color: var(--progress-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    position: relative;
    box-shadow: 0 4px 8px var(--box-shadow-color);
}

.progress-spot {
    width: 40px;
    height: 40px;
    background-color: var(--neutral-light-gray);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color-progress-spot);
    position: relative;
    transition: background-color 0.4s ease;
}

.progress-spot.active {
    background-color: var(--progress-spot-active);
}

.coin {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--progress-spot-active);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--box-shadow-coin);
    transform: translateX(-50%);
    transition: top 0.4s ease-in;
    z-index: 1000;
}

.falling-coin {
    width: 40px;
    height: 40px;
    background-color: var(--progress-spot-active);
    border-radius: 50%;
    position: absolute;
    top: -50px;
    animation: coins-fall 1s ease-in forwards;
    opacity: 0.9;
    z-index: 1000;
    box-shadow: 0 0 6px var(--box-shadow-coin);
}

@keyframes coins-fall {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

#finish-message {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-family: 'Patrick Hand', cursive;
    z-index: 20;
    text-align: center;
    padding: 1rem;
    box-sizing: border-box;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.modal.hidden {
    display: none;
}

.modal-content {
    position: relative;
    background: var(--neutral-white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.modal-content input[type="text"] {
    width: 90%;
    padding: 10px;
    margin: 1rem 0;
    font-size: 1rem;
    border: 2px solid var(--neutral-light-gray);
    border-radius: 5px;
}

.modal-content button {
    background: var(--btn-bg-blue);
    color: var(--neutral-white);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-family: 'Patrick Hand', cursive;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.modal-content button:hover {
    background: var(--btn-bg-blue-hover);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    width: 32px;
    height: 32px;
    background-color: var(--neutral-light-gray); /* Neutral gray */
    color: var(--neutral-white); /* White × icon */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 1;
    line-height: 1; /* Helps vertical centering */
    font-weight: bold; /* Makes × easier to see */
    user-select: none;
}

.close-btn:hover {
    background-color: #999; /* Slightly darker gray on hover */
    transform: scale(1.1);
}

.edit-link {
    color: var(--btn-bg-blue);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

.edit-link:hover {
    color: var(--btn-bg-blue-hover);
}
