/* === AGENT CTF — Core Styles === */

:root {
  /* Palette: deep navy base, warm gold accent, clean whites */
  --navy: #0f1729;
  --navy-mid: #1a2744;
  --navy-light: #243356;
  --gold: #f0a500;
  --gold-dim: #c4880a;
  --green: #22c55e;
  --green-bg: #dcfce7;
  --amber: #f59e0b;
  --amber-bg: #fef3c7;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --white: #ffffff;
  --off-white: #f8f9fc;
  --grey-100: #f1f3f8;
  --grey-200: #e2e5ee;
  --grey-400: #9ca3af;
  --grey-600: #6b7280;
  --grey-800: #374151;
  --text: #1e293b;
  --text-light: #64748b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(15, 23, 41, 0.08);
  --shadow-lg: 0 8px 32px rgba(15, 23, 41, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--off-white);
  color: var(--text);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
}

/* === HEADER / SCOREBAR === */

.header {
  background: var(--navy);
  color: var(--white);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(15, 23, 41, 0.3);
}

.header__logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
}

.header__logo:hover {
  opacity: 0.85;
}

.header__score {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 16px;
}

.header__team-name {
  color: var(--grey-400);
  font-size: 14px;
}

.header__points {
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 16px;
  min-width: 60px;
  text-align: center;
}

.header__solved {
  color: var(--grey-400);
  font-size: 14px;
}

/* === PAGE LAYOUT === */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page--wide {
  max-width: 1100px;
}

/* === HERO / LANDING === */

.hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.hero__badge {
  display: inline-block;
  background: var(--navy);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  padding: 6px 18px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero__title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--navy);
  margin-bottom: 16px;
}

.hero__subtitle {
  font-size: 20px;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* === TEAM NAME INPUT === */

.team-entry {
  max-width: 440px;
  margin: 32px auto;
  text-align: center;
}

.team-entry__label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--grey-600);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.team-entry__input {
  width: 100%;
  padding: 14px 20px;
  font-size: 20px;
  font-weight: 700;
  border: 3px solid var(--grey-200);
  border-radius: var(--radius);
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  background: var(--white);
  color: var(--navy);
}

.team-entry__input:focus {
  border-color: var(--gold);
}

.team-entry__btn {
  margin-top: 12px;
  padding: 12px 32px;
  font-size: 18px;
  font-weight: 700;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.team-entry__btn:hover {
  background: var(--gold-dim);
}

.team-entry__btn:active {
  transform: scale(0.97);
}

/* === CATEGORY GRID (landing page) === */

.categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 36px;
}

.category-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold);
}

.category-card__icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.category-card__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.category-card__desc {
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.5;
}

.category-card__progress {
  margin-top: auto;
  padding-top: 12px;
  font-size: 14px;
  color: var(--grey-600);
  font-weight: 600;
}

.category-card__progress-bar {
  height: 6px;
  background: var(--grey-100);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.category-card__progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* === SECTION HEADER (category pages) === */

.section-header {
  margin-bottom: 32px;
}

.section-header__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--text-light);
  text-decoration: none;
  margin-bottom: 16px;
  font-weight: 600;
}

.section-header__back:hover {
  color: var(--navy);
}

.section-header__title {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.section-header__desc {
  font-size: 17px;
  color: var(--text-light);
}

.section-header__score {
  display: inline-block;
  margin-top: 12px;
  background: var(--navy);
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
  padding: 6px 16px;
  border-radius: 20px;
}

/* === CHALLENGE CARDS === */

.challenges {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.challenge {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.challenge--solved {
  border-color: var(--green);
}

.challenge__header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  user-select: none;
}

.challenge__number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grey-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--navy);
  flex-shrink: 0;
}

.challenge--solved .challenge__number {
  background: var(--green);
  color: white;
}

.challenge__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  flex-grow: 1;
}

.challenge__badge {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.challenge__badge--tutorial {
  background: #e0f2fe;
  color: #0369a1;
}

.challenge__badge--easy {
  background: var(--green-bg);
  color: #15803d;
}

.challenge__badge--medium {
  background: var(--amber-bg);
  color: #92400e;
}

.challenge__badge--hard {
  background: var(--red-bg);
  color: #991b1b;
}

.challenge__points {
  font-size: 14px;
  font-weight: 700;
  color: var(--grey-400);
  flex-shrink: 0;
}

.challenge__toggle {
  font-size: 20px;
  color: var(--grey-400);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.challenge--open .challenge__toggle {
  transform: rotate(180deg);
}

.challenge__body {
  display: none;
  padding: 0 24px 24px;
  border-top: 1px solid var(--grey-100);
}

.challenge--open .challenge__body {
  display: block;
}

.challenge__instructions {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  margin-top: 16px;
  margin-bottom: 20px;
}

.challenge__instructions img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  border: 1px solid var(--grey-200);
}

.challenge__instructions code {
  background: var(--grey-100);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

/* === HINT TOGGLE === */

.hint {
  margin-bottom: 16px;
}

.hint__toggle {
  background: none;
  border: 2px dashed var(--grey-200);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: border-color 0.2s, color 0.2s;
}

.hint__toggle:hover {
  border-color: var(--gold);
  color: var(--navy);
}

.hint__content {
  display: none;
  padding: 12px 16px;
  margin-top: 8px;
  background: #fefce8;
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--grey-800);
  border-left: 4px solid var(--gold);
}

.hint--open .hint__content {
  display: block;
}

/* === FLAG INPUT === */

.flag-input {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.flag-input__field {
  flex-grow: 1;
  padding: 12px 16px;
  font-size: 17px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  border: 3px solid var(--grey-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  background: var(--white);
}

.flag-input__field:focus {
  border-color: var(--navy);
}

.flag-input__field::placeholder {
  color: var(--grey-400);
  font-weight: 400;
}

.flag-input__btn {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 700;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.flag-input__btn:hover {
  background: var(--navy-light);
}

.flag-input__btn:active {
  transform: scale(0.97);
}

/* === FEEDBACK MESSAGES === */

.feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  display: none;
}

.feedback--correct {
  display: block;
  background: var(--green-bg);
  color: #15803d;
}

.feedback--wrong {
  display: block;
  background: var(--red-bg);
  color: #991b1b;
}

/* === SOLVED OVERLAY === */

.challenge--solved .flag-input {
  display: none;
}

.solved-message {
  display: none;
  padding: 12px 16px;
  background: var(--green-bg);
  border-radius: var(--radius-sm);
  color: #15803d;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
}

.challenge--solved .solved-message {
  display: block;
}

/* === HOW TO PLAY PANEL === */

.how-to-play {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 28px;
  border-left: 5px solid var(--gold);
}

.how-to-play__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.how-to-play__text {
  font-size: 16px;
  color: var(--text);
  line-height: 1.7;
}

.how-to-play__text strong {
  color: var(--navy);
}

/* === COMPLETION BANNER === */

.completion-banner {
  display: none;
  text-align: center;
  padding: 32px;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--white);
  border-radius: var(--radius);
}

.completion-banner--visible {
  display: block;
  animation: fadeInUp 0.4s ease;
}

.completion-banner__title {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
}

.completion-banner__text {
  font-size: 17px;
  color: var(--grey-200);
  margin-bottom: 20px;
}

.completion-banner__link {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 16px;
  transition: background 0.2s;
}

.completion-banner__link:hover {
  background: var(--gold-dim);
}

/* === ANIMATIONS === */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.challenge {
  animation: fadeInUp 0.3s ease both;
}

.challenge:nth-child(2) { animation-delay: 0.05s; }
.challenge:nth-child(3) { animation-delay: 0.1s; }
.challenge:nth-child(4) { animation-delay: 0.15s; }
.challenge:nth-child(5) { animation-delay: 0.2s; }
.challenge:nth-child(6) { animation-delay: 0.25s; }

/* === INFO CALLOUT === */

.callout {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1.6;
  margin: 16px 0;
}

.callout--info {
  background: #e0f2fe;
  border-left: 4px solid #0284c7;
  color: #0c4a6e;
}

.callout--warning {
  background: #fefce8;
  border-left: 4px solid var(--gold);
  color: #713f12;
}

/* === RESPONSIVE === */

@media (max-width: 640px) {
  .hero__title { font-size: 28px; }
  .hero__subtitle { font-size: 17px; }
  .categories { grid-template-columns: 1fr; }
  .challenge__header { padding: 16px; gap: 10px; }
  .challenge__body { padding: 0 16px 16px; }
  .flag-input { flex-direction: column; }
  .header { padding: 10px 16px; }
  .header__score { gap: 10px; }
}
