/* ─────────────────────────────────────────────────
   SOC Live — Gamification section
   ───────────────────────────────────────────────── */

#soc-live {
  position: relative;
  min-height: 100vh;
  padding: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* Video background */
#soc-bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.3;
}

.soc-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(5,6,10,0.88) 0%, rgba(5,6,10,0.7) 50%, rgba(5,6,10,0.92) 100%),
    radial-gradient(ellipse 60% 55% at 15% 50%, rgba(255,45,74,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 55% at 85% 50%, rgba(45,127,255,0.12) 0%, transparent 60%);
}

.soc-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 48px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Top bar ── */
.soc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(5,6,10,0.75);
  backdrop-filter: blur(12px);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 2px;
  gap: 12px;
}
.soc-topbar-l, .soc-topbar-r { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.soc-dot-live {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ff2d4a;
  box-shadow: 0 0 8px #ff2d4a, 0 0 16px rgba(255,45,74,0.3);
  animation: socpulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes socpulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #ff2d4a, 0 0 16px rgba(255,45,74,0.3); }
  50% { opacity: 0.25; box-shadow: none; }
}

.soc-tag-live { color: #ff2d4a; font-weight: 700; }
.soc-clock    { color: #6a7180; font-size: 10px; }

.soc-gauge-lbl { color: #6a7180; font-size: 9px; letter-spacing: 0.18em; }
.soc-gauge-track {
  width: 120px; height: 3px;
  background: rgba(255,255,255,0.07);
  position: relative;
  border-radius: 2px;
  overflow: hidden;
}
#soc-gauge-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff2d4a, #ff6b00);
  box-shadow: 0 0 8px #ff2d4a;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1),
              background 1s ease,
              box-shadow 1s ease;
  border-radius: 2px;
}
#soc-score-disp {
  color: #f4f5f8;
  min-width: 65px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

/* ── Challenge progress dots ── */
.soc-progress-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}
.soc-pdot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  transition: all 0.3s;
}
.soc-pdot.done-ok  { background: #00e676; border-color: #00e676; box-shadow: 0 0 6px rgba(0,230,118,0.5); }
.soc-pdot.done-err { background: #ff2d4a; border-color: #ff2d4a; box-shadow: 0 0 6px rgba(255,45,74,0.5); }
.soc-pdot.active   { border-color: #f0a500; background: rgba(240,165,0,0.3); animation: dotpulse 1s ease-in-out infinite; }
@keyframes dotpulse { 50% { box-shadow: 0 0 10px rgba(240,165,0,0.6); } }

/* ── Main layout ── */
.soc-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 2px;
  height: 520px; /* both columns equal height */
  min-height: 0;
}

/* ── Event log ── */
.soc-log {
  border: 1px solid rgba(255,255,255,0.08);
  border-right: none;
  background: rgba(5,6,10,0.65);
  backdrop-filter: blur(8px);
  padding: 20px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.7;
  overflow-y: auto;
  height: 100%; /* fill grid row */
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.soc-log::-webkit-scrollbar { width: 4px; }
.soc-log::-webkit-scrollbar-track { background: transparent; }
.soc-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.soc-log-intro {
  color: #6a7180;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
  line-height: 1.6;
}

.soc-log-line {
  display: grid;
  grid-template-columns: 92px 54px 1fr;
  gap: 10px;
  align-items: baseline;
  opacity: 0;
  transform: translateX(-6px);
  animation: logappear 0.35s ease forwards;
  padding: 3px 6px;
  border-radius: 2px;
  border-left: 2px solid transparent;
  transition: background 0.15s;
}
.soc-log-line:hover { background: rgba(255,255,255,0.02); }

/* Highlight the event that triggered the current challenge */
.soc-log-line.soc-log-highlight {
  background: rgba(255,45,74,0.07);
  border-left-color: rgba(255,45,74,0.55);
  animation: logappear 0.35s ease forwards, logHighlight 1.8s ease 0.35s;
}
@keyframes logHighlight {
  0%   { background: rgba(255,45,74,0.22); }
  100% { background: rgba(255,45,74,0.07); }
}
@keyframes logappear {
  to { opacity: 1; transform: translateX(0); }
}
.soc-log-time  { color: #4a5160; font-size: 11px; }
.soc-log-level { letter-spacing: 0.08em; font-weight: 700; font-size: 11px; }
.soc-log-level.warn  { color: #f0a500; }
.soc-log-level.alert { color: #ff6b00; }
.soc-log-level.crit  { color: #ff2d4a; text-shadow: 0 0 10px rgba(255,45,74,0.6); }
.soc-log-level.ok    { color: #00e676; }
.soc-log-level.info  { color: #2d7fff; }
.soc-log-msg { color: rgba(255,255,255,0.72); font-size: 11px; }
.soc-log-msg.neutralized {
  color: #00e676;
  text-decoration: line-through;
  opacity: 0.5;
}

/* ── Challenge panel ── */
.soc-panel {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(8,10,18,0.82);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.soc-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, #ff2d4a, #b85cff, #2d7fff);
}

/* Idle */
.soc-idle {
  text-align: center;
  padding: 36px 28px;
  color: rgba(255,255,255,0.28);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.85;
  letter-spacing: 0.08em;
}
.soc-idle-icon {
  font-size: 38px;
  color: rgba(255,45,74,0.25);
  margin-bottom: 16px;
  animation: idleping 2.5s ease-in-out infinite;
  display: block;
  transition: filter 0.3s;
}
@keyframes idleping {
  0%, 100% { color: rgba(255,45,74,0.25); transform: scale(1); }
  50% { color: rgba(255,45,74,0.7); transform: scale(1.1); }
}
.soc-idle-text { margin-bottom: 14px; }
.soc-idle-alert { color: #ff2d4a; font-weight: 700; }
.soc-idle-hint {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.2);
}

/* Challenge */
.soc-challenge {
  padding: 24px 22px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.soc-challenge.hidden { display: none; }

.soc-challenge-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.soc-blink { color: #ff2d4a; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
#soc-challenge-num { color: #6a7180; }

.soc-challenge-q {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255,255,255,0.92);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 500;
  border-left: 2px solid #ff2d4a;
  padding-left: 12px;
  margin: 0;
}

.soc-opts { display: flex; flex-direction: column; gap: 6px; }
.soc-opt {
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.7);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.soc-opt::before { display: none; } /* removed, using .soc-opt-letter instead */
.soc-opt:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.28);
  color: #f4f5f8;
  background: rgba(255,255,255,0.05);
  transform: translateX(3px);
}
.soc-opt:hover:not(:disabled) .soc-opt-letter {
  color: #ff2d4a;
  border-color: rgba(255,45,74,0.5);
  background: rgba(255,45,74,0.1);
}
.soc-opt.correct {
  border-color: #00e676;
  color: #00e676;
  background: rgba(0,230,118,0.07);
}
.soc-opt.correct .soc-opt-letter {
  color: #00e676;
  border-color: #00e676;
  background: rgba(0,230,118,0.12);
}
.soc-opt.wrong {
  border-color: rgba(255,45,74,0.5);
  color: rgba(255,45,74,0.7);
  background: rgba(255,45,74,0.04);
}
.soc-opt.wrong .soc-opt-letter {
  color: rgba(255,45,74,0.7);
  border-color: rgba(255,45,74,0.5);
}
.soc-opt:disabled { cursor: default; transform: none; }

/* Letter label inside each option */
.soc-opt-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.04);
  transition: all 0.15s;
  margin-top: 1px;
}
.soc-opt-text {
  flex: 1;
  text-align: left;
  line-height: 1.45;
}

.soc-feedback {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 8px 12px;
  border-left: 2px solid;
  line-height: 1.5;
}
.soc-feedback.hidden { display: none; }
.soc-feedback.ok  { color: #00e676; border-color: #00e676; background: rgba(0,230,118,0.05); }
.soc-feedback.err { color: #ff6b00; border-color: #ff6b00; background: rgba(255,107,0,0.05); }
.soc-feedback.timeout { color: #f0a500; border-color: #f0a500; background: rgba(240,165,0,0.05); }

/* Timer bar */
.soc-timer-bar {
  height: 2px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
  border-radius: 2px;
}
#soc-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00e676, #f0a500, #ff2d4a);
  background-size: 200% 100%;
  transition: width linear;
  border-radius: 2px;
}

/* ── Result ── */
.soc-result {
  padding: 36px 28px;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.soc-result.hidden { display: none; }

.soc-grade {
  font-size: 88px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  animation: gradepop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes gradepop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.soc-grade.grade-a { color: #00e676; text-shadow: 0 0 50px rgba(0,230,118,0.55); }
.soc-grade.grade-b { color: #2d7fff; text-shadow: 0 0 50px rgba(45,127,255,0.55); }
.soc-grade.grade-c { color: #f0a500; text-shadow: 0 0 50px rgba(240,165,0,0.55); }
.soc-grade.grade-d { color: #ff2d4a; text-shadow: 0 0 50px rgba(255,45,74,0.55); }

.soc-grade-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #6a7180;
}
.soc-final-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: #f4f5f8;
  margin: 4px 0 8px;
}
.soc-cta { width: 100%; justify-content: center; }
.soc-restart {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
  margin-top: 4px;
}
.soc-restart:hover { color: rgba(255,255,255,0.65); }

/* ── Score strip ── */
.soc-scorestrip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: none;
  background: rgba(5,6,10,0.75);
  backdrop-filter: blur(8px);
  margin-top: 2px;
  margin-bottom: 0;
}
.soc-scorestrip-item {
  padding: 14px 18px;
  border-left: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.soc-scorestrip-item:first-child { border-left: none; }
.soc-ss-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6a7180;
}
.soc-ss-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: #f4f5f8;
  transition: color 0.4s, text-shadow 0.4s;
}
.soc-ss-val.red   { color: #ff2d4a; text-shadow: 0 0 10px rgba(255,45,74,0.3); }
.soc-ss-val.green { color: #00e676; text-shadow: 0 0 10px rgba(0,230,118,0.3); }
.soc-ss-val.flash {
  animation: scoreflash 0.4s ease;
}
@keyframes scoreflash {
  0%, 100% { color: #f4f5f8; }
  50% { color: #00e676; text-shadow: 0 0 20px rgba(0,230,118,0.8); }
}

/* ── Mobile ── */
@media (max-width: 820px) {
  .soc-inner { padding: 20px 16px 0; }

  .soc-topbar {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
  }
  .soc-topbar-l, .soc-topbar-r {
    width: 100%;
    justify-content: space-between;
  }
  .soc-gauge-track { width: 80px; }

  /* Stack layout vertically on mobile */
  .soc-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 2px;
  }

  /* Log: fixed height, scrollable */
  .soc-log {
    height: 240px;
    border-right: 1px solid rgba(255,255,255,0.08);
    font-size: 11px;
  }
  .soc-log-line {
    grid-template-columns: 78px 48px 1fr;
    gap: 6px;
  }
  .soc-log-time, .soc-log-level, .soc-log-msg { font-size: 10px; }

  /* Challenge panel */
  .soc-panel {
    min-height: 320px;
    border-top: none;
  }
  .soc-challenge { padding: 18px 16px; gap: 12px; }
  .soc-challenge-q { font-size: 13px; }
  .soc-opt { font-size: 11px; padding: 11px 12px; }

  /* Score strip: 2×2 */
  .soc-scorestrip {
    grid-template-columns: repeat(2, 1fr);
  }
  .soc-scorestrip-item:nth-child(3) { border-left: none; }
  .soc-scorestrip-item:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,0.07); }

  /* Result screen */
  .soc-grade { font-size: 72px; }
  .soc-result { padding: 24px 20px; }
}

@media (max-width: 420px) {
  .soc-log { max-height: 200px; }
  .soc-log-time { display: none; }
  .soc-log-line { grid-template-columns: 50px 1fr; }
}
