/* Sign-in, parent and admin pages: one readable column in the same ink-on-paper look as the app. */

body.tutor {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

.t-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.t-narrow { max-width: 520px; }

.tutor a:not(.btn) { color: var(--ink); text-underline-offset: 3px; }

/* Long labels, like "Open Kids Love Math as …" with a long name, wrap onto a second line. */
.tutor .btn { line-height: 1.15; text-align: center; }
/* .btn sets display, which would otherwise win over the hidden attribute. */
.tutor .btn[hidden] { display: none; }

.t-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-bottom: 18px;
  border-bottom: var(--rule) solid var(--ink);
}

.t-head h1 { margin: 0; font: 700 30px/1.1 var(--font-ui); }
.t-head nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.t-head .btn { min-height: 44px; font-size: 17px; text-decoration: none; }
.t-head .lang > .btn { flex: none; width: 50px; }

.t-flash {
  margin: 20px 0 0;
  padding: 12px 16px;
  border: var(--rule) solid currentColor;
  border-radius: var(--radius);
  font-weight: 700;
}

.t-flash.is-ok { color: var(--right); }
.t-flash.is-error { color: var(--wrong); }

.t-section { padding: 28px 0; border-bottom: var(--rule) solid var(--ink); }
.t-section:last-child { border-bottom: 0; }
.t-section h2 { margin: 0 0 6px; font: 700 24px/1.2 var(--font-ui); }

.t-lead { max-width: 62ch; margin: 0 0 18px; color: var(--muted); }
.t-lead code { color: var(--ink); overflow-wrap: anywhere; }

/* ── Forms ──────────────────────────────────────────────────────────────── */

.t-form { max-width: 420px; }

.t-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.t-field label { font-size: 16px; color: var(--muted); }
.t-hint { font-size: 15px; color: var(--muted); }

.input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
  font: 400 19px/1.2 var(--font-ui);
  user-select: text;
}

.input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.btn-small { min-height: 40px; padding: 0 12px; font-size: 16px; }

.t-danger { color: var(--wrong); border-color: var(--wrong); }
.t-danger:active { background: var(--wrong); color: var(--paper); }

.t-note a, .t-foot a { font-weight: 700; }
.t-foot { margin: 28px 0 0; text-align: center; }

/* ── Students (parent settings) ─────────────────────────────────────────── */

.t-students { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.t-students .btn { min-height: 48px; font-size: 18px; text-decoration: none; }

/* The chosen student, above their tabs: name and coins, and the button that signs them in here. */
.t-student {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 28px;
  padding-top: 28px;
}

.t-student h2 { margin: 0 0 4px; font: 700 28px/1.2 var(--font-ui); overflow-wrap: anywhere; }
.t-open { flex: 0 1 340px; }
.t-open .btn { width: 100%; }
.t-open .t-note { margin-top: 8px; font-size: 15px; }

/* One tab per part of a student's settings; on a phone the icons sit above the words. */
.t-tablist {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 24px;
  border-bottom: var(--rule) solid var(--ink);
}

.tutor a.t-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  padding: 8px 10px;
  color: var(--muted);
  font: 700 18px/1.15 var(--font-ui);
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.t-tab svg.glyph { flex: none; width: 24px; height: 24px; }
.tutor a.t-tab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -6px 0 var(--ink); }
.t-tab:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

@media (hover: hover) {
  .tutor a.t-tab:hover { color: var(--ink); }
}

@media (max-width: 600px) {
  .t-tablist { grid-template-columns: repeat(4, auto); }
  .tutor a.t-tab { flex-direction: column; justify-content: flex-start; gap: 4px; min-height: 76px; padding: 10px 4px 12px; font-size: 15px; }
}

.t-panel { padding: 24px 0 28px; }

/* Deleting sits apart from the form above it. */
.t-delete { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--grid); }
.t-delete .t-note { margin: 12px 0; }

/* ── Difficulty ─────────────────────────────────────────────────────────── */

.t-digits { width: 100%; max-width: 560px; border-collapse: collapse; }
.t-digits th, .t-digits td { padding: 8px 0; text-align: left; vertical-align: middle; }
.t-digits :is(th, td) + :is(th, td) { padding-left: 12px; }
.t-digits thead th { font-size: 16px; font-weight: 400; color: var(--muted); }
.t-digits tbody tr { border-top: 1px solid var(--grid); }
.t-digits tbody th { font-size: 19px; white-space: nowrap; }
.t-digits .input { min-width: 76px; cursor: pointer; }
.t-sign { display: inline-block; width: 1.4em; font-family: var(--font-num); }
.t-note { margin: 12px 0 0; font-size: 16px; color: var(--muted); }

/* ── Messages ───────────────────────────────────────────────────────────── */

.t-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.t-add .t-field { flex: 1 1 320px; margin: 0; }
.t-count { margin-left: 6px; font-size: 14px; }

.t-messages { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--grid); }

.t-messages li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grid);
}

.t-text { flex: 1; font-size: 19px; overflow-wrap: anywhere; }
.t-empty { margin: 18px 0 0; color: var(--muted); }

/* ── Colours ────────────────────────────────────────────────────────────── */

.t-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
}

.t-mode { min-width: 0; margin: 0; padding: 0; border: 0; }
.t-mode legend { margin-bottom: 12px; padding: 0; font: 700 20px/1.2 var(--font-ui); }

.t-swatch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 17px;
}

.t-swatch input[type="color"] {
  width: 64px;
  height: 44px;
  padding: 3px;
  background: var(--paper);
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

.t-contrast { min-height: 1.3em; margin: 10px 0 0; font-size: 16px; color: var(--muted); }
.t-contrast.is-warning { color: var(--wrong); }

.t-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }

/* A miniature problem drawn with the chosen colours; its tokens are set inline per mode. */
.preview {
  --grid: color-mix(in srgb, var(--ink) 18%, var(--paper));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px 20px;
  background: var(--paper);
  color: var(--ink);
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
}

.pv-sheet {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(4, 44px);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  box-shadow: inset -1px -1px 0 var(--grid);
  font: 700 34px/1 var(--font-num);
}

.pv-sheet > span { display: grid; place-items: center; }
.pv-sheet > :nth-child(n + 4):nth-child(-n + 6) { box-shadow: inset 0 -3px 0 var(--ink); }
.pv-sheet svg.glyph { width: 28px; height: 28px; stroke-width: 3; }

.pv-right { color: var(--right); }
.pv-wrong { color: var(--wrong); }

.pv-prize { display: flex; gap: 4px; }
.pv-prize .ico { width: 40px; height: 40px; }

/* ── The parent's account dialog ────────────────────────────────────────── */

.t-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px 24px 28px;
  background: var(--paper);
  color: var(--ink);
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
}

.t-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.t-dialog .t-form { max-width: none; }
.t-dialog .t-flash { margin: 0 0 16px; }

.t-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.t-dialog-head h2 { margin: 0; font: 700 24px/1.2 var(--font-ui); }
.t-dialog-head .btn { gap: 6px; }
.t-dialog-head svg.glyph { width: 20px; height: 20px; }

/* The page behind stays put while the dialog is open. */
body.tutor:has(.t-dialog[open]) { overflow: hidden; }

/* ── Admin: invitations and accounts ────────────────────────────────────── */

.t-list { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--grid); }

.t-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grid);
}

.t-list > li.is-new { box-shadow: inset 4px 0 0 var(--right); padding-left: 14px; }

.t-item { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.t-item strong { font-size: 19px; overflow-wrap: anywhere; }
.t-meta { margin: 0; font-size: 16px; color: var(--muted); overflow-wrap: anywhere; }
.t-link { min-height: 44px; margin-top: 4px; font-size: 15px; }
.t-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.t-card { margin-top: 20px; padding: 16px 18px; border: var(--rule) solid var(--ink); border-radius: var(--radius); }
.t-card h3 { margin: 0 0 4px; font: 700 21px/1.2 var(--font-ui); overflow-wrap: anywhere; }
.t-card .t-list { margin-top: 12px; }
.t-card > .t-edit { margin-top: 12px; }

/* Edit forms fold away; opened, one takes the whole row under its account. */
.t-edit > summary { list-style: none; display: inline-flex; }
.t-edit > summary::-webkit-details-marker { display: none; }
.t-edit[open] { flex-basis: 100%; }
.t-edit[open] > summary { margin-bottom: 14px; }
.t-edit .t-form { margin-top: 4px; }
