/* problem.css — single problem page: description, playground, hints, ads */

.problem-header { margin-bottom: 20px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
  padding: 6px 4px;
}
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--accent-mint); }
.problem-header__tags { display: flex; gap: 8px; margin-bottom: 10px; }
.problem-meta-row { display: flex; gap: 16px; margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }

.problem-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .problem-layout { grid-template-columns: 1fr; }
}

.playground-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.playground-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.playground-panel__header .dots { display: flex; gap: 6px; }
.playground-panel__header .dots span {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.dots span:nth-child(1) { background: var(--accent-red); }
.dots span:nth-child(2) { background: var(--accent-amber); }
.dots span:nth-child(3) { background: var(--accent-green); }

#code-editor { min-height: 320px; }
#code-editor .CodeMirror {
  height: calc(100vh - 300px);
  min-height: 320px;
  max-height: 560px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* Full-screen "Running Python" output view — opens when Run is pressed */
.run-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.run-modal.open { transform: translateY(0); }

.run-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.run-modal__header .title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}
.run-modal__status {
  font-size: 1.15rem;
  line-height: 1;
}
.run-modal__status.success { color: var(--accent-green); }
.run-modal__status.error { color: var(--accent-red); }
.status-with-spinner { display: flex; align-items: center; gap: 8px; }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-mint);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.run-modal__status.loading {
  width: 16px; height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-mint);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.run-modal__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.run-modal__close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.run-modal__body { padding: 22px 20px; overflow-y: auto; flex: 1; }
.run-modal__body h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
#code-output {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-primary);
}
#code-output.has-error { color: var(--accent-red); }
#code-output:empty::before { content: "(no output)"; color: var(--text-muted); font-style: italic; }

.side-panel .section-card { margin-bottom: 16px; }

#answer-section textarea {
  width: 100%;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 14px;
  line-height: 1.6;
}
#answer-section textarea::placeholder { color: var(--text-muted); }
#answer-section textarea:focus {
  outline: 2px solid var(--accent-mint);
  outline-offset: 1px;
  border-color: transparent;
}
.hint-text { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; }

.hint-power {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.hint-power__icon { font-size: 1.15rem; }
.hint-power__icon--full { opacity: 1; }
.hint-power__icon--half { opacity: 0.65; }
.hint-power__icon--empty { opacity: 0.3; filter: grayscale(1); }
.hint-power__label { color: var(--text-primary); font-weight: 600; }

.result { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.result--success { background: rgba(63,185,80,0.12); color: var(--accent-green); border: 1px solid var(--accent-green); }
.result--fail { background: rgba(242,84,91,0.12); color: var(--accent-red); border: 1px solid var(--accent-red); }

.locked-message {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Rewarded ad modal */
.ad-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.ad-modal__box {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 30px 24px 24px;
  text-align: center;
  min-width: 260px;
  max-width: 360px;
  width: 100%;
}
.ad-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.ad-modal__close:hover { color: var(--accent-red); border-color: var(--accent-red); }
.ad-modal__title { font-size: 0.92rem; margin-bottom: 16px; color: var(--text-primary); }
.ad-modal__ad-slot { min-height: 250px; margin-bottom: 16px; display: flex; justify-content: center; align-items: center; }
.ad-modal__timer { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 6px; }
.ad-modal__bar { background: var(--bg-elevated); height: 6px; border-radius: 3px; overflow: hidden; }
.ad-modal__bar-fill { height: 100%; background: var(--accent-mint); width: 0%; transition: width 1s linear; }

.ad-slot { margin: 20px 0; text-align: center; min-height: 90px; }

/* Playground files — slide-in drawer (opens inside the Playground page only) */
.files-drawer-btn { display: inline-flex; align-items: center; gap: 6px; }

.files-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.files-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.files-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  max-width: 82vw;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  z-index: 1051;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 18px;
}
.files-drawer.open { transform: translateX(0); }

.files-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.files-drawer__header h3 { font-size: 1rem; margin: 0; }
.files-drawer__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.files-drawer__close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.file-count-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 12px; display: block; }

.file-list { list-style: none; padding: 0; margin: 0 0 14px; flex: 1; overflow-y: auto; }
.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  cursor: pointer;
}
.file-row:hover { background: var(--bg-elevated); }
.file-row--active { background: rgba(79, 209, 197, 0.12); color: var(--accent-mint); }
.file-row__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn--danger:hover { color: var(--accent-red); }

.editing-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
#current-file-label::before { content: "📄 "; }
/* Challenge page (guest-friendly, no login required) */
.challenge-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.challenge-steps {
  display: flex;
  gap: 8px;
  margin: 20px 0 18px;
}
.challenge-step {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.challenge-step.active { background: rgba(79, 209, 197, 0.12); color: var(--accent-mint); border-color: var(--accent-mint); }

.challenge-page h1 { font-size: 1.4rem; margin-bottom: 8px; }
.challenge-desc { margin-bottom: 16px; }

.challenge-run-btn { margin-top: 14px; }

.challenge-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.challenge-actions .btn { flex: 1; }

.challenge-signup-nudge {
  margin-top: 28px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.88rem;
}
.challenge-signup-nudge a { color: var(--accent-mint); font-weight: 600; }
/* Daily Challenge streak badge */
.daily-streak-badge {
  background: rgba(227, 179, 65, 0.15);
  color: var(--accent-amber);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Mini Quiz */
.quiz-code {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  margin: 0;
}
.quiz-score-card {
  text-align: center;
  padding: 30px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.quiz-score-card__number {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--accent-mint);
  margin-bottom: 8px;
}
