/* The app (/app/): a calm, modern look on top of board.css, for students of fifteen and sixteen. Mobile first (a phone is 360 to 430 px wide);
   on a tablet or a desktop the same app is a centred column.

   Typography (DESIGN.md 11.2): the font is Vazirmatn through var(--font) (declared in board.css; no other family is named here), code and
   codes use var(--mono); weights 400 text, 500 labels, 600 to 700 headings and buttons; no letter-spacing on Persian text; body text 16 px
   or more, inputs 16 px or more. Every text colour has at least 4.5:1 against its background; a colour is never the only signal (there is
   always a word, a mark or a shape too); `prefers-reduced-motion` switches the movement off.
   No inline style is used anywhere: the scripts set classes, and the few numbers (a bar's width) through element.style. */

:root {
  /* board.css variables, re-coloured for the app: the shared pieces (problem cards, reports, the road) follow */
  --accent: #3a3fd1;
  --accent-dark: #2a2ca3;
  --accent-wash: #eceafd;
  --paper: #f5f4f0;
  --sheet: #ffffff;
  --ink: #1b2140;
  --ink-2: #4a5272;
  --rule: #e2ded3;
  --radius: 18px;
  /* the app's own */
  --sun: #ffc233;
  --sun-deep: #d99a00;
  --sun-wash: #fff3d1;
  --sun-ink: #7a4d00;
  --violet: #6c3fd6;
  --bad: #8a3b12;                 /* the shared «bad» (a returned try, a low closeness bar) is a burnt orange here, not an alarm red: an error is information (DESIGN.md 11.1) */
  --bad-wash: #fdeede;
  --mint-wash: #e1f5ea;
  --note-wash: #fff3d6;
  --note-ink: #5b3600;
  --shadow-1: 0 1px 2px rgba(27, 33, 64, .06), 0 5px 16px rgba(58, 63, 209, .08);
  --shadow-2: 0 2px 4px rgba(27, 33, 64, .08), 0 14px 30px rgba(42, 44, 163, .16);
  --gutter: 16px;
  --col: 560px;
  --top-h: 56px;
  --tab-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + var(--safe-top) + 16px); }
body.app {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink);
  overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent;
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.app :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app .view:focus, .app .view:focus-visible { outline: none; }        /* the screen takes the focus when it opens (for screen readers); it is not a control, so no ring around the whole page */
.app .topbar :focus-visible { outline-color: #fff; }
.app .station-strip :focus-visible { outline-color: var(--ink); }

/* on a wide screen the app is a column in the middle of a soft background */
@media (min-width: 700px) {
  body.app { background: #e9e7e0; }
  .app-root { box-shadow: 0 0 0 1px rgba(27, 33, 64, .06), 0 24px 60px rgba(27, 33, 64, .16); }
}
.app-root { max-width: var(--col); margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--paper); position: relative; display: flex; flex-direction: column; }

/* the old shared banners are replaced by the app's own */
.app .offline { display: none; }
.app .toast { bottom: calc(var(--safe-bottom) + 16px); border-radius: 14px; box-shadow: var(--shadow-2); max-width: min(92vw, 480px); text-align: center; line-height: 1.7; font-weight: 500; font-size: 1rem; }
.app .toast.bad { background: var(--ink); border-inline-start: 6px solid #ffb347; }
.app.has-tabs .toast { bottom: calc(var(--tab-h) + var(--safe-bottom) + 14px); }
.toast { animation: toast-in .25s var(--ease); }

/* =============================================================== top bar */
.topbar {
  position: sticky; top: 0; z-index: 40; color: #fff;
  padding-top: var(--safe-top); background: linear-gradient(120deg, #3a3fd1 0%, #5238d6 60%, #6c3fd6 100%);
  box-shadow: 0 4px 16px rgba(42, 44, 163, .24);
}
.topbar-in { display: flex; align-items: center; gap: 10px; min-height: var(--top-h); padding: 6px var(--gutter); max-width: var(--col); margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; margin-inline-end: auto; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; min-height: 44px; }
.site-links { text-align: center; color: var(--ink-2); margin: 18px 0 0; }
.site-link { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.conn { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: .95rem; font-weight: 500; }
.conn .dot { width: 10px; height: 10px; border-radius: 50%; background: #5ff2a8; box-shadow: 0 0 0 3px rgba(95, 242, 168, .28); }
.conn.off { background: #fff1d6; color: var(--note-ink); }
.conn.off .dot { background: var(--note-ink); border-radius: 2px; box-shadow: none; }       /* a square, not a round dot: the shape differs too */
.icon-btn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; min-height: 48px; padding: 0; border: 0; border-radius: 14px;
  background: transparent; color: inherit; cursor: pointer;
}
.app .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.inline { width: 1.1em; height: 1.1em; vertical-align: -.18em; }
.icon-back { width: 20px; height: 20px; }

/* the station strip: permanent while the phone is a station */
.station-strip { position: sticky; top: calc(var(--top-h) + var(--safe-top)); z-index: 39; background: var(--sun); color: var(--ink); box-shadow: 0 3px 10px rgba(122, 77, 0, .22); }
.strip-in { display: flex; align-items: center; gap: 10px; max-width: var(--col); margin: 0 auto; padding: 5px var(--gutter); min-height: 46px; }
.strip-name { font-size: 1.1rem; font-weight: 700; }
.strip-note { flex: 1; font-size: .95rem; line-height: 1.5; }
body.is-station { --strip-h: 46px; }

/* banners under the bar */
.banners { position: sticky; top: calc(var(--top-h) + var(--safe-top) + var(--strip-h, 0px)); z-index: 38; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px var(--gutter); font-weight: 500; line-height: 1.6; animation: drop-in .3s var(--ease); }
.banner-text { flex: 1; }
.banner-info { background: var(--accent-wash); color: var(--accent-dark); }
.banner-good { background: #d8f5e4; color: #0f5a2d; }
.banner-warn { background: var(--note-wash); color: var(--note-ink); }
.banner-bad { background: var(--note-wash); color: var(--note-ink); }
.banner .btn { white-space: nowrap; }
.banner-x { width: 44px; height: 44px; min-height: 44px; }
.app .banner .icon-btn:hover:not(:disabled) { background: rgba(27, 33, 64, .08); }

/* =============================================================== the screen */
.view { flex: 1; width: 100%; padding: 16px var(--gutter) 28px; outline: none; }
body.has-tabs .view { padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 28px); }
.view > * { animation: rise .35s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > *:nth-child(3) { animation-delay: .08s; }
.view > *:nth-child(4) { animation-delay: .12s; }
.center { text-align: center; }
.center:has(> .btn, > button, > .button) { text-align: left; }          /* a box that only holds a button: the button goes to the left like every other button */
.page-head { margin: 4px 0 14px; }
.page-title { font-size: 1.55rem; font-weight: 700; line-height: 1.45; }
.lead { color: var(--ink-2); font-size: 1rem; margin-block: 6px 12px; line-height: 1.8; }
.hint { color: var(--ink-2); font-size: .95rem; margin-block: 6px; line-height: 1.8; }
.sub-title { font-size: 1.05rem; font-weight: 600; margin-block: 16px 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding-inline-end: 12px; color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.bullets { margin: 6px 0; padding-inline-start: 22px; line-height: 1.9; }
.links-row { margin-top: 8px; }

.app .card {
  background: var(--sheet); border: 0; border-radius: var(--radius); padding: 18px; margin-block-end: 14px; box-shadow: var(--shadow-1);
}
.app .card h2 { font-size: 1.15rem; font-weight: 700; margin-block-end: 8px; line-height: 1.5; }
.app .notice { border-radius: 14px; line-height: 1.8; }
.app .notice.warn, .app .notice.bad { background: var(--note-wash); color: var(--note-ink); }
.notice-soft { background: var(--note-wash); color: var(--note-ink); }
.empty-state { text-align: center; padding: 14px 6px; color: var(--ink-2); }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; margin-bottom: 4px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-dark); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty { color: var(--ink-2); padding: 8px 2px; }

/* =============================================================== buttons */
.app button { font-family: inherit; }
/* the shared styles (board.css) set a few things smaller than the 16 px of DESIGN.md 11.2: in the app they are not */
.app .concept { font-size: .95rem; }
.app code.inline { font-size: 1em; }
.app .badge, .app .example h3, .app .example .label, .app .codeview .cl-note, .app .codeview .py, .app .cam-side, .app table.results th { font-size: .95rem; }
.app dt, .app .spec dt, .app .closeness, .app .who { font-weight: 700; }
.app .jr.jr-sm { --jr-title: 17px; --jr-name: 17px; }          /* the road of the kit on a phone: its text sizes were 13 to 16 px */
.app .jr-hint { font-size: 1rem; }
.app strong, .app b { font-weight: 700; }                    /* not "bolder": inside a heading that would be 900 */
.app small { font-size: .95rem; }
.app .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px; padding: 8px 22px; border: 0; border-radius: 14px;
  font-size: 1rem; font-weight: 600; line-height: 1.5; text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  background: var(--accent-wash); color: var(--accent-dark); touch-action: manipulation;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .15s;
}
.app .btn:hover:not(:disabled) { background: #dcd8fb; }
.app .btn:active:not(:disabled) { transform: translateY(1px); }
.app .btn-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark), 0 8px 16px rgba(58, 63, 209, .2); }
.app .btn-primary:hover:not(:disabled) { background: #4a4fe0; }
.app .btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--accent-dark), 0 4px 8px rgba(58, 63, 209, .18); }
.app .btn-sun { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--sun-deep), 0 8px 16px rgba(217, 154, 0, .24); }
.app .btn-sun:hover:not(:disabled) { background: #ffcf5c; }
.app .btn-sun:active:not(:disabled) { box-shadow: 0 1px 0 var(--sun-deep); }
.app .btn-danger { background: var(--bad-wash); color: var(--bad); }
.app .btn-danger:hover:not(:disabled) { background: #fadfc3; }
.app .btn-light { background: #fff; color: var(--ink); box-shadow: 0 2px 0 rgba(27, 33, 64, .22); }
.app .btn-light:hover:not(:disabled) { background: #fff8e6; }
.app .btn-quiet { background: var(--accent-wash); color: var(--accent-dark); }
.app .btn-big { min-height: 56px; font-size: 1.1rem; padding-inline: 28px; border-radius: 16px; }
.app .btn-small { min-height: 44px; padding: 4px 16px; font-size: .95rem; border-radius: 12px; }
.app .btn-block { display: flex; width: 100%; }
.app .btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn .icon { width: 1.25em; height: 1.25em; }
.btn.busy .btn-text::before {
  content: ""; display: inline-block; width: .9em; height: .9em; margin-inline-end: .5em; vertical-align: -.1em; border-radius: 50%;
  border: 3px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-block: 10px; }      /* the END of a right-to-left row is the left: buttons sit there */
.row.between { justify-content: space-between; }
.row.center { justify-content: flex-end; }
.links-row, .choices, .tiles { display: grid; gap: 12px; }

/* =============================================================== forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field-label { font-weight: 500; }
.field-hint { margin: 0; color: var(--ink-2); font-size: .95rem; line-height: 1.8; }
.field-error { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--note-wash); color: var(--note-ink); font-weight: 500; line-height: 1.7; }
.field-error .icon { margin-top: .35em; color: #9a5b00; flex: none; }
.app input[type="text"], .app input[type="password"], .app input[type="search"], .app textarea {
  font: inherit; font-size: 1rem; width: 100%; min-height: 52px; padding: 10px 14px; border: 2px solid var(--rule); border-radius: 14px; background: #fff; color: var(--ink);
}
.app input:focus, .app textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(58, 63, 209, .18); }
.app input[aria-invalid="true"], .app textarea[aria-invalid="true"] { border-color: #b45f06; }
.app ::placeholder { color: #6b7391; opacity: 1; }
.code-input { text-align: center; font-size: 1.9rem; font-weight: 600; min-height: 66px; direction: ltr; font-variant-numeric: tabular-nums; }
.code-row { display: flex; align-items: center; gap: 8px; }
.code-row .code-input { flex: 1; min-width: 0; }
.eye { background: var(--accent-wash); color: var(--accent-dark); border: 0; }
.app .eye:hover:not(:disabled) { background: #dcd8fb; }
.dots { display: flex; justify-content: center; gap: 12px; margin: 2px 0; }
.dot-slot { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--rule); background: transparent; transition: background .15s, border-color .15s, transform .15s var(--ease); }
.dot-slot.on { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.check { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 6px 2px; font-weight: 500; line-height: 1.8; cursor: pointer; }
.check input { width: 26px; height: 26px; min-height: 26px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.consent { font-weight: 400; font-size: .95rem; background: var(--accent-wash); border-radius: 14px; padding: 10px 12px; }
.why { margin: 0; min-height: 1.7em; color: var(--ink-2); font-size: .95rem; text-align: center; line-height: 1.8; }
.why.ready { color: #0f5a2d; font-weight: 500; }
.counter { color: var(--ink-2); font-size: .95rem; margin: 0; }
.optional { color: var(--ink-2); font-weight: 400; font-size: .95rem; }

/* =============================================================== first screens (start, join, login, register) */
.hero-plain { text-align: center; padding: 12px 0 6px; }
.hero-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; margin-bottom: 8px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-dark); box-shadow: inset 0 0 0 3px #fff, var(--shadow-1); }
.hero-icon .icon { width: 36px; height: 36px; }
.hero-icon.good { background: #d8f5e4; color: #0f5a2d; }
.hero-icon.pop { animation: pop .6s var(--ease) both; }
.hero-icon.waiting-icon { animation: sway 3.2s ease-in-out infinite; }
.hero-title { font-size: 1.6rem; font-weight: 700; line-height: 1.5; }
.choice {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 18px; border-radius: var(--radius); text-decoration: none;
  background: #fff; color: var(--ink); box-shadow: var(--shadow-1); border: 2px solid transparent;
  transition: transform .15s var(--ease), box-shadow .15s;
}
.choice:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.choice:active { transform: translateY(1px); }
.choice-primary { background: linear-gradient(120deg, #3a3fd1, #6c3fd6); color: #fff; }
.choice-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-dark); flex: none; }
.choice-primary .choice-icon { background: rgba(255, 255, 255, .22); color: #fff; }
.choice-text { display: grid; gap: 2px; line-height: 1.6; }
.choice-text strong { font-size: 1.1rem; font-weight: 700; }
.choice-text small { font-size: .95rem; opacity: .92; }
.ticket-card { text-align: center; }

.stepper { display: flex; justify-content: center; gap: 0; list-style: none; margin: 0 0 8px; padding: 0; }
.stepper li { display: grid; justify-items: center; gap: 4px; width: 90px; position: relative; font-size: .95rem; color: var(--ink-2); font-weight: 500; }
.stepper li + li::before { content: ""; position: absolute; top: 15px; inset-inline-end: 50%; width: 100%; height: 3px; background: var(--rule); z-index: 0; }
.stepper li.done + li::before, .stepper li.current::before { background: var(--accent); }
.step-dot { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 3px solid var(--rule); font-weight: 700; }
.stepper li.current .step-dot { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 5px rgba(58, 63, 209, .18); }
.stepper li.current { color: var(--accent-dark); }
.stepper li.done .step-dot { border-color: #17703a; background: #17703a; color: #fff; }

.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; }
.app .avatar-pick {
  display: grid; justify-items: center; gap: 4px; padding: 6px 2px 4px; min-height: 92px; border: 0; border-radius: 18px; background: transparent; color: var(--ink); cursor: pointer;
  transition: transform .15s var(--ease), background .15s;
}
.app .avatar-pick:hover:not(:disabled) { background: var(--accent-wash); transform: translateY(-2px); }
.avatar-emoji { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--accent-wash); font-size: 2rem; line-height: 1; border: 3px solid transparent; transition: border-color .15s, transform .2s var(--ease), box-shadow .15s; }
.avatar-name { font-size: .95rem; color: var(--ink-2); line-height: 1.4; font-weight: 500; }
.avatar-pick.on .avatar-emoji { border-color: var(--accent); transform: scale(1.1); box-shadow: 0 0 0 4px rgba(58, 63, 209, .2); }
.avatar-pick.on .avatar-name { color: var(--accent-dark); font-weight: 600; }
.avatar-pick.on .avatar-name::before { content: "✓ "; }
.selfie-preview { display: grid; place-items: center; width: 132px; height: 132px; margin: 6px auto 12px; border-radius: 50%; overflow: hidden; background: var(--accent-wash); border: 3px dashed #aab0f0; color: var(--accent-dark); }
.selfie-preview.has-photo { border-style: solid; border-color: var(--accent); }
.selfie-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.selfie-placeholder { width: 52px; height: 52px; }
.selfie .row { justify-content: flex-end; }
.nav-row { display: flex; gap: 10px; justify-content: space-between; margin: 6px 0; }
.nav-row .btn-primary { flex: 1; }
.summary { text-align: center; }
.summary-name { font-size: 1.5rem; margin-top: 10px; }
.summary .av { margin-inline: auto; }

.waiting { padding-block: 26px; }
.waiting .hero-icon { margin-bottom: 10px; }
.wait-steps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 6px; text-align: start; max-width: 300px; margin-inline: auto; }
.wait-steps li { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.wait-steps li::before { content: "○"; font-weight: 700; width: 1.4em; text-align: center; }
.wait-steps li.done { color: #0f5a2d; }
.wait-steps li.done::before { content: "✓"; }
.wait-steps li.now { color: var(--ink); font-weight: 600; }
.wait-steps li.now::before { content: "●"; color: var(--accent); animation: blink 1.4s ease-in-out infinite; }
.reason { margin: 12px 0; padding: 12px 16px; border-radius: 14px; background: var(--note-wash); color: var(--note-ink); text-align: start; font-weight: 500; line-height: 1.8; }
.happy { padding-block: 24px; }
.code-card { padding-block: 24px; }
.code-card h1 { font-size: 1.35rem; line-height: 1.6; }
.secret-code { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.secret-digit { display: inline-grid; place-items: center; width: 52px; height: 72px; border-radius: 14px; background: var(--accent-wash); border: 3px solid var(--accent); color: var(--accent-dark); font-size: 2.4rem; font-weight: 700; box-shadow: 0 3px 0 var(--accent-dark); animation: pop .5s var(--ease) both; }
.secret-digit:nth-child(2) { animation-delay: .06s; }
.secret-digit:nth-child(3) { animation-delay: .12s; }
.secret-digit:nth-child(4) { animation-delay: .18s; }
.secret-digit:nth-child(5) { animation-delay: .24s; }

/* =============================================================== home */
.hero-card {
  position: relative; overflow: hidden; margin-bottom: 14px; padding: 20px 18px 18px; border-radius: 24px; color: #fff;
  background: linear-gradient(135deg, #3a3fd1 0%, #5a3dd6 55%, #6c3fd6 100%); box-shadow: var(--shadow-2);
}
.hero-card::before, .hero-card::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); pointer-events: none; }
.hero-card::before { width: 180px; height: 180px; top: -70px; inset-inline-start: -50px; }
.hero-card::after { width: 120px; height: 120px; bottom: -50px; inset-inline-end: -30px; }
.hero-card > * { position: relative; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-avatar .av { --av: 88px; }
.hero-hello { margin: 0; font-size: 1rem; opacity: .95; }
.hero-name { font-size: 1.6rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.hero-stop { margin: 2px 0 0; font-weight: 600; font-size: 1.05rem; background: rgba(16, 16, 70, .32); display: inline-block; padding: 1px 12px; border-radius: 999px; }
.hero-place { display: flex; align-items: center; gap: 6px; margin: 12px 0 8px; font-size: 1rem; font-weight: 500; }
.hero-place .icon { width: 1.2em; height: 1.2em; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-end { font-size: 1.5rem; line-height: 1; flex: none; min-width: 1.5rem; display: inline-grid; place-items: center; color: var(--accent-dark); }
.progress-end .ic, .stop-emoji .ic, .hero-stop .ic, .stop-line .ic { width: 1em; height: 1em; vertical-align: -.15em; }
.hero-stop .ic { color: inherit; }
.progress { flex: 1; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, .26); overflow: hidden; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .18); }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ffe27a, #ffb800); box-shadow: 0 0 12px rgba(255, 210, 80, .8); transition: width 1.1s var(--ease); position: relative; overflow: hidden; }
.progress-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .5) 50%, transparent 80%); transform: translateX(-100%); animation: shine 2.8s ease-in-out 1.2s infinite; }
.progress-note { margin: 8px 0 0; font-weight: 600; font-size: 1.05rem; text-align: center; line-height: 1.7; }
.hero-points { margin: 2px 0 0; text-align: center; font-size: .95rem; opacity: .95; }
.hero-pending { margin: 8px 0 0; padding: 6px 12px; border-radius: 12px; background: rgba(16, 16, 70, .34); font-size: .95rem; line-height: 1.7; }       /* dark, like the line with the stop: white on it stays above 4.5:1 on every part of the hero */
.home-grid { display: block; }
.statement-preview { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); margin-block: 6px 12px; white-space: normal; }
.problem-name { font-size: 1.05rem; font-weight: 600; margin: 0 0 6px; }
.here-card { text-align: center; }
.here-card.is-here { background: var(--mint-wash); box-shadow: none; }
.here-ok { margin: 0; font-weight: 600; color: #0f5a2d; }
.here-tick { display: inline-block; animation: pop .5s var(--ease) both; }
.latest .who { font-weight: 600; margin: 0; }
.reason-line { margin: 6px 0; line-height: 1.8; }
.medal-mini-list { list-style: none; margin: 4px 0 12px; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.medal-mini { display: grid; justify-items: center; gap: 4px; width: 76px; text-align: center; }
.medal-mini-title { font-size: .95rem; font-weight: 500; line-height: 1.5; }

.medal-grid { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.medal { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 14px 10px 12px; text-align: center; border-radius: 16px; background: var(--sun-wash); }
.medal.locked { background: #eeece6; }
.medal-title { font-weight: 600; font-size: 1rem; line-height: 1.5; }
.medal-date { font-size: .95rem; font-weight: 500; color: #0f5a2d; }
.medal-how { font-size: .95rem; color: var(--ink-2); line-height: 1.7; }
.medal-how:empty { display: none; }
.tier-legend { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 8px; }
.tier-legend li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.tier-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-dark); font-weight: 600; font-size: .95rem; }
.tier-rule { font-size: .95rem; color: var(--ink-2); line-height: 1.7; }
.badge-wall { list-style: none; margin: 12px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
.badge-ring { display: grid; justify-items: center; gap: 2px; text-align: center; }
.ring { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; border: 6px solid var(--rule); background: #fff; font-size: 1.5rem; line-height: 1; }
.badge-ring.tier-bronze .ring { border-color: #c27a3f; }
.badge-ring.tier-silver .ring { border-color: #9aa5b8; }
.badge-ring.tier-gold .ring { border-color: #f2b705; box-shadow: 0 0 0 3px #fff3c2; }
.badge-ring.none .ring { border-style: dashed; color: var(--ink-2); }
.concept-name { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.tier-name { font-size: .95rem; color: var(--ink-2); }
.stops { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
.stop { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #f8f7f3; border: 2px solid transparent; }
.stop.past { background: var(--mint-wash); }
.stop.here { background: var(--accent-wash); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(58, 63, 209, .12); }
.stop.future .stop-emoji { filter: grayscale(.8) opacity(.65); }
.stop-emoji { font-size: 2rem; width: 46px; text-align: center; flex: none; display: inline-grid; place-items: center; color: var(--accent-dark); }
.stop-text { display: grid; gap: 1px; flex: 1; line-height: 1.6; }
.stop-place { font-size: .95rem; color: var(--ink-2); }
.stop-hint { font-size: .95rem; color: var(--ink-2); }
.stop-next { font-size: .95rem; color: var(--accent-dark); font-weight: 600; }
.here-tag { flex: none; padding: 3px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: .95rem; }
.past-tag { flex: none; color: #0f5a2d; font-weight: 700; font-size: 1.2rem; }

/* =============================================================== avatar and face (#/me/face) */
.hero-avatar-slot { flex: none; }
.hero-avatar-edit { position: relative; display: block; border-radius: 50%; color: inherit; text-decoration: none; }
.hero-avatar-edit:focus-visible { outline-color: #fff; outline-offset: 4px; }
.edit-badge { position: absolute; bottom: -2px; inset-inline-end: -4px; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--accent-dark); box-shadow: 0 2px 6px rgba(27, 33, 64, .35); transition: transform .15s var(--ease); }
.edit-badge .icon { width: 18px; height: 18px; }
.hero-avatar-edit:hover .edit-badge { transform: scale(1.08); }
.face-picker { margin-block: 6px 14px; }
.face-now { display: flex; align-items: center; gap: 14px; margin-block: 4px 10px; }
.face-preview { flex: none; }
.face-preview .av { --av: 96px; }
.face-status { flex: 1; margin: 0; line-height: 1.8; }
.face-buttons { margin-block: 6px; }
.face-new { margin-top: 14px; padding-top: 8px; border-top: 2px dashed var(--rule); display: grid; gap: 8px; }
.face-new[hidden] { display: none; }
.face-new .sub-title { margin-block: 6px 0; }
.face-new .why { min-height: 0; }

/* =============================================================== practice */
.fold { margin-bottom: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.fold > summary { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 16px; cursor: pointer; list-style: none; font-weight: 600; }
.fold > summary::-webkit-details-marker { display: none; }
.fold-title { flex: 1; }
.fold-chevron { transition: transform .2s var(--ease); }
.fold[open] .fold-chevron { transform: rotate(180deg); }
.fold .problem { border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 0 16px 16px; }
.fold[open] .problem > h2 { display: none; }
.empty-card { text-align: center; }
.try-card { border-inline-start: 6px solid var(--rule); scroll-margin-top: calc(var(--top-h) + var(--safe-top) + 16px); }
.try-waiting { border-inline-start-color: #d99a00; }
.try-approved { border-inline-start-color: var(--accent); }
.try-compiled { border-inline-start-color: #17703a; }
.try-returned { border-inline-start-color: #b45f06; }              /* a returned try is information, not an alarm: the burnt orange of the kit's low closeness bar */
.try-card:focus { outline: none; }
.try-card.flash { animation: flash 1.4s ease-out 1; }
.try-head, .item-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 8px; }
.try-head .when { margin-inline-start: auto; color: var(--ink-2); font-size: .95rem; }
.who { font-weight: 600; }
.status-steps { list-style: none; margin: 8px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .95rem; }
.status-steps li { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.status-steps li.done { color: #0f5a2d; font-weight: 500; }
.status-steps li.now { color: var(--ink); font-weight: 600; }
.status-steps li.now .step-mark { color: var(--accent); animation: blink 1.4s ease-in-out infinite; }
.try-note { margin: 6px 0; line-height: 1.8; }
.said { margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: #f1f4ff; line-height: 1.8; }
.report { margin-top: 6px; }
.app .codeview { border-radius: 14px; max-height: 50vh; font-size: .95rem; }
.app .machine, .app .coach { border-radius: 14px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 16px; background: var(--accent-wash); margin-bottom: 12px; }
.app .seg { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; color: var(--accent-dark); font-weight: 600; font-size: 1rem; cursor: pointer; transition: background .15s, box-shadow .15s; }
.app .seg:hover:not(:disabled) { background: rgba(255, 255, 255, .6); }
.app .seg.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(58, 63, 209, .22); }
.panel[hidden] { display: none !important; }
.kb-hint { margin-top: 0; }
.editor { display: flex; direction: ltr; border: 2px solid var(--rule); border-radius: 16px; background: #fff; overflow: hidden; }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(58, 63, 209, .18); }
.gutter { margin: 0; padding: 12px 10px 12px 12px; min-width: 3em; text-align: right; color: #5b6485; background: #f4f2ec; border-right: 1px solid var(--rule); font-family: var(--mono); font-size: 16px; line-height: 1.6; user-select: none; -webkit-user-select: none; overflow: hidden; }
.app .code-area { flex: 1; min-width: 0; min-height: 0; border: 0; border-radius: 0; padding: 12px 12px; font-family: var(--mono); font-size: 16px; line-height: 1.6; direction: ltr; text-align: left; white-space: pre; overflow: auto; tab-size: 4; resize: none; box-shadow: none; }
.app .code-area:focus { box-shadow: none; }
.ltr-counter { direction: rtl; text-align: end; margin-top: 4px; }
.symbols { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 2px 4px; direction: ltr; }   /* two rows on a phone: every key in sight (the «=» used to sit past the edge) */
.symbols::-webkit-scrollbar { display: none; }
.app .symbol { flex: none; width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0; border: 0; border-radius: 12px; background: var(--accent-wash); color: var(--accent-dark); font-size: 1.3rem; font-weight: 600; cursor: pointer; display: inline-grid; place-items: center; touch-action: manipulation; }
.app .symbol:hover:not(:disabled) { background: #dcd8fb; }
.app .symbol:active { transform: translateY(1px); }
.symbol code { font-family: var(--mono); background: none; color: inherit; font-size: 1.3rem; }
@media (hover: hover) and (pointer: fine) { .symbols, .kb-hint { display: none; } }
@media (hover: none), (pointer: coarse) { .desk-hint { display: none; } }
.shot-box { margin: 8px 0 12px; border-radius: 16px; overflow: hidden; background: #0e1424; }
.shot { display: block; width: 100%; max-height: 55vh; object-fit: contain; }
.explain { margin-top: 12px; display: grid; gap: 6px; }
.explain-area { min-height: 64px; line-height: 1.8; resize: vertical; }
.explain-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mic-note { margin: 0; }
.app .btn.listening { background: var(--note-wash); color: var(--note-ink); box-shadow: 0 0 0 4px rgba(255, 179, 71, .45); animation: pulse 1.4s ease-in-out infinite; }
.compose .btn-block { margin-top: 14px; }
.send-why { margin-top: 10px; }
.retry-note { margin-block: 0 12px; }

/* =============================================================== road, works */
.road-card { padding: 10px; }
.journey-box { min-height: 120px; }
.here-row { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 14px; }
.here-person { display: grid; justify-items: center; gap: 4px; width: 64px; text-align: center; }
.here-name { font-size: .95rem; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.here-person.me .here-name { color: var(--accent-dark); }
.here-person.me .here-name::after { content: " (تو)"; }
.feed-list { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 8px; }
.feed-item { display: grid; gap: 2px; padding: 10px 14px; border-radius: 14px; background: #f8f7f3; border-inline-start: 5px solid var(--accent); line-height: 1.8; }
.feed-level { border-inline-start-color: #6c3fd6; }
.feed-medal, .feed-award, .feed-badge { border-inline-start-color: #d99a00; }
.feed-arrived, .feed-joined { border-inline-start-color: #17703a; }
.feed-time { color: var(--ink-2); font-size: .95rem; }
.wall-item { margin-top: 10px; border: 2px solid var(--rule); border-radius: 16px; padding: 4px 12px 12px; background: #fff; }
.wall-item > summary { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; min-height: 48px; padding-block: 8px; cursor: pointer; font-weight: 600; }
.wall-title { color: var(--ink-2); font-weight: 400; font-size: .95rem; }
.plain-road { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plain-road li { display: flex; justify-content: space-between; }
.group .hint { margin-top: 0; }
.tries { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.try-fold { border: 2px solid var(--rule); border-radius: 16px; background: #fff; overflow: hidden; }
.try-fold[open] { border-color: #c9cdf5; }
.try-fold > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 52px; padding: 8px 14px; cursor: pointer; list-style: none; }
.try-fold > summary::-webkit-details-marker { display: none; }
.try-fold > summary .when { color: var(--ink-2); font-size: .95rem; }
.try-fold > summary .fold-chevron { margin-inline-start: auto; }
.try-fold[open] > summary .fold-chevron { transform: rotate(180deg); }
.try-body { padding: 4px 14px 14px; }
.mini-closeness { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .95rem; }
.mini-closeness .meter-bar i { width: 5px; height: 14px; }
.featured { color: var(--sun-ink); font-weight: 600; font-size: .95rem; }

/* =============================================================== station, teacher */
.station-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.app .station-pick { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 104px; min-width: 0; padding-inline: 2px; border: 3px solid var(--rule); border-radius: 20px; background: #fff; color: var(--ink); cursor: pointer; transition: transform .15s var(--ease), border-color .15s; }
.app .station-pick:hover:not(:disabled) { background: var(--accent-wash); transform: translateY(-2px); }
.app .station-pick.on { background: var(--sun); border-color: var(--sun-deep); }
.station-num { font-size: 2.4rem; font-weight: 700; line-height: 1.3; }
.station-word { font-size: .95rem; font-weight: 500; }
.station-pick.on .station-word::after { content: " ✓"; }
.hold-box { display: grid; gap: 6px; }
.btn.holding { background: linear-gradient(90deg, #f0c59a 0 100%) no-repeat var(--bad-wash); background-size: 0 100%; animation: hold 2s linear forwards; }
.hold-box .btn { touch-action: none; -webkit-touch-callout: none; }
.tiles { grid-template-columns: 1fr; margin-block-end: 14px; }
.tile { position: relative; display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 16px; border-radius: var(--radius); background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-1); transition: transform .15s var(--ease), box-shadow .15s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.tile-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--accent-wash); color: var(--accent-dark); flex: none; }
.tile-text { display: grid; gap: 2px; flex: 1; line-height: 1.6; }
.tile-text strong { font-weight: 600; }
.tile-text small { color: var(--ink-2); font-size: .95rem; }
.tile-count { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; background: var(--violet); color: #fff; font-weight: 700; }
.links-card { display: grid; gap: 4px; }
.link-row { display: flex; flex-direction: column; min-height: 56px; justify-content: center; padding: 6px 4px; color: var(--accent-dark); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--rule); }
.link-row:last-child { border-bottom: 0; }
.link-row small { color: var(--ink-2); font-weight: 400; font-size: .95rem; }
.pending-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pending-info { display: grid; }
.pending-name { font-size: 1.1rem; font-weight: 600; }
.pending-card { transition: opacity .25s, transform .25s var(--ease); }
.pending-card.leaving { opacity: 0; transform: translateX(40px); }
.mini-fold { margin: 8px 0; border: 2px solid var(--rule); border-radius: 14px; padding: 2px 12px 10px; }
.mini-fold > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.mini-fold > * + * { margin-top: 8px; }
.people-pick { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.app .person-pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 12px; border: 2px solid transparent; border-radius: 14px; background: #f8f7f3; color: var(--ink); text-align: start; cursor: pointer; justify-content: flex-start; }
.app .person-pick:hover:not(:disabled) { background: var(--accent-wash); }
.app .person-pick.on { border-color: var(--accent); background: var(--accent-wash); }
.person-text { display: grid; line-height: 1.5; flex: 1; }
.person-text small { color: var(--ink-2); }
.picked { color: #17703a; font-weight: 700; font-size: 1.3rem; }
.medal-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.app .medal-choice { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; min-height: 96px; border: 3px solid transparent; border-radius: 16px; background: var(--sun-wash); color: var(--ink); cursor: pointer; }
.app .medal-choice:hover:not(:disabled) { background: #ffe9a8; }
.app .medal-choice.on { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(58, 63, 209, .18); }
.medal-choice.on .medal-title::before { content: "✓ "; }
.medal-choice .medal-title { font-size: .95rem; }
.inbox-card .row { margin-block: 8px; }
.inbox-thumb { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: #0e1424; cursor: zoom-in; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.app .chip { min-height: 44px; padding: 4px 14px; border: 0; border-radius: 999px; background: var(--accent-wash); color: var(--accent-dark); font-weight: 500; font-size: .95rem; cursor: pointer; }

/* =============================================================== tabs */
.tabbar { position: fixed; left: 50%; bottom: 0; width: 100%; max-width: var(--col); transform: translateX(-50%); z-index: 40; background: #fff; box-shadow: 0 -4px 20px rgba(27, 33, 64, .12); padding-bottom: var(--safe-bottom); }
.tabbar-in { display: flex; max-width: var(--col); margin: 0 auto; }
.tab { position: relative; flex: 1; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tab-h); padding: 6px 4px; color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500; transition: color .15s; }
.tab .icon { width: 26px; height: 26px; transition: transform .2s var(--ease); }
.tab:hover { color: var(--accent-dark); }
.tab.active { color: var(--accent-dark); font-weight: 700; }
.tab.active .icon { transform: translateY(-2px) scale(1.1); }
.tab.active::before { content: ""; position: absolute; top: 0; width: 34px; height: 4px; border-radius: 0 0 6px 6px; background: var(--accent); }
.tab-badge { position: absolute; top: 7px; left: calc(50% + 9px); width: 12px; height: 12px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px #fff; animation: pulse 1.6s ease-in-out infinite; }

/* =============================================================== dialogs (the camera dialog of the kit has its own: .cam in board.css) */
dialog.app-sheet { border: 0; border-radius: 22px; padding: 20px; width: min(92vw, 420px); background: #fff; color: var(--ink); box-shadow: var(--shadow-2); animation: pop-in .25s var(--ease); }
dialog.app-sheet::backdrop { background: rgba(27, 33, 64, .55); }
dialog.app-sheet h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; line-height: 1.6; }
.app-sheet-text { color: var(--ink-2); line-height: 1.8; margin-block: 0 14px; }
.app-sheet-actions { display: grid; gap: 10px; }
.app-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.app-sheet-head .icon-btn { color: var(--ink); }
.app .app-sheet-head .icon-btn:hover:not(:disabled) { background: var(--accent-wash); }
dialog.app-menu { position: fixed; inset: calc(var(--top-h) + var(--safe-top) + 4px) auto auto max(8px, calc(50% - var(--col) / 2 + 8px)); margin: 0; padding: 8px 12px 12px; }        /* under the menu button (left in a right-to-left page), inside the column on a wide screen */
.app-menu-list { list-style: none; margin: 0; padding: 0; display: grid; }
.app .app-menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font-weight: 500; font-size: 1rem; text-align: start; cursor: pointer; justify-content: flex-start; }
.app .app-menu-item:hover:not(:disabled) { background: var(--accent-wash); }
.app-menu-note { padding: 10px; font-size: .95rem; color: var(--note-ink); line-height: 1.8; background: var(--note-wash); border-radius: 12px; margin-block: 4px; }
.app-menu-foot { margin: 8px 0 0; text-align: center; font-size: .95rem; color: var(--ink-2); }

/* =============================================================== loading */
.skeleton { border-radius: 24px; margin-bottom: 14px; background: linear-gradient(100deg, #ebe8df 30%, #f7f5ef 45%, #ebe8df 60%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.sk-hero { height: 220px; }
.sk-card { height: 120px; }

/* =============================================================== motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -300% 0; } }
@keyframes shine { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 122, .5); } 50% { box-shadow: 0 0 0 8px rgba(255, 138, 122, 0); } }
@keyframes sway { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(58, 63, 209, .55), var(--shadow-1); } 40% { box-shadow: 0 0 0 10px rgba(58, 63, 209, .22), var(--shadow-1); } 100% { box-shadow: 0 0 0 0 rgba(58, 63, 209, 0), var(--shadow-1); } }
@keyframes hold { from { background-size: 0 100%; } to { background-size: 100% 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .view > * { animation: none; }
}

/* a narrow phone: a little tighter */
@media (max-width: 380px) {
  :root { --gutter: 14px; }
  .secret-digit { width: 46px; height: 64px; font-size: 2.1rem; }
  .avatar-emoji { width: 52px; height: 52px; }
  .hero-avatar .av { --av: 76px; }
  .face-preview .av { --av: 80px; }
  .stepper li { width: 80px; }
}

/* the class buttons of the teacher menu (a board with several classes) */
.app .class-chips-row { gap: 8px; }
.app .class-chips-row .btn { min-width: 44px; min-height: 44px; }
.app .class-line { margin-block: 2px 0; }
.app .pick-list { display: grid; gap: 10px; }

/* ---- a desktop browser: the app fits the screen instead of staying a phone's column ----
   The frame (top bar, strip, tabs) widens to 1100 px. Reading screens keep a comfortable measure in the middle; the practice screen
   uses the width: the problem on the right, the editor and the verdict on the left, the problem staying in sight while one types. */
@media (min-width: 1000px) {
  :root { --col: 1100px; --gutter: 24px; }
  .view:not(.view-practice) > * { max-width: 820px; margin-inline: auto; }
  .view.view-practice { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 22px; align-items: start; }
  .view.view-practice > .slot:nth-child(2) { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: calc(var(--top-h) + var(--safe-top) + 46px + 12px); }
  .view.view-practice > .compose { grid-column: 2; grid-row: 1; }
  .view.view-practice > .slot:nth-child(3) { grid-column: 2; grid-row: 2; }
  .view.view-practice .fold { margin-bottom: 0; }
  .view.view-practice .fold[open] > .fold-body, .view.view-practice .fold[open] > :not(summary) { max-height: calc(100vh - var(--top-h) - 140px); overflow: auto; }
  .tabbar { border-radius: 18px 18px 0 0; }
}

/* the name picker of a classroom computer (open entry): a search box narrows the whole class to a few names */
.app .name-search-row { margin: 0 0 10px; }
.app .name-search-row input[type="search"] { width: 100%; }
.app .pick-list .field-error { margin: 0; }

/* a lone button in a row sits on the left (RTL: the end), like every lone button of the site; a pair stays centred */
.app .center:has(> .btn:only-child) { text-align: left; }
.app .hold-box .btn { margin-inline-start: 0; }

/* ---- the set on the practice screen: tabs to pick an open problem, its clock ---- */
.app .set-card { padding: 10px 14px; }
.app .set-hint { margin: 0 0 8px; }
.app .set-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.app .set-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px; border: 2px solid var(--rule); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer; }
.app .set-tab.on { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-dark); }
.app .set-tab.passed { border-color: #0f8a5a; }
.app .set-tab.bonus { border-style: dashed; }
.app .set-tab b { font-weight: 700; }
.app .set-tab-mark { font-size: .95rem; color: #0f8a5a; font-weight: 700; }
.app .set-tab-note { font-size: .95rem; padding: 0 6px; border-radius: 999px; background: var(--sun-wash); color: var(--sun-ink); }
.app .set-tab-clock { font-variant-numeric: tabular-nums; font-size: .95rem; color: var(--ink-2); }
.app .set-clock-line { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 4px 12px; border: 2px solid var(--accent-dark); border-radius: 12px; background: var(--accent-wash); font-weight: 700; color: var(--accent-dark); }   /* the time left in a frame of its own */
.app .set-clock-line.over { color: #8a1c4e; border-color: #8a1c4e; background: #fff0f5; }
.app .set-clock-line .hint { font-weight: 400; }

/* ---- help with a class problem: reminders, hints one at a time, the starter ---- */
.app .help-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.app .help-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.app .help-panel { margin-top: 10px; display: grid; gap: 10px; }
.app .help-panel[hidden] { display: none; }
.app .remind { padding: 10px 12px; border-radius: 12px; background: var(--accent-wash); }
.app .remind-title { margin: 0 0 4px; font-size: 1rem; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.app .remind-word { font-family: var(--mono); background: #fff; padding: 1px 8px; border-radius: 6px; }
.app .remind-link { font-size: .95rem; }
.app .remind-text { margin: 0 0 6px; line-height: 1.8; }
.app .remind-code { margin: 0; padding: 8px 10px; border-radius: 8px; background: #1b2140; color: #e8ecff; font-size: .95rem; white-space: pre; overflow-x: auto; text-align: left; }
.app .hint-step { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--sun-wash); color: var(--ink); line-height: 1.8; }
.app .step-chip { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; font-weight: 700; flex: none; }
.app .level-chip { font-size: .95rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.app .compose-title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin: 0 0 10px; }
.app .set-nudge { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--mint-wash); color: #0f5a2d; font-weight: 600; line-height: 1.7; }
