*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --color-primary: #ff6b73;
  --color-primary-dark: #ff3f4b;
  --color-primary-light: #f0a6a5;
  --color-primary-green: #37bb74;
  --color-primary-green-dark: #228642;
  --color-primary-green-light: #9deca2;

  --color-gray-bg: #f0f0f0;
  --color-gray-text: #91a4b3;
  --color-gray-text-dark: #40526b;

  --color-gold: #ee8000;
  --color-silver: #b8c5c8;
  --color-bronze: #d14c00;

  --color-navy: #3d4678;
  --color-navy-dark: #2f3c57;
  --color-bg: #e5e4e9;
  --color-panel: #c0c9e1;
  --color-map-bg: #f9f5e7;
  --color-track: #9aa3b3;
  --color-correct: #9be09b;
  --color-incorrect: #ddb0b0;
  --color-success: #2fa24b;
  --color-card-bg: #ececec;
  --color-card-info-bg: #f2f2f2;
}

.gold-shine {
  --shine-color: var(--color-gold);
}
.silver-shine {
  --shine-color: var(--color-silver);
}
.bronze-shine {
  --shine-color: var(--color-bronze);
}

/* ---------------------------------------------------- MAIN STRUCTURE -----------------------------------------*/
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  /*font-family: system-ui, sans-serif;*/
  background: var(--color-bg);
}
/* optional: keep the UI panel from forcing page scroll */
.ui-body {
  min-height: 0;
}
.game-header {
  display: flex;
  justify-content: center;
  height: 100px;
  img {
    padding: 5px;
  }
}
.game-container {
  max-width: 1400px;
  width: 100%;
  overflow: hidden;
  margin: 0 auto;
  padding: 0 20px 20px;
}
.game-content {
  display: flex;
  /*grid-template-columns: 2fr 1fr;*/
  gap: 20px;
  width: 100%;
  max-height: 80vh;
}
.left-panel {
  height: clamp(300px, 80vh, 900px);
  border: 2px solid;
  border-radius: 20px;
  background: var(--color-map-bg);
  position: relative;
  flex: 1;
}
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 400px;
  overflow-y: auto;
}
/* ---------------------------------------------------- LOADING -----------------------------------------*/

/* --- Loading overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  height: 70px;
}

.loading-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy);
  opacity: 0.6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.loading-track {
  width: 220px;
  height: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(500%);
  }
}

.loading-fill {
  width: 30%;
  height: 100%;
  border-radius: 6px;
  background: var(--color-primary);
  animation: loading-slide 1.1s ease-in-out infinite;
}

/* ---------------------------------------------------- LEFT SIDE -----------------------------------------*/

.draw-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-primary);
  color: #fff;
  font-size: 25px;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: 40px;
  pointer-events: none;
  text-align: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
  z-index: 10;
}

.draw-hint.hidden {
  opacity: 0;
}

@keyframes gate-beat {
  0%,
  100% {
    box-shadow: inset 0 0 0 6px rgba(255, 203, 107, 0.35);
  }
  50% {
    box-shadow: inset 0 0 0 28px rgba(255, 203, 107, 0.15);
  }
}

.left-panel.is-gating {
  animation: gate-beat 0.75s ease-in-out infinite;
}
.border-image {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------- RIGHT SIDE -----------------------------------------*/

button {
  padding: 10px 12px;
}
input {
  padding: 10px 12px;
  font-size: 16px;
}

/* --- Banner --- */
.daily-banner {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--color-primary);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 3px 3px 0px rgb(0 0 0 / 20%);
  min-height: 92px;
}

.daily-banner.archive-mode {
  background: #5b6bb5;
}

/* create the “cut” on the right like the screenshot */
.daily-banner::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 84px;
  height: 100%;
  background: white;
  clip-path: polygon(18% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.daily-banner__text {
  position: relative;
  z-index: 1;
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
}

.daily-banner__title {
  font-weight: 800;
  font-size: clamp(14px, 4vw, 28px);
  line-height: 1.05;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.daily-banner__date {
  margin-top: 4px;
  font-weight: 700;
  font-size: 16px;
  opacity: 0.95;
}

.continent-label {
  margin-top: 10px;
  padding: 6px 22px;
  font-weight: 900;
  letter-spacing: 1px;
  border-radius: 12px;
  color: white;
  background: var(--continent-color);
  border: 2px solid white;
  text-transform: uppercase;
}

/* right icon button in banner */
.icon-btn {
  position: relative;
  z-index: 2;
  width: 84px;
  border: none;
  background: transparent;
  color: var(--color-navy-dark);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:active {
  transform: translateY(1px);
}

.trophy-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
  font-size: 22px;
}

.trophy-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.progress-trophy {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0px 0px 2px black);
  position: relative;
}

@keyframes trophy-pulse {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.4);
  }
  65% {
    transform: scale(0.88);
  }
  100% {
    transform: scale(1);
  }
}

.progress-trophy.pulse {
  animation: trophy-pulse 0.45s ease-out forwards;
}

.gate-disk {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--color-primary) 0%, transparent 0%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.gate-disk.active {
  opacity: 1;
}
/* --- Round indicator --- */
.round-indicator {
  position: absolute;
  top: -22px;
  padding: 2px 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy);
  opacity: 0.6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* --- Progress --- */
.progress-row {
  display: flex;
  gap: 10px;
  align-items: end;
}

.progress-wrap {
  flex: 1;
  position: relative;
}

.progress-percent {
  position: absolute;
  width: 63px;
  right: 10px;
  top: -25px;

  background: white;
  border-radius: 12px 12px 0 0;
  padding: 2px 10px;

  font-weight: 800;
  font-size: 18px;
  color: var(--color-navy-dark);
  text-align: center;
  /*box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);*/
}

.progress-bar {
  position: relative;
  height: 26px;
  border-radius: 8px;
  background: var(--color-track); /* grey-blue track */
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--color-primary); /* same coral red */
  border-radius: 8px;
  transition: width 120ms linear;
}
.progress-outline {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px white;
}

/* ticks: make them look like the screenshot */
.progress-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  pointer-events: none;
}

.progress-ticks span {
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 2px;
  mix-blend-mode: soft-light;
}

.challenge-info {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  gap: 14px;
  background-color: var(--color-panel);
  padding: 16px;
}
.dark {
  background-color: #728ea6;
}
.draw-btn {
  width: 140px;
  height: 140px;
  border-radius: 999px;
  border: none;
  cursor: pointer;

  /* look */
  background: var(--color-primary);
  color: white;
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 22px;

  /* depth */
  box-shadow:
    /* harsh outside shadow */
    0 14px 0 rgba(0, 0, 0, 0.18),
    /* innner shadow */ inset 0 -18px 8px rgba(0, 0, 0, 0.18),
    /* soft outside shadow */ 0 22px 30px rgba(0, 0, 0, 0.18);

  /* layout */
  display: grid;
  place-items: center;

  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* important: prevents scrolling while holding on mobile */
  transition:
    transform 80ms ease,
    filter 80ms ease,
    background 80ms ease;

  .draw-btn__label {
    margin-bottom: 10px;
  }
}

/* quick visual press when clicked */
.draw-btn:active {
  transform: translateY(10px);
  filter: brightness(0.95);
}

/* “held” state (we’ll toggle this class in JS) */
.draw-btn.is-holding {
  background: var(--color-primary-dark); /* darker / more intense */
  transform: translateY(10px);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.18),
    inset 0 -10px 8px rgba(0, 0, 0, 0.18),
    0 14px 22px rgba(0, 0, 0, 0.18);
}

.draw-btn.is-gating {
  background: #f5a623; /* gate/hold warning — intentionally different from primary */
  transform: translateY(10px);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.18),
    0 14px 22px rgba(0, 0, 0, 0.18);
  animation: gating-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes gating-pulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.2);
  }
}

.draw-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Optional: subtle ring/glow while holding */
.draw-btn.is-holding::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  border: 3px solid rgba(255, 107, 115, 0.45);
  box-shadow: 0 0 0 10px rgba(255, 107, 115, 0.18);
  pointer-events: none;
}

.draw-button-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.guess-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.info-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: white;
  padding: 0;
  transition: background 120ms ease;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.info-dialog {
  border: none;
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 90%;
  background-color: #728ea6;
  border: 3px solid white;
  color: white;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  position: relative;
}

.info-dialog::backdrop {
  background: rgba(0, 0, 0, 0.29);
  backdrop-filter: blur(2px);
}

.info-dialog__close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.info-dialog__close:hover {
  color: white;
}

.info-dialog__title {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 800;
}

.info-dialog__list {
  margin: 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.8;
}

.info-dialog__list b {
  color: white;
  font-weight: 800;
}

.guess-header__content {
  flex: 1;
  min-width: 0;
}

.guess-header__hint-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.guess-header__hint-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.guess-header__title {
  font-size: 22px;
  font-weight: 800;
  color: white;
}

.guess-header__hints {
  margin: 6px 0 0 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}

.guess-header__hints b {
  color: white;
  font-weight: 800;
}

.guess-wrap {
  position: relative;
  display: flex;
  height: 46px;
}

.guess-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
  border-radius: 0.4rem;
  border: 3px solid var(--color-gray-text-dark);
  transition:
    opacity 150ms ease,
    border-color 150ms ease;
}

.guess-input:disabled {
  cursor: not-allowed;
  background-color: #dddddd;
}
.guess-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: white;
  border-radius: 14px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1000;
}

.guess-dropdown.hidden {
  display: none;
}

.guess-option {
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
  display: flex;
  align-items: center;
}

.guess-option:hover {
  background: #e8ecf5;
}

.guess-option.active {
  background: #dae1f5;
  border-left: 3px solid var(--color-navy);
  padding-left: 9px;
}

.guess-option small {
  opacity: 0.65;
  margin-left: 8px;
}

.guess-button {
  border: 2px solid black;
  border-radius: 0.4rem;
  margin-left: 10px;
  background: var(--color-primary);
  font-size: larger;
  font-weight: 900;
  color: white;
  cursor: pointer;
}
.chosen {
  border-radius: 10px;
  border: 1px solid grey;
  padding: 10px;
  display: flex;
  gap: 10px;
}
.flag {
  height: 24px;
  img {
    object-fit: cover;
    height: 24px;
    width: 36px;
  }
}
.text-center {
  text-align: center;
}
.nation-neutral {
  background-color: #dfdfdf;
}
.nation-correct {
  background: var(--color-primary-green-light);
}
.nation-incorrect {
  background-color: var(--color-primary-light);
}
.hidden {
  display: none;
}

@media (max-width: 700px) {
  html,
  body {
    overflow-y: auto;
  }

  .game-header {
    height: 60px;
  }

  .game-container {
    padding: 0 12px max(env(safe-area-inset-bottom) + 20px, 80px);
    overflow: visible;
  }

  .game-content {
    flex-direction: column;
    max-height: none;
    gap: 12px;
  }

  .left-panel {
    height: 44vw;
    min-height: 200px;
    flex: none;
    width: 100%;
  }

  .right-panel {
    width: 100%;
    gap: 12px;
    overflow-y: visible;
  }

  .guess-dropdown {
    top: auto;
    bottom: calc(100% + 8px);
  }
}

@media (max-width: 700px), (max-height: 800px) {
  .draw-button-container.result-shown {
    display: none;
  }
}
