
* {
  box-sizing: border-box;
  font-family: sans-serif;
}

body {
  margin: 0;
  background: #ddcdcd;
  overflow: hidden;
}

#passwordOverlay {
  position: fixed;
  inset: 0;
  background: #2c3e50; 
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999; 
}

#passwordBox {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#passwordInput {
  display: block;
  width: 100%;
  padding: 10px;
  margin: 15px 0;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 18px;
}

#passwordSubmit {
  padding: 10px 25px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

#passwordSubmit:hover {
  background: #2980b9;
}

/* ---------- Main grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 100px repeat(6, 225px);
  grid-template-rows: 60px repeat(5, 200px);
  gap: 24px;
  justify-content: center;
  align-content: center;
  padding-top: 10px;
  height: auto;
}

.header-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  color: #2c3e50;
  text-transform: uppercase;
  text-align: center;
}

.card {
  position: relative;
  border-radius: 32px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  flex-direction: column; 
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  color: rgb(252, 252, 252);
  font-size: 21px;
  font-weight: bold;
  padding: 10px; 
  text-align: center; 
}

.front { background: #3498db; }
.back  {
  background-color: #096d33; 
  transform: rotateY(180deg);
  transition: background-color 2s ease-in-out; 
}

.flipped { transform: rotateY(180deg); }

.countdown-timer {
  margin-top: 10px; 
  font-size: 2em; 
  font-weight: bold;
  color: white;
}

.back.timer-ended {
  background-color: #ee4705; 

}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
}

.floating {
  position: fixed;
  border-radius: 20px;
  transition:
    top 0.8s ease,
    left 0.8s ease,
    width 0.8s ease,
    height 0.8s ease,
    transform 0.8s ease;
  transform-style: preserve-3d;
  pointer-events: auto;
  z-index: 5001;
}

.close-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}

.card.visited .front {
  background: #9b59b6;
}

.reveal-btn {
  margin-top: 20px;
  padding: 10px 20px;
  background-color: white;
  color: #096d33;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.reveal-btn:hover {
  transform: scale(1.05);
}


.back-text {
  font-size: 24px;
  margin-bottom: 10px;
  max-width: 80%;
  transition: opacity 0.4s ease-in-out;
  opacity: 1;
}

.face.back {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.back-text {
  font-size: 24px;
  margin-bottom: 10px;
  max-width: 80%;
}

.timer-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  margin-top: 15px;
}

.timer-svg {
  position: absolute;
  transform: rotate(-90deg) scaleY(-1);
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2); 
  stroke-width: 6;
}

.timer-ring-progress {
  fill: none;
  stroke: white; 
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear; 
}

.countdown-timer {
  margin-top: 0 !important; 
  font-size: 1.8em;
  font-weight: bold;
  color: white;
  z-index: 1;
}

#navBtn {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #111;
  color: white;
  font-size: 14px;
  cursor: pointer;
  z-index: 2000;
}

#navBtn:hover {
  background: #333;
}

.zoom-image-container {
  width: 90%;
  height: 70%;
  background-repeat: no-repeat;
  background-size: 400% !important; 
  
  transition: background-size 3s ease-in-out, background-position 3s ease-in-out;
  margin-bottom: 15px;
}

.zoom-image-container.zoomed-out {
  background-size: 40% !important;
  background-position: center !important; 
}

.face.back {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#scoresPanel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  padding: 16px;
  padding-top: 78px; 
  background: linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%);
  border-left: 1px solid rgba(0,0,0,0.10);
  overflow: auto;
  z-index: 500;
  box-shadow: -10px 0 30px rgba(0,0,0,0.08);
}

.scores-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr; 
  align-items: center;
  gap: 12px;

  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 12px;
}

.scores-title {
  margin: 0;
  text-align: center;
  font-size: 16px;
  letter-spacing: 0.2px;
  color: #111;
}

#refreshScoresBtn.refresh-icon-btn {
  justify-self: end;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;

  width: 44px;
  height: 44px;
  border-radius: 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#refreshScoresBtn.refresh-icon-btn:hover {
  background: rgba(0,0,0,0.06);
}

#refreshScoresBtn.refresh-icon-btn:active {
  background: rgba(0,0,0,0.10);
}

#refreshScoresBtn.refresh-icon-btn img {
  width: 34px;   
  height: 34px;
  display: block;
  object-fit: contain;
}

#scoresStatus {
  font-size: 12px;
  color: rgba(0,0,0,0.65);
  margin: 6px 2px 10px;
}

#scoresTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 10px 20px rgba(0,0,0,0.06);
}

#scoresTable thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

#scoresTable thead th:first-child { border-top-left-radius: 14px; }
#scoresTable thead th:last-child  { border-top-right-radius: 14px; }

#scoresTable tbody td {
  padding: 10px 10px;
  font-size: 14px;
  color: #151515;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

#scoresTable tbody tr:nth-child(even) td {
  background: rgba(0,0,0,0.02);
}

#scoresTable tbody tr:hover td {
  background: rgba(52, 152, 219, 0.10);
}

#scoresTable th:last-child,
#scoresTable td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#scoresTable tbody td:last-child {
  font-weight: 700;
  color: #0f5132;
}

#scoresTable tbody tr td:empty {
  color: rgba(0,0,0,0.35);
}

#final-container {
  display: flex;
  justify-content: center;
  padding: 40px 0;
  background: #ddcdcd; 
}

.final-card {
  width: 400px;
  height: 80px;
  position: relative;
  border-radius: 15px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.8s ease, background 0.5s;
}

.final-card.disabled {
  background: #727575;
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.final-card.active .face.front {
  animation: colorCycle 10s infinite linear;
  background: transparent; 
  border: 2px solid white;
}

@keyframes colorCycle {
  0% { background: #3498db; }
  25% { background: #0fc469; }
  50% { background: #c73727; }
  75% { background: #0fd7f1; }
  100% { background: #910d86; }
}

.final-card .face {
  font-weight: bold;
  font-size: 1.5rem;
  border-radius: 15px;
  backface-visibility: hidden;
}

.final-card .back {
  transform: rotateY(180deg);
  background: #2c3e50;
}