/* css/ctf.css — CTF challenge browse + play page styling.
   Extends the existing terminal palette (near-black bg, cyan-teal
   accent) rather than introducing a new one. */

.ctf-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: .72rem;
  padding: .3rem .65rem;
  border-radius: 4px;
  border: 1px solid #1e2330;
  background: #0d1119;
  color: #9aa5b8;
}

.ctf-chip-points {
  color: #00d4aa;
  border-color: rgba(0,212,170,.3);
  background: rgba(0,212,170,.08);
}

.ctf-diff-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.ctf-diff-beginner     .ctf-diff-dot { background: #a6e3a1; box-shadow: 0 0 6px #a6e3a1; }
.ctf-diff-intermediate .ctf-diff-dot { background: #f9e2af; box-shadow: 0 0 6px #f9e2af; }
.ctf-diff-advanced     .ctf-diff-dot { background: #f38ba8; box-shadow: 0 0 6px #f38ba8; }
.ctf-diff-beginner     { color: #a6e3a1; }
.ctf-diff-intermediate { color: #f9e2af; }
.ctf-diff-advanced     { color: #f38ba8; }

/* Unified left panel: one continuous console, sections divided by
   hairlines rather than chopped into identical repeated cards. */
.ctf-console {
  background: #0d1119;
  border: 1px solid #1e2330;
  border-left: 2px solid #00d4aa;
  border-radius: 6px;
  overflow: hidden;
}
.ctf-console-section {
  padding: 1.5rem;
  border-bottom: 1px solid #1e2330;
}
.ctf-console-section:last-child { border-bottom: none; }
.ctf-console-label {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: .72rem;
  color: #00d4aa;
  margin-bottom: .7rem;
  display: block;
}
.ctf-desc-text {
  color: #9aa5b8;
  line-height: 1.65;
  font-size: .92rem;
}

.ctf-hint {
  margin-top: .7rem;
  font-size: .85rem;
}
.ctf-hint summary {
  cursor: pointer;
  color: #00d4aa;
  font-family: var(--font-mono, monospace);
  font-size: .78rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.ctf-hint summary::-webkit-details-marker { display: none; }
.ctf-hint summary::before {
  content: '▸';
  display: inline-block;
  transition: transform .15s;
}
.ctf-hint[open] summary::before { transform: rotate(90deg); }
.ctf-hint p {
  margin-top: .5rem;
  color: #9aa5b8;
  padding-left: 1.15rem;
}

.ctf-flag-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ctf-flag-input-wrap::before {
  content: '>';
  position: absolute;
  left: .9rem;
  color: #00d4aa;
  font-family: var(--font-mono, monospace);
  pointer-events: none;
}
.ctf-flag-input-wrap input {
  padding-left: 1.8rem !important;
  font-family: var(--font-mono, monospace) !important;
  background: #0a0d12 !important;
  border-color: #1e2330 !important;
}
.ctf-flag-input-wrap input:focus {
  border-color: #00d4aa !important;
  box-shadow: 0 0 0 3px rgba(0,212,170,.12) !important;
}

.ctf-start-btn:hover {
  box-shadow: 0 0 24px rgba(0,212,170,.35);
}

/* Right side: standby state before the machine is deployed */
.ctf-standby {
  border: 1px dashed #1e2330;
  border-radius: 6px;
  background: #0d1119;
  padding: 4.5rem 2rem;
  text-align: center;
}
.ctf-standby-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 1.1rem;
  border: 1px solid rgba(0,212,170,.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00d4aa;
  font-family: var(--font-mono, monospace);
  animation: ctf-standby-pulse 2.4s ease-in-out infinite;
}
@keyframes ctf-standby-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,212,170,.25); }
  50%      { box-shadow: 0 0 0 10px rgba(0,212,170,0); }
}
.ctf-standby-text {
  color: #6b7a8d;
  font-size: .88rem;
  max-width: 260px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .ctf-split { flex-direction: column; }
}

/* ── Browse page ── */
.ctf-filterbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.ctf-search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.ctf-search-input-wrap input {
  padding-left: 2.4rem !important;
  background: #0d1119 !important;
  border-color: #1e2330 !important;
}
.ctf-search-input-wrap input:focus {
  border-color: #00d4aa !important;
  box-shadow: 0 0 0 3px rgba(0,212,170,.12) !important;
}
.ctf-search-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: #4a5568;
  pointer-events: none;
}

.ctf-filter-dropdown { position: relative; }
.ctf-filter-dropdown summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--font-mono, monospace);
  font-size: .78rem;
  color: #9aa5b8;
  background: #0d1119;
  border: 1px solid #1e2330;
  border-radius: 6px;
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  user-select: none;
}
.ctf-filter-dropdown summary::-webkit-details-marker { display: none; }
.ctf-filter-dropdown summary::after { content: '▾'; font-size: .65rem; }
.ctf-filter-dropdown[open] summary { border-color: #00d4aa; color: #00d4aa; }
.ctf-filter-dropdown .ctf-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #0d1119;
  border: 1px solid #1e2330;
  border-radius: 8px;
  padding: .85rem;
  min-width: 180px;
  z-index: 20;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.ctf-filter-panel label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: #cdd6f4;
  padding: .35rem 0;
  cursor: pointer;
}

.ctf-results-count {
  font-family: var(--font-mono, monospace);
  font-size: .78rem;
  color: #6b7a8d;
  margin-left: auto;
}

.ctf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.ctf-card {
  display: block;
  text-decoration: none;
  background: #0d1119;
  border: 1px solid #1e2330;
  border-radius: 10px;
  overflow: hidden;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.ctf-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0,212,170,.4);
  box-shadow: 0 16px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(0,212,170,.15);
}

.ctf-card-banner {
  position: relative;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(0,212,170,.16), transparent 60%),
    linear-gradient(135deg, #0a0d12, #10151f 60%, #0a0d12);
}
.ctf-card-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,170,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,170,.06) 1px, transparent 1px);
  background-size: 18px 18px;
}
.ctf-card-icon {
  font-size: 2.1rem;
  opacity: .85;
  filter: drop-shadow(0 0 10px rgba(0,212,170,.35));
  position: relative;
  z-index: 1;
}
.ctf-card-diffbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
}
.ctf-card-body { padding: 1.1rem 1.2rem 1.25rem; }
.ctf-card-title {
  color: #eef1f8;
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 .4rem;
}
.ctf-card-desc {
  color: #6b7a8d;
  font-size: .82rem;
  line-height: 1.55;
  margin: 0 0 .9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ctf-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
}

/* ── Stage progress list (challenge page) ── */
.ctf-stage-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 0;
  border-bottom: 1px solid #1e2330;
}
.ctf-stage-item:last-child { border-bottom: none; }
.ctf-stage-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #2a2f3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: #4a5568;
  flex-shrink: 0;
}
.ctf-stage-item.done .ctf-stage-check {
  border-color: #a6e3a1;
  color: #a6e3a1;
  background: rgba(166,227,161,.1);
}
.ctf-stage-item > div:nth-child(2) { flex: 1; min-width: 0; }
.ctf-stage-title { font-size: .88rem; color: #cdd6f4; }
.ctf-stage-item.done .ctf-stage-title { color: #6b7a8d; text-decoration: line-through; }
.ctf-stage-desc { font-size: .76rem; color: #6b7a8d; margin-top: .15rem; }
.ctf-stage-points {
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
  color: #00d4aa;
  flex-shrink: 0;
}

/* ── Per-stage flag submission ── */
.ctf-stage-header {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.ctf-stage-header .ctf-stage-title { flex: 1; }
.ctf-stage-submit {
  display: flex;
  gap: .5rem;
  margin-top: .6rem;
}
.ctf-stage-msg {
  margin-top: .4rem;
  font-size: .78rem;
  min-height: 1em;
}
