/* Operation Save State — shared homepage tokens and terminal chrome. */
.ctf-main {
  padding-block: clamp(48px, 8vw, 96px);
  background: var(--aurora);
}
.ctf-main h1 {
  margin: 20px 0;
  font-size: var(--fs-h1);
  line-height: 1.05;
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}
.ctf-main p {
  margin-block: 16px;
}
.ctf-main .lead {
  margin-bottom: 28px;
}
.ctf-hero {
  display: grid;
  gap: 40px;
  align-items: center;
}
.ctf-intro, .ctf-status, .ctf-main .term-inner {
  min-width: 0;
}
.ctf-main .term-window {
  animation: none;
}
.ctf-terminal-content {
  padding: clamp(20px, 3vw, 32px);
}
.ctf-counter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ctf-counter #ctf-total {
  font: 500 72px/1.1 var(--font-mono);
  letter-spacing: -.07em;
  color: var(--accent);
}
.ctf-counter > span + span {
  color: var(--text-2);
  font: 13px var(--font-mono);
}
.ctf-status-line {
  color: var(--text-2);
  font: 13px var(--font-mono);
}
.ctf-status-line strong {
  color: var(--accent);
  font-weight: 500;
}
.ctf-form {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-block: 24px;
}
.ctf-field {
  flex: 1 1 0;
  min-width: 0;
}
.ctf-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.ctf-form .btn {
  flex: 0 0 auto;
  padding-inline: 14px;
}
.ctf-main input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--term-bg);
  color: var(--text-1);
  padding: 13px 12px;
  font: 16px var(--font-mono);
}
.ctf-main :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.ctf-meter {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 24px;
}
.ctf-meter span {
  height: 6px;
  border-radius: 4px;
  background: var(--bg-3);
}
.ctf-meter .captured {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-soft);
}
.ctf-timeline {
  position: relative;
  display: grid;
  gap: 20px;
  margin-block: 64px;
  padding-left: 64px;
}
.ctf-timeline::before {
  content: '';
  position: absolute;
  top: 40px;
  bottom: 40px;
  left: 23px;
  width: 1px;
  background: var(--line-accent);
}
.ctf-card, .ctf-panel {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  padding: clamp(20px, 3vw, 32px);
  min-width: 0;
  overflow-wrap: anywhere;
}
.ctf-card {
  position: relative;
}
.ctf-card.active {
  border-color: var(--line-accent);
  box-shadow: 0 0 36px -16px var(--accent-glow), var(--shadow-1);
}
.ctf-card.locked {
  padding-block: 20px;
  background: var(--term-bg);
}
.ctf-card.locked > p {
  color: var(--text-3);
  font-size: var(--fs-sm);
  margin-bottom: 0;
}
.ctf-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.ctf-number {
  position: absolute;
  top: 24px;
  left: -65px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--text-3);
  font: 20px var(--font-mono);
}
.captured .ctf-number {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.active .ctf-number {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 24px -8px var(--accent-glow);
}
.ctf-card h2 {
  font-size: var(--fs-h3);
  margin-right: auto;
}
.ctf-state {
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  padding: 5px 9px;
  font: 11px var(--font-mono);
  color: var(--text-3);
}
.ctf-state.captured {
  background: var(--accent-soft);
  border-color: var(--line-accent);
  color: var(--accent);
}
.ctf-state.active {
  border-color: var(--accent);
  color: var(--accent);
}
.ctf-difficulty {
  color: var(--gold);
  letter-spacing: 3px;
  font-size: 12px;
}
.ctf-main code, .ctf-main pre {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}
.ctf-flag {
  display: block;
  padding: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}
.ctf-captured-flag {
  margin-top: 24px;
}
.ctf-hint-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-3);
  font: 11px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ctf-main a:not(.btn) {
  color: var(--accent);
}
.ctf-main details {
  margin-top: 20px;
}
.ctf-main summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #ffffff08;
  cursor: pointer;
  color: var(--text-2);
  font-size: var(--fs-sm);
  list-style: none;
}
.ctf-main summary::-webkit-details-marker {
  display: none;
}
.ctf-main summary:hover {
  border-color: var(--line-accent);
  color: var(--text-1);
}
.ctf-hints {
  padding-left: 24px;
  color: var(--text-2);
}
.ctf-hints li {
  padding-left: 8px;
  margin-block: 20px;
}
.ctf-hints li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
}
.ctf-hints p {
  margin: 0;
}
.ctf-redaction {
  height: 10px;
  width: 55%;
  background: var(--bg-3);
  border-radius: 4px;
  margin-top: 20px;
}
.ctf-feedback {
  min-height: 28px;
  color: var(--gold);
  overflow-wrap: anywhere;
  font-size: var(--fs-sm);
}
.ctf-rules {
  margin-block: 64px 24px;
}
.ctf-rule-grid {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}
.ctf-rule {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  min-width: 0;
  overflow-wrap: anywhere;
}
.ctf-rule-glyph {
  display: block;
  margin-bottom: 20px;
  color: var(--accent);
  font: 20px var(--font-mono);
}
.ctf-rule h3 {
  font-size: 15px;
}
.ctf-rule p {
  color: var(--text-2);
  font-size: var(--fs-sm);
  margin-bottom: 0;
}
.ctf-finale {
  border-color: var(--gold-line);
  background: linear-gradient(135deg, var(--gold-soft), var(--bg-1) 70%);
  box-shadow: 0 0 64px -28px var(--gold);
  padding: clamp(24px, 5vw, 56px);
}
.ctf-finale h2 {
  color: var(--gold);
  font: clamp(40px, 5vw, 72px)/1 var(--font-pixel);
  letter-spacing: 0;
}
.ctf-finale-total {
  color: var(--gold);
  font-family: var(--font-mono);
}
.ctf-finale-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.ctf-stage-page .wrap {
  max-width: 960px;
}
.ctf-back {
  display: inline-flex;
  margin-bottom: 32px;
  font-size: var(--fs-sm);
}
.ctf-dek {
  color: var(--text-2);
  margin-bottom: 32px !important;
}
.ctf-submit-link {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.ctf-submit-link .btn {
  white-space: normal;
  height: auto;
  min-height: 40px;
  line-height: 1.4;
  padding-block: 10px;
}
.ctf-wave {
  height: 80px;
  margin-block: 24px;
  background: repeating-linear-gradient(90deg, transparent 0 8px, var(--accent-soft) 8px 12px);
  clip-path: polygon(0 40%,10% 30%,20% 45%,30% 0,40% 40%,50% 20%,60% 45%,70% 10%,80% 35%,90% 25%,100% 40%,100% 60%,90% 75%,80% 65%,70% 90%,60% 55%,50% 80%,40% 60%,30% 100%,20% 55%,10% 70%,0 60%);
}
.ctf-still {
  display: block;
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
}
.ctf-relay {
  border-style: dashed;
  background: var(--term-bg);
  min-height: 180px;
}
.ctf-relay-status {
  font: 13px var(--font-mono);
  color: var(--text-3);
}
.ctf-relay > p + p {
  color: var(--text-2);
}
.ctf-gate {
  margin-bottom: 24px;
  padding: 20px;
}
.ctf-gate[hidden] {
  display: none;
}
.ctf-gate > p:first-child {
  margin-top: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.ctf-gate .ctf-form {
  margin-bottom: 0;
}
.ctf-gate #glitch-feedback:empty {
  display: none;
}
.ctf-online {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font: 11px var(--font-mono);
}
.ctf-online i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: ctf-pulse 2s ease-in-out infinite;
}
.ctf-chat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-accent) transparent;
  padding: clamp(16px, 3vw, 28px);
  gap: 12px;
}
.ctf-chat > * {
  flex-shrink: 0;
}
.ctf-chat p {
  flex-shrink: 0;
  max-width: 88%;
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px 12px 12px 3px;
  background: var(--bg-2);
  overflow-wrap: anywhere;
}
.ctf-chat .human {
  align-self: flex-end;
  color: var(--text-1);
  background: var(--accent-soft);
  border: 1px solid var(--line-accent);
  border-radius: 12px 12px 3px 12px;
}
.ctf-chat .glitch {
  color: var(--term-fg);
}
.ctf-chat .ctf-flag {
  max-width: 100%;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
}
.ctf-chat-form {
  padding: 16px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
}
.ctf-chat-form label {
  font-size: 12px;
}
.ctf-celebrate {
  animation: ctf-capture 700ms ease-out;
}
@keyframes ctf-capture {
  from {
    box-shadow: 0 0 0 2px var(--accent), 0 0 40px var(--accent-glow);
  }
  to {
    box-shadow: none;
  }
}
@keyframes ctf-pulse {
  50% {
    opacity: .35;
    box-shadow: 0 0 8px var(--accent-glow);
  }
}
@media (min-width: 640px) {
  .ctf-rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 960px) {
  .ctf-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 56px;
  }
  .ctf-hero h1 {
    font-size: clamp(56px, 5.5vw, 76px);
  }
  .ctf-rule-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 639px) {
  .ctf-main .wrap {
    width: calc(100% - 32px);
    padding-inline: 0;
  }
  .ctf-timeline {
    padding-left: 44px;
    gap: 16px;
  }
  .ctf-timeline::before {
    left: 15px;
  }
  .ctf-number {
    width: 32px;
    height: 36px;
    left: -45px;
    top: 20px;
    border-radius: 8px;
    font-size: 15px;
  }
  .ctf-card {
    padding: 20px 16px;
  }
  .ctf-card-head {
    gap: 8px;
  }
  .ctf-card h2 {
    width: 100%;
  }
  .ctf-card-head .tag {
    font-size: 10px;
    padding-inline: 6px;
  }
  .ctf-difficulty {
    letter-spacing: 1px;
    font-size: 10px;
  }
  .ctf-state {
    margin-left: auto;
    padding-inline: 6px;
    font-size: 10px;
  }
  .ctf-chat {
    height: min(60dvh, 520px);
  }
  .ctf-chat p {
    max-width: 94%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ctf-celebrate, .ctf-online i {
    animation: none;
  }
}
