/* Tutoring: a site on the kit's tokens (Rosé Pine, Dawn in light mode). */
@import url("/kit/css/base.css");

:root {
  --fs: 17px;
  --measure: 40rem;
  --pos: var(--rp-pine);
  --neg: var(--rp-love);
}
@media (prefers-color-scheme: dark) {
  :root { --pos: var(--rp-foam); }
}

html { scrollbar-gutter: stable; }
body { font-size: var(--fs); line-height: 1.65; }

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 28px var(--gutter) 80px;
}

/* Every page: a way home, a title, the tool, the other tools of its topic. */
.home { display: inline-block; margin-bottom: 18px; color: var(--text-muted); font-size: var(--fs-md); text-decoration: none; }
.home:hover { color: var(--accent); }
h1 { font-size: 1.7rem; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 20px; }
h2 { font-size: 1.1rem; margin: 28px 0 8px; }
a { color: var(--accent); text-underline-offset: 3px; }
.m { white-space: nowrap; font-variant-numeric: tabular-nums; }

.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.related a {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-muted);
  font-size: var(--fs-md);
  text-decoration: none;
}
.related a:hover { border-color: var(--accent); color: var(--accent); }

/* Home: search, then the list. */
.search {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  font-size: 16px;
  outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: var(--ring); }
.search::placeholder { color: var(--text-dim); }
.list { display: grid; gap: 8px; }
.card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card .title { font-weight: 600; min-width: 0; }
.card .tag { color: var(--text-dim); font-size: var(--fs-sm); white-space: nowrap; }
.empty { color: var(--text-dim); padding: 12px 2px; }

/* ==========================================================================
   Number line
   ========================================================================== */

.line-box {
  margin: 16px 0 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.line-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.line-axis { stroke: var(--text-dim); stroke-width: 1.5; }
.line-tick { stroke: var(--text-dim); stroke-width: 1; }
.line-tick.major { stroke: var(--text-muted); stroke-width: 1.5; }
.line-label { fill: var(--text-muted); font-size: 13px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.line-label.zero { fill: var(--text); font-weight: 700; }
.line-label.mark { fill: var(--text); font-weight: 700; }
.line-label.mark-mid { fill: var(--text-muted); font-weight: 700; }
.line-mid { fill: var(--text-muted); }
.line-flip { fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-dasharray: 5 5; }
.line-flip-head { fill: var(--text-muted); }
.line-value.flip { fill: var(--text-muted); font-weight: 600; }
.line-start { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.line-end { fill: var(--accent); }
.line-move { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.line-move.right { stroke: var(--pos); fill: none; }
.line-move.left { stroke: var(--neg); fill: none; }
.line-head.right { fill: var(--pos); }
.line-head.left { fill: var(--neg); }
.line-value { font-size: 14px; font-weight: 700; text-anchor: middle; fill: var(--text); }

.line-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.line-controls label { display: grid; gap: 2px; font-size: var(--fs-sm); color: var(--text-muted); min-width: 0; }
.line-controls output { color: var(--text); font-weight: 650; font-size: var(--fs); }
.line-controls input[type="range"] { width: 100%; accent-color: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.seg button { width: 44px; height: 36px; font-size: 1.2rem; color: var(--text-muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { color: var(--accent); background: var(--tint); font-weight: 700; }

.line-eq { margin-top: 10px; font-size: 1.3rem; font-weight: 650; text-align: center; }
.line-eq2 { color: var(--text-muted); font-size: 1.05rem; text-align: center; min-height: 1.6em; }
.times { align-self: center; justify-self: center; font-size: 1.4rem; color: var(--text-muted); padding: 0 8px; }

/* ==========================================================================
   Training (zetamac-style)
   ========================================================================== */

.train { max-width: 34rem; }

.field { margin-bottom: 22px; }
.field > .name { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }

.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check .sym { font-size: 1.2rem; font-weight: 700; width: 1em; text-align: center; color: var(--accent); }
.check:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button {
  min-width: 56px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.choices button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); box-shadow: var(--ring); font-weight: 650; }
.hint { color: var(--text-dim); font-size: var(--fs-sm); margin-top: 6px; }
.error { color: var(--danger); font-size: var(--fs-sm); min-height: 1.4em; }

.start-row { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.start-row .button { height: 48px; padding: 0 28px; font-size: 1.05rem; }
.start-row .record { color: var(--text-muted); font-size: var(--fs-md); }

/* Playing. */
.play { display: flex; flex-direction: column; }
.play-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.play-bar .stat { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.play-bar .stat strong { color: var(--text); font-size: 1.2rem; }
.play-bar .time.low strong { color: var(--warn); }

.question {
  margin-top: 12vh;
  text-align: center;
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.typed {
  margin: 18px auto 0;
  min-width: 6ch;
  width: max-content;
  padding: 4px 14px;
  border-bottom: 2px solid var(--accent);
  text-align: center;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  min-height: 1.6em;
}
.typed.empty::after { content: "?"; color: var(--text-dim); font-weight: 400; }
.feedback { margin-top: 18px; text-align: center; min-height: 3em; font-size: var(--fs-md); }
.feedback .fix { color: var(--danger); }
.feedback .fix strong { font-size: 1.1rem; }
.feedback .was { display: block; color: var(--text-muted); }
.play .hint { text-align: center; margin-top: 24px; }

@keyframes good { from { color: var(--pos); } }
.typed.good { animation: good 0.35s; }

/* Keypad: touch screens only, at the bottom, within thumb reach. */
.keypad { display: none; }
@media (pointer: coarse) {
  .play .hint { display: none; }
  .keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--border);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }
  .keypad button {
    height: 54px;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .keypad button:active { background: var(--surface-hover); }
  .keypad .minus { color: var(--neg); font-size: 1.8rem; }
  .keypad .enter { grid-column: 2 / -1; height: 48px; font-size: 1rem; color: var(--text-muted); }
  .keypad .stop { height: 48px; font-size: 1rem; color: var(--text-muted); font-weight: 500; }
  .play-bar .link-button { display: none; }
  .play { padding-bottom: 330px; }
  .question { margin-top: 6vh; }
}

/* End of a round. */
.over { margin-top: 0; color: var(--text-muted); font-size: var(--fs-md); font-weight: 600; }
.score { font-size: 4rem; font-weight: 700; line-height: 1; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.score-sub { color: var(--text-muted); margin-bottom: 24px; }
.score-sub .best { color: var(--accent); font-weight: 650; }
.mistakes { list-style: none; padding: 0; margin: 0 0 24px; }
.mistakes a {
  display: flex;
  color: inherit;
  text-decoration: none;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.mistakes a:hover { color: var(--accent); }
.mistakes .was { color: var(--text-muted); font-size: var(--fs-md); white-space: nowrap; }

.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.link-button { color: var(--text-muted); font-size: var(--fs-md); padding: 6px 0; }
.link-button:hover { color: var(--accent); }

@media (max-width: 768px) {
  :root { --fs: 16px; }
  h1 { font-size: 1.5rem; }
  .page { padding-top: 16px; }
  .line-box { padding: 12px; }
  .line-controls { grid-template-columns: 1fr 1fr; }
  .line-controls .seg { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .line-controls .times { display: none; }
  .start-row .button { width: 100%; }
  /* Phone: the actions of the settings and the result sit at the bottom. */
  .train { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 0; }
  #app { flex: 1; display: flex; flex-direction: column; }
  #app > .start-row {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 12px 0 calc(16px + env(safe-area-inset-bottom));
    background: var(--bg);
  }
}
