/* ==========================================================================
   study-tools.css — Styles for the LPIC interactive study platform
   Works with Quartz v5 light & dark themes via CSS custom properties.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Common / Shared
   -------------------------------------------------------------------------- */

.st-hidden {
  display: none !important;
}

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  background: var(--light);
  color: var(--darkgray);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
  line-height: 1.4;
}

.st-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.st-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.st-btn-primary {
  background: var(--secondary);
  color: var(--light);
  border-color: var(--secondary);
}

.st-btn-primary:hover {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: var(--light);
}

.st-btn-secondary {
  background: transparent;
  color: var(--secondary);
  border-color: var(--secondary);
}

.st-btn-secondary:hover {
  background: var(--secondary);
  color: var(--light);
}

.st-btn-danger {
  background: transparent;
  color: #d33;
  border-color: #d33;
}

.st-btn-danger:hover {
  background: #d33;
  color: #fff;
}

/* Progress bar (shared component) */
.st-progress-bar-container {
  width: 100%;
  height: 10px;
  background: var(--lightgray);
  border-radius: 5px;
  overflow: hidden;
  margin: 0.4rem 0;
}

.st-progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
  min-width: 0;
}

.st-progress-good {
  background: #2eaa4a;
}

.st-progress-ok {
  background: #e8a735;
}

.st-progress-bad {
  background: #d33;
}

/* Color utilities */
.st-text-green {
  color: #2eaa4a;
}

.st-text-orange {
  color: #e8a735;
}

.st-text-red {
  color: #d33;
}

/* --------------------------------------------------------------------------
   QUIZ RUNNER
   -------------------------------------------------------------------------- */

.st-quiz {
  max-width: 800px;
  margin: 0 auto;
}

.st-quiz-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--lightgray);
}

.st-quiz-mode-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--lightgray);
}

.st-btn-mode {
  border-radius: 0;
  border: none;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  background: var(--light);
  color: var(--gray);
}

.st-btn-mode.st-active {
  background: var(--secondary);
  color: var(--light);
}

.st-btn-mode:hover {
  color: var(--darkgray);
}

.st-btn-mode.st-active:hover {
  color: var(--light);
}

.st-quiz-progress {
  font-size: 0.88rem;
  color: var(--darkgray);
  flex: 1;
  text-align: center;
}

.st-quiz-score {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
}

/* Question card */
.st-quiz-card {
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.st-quiz-title {
  margin: 0 0 0.8rem 0;
  font-size: 1.15rem;
  color: var(--dark);
}

.st-quiz-text {
  margin-bottom: 1rem;
  color: var(--darkgray);
  line-height: 1.6;
}

.st-quiz-text p {
  margin: 0.3rem 0;
}

.st-quiz-text code {
  background: var(--lightgray);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Options as pills */
.st-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.st-quiz-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  background: var(--light);
  border: 2px solid var(--lightgray);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  line-height: 1.45;
}

.st-quiz-option:hover {
  border-color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 5%, var(--light));
}

.st-quiz-option input[type="radio"] {
  accent-color: var(--secondary);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.st-quiz-option input[type="radio"]:disabled {
  cursor: default;
}

.st-quiz-option span {
  color: var(--darkgray);
  font-size: 0.95rem;
}

/* Selected option highlight */
.st-quiz-option:has(input:checked) {
  border-color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 8%, var(--light));
}

/* Correct / Incorrect feedback */
.st-quiz-option.st-correct {
  border-color: #2eaa4a;
  background: color-mix(in srgb, #2eaa4a 10%, var(--light));
}

.st-quiz-option.st-correct span {
  color: #1d7a34;
  font-weight: 600;
}

.st-quiz-option.st-incorrect {
  border-color: #d33;
  background: color-mix(in srgb, #d33 8%, var(--light));
}

.st-quiz-option.st-incorrect span {
  text-decoration: line-through;
  color: #a32;
}

/* Fill-blank question */
.st-fill-blank-wrapper {
  margin: 1rem 0;
}

.st-fill-blank-label {
  display: block;
  font-size: 0.88rem;
  color: var(--gray);
  margin-bottom: 0.4rem;
}

.st-fill-blank-input {
  width: 100%;
  max-width: 480px;
  padding: 0.6rem 1rem;
  font-family: var(--codeFont, monospace);
  font-size: 1rem;
  border: 2px solid var(--lightgray);
  border-radius: 8px;
  background: var(--light);
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s;
}

.st-fill-blank-input:focus {
  border-color: var(--secondary);
}

.st-fill-blank-input.st-fill-correct {
  border-color: #2a9;
  background: color-mix(in srgb, #2a9 8%, var(--light));
}

.st-fill-blank-input.st-fill-incorrect {
  border-color: #d33;
  background: color-mix(in srgb, #d33 8%, var(--light));
}

.st-fill-blank-input:disabled {
  cursor: default;
}

/* Shake animation for "please select" */
@keyframes st-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.st-shake {
  animation: st-shake 0.4s ease;
}

/* Feedback message */
.st-quiz-feedback {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.st-feedback-correct {
  background: color-mix(in srgb, #2eaa4a 12%, var(--light));
  border-left: 4px solid #2eaa4a;
  color: #1a6e2e;
}

.st-feedback-incorrect {
  background: color-mix(in srgb, #d33 10%, var(--light));
  border-left: 4px solid #d33;
  color: #922;
}

.st-quiz-explanation {
  margin-top: 0.7rem;
  padding: 0.8rem 1rem;
  background: color-mix(in srgb, var(--secondary) 6%, var(--light));
  border-left: 4px solid var(--secondary);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--darkgray);
  line-height: 1.55;
}

.st-quiz-explanation code {
  background: var(--lightgray);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Navigation */
.st-quiz-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  padding-top: 0.8rem;
}

.st-btn-check {
  background: var(--secondary);
  color: var(--light);
  border-color: var(--secondary);
  font-weight: 600;
  padding: 0.55rem 1.6rem;
}

.st-btn-check:hover {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: var(--light);
}

/* Results */
.st-quiz-results-card {
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.st-quiz-results-title {
  margin: 0 0 1rem 0;
  color: var(--dark);
}

.st-quiz-results-score {
  font-size: 1.15rem;
  color: var(--darkgray);
  margin-bottom: 1rem;
}

.st-big-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
}

.st-quiz-best {
  font-size: 0.88rem;
  color: var(--gray);
  margin-top: 0.5rem;
}

/* Breakdown */
.st-quiz-breakdown {
  margin-top: 1.5rem;
  text-align: left;
}

.st-quiz-breakdown h3 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
  color: var(--dark);
}

.st-quiz-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.7rem;
  border-radius: 4px;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
}

.st-bd-correct {
  background: color-mix(in srgb, #2eaa4a 8%, var(--light));
}

.st-bd-incorrect {
  background: color-mix(in srgb, #d33 8%, var(--light));
}

.st-bd-label {
  color: var(--darkgray);
}

.st-bd-status {
  font-weight: 600;
  font-size: 0.82rem;
}

.st-bd-correct .st-bd-status {
  color: #2eaa4a;
}

.st-bd-incorrect .st-bd-status {
  color: #d33;
}

.st-quiz-results-actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   FLASHCARD VIEWER
   -------------------------------------------------------------------------- */

.st-fc {
  max-width: 700px;
  margin: 0 auto;
}

.st-fc-header {
  margin-bottom: 1.2rem;
}

.st-fc-due-info {
  font-size: 0.88rem;
  color: var(--gray);
  margin-bottom: 0.3rem;
}

/* Anki download button */
.st-btn-anki {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: #235dff;
  color: #fff;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  margin-top: 0.4rem;
  margin-bottom: 0.3rem;
  transition: background 0.2s, transform 0.15s;
}
.st-btn-anki:hover {
  background: #1a47cc;
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}
.st-btn-anki svg {
  flex-shrink: 0;
}

.st-fc-count {
  font-size: 0.88rem;
  color: var(--darkgray);
  text-align: right;
  margin-top: 0.2rem;
}

/* 3D Flip card */
.st-fc-card-area {
  perspective: 1200px;
  margin-bottom: 1rem;
}

.st-fc-card-outer {
  position: relative;
  width: 100%;
  min-height: 260px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.st-fc-card-outer.st-flipped {
  transform: rotateY(180deg);
}

.st-fc-card-front,
.st-fc-card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 260px;
  box-sizing: border-box;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--lightgray);
  border-radius: 12px;
  padding: 2rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--darkgray);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  overflow-y: auto;
  word-break: break-word;
}

.st-fc-card-front {
  background: var(--light);
}

.st-fc-card-back {
  background: color-mix(in srgb, var(--secondary) 5%, var(--light));
  transform: rotateY(180deg);
}

.st-fc-card-front::before {
  content: "Pregunta";
  position: absolute;
  top: 0.7rem;
  left: 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  font-weight: 600;
}

.st-fc-card-back::before {
  content: "Respuesta";
  position: absolute;
  top: 0.7rem;
  left: 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  font-weight: 600;
}

.st-fc-flip-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--gray);
  margin-bottom: 1.2rem;
}

/* Rating buttons */
.st-fc-rating {
  text-align: center;
  margin-top: 0.5rem;
}

.st-fc-rating-label {
  font-size: 0.88rem;
  color: var(--darkgray);
  margin-bottom: 0.6rem;
}

.st-fc-rating-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.st-btn-rating {
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  border-width: 2px;
}

.st-rating-0 {
  color: #d33;
  border-color: #d33;
  background: color-mix(in srgb, #d33 6%, var(--light));
}

.st-rating-0:hover {
  background: #d33;
  color: #fff;
}

.st-rating-2 {
  color: #c78a20;
  border-color: #daa520;
  background: color-mix(in srgb, #daa520 8%, var(--light));
}

.st-rating-2:hover {
  background: #daa520;
  color: #fff;
}

.st-rating-3 {
  color: #2e8b57;
  border-color: #2eaa4a;
  background: color-mix(in srgb, #2eaa4a 6%, var(--light));
}

.st-rating-3:hover {
  background: #2eaa4a;
  color: #fff;
}

.st-rating-4 {
  color: #218838;
  border-color: #28a745;
  background: color-mix(in srgb, #28a745 8%, var(--light));
}

.st-rating-4:hover {
  background: #28a745;
  color: #fff;
}

.st-rating-5 {
  color: #1a7a2e;
  border-color: #1e8e3e;
  background: color-mix(in srgb, #1e8e3e 10%, var(--light));
}

.st-rating-5:hover {
  background: #1e8e3e;
  color: #fff;
}

/* Summary */
.st-fc-summary-card {
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.st-fc-summary-title {
  margin: 0 0 1.2rem 0;
  color: var(--dark);
}

.st-fc-summary-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.st-fc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.st-fc-stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
}

.st-fc-stat-label {
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

.st-fc-dist {
  text-align: left;
  max-width: 320px;
  margin: 0.8rem auto;
}

.st-fc-dist-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.88rem;
  color: var(--darkgray);
  border-bottom: 1px solid var(--lightgray);
}

.st-fc-dist-count {
  font-weight: 600;
}

.st-fc-summary-actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   DASHBOARD
   -------------------------------------------------------------------------- */

.st-dashboard {
  max-width: 860px;
  margin: 0 auto;
}

.st-dash-title {
  margin: 0 0 1.2rem 0;
  color: var(--dark);
}

/* Stat cards grid */
.st-dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.st-dash-stat-card {
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 10px;
  padding: 1.2rem 1rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}

.st-dash-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.st-dash-stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.st-dash-stat-label {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.3rem;
}

/* Stat card accent colors */
.st-stat-blue .st-dash-stat-value {
  color: #2563eb;
}

.st-stat-purple .st-dash-stat-value {
  color: #7c3aed;
}

.st-stat-orange .st-dash-stat-value {
  color: #e8a735;
}

.st-stat-green .st-dash-stat-value {
  color: #2eaa4a;
}

/* Sections */
.st-dash-section {
  margin-bottom: 2rem;
}

.st-dash-section-title {
  font-size: 1.05rem;
  margin: 0 0 0.8rem 0;
  color: var(--dark);
  border-bottom: 1px solid var(--lightgray);
  padding-bottom: 0.4rem;
}

/* Progress rows */
.st-dash-progress-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--lightgray) 50%, transparent);
}

.st-dash-progress-label {
  font-size: 0.88rem;
  color: var(--darkgray);
}

.st-dash-progress-pct {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
  min-width: 40px;
  text-align: right;
}

.st-progress-lpic1 {
  background: #2563eb;
}

.st-progress-lpic2 {
  background: #7c3aed;
}

.st-progress-lpic3 {
  background: #e8a735;
}

/* Recent quiz scores */
.st-dash-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.st-dash-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 6px;
  font-size: 0.88rem;
  transition: background 0.1s;
}

.st-dash-recent-item:hover {
  background: color-mix(in srgb, var(--lightgray) 30%, var(--light));
}

.st-dash-recent-name {
  color: var(--darkgray);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 0.8rem;
  font-family: monospace;
  font-size: 0.82rem;
}

.st-dash-recent-meta {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-shrink: 0;
}

.st-dash-recent-score {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 40px;
  text-align: right;
}

.st-dash-recent-date {
  font-size: 0.78rem;
  color: var(--gray);
  min-width: 70px;
  text-align: center;
}

.st-dash-recent-mode {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
  min-width: 58px;
  text-align: right;
}

/* Nav grid */
.st-dash-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}

.st-dash-nav-btn {
  text-align: center;
  text-decoration: none;
  padding: 0.7rem 1rem;
  font-weight: 600;
  border: 2px solid var(--secondary);
  color: var(--secondary);
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.st-dash-nav-btn:hover {
  background: var(--secondary);
  color: var(--light);
}

/* --------------------------------------------------------------------------
   DATA PORTABILITY
   -------------------------------------------------------------------------- */

.st-portability {
  max-width: 700px;
  margin: 1.5rem auto 0;
  padding: 1.5rem;
  background: var(--light);
  border: 1px solid var(--lightgray);
  border-radius: 10px;
}

.st-port-title {
  margin: 0 0 0.5rem 0;
  color: var(--dark);
}

.st-port-desc {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.st-port-btn-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.st-port-status {
  font-size: 0.88rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 0.8rem;
  min-height: 1.4em;
}

.st-port-status:empty {
  display: none;
}

.st-port-status-ok {
  background: color-mix(in srgb, #2eaa4a 10%, var(--light));
  color: #1d7a34;
}

.st-port-status-warn {
  background: color-mix(in srgb, #e8a735 12%, var(--light));
  color: #8a6214;
}

.st-port-count {
  font-size: 0.82rem;
  color: var(--gray);
}

.st-port-danger {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--lightgray);
}

.st-port-danger-title {
  font-size: 0.88rem;
  color: #d33;
  margin: 0 0 0.6rem 0;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .st-quiz-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .st-quiz-progress {
    text-align: left;
  }

  .st-quiz-nav {
    flex-wrap: wrap;
  }

  .st-quiz-card {
    padding: 1rem;
  }

  .st-quiz-results-card {
    padding: 1.2rem;
  }

  .st-quiz-breakdown-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .st-fc-card-outer {
    min-height: 200px;
  }

  .st-fc-card-front,
  .st-fc-card-back {
    min-height: 200px;
    padding: 1.5rem 1.2rem;
  }

  .st-fc-rating-btns {
    gap: 0.35rem;
  }

  .st-btn-rating {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
  }

  .st-fc-summary-stats {
    gap: 1rem;
  }

  .st-dash-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .st-dash-progress-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .st-dash-progress-pct {
    text-align: left;
  }

  .st-dash-recent-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .st-dash-recent-meta {
    width: 100%;
    justify-content: space-between;
  }

  .st-dash-nav-grid {
    grid-template-columns: 1fr 1fr;
  }

  .st-port-btn-row {
    flex-direction: column;
  }

  .st-port-btn-row .st-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .st-dash-stats-grid {
    grid-template-columns: 1fr;
  }

  .st-dash-nav-grid {
    grid-template-columns: 1fr;
  }

  .st-quiz-option {
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
  }

  .st-fc-card-outer {
    min-height: 180px;
  }

  .st-fc-card-front,
  .st-fc-card-back {
    min-height: 180px;
    padding: 1.2rem 1rem;
    font-size: 0.95rem;
  }
}

/* --------------------------------------------------------------------------
   DARK MODE adjustments
   Quartz toggles a [saved-theme="dark"] attribute on the root element.
   The CSS variables already handle most color shifts, but we fine-tune
   the feedback colors for better contrast in dark mode.
   -------------------------------------------------------------------------- */

[saved-theme="dark"] .st-feedback-correct {
  color: #6ede8b;
}

[saved-theme="dark"] .st-feedback-incorrect {
  color: #f09090;
}

[saved-theme="dark"] .st-quiz-option.st-correct span {
  color: #6ede8b;
}

[saved-theme="dark"] .st-quiz-option.st-incorrect span {
  color: #f09090;
}

[saved-theme="dark"] .st-bd-correct .st-bd-status {
  color: #6ede8b;
}

[saved-theme="dark"] .st-bd-incorrect .st-bd-status {
  color: #f09090;
}

[saved-theme="dark"] .st-text-green {
  color: #6ede8b;
}

[saved-theme="dark"] .st-text-red {
  color: #f09090;
}

[saved-theme="dark"] .st-text-orange {
  color: #f0c060;
}

[saved-theme="dark"] .st-port-status-ok {
  color: #6ede8b;
}

[saved-theme="dark"] .st-port-status-warn {
  color: #f0c060;
}

[saved-theme="dark"] .st-port-danger-title {
  color: #f09090;
}

[saved-theme="dark"] .st-btn-danger {
  color: #f09090;
  border-color: #f09090;
}

[saved-theme="dark"] .st-btn-danger:hover {
  background: #d33;
  color: #fff;
}

[saved-theme="dark"] .st-stat-blue .st-dash-stat-value {
  color: #60a5fa;
}

[saved-theme="dark"] .st-stat-purple .st-dash-stat-value {
  color: #a78bfa;
}

[saved-theme="dark"] .st-stat-orange .st-dash-stat-value {
  color: #f0c060;
}

[saved-theme="dark"] .st-stat-green .st-dash-stat-value {
  color: #6ede8b;
}

/* ================================================================
   EXAM SIMULATOR
   ================================================================ */

.exam-simulator {
  max-width: 900px;
  margin: 0 auto;
}

.exam-controls {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--light);
  padding: 1rem;
  border-bottom: 2px solid var(--secondary);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.exam-start-btn, .exam-submit-btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.exam-start-btn {
  background: var(--secondary);
  color: var(--light);
}

.exam-start-btn:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

.exam-submit-btn {
  background: #2563eb;
  color: #fff;
}

.exam-submit-btn:hover {
  background: #1d4ed8;
}

.exam-timer {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: monospace;
  padding: 0.5rem 1rem;
  background: var(--lightgray);
  border-radius: 8px;
}

.exam-timer-warning {
  background: #fef2f2;
  color: #dc2626;
  animation: timer-pulse 1s infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.exam-question {
  padding: 1.5rem;
  margin: 1rem 0;
  border: 1px solid var(--lightgray);
  border-radius: 10px;
  transition: border-color 0.3s, background 0.3s;
}

.exam-question h3 {
  margin-top: 0;
  color: var(--secondary);
  font-size: 0.9rem;
}

.exam-question ul {
  list-style: none;
  padding: 0;
}

.exam-question li {
  padding: 0.6rem 1rem;
  margin: 0.4rem 0;
  border: 2px solid var(--lightgray);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.exam-question li:hover {
  border-color: var(--secondary);
  background: rgba(var(--secondary-rgb, 0,0,0), 0.05);
}

.exam-question li.exam-selected {
  border-color: var(--secondary);
  background: rgba(var(--secondary-rgb, 0,0,0), 0.1);
  font-weight: 600;
}

.exam-question li input[type="checkbox"] {
  display: none;
}

/* Graded states */
.exam-question.exam-correct {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.05);
}

.exam-question.exam-wrong {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.05);
}

.exam-question.exam-wrong li.exam-selected {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  text-decoration: line-through;
}

.exam-question li.exam-correct-option {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.15);
  font-weight: 700;
}

/* Results */
.exam-results {
  margin-top: 2rem;
  padding: 2rem;
  border: 2px solid var(--secondary);
  border-radius: 12px;
  background: var(--light);
}

.exam-results h3.exam-passed {
  color: #16a34a;
  font-size: 1.8rem;
}

.exam-results h3.exam-failed {
  color: #dc2626;
  font-size: 1.8rem;
}

.exam-results table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.exam-results th, .exam-results td {
  padding: 0.5rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--lightgray);
}

.exam-results th {
  background: var(--lightgray);
  font-weight: 700;
}

/* Dark mode overrides */
[saved-theme="dark"] .exam-controls {
  background: var(--dark);
}

[saved-theme="dark"] .exam-timer {
  background: #1e293b;
}

[saved-theme="dark"] .exam-timer-warning {
  background: #450a0a;
  color: #fca5a5;
}

[saved-theme="dark"] .exam-question {
  border-color: #374151;
}

[saved-theme="dark"] .exam-question li {
  border-color: #374151;
}

[saved-theme="dark"] .exam-results {
  background: var(--dark);
}

[saved-theme="dark"] .exam-results th {
  background: #1e293b;
}

/* --------------------------------------------------------------------------
   Copy-to-clipboard button on code blocks
   -------------------------------------------------------------------------- */

.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--lightgray);
  border-radius: 5px;
  background: var(--light);
  color: var(--darkgray);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  z-index: 2;
}

pre:hover .copy-btn,
.copy-btn:focus {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--lightgray);
  color: var(--dark);
}

.copy-btn.copy-ok {
  color: #16a34a;
  border-color: #16a34a;
  opacity: 1;
}

[saved-theme="dark"] .copy-btn {
  background: #1e293b;
  border-color: #374151;
  color: #9ca3af;
}

[saved-theme="dark"] .copy-btn:hover {
  background: #374151;
  color: #e5e7eb;
}

[saved-theme="dark"] .copy-btn.copy-ok {
  color: #4ade80;
  border-color: #4ade80;
}
