:root {
  --green: #39ff67;
  --green2: #11c84b;
  --bg: #1a1a2e;
  --panel: #041f0c;
  --text: #c6ffd7;
  --muted: #7feea2;
  --shadow: rgba(0, 0, 0, 0.55);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#gameContainer {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
#info {
  position: fixed;
  top: 20px;
  left: 20px;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 10px;
  font-size: clamp(6px, 1.5vw, 32px);
  backdrop-filter: blur(10px);
  z-index: 1000;
}
#devClickInfo {
  position: fixed;
  right: 20px;
  top: 20px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 12px;
  border-radius: 10px;
  font: 12px/1.4 monospace;
  backdrop-filter: blur(10px);
  z-index: 9999;
  white-space: pre;
}

/* POPUP */
.hidden {
  display: none !important;
}

.popup {
  position: fixed;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.popup-header {
  padding: 0 10px 14px 0;
}

.popup-card {
  max-width: 100%; /* agar tidak overflow */
  background: linear-gradient(
    180deg,
    rgba(30, 30, 55, 0.95),
    rgba(18, 18, 40, 0.95)
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 18px 18px 16px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  color: #fff;
  position: relative;
}
.small {
  width: min(520px, 92vw);
}

.big {
  width: min(calc(600px - 2 * 18px), calc(95vw - 2 * 18px));
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 32px;
}
.popup-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

#popupTitle {
  margin: 2px 0 8px;
  font-size: 20px;
  letter-spacing: 0.2px;
}
#popupDesc {
  margin: 0 0 12px;
  opacity: 0.9;
  line-height: 1.4;
}

.popup-image {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.popup-image img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;

  border: 1px solid rgba(0, 255, 255, 0.35);
  background: rgba(0, 255, 255, 0.08);

  box-shadow: 0 0 16px rgba(0, 255, 255, 0.35),
    inset 0 0 12px rgba(0, 255, 255, 0.15);
}

/* Container 2 video */
.popup-video {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 1rem;
}

/* toggle bar */
.video-toggle {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  width: fit-content;
}

.toggle-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.toggle-btn:hover {
  transform: translateY(-1px);
  color: rgba(255, 255, 255, 0.95);
}

.toggle-btn.is-active {
  background: rgba(0, 255, 204, 0.18);
  color: #eaffff;
}

/* 1 stage for video */
.com-stage-3 {
  position: relative;
  width: 100%;
  min-height: 360px;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0f14;
}

.com-loading {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-direction: column;
  background: rgba(11, 15, 20, 0.75);
  backdrop-filter: blur(2px);
}

.com-loading.hidden {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(0, 255, 204, 0.9);
  animation: spin 0.9s linear infinite;
}

.loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* frames stacked, only 1 shown */
.present-com-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
}

.present-com-frame.is-active {
  display: block;
}

/* Link cell */
.popup-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.popup-link a {
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.35);
  background: rgba(0, 255, 255, 0.08);
  color: #7ffcff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.35);
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

#loginPopupBtn {
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.35);
  background: rgba(0, 255, 255, 0.08);
  color: #7ffcff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.35);
}

.popup-cell.popup-link a:hover {
  background: rgba(0, 255, 255, 0.15);
}

/* RATING */
#mode-rating {
  overflow: clip;
  height: 100%;
}
/* Rating */
.rating-average,
.rating-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rating-info span {
  white-space: nowrap;
}

#rating-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  overflow: auto;
}

.card {
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
  padding-bottom: 3rem; /* untuk total height */
}

.card-img {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.card img.project-img {
  width: 100%;
  max-width: 100px;
  aspect-ratio: 1 /1;
  object-fit: cover;
}

.card-body {
  padding: 12px;
}

.card-title {
  font-weight: bold;
  margin-bottom: 8px;
}

.rating-average {
  margin-bottom: 8px;
}

.stars {
  color: #ffc107;
}

.rating-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: bold;
}

.rating-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rating-count {
  font-size: 9px;
}

.avatars {
  display: flex;
  margin-top: 4px;
}

.avatars img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-left: -8px;
}

.avatars img:first-child {
  margin-left: 0;
}

.total {
  position: absolute;
  bottom: 10px;
  margin-top: 10px;
  font-weight: bold;
  font-size: 13px;
}

/* PRESENT COM */
#doc-report {
  width: calc(100% / 0.85);
  height: calc(100% / 0.85);
  transform: scale(0.85);
  transform-origin: top left;
  border: 0;
}

/* !!! RATE */
.rate-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.stars {
  display: flex;
  gap: 6px;
}

.star {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 2px;
  color: #777; /* default (inactive) */
  transition: transform 0.08s ease, color 0.08s ease;
}

.star:hover {
  transform: translateY(-1px);
}

.star.is-active {
  color: #f5c518;
} /* selected */
.star.is-hover {
  color: #ffd86b;
} /* hover preview */

.submit-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  background: #111;
  color: #fff;
  cursor: pointer;
  transition: filter 0.12s ease, opacity 0.12s ease;
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* #mode-presentation.big .popup-header{
  flex: 0 0 auto;
} */

#mode-presentation.big {
  width: 70vw;
}

#mode-presentation .iframe-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

#mode-presentation .iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* loading overlay */
.iframe-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.75);
  color: #39ff67;
  font-weight: 600;
  letter-spacing: 0.4px;
  z-index: 2;
  transition: opacity 0.25s ease;
}

.iframe-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

#vid-presentation-day {
  width: 100%;
  aspect-ratio: 16 / 9;
}



/* TABLET */
@media (max-width: 768px) {
  .card-img {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .com-stage-3 {
    min-height: 300px;
  }

  .popup-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .popup-link a {
    padding: 7px 9px;
    border-radius: 6px;
    box-shadow: 0 0 7px rgba(0, 255, 255, 0.35);
  }
}

/* MOBILE */
@media (max-width: 426px) {
  #info {
    padding: 3vw;
  }

  #mode-presentation.big {
    width: 100%;
  }

  .popup-card {
    width: calc(100vw - 32px);
    overflow: auto;
    max-height: 90vh;
  }

  #rating-container {
    gap: 0.5rem;
  }

  .avatars > img {
    width: 20px;
    height: 20px;
  }

  #mode-top {
    width: 100%;
    max-height: 90vh;
    overflow: auto;
  }

  #mode-com {
    width: 100%;
    max-height: 90vh;
    overflow: auto;
  }

  .popup-link a {
    font-size: 12px;
  }

  #githubLink img {
    width: 12px;
    height: 12px;
  }

  /* Present-com */
  .video-toggle {
    gap: 2px;
    padding: 2px;
    margin-top: 1rem;
  }
  .video-toggle button {
    padding: 8px;
  }
}

@media (max-width: 375px) {
  .popup-card {
    width: calc(100vw - 12px);
    padding: 8px;
  }

  .com-stage-3 {
    overflow: auto;
  }

  .present-com-frame {
    min-width: 264px;
  }

  #loginMessage {
    font-size: 12px;
  }

  #loginPopupBtn a {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
  }
}
