/* @import url("https://fonts.googleapis.com/css?family=Comfortaa");
html, body {
  margin: 0;
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: relative;
  font-family: "Comfortaa", cursive;
} */

/* Base styles */
html, body {
    margin: 0;
    overflow: hidden !important;
    height: 100%;
    width: 100%;
    position: relative;
    font-family: sans-serif;
}

#container,
.wrapper,
.containerTest {
  overflow: hidden !important;
  max-width: 100vw;
  max-height: 100vh;
}

#container {
  width: 100%;
  height: 100%;
    position: relative;
  font-family: sans-serif;
  font-style: normal;
  font-size: 1.2vw;
    background: none !important;
}

#game {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    opacity: 1 !important;
    visibility: visible !important;
    background: none !important;
}

#container.playing #game {
    opacity: 1;
}

/* Card styles */
.regulatory-card, .regulatory-card.placed {
    width: 22vw;
    min-width: 140px;
    max-width: 320px;
    height: min(12vw, 14vh);
    min-height: 50px;
    max-height: 180px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.12), 0 1.5px 8px rgba(0,0,0,0.10);
    padding: 15px;
    user-select: none;
    z-index: 10;
    position: absolute;
    font-size: 0.8em;
    cursor: pointer;
    bottom: 120px !important;
}

.regulatory-card.placed {
    background-color: #d6ffd6 !important;
    pointer-events: none;
    cursor: default;
    position: static;
    z-index: 1;
    margin-bottom: 8px;
    width: 100% !important;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 5px 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 24px 0 rgba(0,0,0,0.25), 0 1.5px 8px rgba(0,0,0,0.18);
}

.regulatory-card.placed .card-header {
    font-size: 0.92em;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1em;
    max-height: 2.2em;
}

.regulatory-card.incorrect {
    background: #ffd6d6;
}

.regulatory-card:not(.placed):not(.incorrect) {
    background: white;
}

.card-header {
    font-size: 1.05em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.card-subheader {
    font-size: 1em;
    color: #666;
    margin-bottom: 12px;
}

.card-content {
    font-size: 0.85em;
    color: #777;
}

/* Drop zones */
.drop-zones-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    gap: 16px 20px;
    margin-top: 60px;
    margin-bottom: 0;
}

.drop-zone {
    width: 22vw;
    min-width: 140px;
    max-width: 320px;
    height: min(14vw, 16vh);
    min-height: 70px;
    max-height: 220px;
    border: 2px dashed #ccc;
    border-radius: 10px;
    margin: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1;
    background: none !important;
    position: relative;
    padding-bottom: 12px;
}

.drop-zone.active {
    border-color: #666;
    background: none !important;
}

.drop-zone:has(.regulatory-card.placed) {
    border-color: #4CAF50;
    background: none !important;
}

.drop-zone-label {
    margin-top: 8px;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

/* QMS drop zone: even smaller font for placed card headings */
.drop-zone[data-order="3"] .regulatory-card.placed .card-header {
    font-size: 0.8em !important;
}

/* Quiz modal */
.quiz-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.quiz-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    z-index: 10000;
    position: relative;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.quiz-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    background: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
    font-size: 0.95em;
    line-height: 1.4;
}

.quiz-btn:hover {
    background: #0056b3;
}

/* Game states */
#container.playing #score {
    opacity: 1;
    visibility: visible;
}

#container.ended .game-over {
    opacity: 1;
    visibility: visible;
}

#container.ended .game-over * {
    opacity: 1;
    transform: translateY(0);
}

/* Score display */
#score {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
    transform-origin: center;
}

/* Instructions */
#instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    color: #333;
    text-align: center;
  opacity: 0;
    transition: opacity 0.3s;
}

#container.playing #instructions {
    opacity: 1;
}

/* Game over screen */
.game-over {
  position: absolute;
  top: 0;
    left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
    justify-content: center;
  opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
}

.game-over h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #333;
}

.game-over p {
    font-size: 1.2em;
    color: #666;
    margin: 10px 0;
}

/* Start button */
.game-ready {
  position: absolute;
    top: 0;
    left: 0;
  width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-button {
    padding: 15px 40px;
    font-size: 1.5em;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#start-button:hover {
    background: #0056b3;
}

/* Medium screens */
@media (max-width: 900px) {
    .regulatory-card, .drop-zone {
        width: 32vw;
        min-width: 100px;
        height: min(16vw, 12vh);
        min-height: 40px;
        max-height: 120px;
        font-size: 0.95em;
    }
}

/* Small screens */
@media (max-width: 600px) {
    .regulatory-card, .drop-zone {
        width: 90vw;
        min-width: 60px;
        height: min(22vw, 10vh);
        min-height: 30px;
        max-height: 80px;
        font-size: 0.9em;
    }
    .drop-zones-container {
        gap: 3vw;
        padding: 10px;
    }
}

/* Short screens */
@media (max-height: 700px) {
  .drop-zones-container {
    margin-top: 20px;
    padding: 8px;
    gap: 8px 10px;
  }
  .regulatory-card, .drop-zone {
    height: min(9vw, 10vh);
    min-height: 30px;
    max-height: 70px;
    font-size: 0.85em;
    padding: 8px;
  }
  #score {
    top: 8px;
    font-size: 18px;
    padding: 6px 12px;
  }
  #instructions {
    bottom: 8px;
    font-size: 1em;
    padding: 6px 12px;
  }
  .game-over h2 {
    font-size: 1.3em;
    margin-bottom: 10px;
  }
  .game-over p {
    font-size: 1em;
    margin: 6px 0;
  }
  #start-button {
    font-size: 1.1em;
    padding: 10px 20px;
  }
}

@media (max-height: 500px) {
  .drop-zones-container {
    margin-top: 8px;
    padding: 4px;
    gap: 4px 6px;
  }
  .regulatory-card, .drop-zone {
    height: min(7vw, 8vh);
    min-height: 20px;
    max-height: 40px;
    font-size: 0.7em;
    padding: 4px;
  }
  #score, #instructions {
    font-size: 0.8em;
    padding: 4px 8px;
  }
  .game-over h2 {
    font-size: 1em;
  }
  .game-over p {
    font-size: 0.8em;
  }
  #start-button {
    font-size: 0.9em;
    padding: 6px 12px;
  }
}

@keyframes success-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    border-color: #4CAF50;
  }
  70% {
    box-shadow: 0 0 16px 8px rgba(76, 175, 80, 0.5);
    border-color: #4CAF50;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    border-color: #4CAF50;
  }
}
.drop-zone.success-flash {
  animation: success-flash 0.7s ease;
  border-color: #4CAF50 !important;
}

@keyframes score-pop {
  0% { box-shadow: 0 0 0 0 #4CAF50; }
  30% { box-shadow: 0 0 16px 6px #d6ffd6; }
  100% { box-shadow: 0 0 0 0 #4CAF50; }
}
#score.score-pop {
  animation: score-pop 0.5s;
}

@keyframes error-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    border-color: #f44336;
  }
  70% {
    box-shadow: 0 0 16px 8px rgba(244, 67, 54, 0.5);
    border-color: #f44336;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    border-color: #f44336;
  }
}
.drop-zone.error-flash {
  animation: error-flash 0.7s ease;
  border-color: #f44336 !important;
}

@keyframes score-pop-error {
  0% { box-shadow: 0 0 0 0 #f44336; }
  30% { box-shadow: 0 0 16px 6px #ffd6d6; }
  100% { box-shadow: 0 0 0 0 #f44336; }
}
#score.score-pop-error {
  animation: score-pop-error 0.5s;
}