/* Question cards (study mode, articles, public question pages), stats tiles and the notes layer. */
.qcard { position: relative; max-width: 860px; padding: 20px; }
.qcard-loading { min-height: 160px; display: grid; place-items: center; color: var(--muted); }
.qcard-head { position: relative; z-index: 3; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.qcard-num { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.qcard-tags { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.card-tools { display: flex; gap: 8px; }
.qcard-body .q-group { margin: 8px 0 16px; }
.qcard-body .question { grid-template-columns: 1fr; padding: 0; }
.qcard-body .q-head { display: none; }
.qcard-body .q-prompt { font-size: 1.08rem; font-weight: 600; white-space: pre-line; }
.qcard-check { width: 100%; margin-top: 4px; }

/* Stats */
.stats-panel {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.stat-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; text-align: center; }
.stat-tile + .stat-tile { border-left: 1px solid var(--border); }
.stat-tile .icon { width: 24px; height: 24px; margin-bottom: 4px; }
.stat-tile strong { font-size: 1.15rem; }
.stat-tile span { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stats-note { grid-column: 1 / -1; margin: 0; padding: 0 12px 10px; font-size: .8rem; color: var(--muted); text-align: center; }
.stats-note:empty { display: none; }
.tone-primary { color: #4f46e5; }
.tone-success { color: var(--success); }
.stars { display: inline-flex; gap: 2px; margin-bottom: 4px; }
.stars .icon { width: 18px; height: 18px; margin: 0; color: #c9ced6; }
.stars .icon.on { color: #f5b301; fill: #f5b301; }

/* Results inside a card */
.study-result { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.study-verdict { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; }
.study-verdict.ok { color: var(--success); }
.study-verdict.bad { color: var(--danger); }
.method-box { margin-top: 12px; padding: 12px 14px; background: #f7ecd8; border-radius: var(--radius-small); }
.method-box strong { display: flex; align-items: center; gap: 6px; }
.method-box p { margin: 6px 0 0; }
.study-passage { max-height: 50vh; overflow-y: auto; padding: 12px; margin: 12px 0; background: var(--surface-2); border-radius: var(--radius-small); }

/* Like, bookmark, share, report */
.card-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.card-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface);
  font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer;
}
.card-action:hover { background: var(--surface-2); }
.card-action .count { font-variant-numeric: tabular-nums; }
.card-action.on { color: var(--primary); border-color: var(--primary); }
.card-action.on .icon { fill: currentColor; }
.card-action.danger { color: var(--danger); }
.card-report { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-small); }
.card-report label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.card-report.alert { display: flex; align-items: center; gap: 8px; }

/* Notes layer: the canvas covers the card; tools and the toggle stay above it. */
.notes-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; display: none; touch-action: none; border-radius: inherit; }
.notes-canvas.active { display: block; cursor: crosshair; }
.notes-toolbar {
  position: sticky; top: 8px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 12px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-small); box-shadow: var(--shadow);
}
.notes-toolbar .swatch { width: 18px; height: 18px; border-radius: 50%; }
.notes-done { margin-left: auto; }
.notes-on { outline: 2px dashed #93a4b8; outline-offset: 2px; }

@media (max-width: 600px) {
  .qcard { padding: 14px; }
  .qcard-head { flex-wrap: wrap; }
  .qcard-tags { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .card-tools { margin-left: auto; }
  .stats-panel { grid-template-columns: repeat(2, 1fr); }
  .stat-tile:nth-child(3) { border-left: 0; }
  .stat-tile:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .card-action .label { display: none; }
}
