.flush { margin-top: 0; }
#language-picker { max-width: 100%; min-width: 0; }
.sub-h { margin: 18px 0 8px; font-size: 16px; }
.card { margin-bottom: 20px; overflow-wrap: anywhere; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; margin-bottom: 12px; }
.top-gap { margin-top: 10px; }
.bottom-gap { margin-bottom: 12px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 4px; }
textarea { resize: vertical; }

button, .btn, select, textarea, input:not([type="file"]):not([type="hidden"]) {
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
}
.row > select { max-width: 100%; }
label.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.step-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.step-row > div { min-width: 0; }
.step-row label { display: block; margin-bottom: 4px; font-weight: 600; }
.step-row .step-rm { justify-self: start; }

@media (min-width: 560px) {
  .step-row {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

.drill-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 10px;
}
.drill-title {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.prompt-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.prompt-text {
  margin: 4px 0 0;
  color: var(--ink) !important;
  font-size: 16px !important;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.reveal-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.answer-box {
  border-color: var(--accent);
}
.reveal-line {
  margin: 4px 0;
  white-space: pre-line;
}
.watchout {
  color: var(--warn);
  margin-top: 8px;
}
.steps-ol {
  margin: 6px 0 0;
  padding-inline-start: 22px;
}
.steps-ol li {
  margin-bottom: 6px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: 8px;
  margin: 8px 0 14px;
}
.stat-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
.stat-box dt { margin: 0 0 2px; }
.stat-box dd {
  margin: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.tbl-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}
#topic-table th, #topic-table td {
  padding: 8px 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.num {
  text-align: right;
  font-family: var(--mono);
}

.err-msg {
  color: var(--warn);
  font-weight: 600;
  margin: 10px 0 4px;
}
.warn-box {
  background: var(--chip);
  border: 1px solid var(--warn);
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 12px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.list .title {
  font-weight: 600;
  overflow-wrap: anywhere;
  flex: 1 1 150px;
  min-width: 0;
}
.list .meta {
  flex: 1 1 100%;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
code {
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.print-only { display: none; }
.print-item {
  border-bottom: 1px solid #cccccc;
  padding: 12px 0;
  page-break-inside: avoid;
}
.print-blank-space {
  display: none;
  height: 84px;
  border-bottom: 1px dashed #888888;
  margin-top: 8px;
}

@media print {
  .no-print, header.top, footer { display: none !important; }
  body { background: #ffffff; color: #000000; }
  .print-only { display: block !important; }
  body.print-prompts-only .print-solution { display: none !important; }
  body.print-prompts-only .print-blank-space { display: block !important; }
}
