/* Reset & Box Model Fix */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Load local font */
@font-face {
  font-family: 'Colossalis';
  src: url('../fonts/colossalis.otf') format('opentype');
}

/* Base */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: 'Colossalis', sans-serif;

  background: linear-gradient(
    to right,
    #002868 0%,
    #002868 42%,
    #b22234 42%,
    #b22234 58%,
    #002868 58%,
    #002868 100%
  );

  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Layout wrapper */
.content {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Main card */
.challenge-container {
  background-color: rgba(255, 255, 255, 0.85);
  border-radius: 15px;

  width: 100%;
  max-width: 500px;
  max-height: 95vh;

  padding: clamp(25px, 5vw, 45px);

  display: flex;
  flex-direction: column;
  gap: 15px;

  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Header */
.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  width: 100%;
  padding: 0 10px; /* balances left/right visually */
}

/* NEW: text wrapper */
.title-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

/* Image */
.ega-img {
  width: clamp(70px, 12vw, 100px);
  height: auto;
  display: block;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

/* Title */
.title {
  font-size: clamp(2rem, 5vw, 4rem);
  margin: 0;
  line-height: 1.1;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  color: black;
}

/* Subtitle */
.subtitle {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  margin: 0;
  color: #333;
}

/* Image */
.challenge-img {
  width: 100%;
  max-height: 30vh;
  object-fit: contain;
  border-radius: 10px;
}

/* Question */
.challenge-question {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: #333;
  margin: 0;
  text-align: center;
}

.challenge-type {
  display: none;
  margin: 0.5rem 0 1.2rem;
  color: #444;
  text-align: center;
  font-size: 0.95rem;
}

/* Guess block */
.guess-block {
  background-color: rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 15px;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Input row */
.guess-row {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.guess-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.guess-input-wrapper .autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: auto;
}

/* Input */
.guess-input {
  width: 100%;
  font-size: 1rem;
  padding: 10px;

  border-radius: 5px;
  border: 1px solid #ddd;
  outline: none;
}

/* Button */
.guess-btn {
  font-size: 1rem;
  padding: 10px 20px;

  background-color: #002868;
  color: white;

  border: none;
  border-radius: 5px;
  cursor: pointer;

  white-space: nowrap;
  transition: background 0.3s ease;
}

.guess-btn:hover {
  background-color: #b22234;
}

/* Counter */
.guess-counter {
  font-size: 0.85rem;
  color: #444;
}

/* History */
.guess-history {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
  color: #333;
}

.guess-entry {
  padding: 4px 6px;
  background: rgba(255,255,255,0.5);
  border-radius: 4px;
}

/* Status */
.guess-status {
  font-size: 0.9rem;
  color: #555;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.form-group label {
  font-weight: 700;
  color: #111;
}

.form-group textarea,
.form-group input {
  width: 100%;
  font-size: 1rem;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
}

.autocomplete-list {
  width: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item:focus {
  background: #eef3ff;
}

.autocomplete-item.empty {
  color: #666;
  cursor: default;
}

.hidden {
  display: none;
}

.guess-status.error {
  color: #b22234;
}

.guess-status.success {
  color: #002868;
}

/* Locked button */
.guess-btn.locked {
  background-color: gray;
  cursor: not-allowed;
}

/* Footer */
.disclaimer {
  font-size: 0.75rem;
  text-align: center;
  color: #111;
  margin-top: auto;
}

/* crayons */
.crayons {
  position: fixed;
  top: -10px;
  opacity: 0.95;
  z-index: 9999;
  pointer-events: none;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 2px 4px rgba(0, 0, 0, 0.12);
  animation: fall linear forwards;
  will-change: transform, opacity;
  overflow: hidden;
  clip-path: polygon(
    0% 100%,
    100% 100%,
    100% 24%,
    90% 24%,
    70% 12%,
    52% 0%,
    48% 0%,
    30% 12%,
    10% 24%,
    0% 24%
  );
}

.crayons::before,
.crayons::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 14%;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 999px;
  transform: skewX(-8deg);
  opacity: 0.9;
}

.crayons::before {
  top: 34%;
}

.crayons::after {
  top: 75%;
}

@keyframes fall {
  to {
    transform: translate(calc(var(--drift, 0px)), 110vh) rotate(720deg);
    opacity: 0;
  }
}
