/* =====================================================================
   thinkfirst.css — ThinkFirst Lab (Programming Thinking Lab)
   Platform look: white cards, purple/blue accents, dark code blocks.
   ===================================================================== */
.tf-app { padding: 22px 0 60px; }

/* ---------- hero ---------- */
.tf-hero {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 55%, #2563eb 100%);
  color: #fff; border-radius: 18px; padding: 30px 28px; margin-bottom: 20px;
  box-shadow: 0 12px 30px rgba(79,70,229,.25);
}
.tf-hero-badge {
  display: inline-block; background: rgba(255,255,255,.18); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 20px; margin-bottom: 12px;
}
.tf-hero h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.15; color: #fff; }
.tf-hero h1 em { font-style: normal; background: rgba(255,255,255,.22); padding: 0 8px; border-radius: 8px; }
/* Override the platform's gradient-clip heading (sim-future.css makes
   .sim-wrap h1 text transparent) so the white hero title stays visible. */
.sim-wrap .tf-hero h1, .sim-wrap .tf-hero h1 em {
  background: none !important; color: #fff !important; -webkit-text-fill-color: #fff !important;
}
.sim-wrap .tf-hero h1 em { background: rgba(255,255,255,.22) !important; }
.tf-hero p { margin: 0; max-width: 760px; color: #eef2ff; font-size: 15px; line-height: 1.6; }

/* ---------- stat cards ---------- */
.tf-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.tf-stat {
  background: #fff; border: 1px solid #ecebf5; border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(17,24,39,.04);
}
.tf-stat-val { font-size: 26px; font-weight: 800; color: #4f46e5; }
.tf-stat-label { font-size: 13px; color: #374151; font-weight: 600; margin-top: 2px; }
.tf-stat-sub { font-size: 11px; color: #9ca3af; margin-top: 6px; }
.tf-bar { height: 7px; background: #eef2ff; border-radius: 5px; overflow: hidden; margin-top: 4px; }
.tf-bar-fill { height: 100%; background: linear-gradient(90deg,#7c3aed,#2563eb); border-radius: 5px; transition: width .4s; }

/* ---------- collapsible blocks ---------- */
.tf-block { background: #fff; border: 1px solid #ecebf5; border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.tf-block > summary {
  list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 700; color: #1f2937;
  display: flex; align-items: center; gap: 10px; user-select: none;
}
.tf-block > summary::-webkit-details-marker { display: none; }
.tf-block > summary::after { content: "▸"; margin-left: auto; color: #9ca3af; transition: transform .2s; }
.tf-block[open] > summary::after { transform: rotate(90deg); }
.tf-block-badge {
  background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff; font-size: 12px; font-weight: 700;
  min-width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 7px;
}
.tf-block-body { padding: 4px 18px 18px; color: #374151; font-size: 14px; line-height: 1.6; }

/* ---------- dark code blocks ---------- */
.tf-code {
  background: #0b1220; border-radius: 10px; padding: 13px 16px; margin: 8px 0;
  overflow: auto; line-height: 1.55;
}
.sim-wrap .tf-code code,
.tf-code code {
  background: transparent !important; border: 0 !important; padding: 0 !important; border-radius: 0 !important;
  color: #e6edf7 !important; -webkit-text-fill-color: #e6edf7 !important;
  font-family: Consolas, "Cascadia Code", "Fira Code", monospace; font-size: 13px;
  white-space: pre;
}

/* ---------- "How to Start" framework ---------- */
.tf-fw { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.tf-fw-step { display: flex; gap: 10px; }
.tf-fw-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: #ede9fe; color: #6d28d9;
  font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.tf-fw-step b { color: #1f2937; font-size: 14px; }
.tf-fw-step p { margin: 2px 0 0; font-size: 13px; color: #6b7280; }

/* ---------- loop thinking cards ---------- */
.tf-loop-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.tf-loop-card { border: 1px solid #ecebf5; border-radius: 12px; padding: 14px; background: #fbfbff; }
.tf-loop-card h4 { margin: 0 0 6px; font-size: 14px; color: #4338ca; }
.tf-loop-when { margin: 0 0 8px; font-size: 12.5px; color: #374151; }
.tf-loop-ex {
  background: #0b1220; color: #a5b4fc; font-family: Consolas, monospace; font-size: 12px;
  border-radius: 7px; padding: 8px 10px; margin: 0 0 8px; white-space: pre;
}
.tf-loop-note { margin: 0; font-size: 12px; color: #6b7280; }
.tf-loop-for { border-left: 3px solid #7c3aed; } .tf-loop-while { border-left: 3px solid #2563eb; }
.tf-loop-nested { border-left: 3px solid #db2777; } .tf-loop-acc { border-left: 3px solid #059669; }
.tf-loop-count { border-left: 3px solid #d97706; } .tf-loop-flag { border-left: 3px solid #0891b2; }

/* ---------- section + cards ---------- */
.tf-h2 { font-size: 20px; color: #1f2937; margin: 26px 0 12px; }
.tf-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tf-search { flex: 1 1 240px; min-width: 200px; padding: 9px 13px; border: 1px solid #d8d6ea; border-radius: 9px; font-size: 14px; }
.tf-filters select { padding: 9px 11px; border: 1px solid #d8d6ea; border-radius: 9px; font-size: 13px; background: #fff; color: #374151; }
.tf-search:focus, .tf-filters select:focus { outline: 2px solid #c4b5fd; border-color: #a78bfa; }

.tf-section { margin-bottom: 26px; }
.tf-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tf-section-head h3 { margin: 0; font-size: 17px; color: #1f2937; display: flex; align-items: center; gap: 9px; }
.tf-sec-num {
  background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff; font-size: 13px; font-weight: 700;
  width: 27px; height: 27px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.tf-section-blurb { font-size: 13px; color: #9ca3af; }
.tf-section-count { margin-left: auto; font-size: 12px; color: #6b7280; }
.tf-soon { background: #fef3c7; color: #92400e; padding: 2px 9px; border-radius: 12px; font-weight: 600; }

.tf-card-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.tf-card-grid.tf-locked { opacity: .65; }
.tf-empty { color: #9ca3af; font-size: 13px; grid-column: 1/-1; padding: 8px 0; }

.tf-card {
  display: block; background: #fff; border: 1px solid #ecebf5; border-radius: 14px; padding: 16px;
  text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tf-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(79,70,229,.12); border-color: #c7d2fe; }
.tf-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tf-card-id { font-size: 12px; font-weight: 700; color: #6d28d9; background: #ede9fe; padding: 2px 8px; border-radius: 6px; }
.tf-done-tick { margin-left: auto; color: #16a34a; font-weight: 800; }
.tf-card h4 { margin: 0 0 6px; font-size: 15px; color: #1f2937; }
.tf-card p { margin: 0 0 10px; font-size: 13px; color: #6b7280; line-height: 1.5; }
.tf-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tf-time { margin-left: auto; font-size: 11.5px; color: #9ca3af; white-space: nowrap; }

/* badges + chips */
.tf-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 12px; }
.tf-diff-medium { background: #dcfce7; color: #15803d; }
.tf-diff-hard { background: #fef3c7; color: #b45309; }
.tf-diff-very-hard { background: #fee2e2; color: #b91c1c; }
.tf-diff-challenge { background: #ede9fe; color: #6d28d9; }
.tf-chip { font-size: 11px; color: #4338ca; background: #eef2ff; border-radius: 10px; padding: 2px 8px; }

/* ---------- problem detail ---------- */
.tf-detail-top { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.tf-back { color: #6d28d9; text-decoration: none; font-weight: 600; font-size: 14px; }
.tf-back:hover { text-decoration: underline; }
.tf-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tf-detail-title { margin: 0 0 14px; font-size: 26px; color: #1f2937; }

.tf-modes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tf-mode {
  border: 1px solid #ddd6fe; background: #f5f3ff; color: #6d28d9; border-radius: 10px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.tf-mode:hover { background: #ede9fe; }
.tf-mode.active { background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff; border-color: transparent; }

.tf-io { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-top: 10px; }
.tf-io b { color: #4338ca; font-size: 13px; }
.tf-io p { margin: 3px 0 0; font-size: 13.5px; color: #374151; }

.tf-think { list-style: none; margin: 0; padding: 0; }
.tf-think li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #eef2f7; }
.tf-think li:last-child { border-bottom: 0; }
.tf-think-k { flex: 0 0 200px; font-weight: 600; color: #4338ca; font-size: 13.5px; }
.tf-logic { margin: 0; padding-left: 20px; } .tf-logic li { padding: 4px 0; }

.tf-dry, .tf-tests { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.tf-dry th, .tf-dry td, .tf-tests th, .tf-tests td { border: 1px solid #ecebf5; padding: 7px 10px; text-align: left; }
.tf-dry th, .tf-tests th { background: #f5f3ff; color: #4338ca; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.tf-dry td:last-child { font-family: Consolas, monospace; color: #1f2937; }
.tf-tests code { background: #f1f5f9; color: #0f172a; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

.tf-mist { margin: 0; padding-left: 18px; } .tf-mist li { padding: 4px 0; color: #b45309; }
.tf-practice { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 12px 14px; color: #166534; margin: 0; }
.tf-hint { background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; padding: 8px 12px; margin-bottom: 8px; }
.tf-hint summary { cursor: pointer; color: #92400e; font-weight: 600; font-size: 13.5px; }
.tf-hint p { margin: 8px 0 0; color: #78350f; }
.tf-solve-hints h4 { margin: 14px 0 8px; color: #1f2937; }

/* buttons */
.tf-btn { border: 0; border-radius: 9px; padding: 9px 15px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.tf-btn-primary { background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff; }
.tf-btn-primary:hover { filter: brightness(1.08); }
.tf-btn-lg { padding: 12px 22px; font-size: 15px; }
.tf-btn-ghost { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.tf-btn-ghost:hover { background: #ede9fe; }
.tf-btn-done { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.tf-row { margin-top: 12px; } .tf-copy { margin-top: 8px; }
.tf-muted { color: #6b7280; font-size: 13.5px; }

/* exam + mistake modes */
.tf-exam-field { margin-bottom: 12px; }
.tf-exam-field label { display: block; font-weight: 600; color: #374151; font-size: 13.5px; margin-bottom: 5px; }
.tf-exam-field textarea { width: 100%; border: 1px solid #d8d6ea; border-radius: 9px; padding: 9px 12px; font-size: 13px; font-family: inherit; resize: vertical; }
.tf-exam-model { margin-top: 14px; border-top: 1px dashed #e5e7eb; padding-top: 12px; }
.tf-exam-model h4 { margin: 10px 0 4px; color: #4338ca; font-size: 13.5px; }
.tf-mistake-card { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.tf-mistake-card summary { cursor: pointer; color: #9a3412; font-weight: 600; }

/* related */
.tf-related { margin-top: 26px; }
.tf-related h3 { font-size: 16px; color: #1f2937; margin: 0 0 10px; }
.tf-rel { display: inline-block; margin: 0 8px 8px 0; padding: 7px 13px; border: 1px solid #ddd6fe; border-radius: 9px; color: #6d28d9; text-decoration: none; font-size: 13px; }
.tf-rel:hover { background: #f5f3ff; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .tf-stats { grid-template-columns: repeat(2,1fr); }
  .tf-fw, .tf-loop-grid, .tf-card-grid, .tf-io { grid-template-columns: 1fr; }
  .tf-think-k { flex-basis: 130px; }
  .tf-hero h1 { font-size: 23px; }
}
