/* Training tab (js/training/view.js). Uses the tokens of styles.css; quiet like Schreiben:
   one sentence, one action, the picture of the progress, nothing boxed in boxes. */

.view-training { padding: 4px var(--gutter) max(32px, env(safe-area-inset-bottom)); overflow-y: auto; }
.trn { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; padding-top: 20px; }

.trn-head { display: grid; gap: 8px; }
.trn-text {
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em;
}
.trn-text .pen-dot { display: inline-block; margin-left: 12px; vertical-align: middle; }   /* right after the sentence */
.trn-sub { color: var(--muted); max-width: 58ch; }

.trn-progress { display: grid; gap: 10px; }
.trn-progress-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.trn-left { color: var(--muted); font-weight: 400; }
.trn-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.trn-bar span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .4s; }

.trn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.trn-actions:not(:has(> :not([hidden]))) { display: none; }
.trn-actions .btn { transition: transform .08s; }   /* the same button changes role (start / stop): no colour fade */
.trn-actions .btn.primary { min-width: 200px; }
.trn-note { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 16px; }

.trn-sample, .trn-curve { margin: 0; display: grid; gap: 10px; }
.trn-sample figcaption, .trn-curve figcaption { font-size: 14px; color: var(--muted); }

/* the sample is a picture of paper: light in both themes, like the sheet in Schreiben */
.trn-paper {
  appearance: none; display: block; width: 100%; padding: 10px 12px; margin: 0; border: 0; border-radius: 3px;
  background: #FFFFFF; cursor: zoom-in; touch-action: manipulation;
  box-shadow: 0 0 0 1px rgba(28, 35, 48, .09), 0 1px 2px rgba(20, 26, 38, .06), 0 14px 30px -14px rgba(20, 26, 38, .22);
}
.trn-paper img { display: block; width: 100%; height: auto; }
@media (prefers-color-scheme: dark) { .trn-paper { background: #EFEDE7; box-shadow: none; } .trn-paper img { mix-blend-mode: multiply; } }

.trn-curve svg { display: block; width: 100%; height: 96px; overflow: visible; }
.trn-curve .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trn-curve .line { fill: none; stroke: var(--muted); stroke-width: 1.75; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trn-curve .dot { stroke: var(--muted); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trn-curve .dot.best { stroke: var(--accent); stroke-width: 10; }
.trn-axis { display: flex; justify-content: space-between; margin-top: -4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* "Erweitert": closed by default; a beginner never needs it */
.trn-adv { border-top: 1px solid var(--line); }
.trn-adv summary {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding-right: 8px;
  color: var(--muted); font-weight: 500; cursor: pointer; list-style: none; touch-action: manipulation;
}
.trn-adv summary::-webkit-details-marker { display: none; }
.trn-adv summary::after {
  content: ""; width: 7px; height: 7px; margin-top: -3px; border: solid currentColor; border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg); transition: transform .15s;
}
.trn-adv[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.trn-adv summary:hover { color: var(--ink); }
.trn-adv-body { display: grid; }
.trn-field { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--line); }
.trn-field-text, .trn-field.switch-row > span { display: grid; gap: 2px; }
.trn-field strong { font-weight: 500; }
.trn-field .muted { font-size: 15px; }
.trn-field input[type="number"], .trn-field select {
  flex: none; font: inherit; min-height: 48px; min-width: 48px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
}
.trn-field input[type="number"] { width: 96px; text-align: center; font-variant-numeric: tabular-nums; }
.trn-field select { width: 190px; }

/* enlarged sample: at its own size, scrolls sideways on a phone */
.dlg.trn-zoom { width: min(1100px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 16px; overflow: auto; }
.trn-zoom-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.trn-zoom-head h2 { margin: 0; }
.trn-zoom-body { overflow-x: auto; border-radius: 3px; background: #FFFFFF; padding: 10px 12px; }
.trn-zoom-body img { display: block; width: 100%; min-width: 860px; height: auto; }

@media (max-width: 560px) {
  .trn { gap: 18px; padding-top: 12px; }
  .trn-actions .btn { flex: 1 1 100%; }
  .trn-actions .btn.quiet { justify-content: flex-start; padding-left: 0; }
  .trn-field { flex-wrap: wrap; gap: 8px 16px; }
}

/* A third tab: on a phone the top bar keeps everything by narrowing the tabs and
   showing the upload indicator as its icon only (the settings say the rest). */
@media (max-width: 480px) {
  .tabs { gap: 0; }
  .tabs a { padding: 0 9px; font-size: 16px; }
  .waiting { width: auto; min-width: 48px; padding: 0 12px; justify-content: center; }
  .waiting .w-short { display: none; }
}

/* Einstellungen: the optional GitHub token (js/training/github-settings.js) */
#gh-settings > p { max-width: 60ch; }
.gh-steps { margin: 16px 0 0; padding-left: 1.4em; display: grid; gap: 10px; max-width: 60ch; }
.gh-steps li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.gh-steps .gh-open { display: flex; width: max-content; margin-top: 8px; }
.gh-form { margin-top: 18px; max-width: 460px; }
.gh-form-actions { margin-top: 14px; }

/* the one-time hint on the Training tab */
.trn-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; color: var(--muted); font-size: 15px; }
.trn-offer .btn.quiet { padding: 0 10px; margin-left: -10px; }
.trn-offer span { margin-right: 10px; }
