/* Styles specific to the problem detail page (problem.html). */

.toolbar-meta[hidden],
.answer-section[hidden],
.reveal-btn[hidden] {
  display: none;
}

.problem-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-left {
  display: flex;
  align-items: center;
}

/* Deliberately not a button: a quiet text link, so the way out of the
   problem is available without competing with the problem itself. */
.toolbar-back {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.toolbar-back:hover {
  color: var(--text-primary);
}

/* Prev/next below the content, aligned right — "Next" lands where the eye
   exits the page (variant A). */
.problem-bottom-nav {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* Centered stopwatch: monospace time so the digits don't jitter as they
   tick. Counts up from load; problem.js pauses it once the answer is
   correct or the solution is revealed. */
.toolbar-timer {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.toolbar-timer.is-stopped {
  color: var(--text-muted);
}

/* Keep the digits' width reserved when hidden so the toggle doesn't jump.
   (.timer-toggle styling lives in components.css, shared with the demo.) */
.toolbar-timer.is-hidden .timer-display {
  visibility: hidden;
}

.toolbar-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
}

.toolbar-nav-link {
  padding: var(--space-2) var(--space-3);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.toolbar-nav-link:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.toolbar-nav-link.is-disabled {
  color: var(--text-disabled);
  border-color: var(--border-subtle);
  cursor: not-allowed;
  pointer-events: none;
}

@media (min-width: 640px) {
  .problem-toolbar {
    flex-direction: row;
    align-items: center;
    position: relative;
  }

  .toolbar-left {
    flex: 1;
    flex-direction: row;
    justify-content: flex-start;
  }

  /* Absolutely centered on the toolbar (which spans the centered container),
     so the timer lands at the true horizontal middle of the screen, not
     just between two unequal side groups. */
  .toolbar-timer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .toolbar-meta {
    flex: 1;
    justify-content: flex-end;
  }
}

.problem-main {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-24);
}

.problem-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.problem-statement {
  margin-top: var(--space-4);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.problem-main .hr {
  margin: var(--space-8) 0;
}

.answer-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 420px;
  /* Replaces the removed divider's spacing — keeps the answer form clearly
     separated from the statement without a visible rule between them. */
  margin-top: var(--space-12);
}

.answer-input-wrapper {
  width: 100%;
}

.answer-input {
  width: 100%;
}

.answer-input.input-flash {
  border-color: var(--diff-expert);
  transition: border-color 600ms ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.answer-input-wrapper.shake {
  animation: shake 300ms ease;
}

.answer-feedback {
  font-size: 14px;
  font-weight: 500;
  min-height: 20px;
  opacity: 0;
  transition: opacity 200ms ease;
}

.answer-feedback.is-visible {
  opacity: 1;
}

/* Red (--diff-expert), not the orange hard-band color — "wrong" reads as
   red, and the orange was blurring into the difficulty scale's meaning. */
.answer-feedback.is-incorrect {
  color: var(--diff-expert);
}

.answer-feedback.is-correct {
  color: var(--diff-easy);
}

.answer-feedback.is-revealed {
  color: var(--diff-medium);
}

.answer-section .btn {
  margin-top: var(--space-2);
}

.btn-correct {
  background: var(--diff-easy);
  color: #052e16;
}

.btn-correct:disabled,
.btn-revealed:disabled {
  opacity: 1;
}

.btn-revealed {
  background: var(--diff-medium);
  color: #431407;
}

.reveal-btn {
  display: block;
  margin-top: var(--space-2);
  padding: 0;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.reveal-btn:hover {
  text-decoration: underline;
}

.solution-reveal {
  max-height: 0;
  margin-top: 0;
  padding: var(--space-4);
  overflow: hidden;
  opacity: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: max-height 400ms ease, opacity 400ms ease, margin-top 400ms ease;
}

.solution-reveal.is-open {
  max-height: 600px;
  margin-top: var(--space-8);
  opacity: 1;
}

.solution-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.solution-text {
  margin-top: var(--space-2);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}
