/* 問題ページ（exercise / question） */

.band--problem {
  background-color: #f4f6f9;
  background-image: radial-gradient(circle, rgba(13, 20, 32, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  padding-top: clamp(16px, 3vw, 28px);
  padding-bottom: clamp(40px, 6vw, 72px);
}

.container--problem {
  max-width: 1100px;
}

/* 動画 */
.problem-media {
  margin-bottom: 16px;
}

.band--problem .video-container {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 2px solid #111;
  box-shadow: 4px 4px 0 #111;
  background: #0d1420;
  border-radius: 0;
  padding: 0;
}

.band--problem img.video-container {
  object-fit: cover;
}

.problem-explain-link {
  text-align: center;
  margin: 0 0 28px;
}

.problem-explain-link .btn {
  display: inline-flex;
}

/* 問題ブロック — 外枠だけ影 */
.band--problem .problem {
  background: #fff;
  border: 2px solid #111;
  box-shadow: 4px 4px 0 #111;
  border-radius: 0;
  margin: 0 0 32px;
  padding: 0;
  max-width: none;
}

.band--problem .problem-card {
  padding: clamp(16px, 3vw, 28px);
  border-bottom: 2px solid #111;
  border-radius: 0;
  margin: 0;
}

.band--problem .problem-card__label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  background: #ff2d6e;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.08em;
}

.band--problem .problem h2 {
  margin: 0 0 14px;
  color: #111;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 900;
  font-style: italic;
}

.band--problem .problem-text {
  margin: 0;
  padding: 14px 16px;
  background: #f4f6f9;
  border: 2px solid #111;
  border-left: 6px solid #00a2ff;
  border-radius: 0;
  line-height: 1.75;
  color: #111;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: pre-line;
}

/* ワークスペース */
.band--problem .workspace {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
  padding: 0;
}

.band--problem .code-output-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  border-right: 2px solid #111;
}

.band--problem .code-input,
.band--problem .code-output,
.band--problem .hint-section {
  padding: clamp(14px, 2.5vw, 22px);
  border-radius: 0;
  min-width: 0;
}

.band--problem .code-output {
  border-top: 2px solid #111;
}

.band--problem .pane-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 12px;
  background: #111;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.1em;
}

.band--problem .hint-section .pane-label {
  background: #00a2ff;
}

.band--problem .pane-label--answer {
  background: #ff2d6e;
}

.band--problem .hint-block {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 2px dashed #c5cad3;
}

.band--problem .answer-block h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 900;
  font-style: italic;
  color: #111;
}

.band--problem .answer-note {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6270;
  line-height: 1.5;
}

.band--problem .hint-body {
  margin-top: 12px;
}

.band--problem .hint-body[hidden] {
  display: none !important;
}

.band--problem .hint-body__lead {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #111;
}

.band--problem .hint-quote {
  background: #f7f9fc;
  border: 2px solid #111;
  border-left: 6px solid #00a2ff;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.65;
  color: #333;
}

.band--problem .code-input h3,
.band--problem .code-output h3,
.band--problem .hint-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 900;
  font-style: italic;
  color: #111;
}

.band--problem .CodeMirror {
  border: 2px solid #111;
  border-radius: 0;
  font-size: 14px;
  height: 280px;
  max-width: 100%;
}

.band--problem .CodeMirror-scroll {
  min-height: 100%;
}

.band--problem .problem-run-btn {
  width: 100%;
  margin-top: 14px;
  box-sizing: border-box;
}

.band--problem .output {
  background: #0d1420;
  border: 2px solid #111;
  border-radius: 0;
  padding: 14px;
  font-family: "Courier New", Monaco, monospace;
  min-height: 160px;
  color: #7dffa3;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ヒント / 正解 */
.band--problem .correct-output-section {
  background: #f3faff;
  border: 2px solid #111;
  border-left: 6px solid #00a2ff;
  border-radius: 0;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: none;
}

.band--problem .correct-output-section.show,
.band--problem .correct-output-section.is-visible {
  display: block;
}

.band--problem .correct-output-section h4 {
  margin: 0 0 6px;
  color: #00a2ff;
  font-size: 0.85rem;
  font-weight: 900;
  font-style: italic;
}

.band--problem .correct-output-section p {
  margin: 0;
  color: #111;
  font-family: "Courier New", Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
  word-wrap: break-word;
  font-weight: 700;
  white-space: pre-wrap;
}

.band--problem .problem-toggle-btn {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 16px;
  background: #fff;
  color: #111;
  border: 2px solid #111;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 900;
  font-style: italic;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  display: none;
  box-sizing: border-box;
}

.band--problem .problem-toggle-btn.show,
.band--problem .problem-toggle-btn.is-visible {
  display: block;
}

.band--problem .problem-toggle-btn:hover {
  background: #111;
  color: #fff;
}

.band--problem [id^="correct-codes-"],
.band--problem [id^="correct-code-"],
.band--problem pre[id^="correct-codes-"] {
  margin: 0;
  background: #282c34;
  border: 2px solid #111;
  border-radius: 0;
  padding: 14px;
  font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
  font-size: 13px;
  color: #abb2bf;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

/* モーダル */
.band--problem ~ .modal,
.problem-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 20, 32, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.problem-modal.show,
.modal.show {
  display: flex;
}

.problem-modal .modal-content,
.modal .modal-content {
  background: #fff;
  border: 3px solid #111;
  border-radius: 0;
  box-shadow: 6px 6px 0 #111;
  padding: 28px 24px;
  max-width: 380px;
  width: calc(100% - 32px);
  text-align: center;
  animation: problemModalIn 0.22s ease;
}

@keyframes problemModalIn {
  from {
    opacity: 0;
    transform: translate(-4px, -4px);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

.problem-modal .modal-content img,
.modal .modal-content img {
  max-width: 140px;
  margin-bottom: 16px;
}

.problem-modal .modal-content .btn,
.modal .modal-content .btn {
  width: 100%;
  margin-top: 8px;
  box-sizing: border-box;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.friendly-error {
  padding: 4px 0;
}

.friendly-error__tip {
  margin: 0 0 8px;
  color: #7dffa3;
  font-weight: 700;
  line-height: 1.6;
}

.friendly-error__raw {
  margin: 0;
  color: #9da5b4;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-word;
}

/* ナビは nav.css。問題帯向けの微調整のみ */

@media (max-width: 900px) {
  .band--problem .workspace {
    grid-template-columns: 1fr;
  }

  .band--problem .code-output-container {
    border-right: none;
    border-bottom: 2px solid #111;
  }

  .band--problem .CodeMirror {
    height: 220px;
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  .band--problem .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .band--problem .nav-container .prev,
  .band--problem .nav-container .next,
  .band--problem .nav-container .home {
    position: relative;
    left: auto;
    right: auto;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  .band--problem .problem h2 {
    font-size: 1.15rem;
  }
}

/* 手元実行ページ: 「できた」記録 */
.progress-mark-wrap {
  margin: 28px auto 0;
  max-width: 420px;
  text-align: center;
}

.progress-mark-wrap .btn {
  min-width: 200px;
}

.progress-mark-wrap .btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.progress-mark-note {
  margin: 10px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #5a6270;
}
