/* The colours of the Drawme app, dimmed a little so the screen is easy on the eyes */
:root {
  --background: #CBC4B4;
  --paper: #E7E0D0;
  --button: #F0EADC;
  --primary: #6A3DE8;
  --on-primary: #FFFFFF;
  --title: #3E2A78;
  --body: #5D5470;
  --outline: #B5AC98;
  --chosen: #D9CEF7;
  --whatsapp: #25D366;
  --spoken: #FF7043;
  --board: #D4B9A0;

  /* sizes for a phone; a tablet gets the bigger ones below */
  --title-text: 26px;
  --body-title-text: 30px;
  --fact-text: 14px;
  --count-text: 12px;
  --chip-text: 15px;
  --tool-text: 14px;
  --write-text: 16px;
  --tool-height: 48px;
  --big-text: 18px;
  --big-height: 56px;
  --sample: 68px;
  --round: 40px;
  --round-pad: 9px;
  --swatch: 44px;
  --story-title-text: 22px;
  --story-text: 20px;
  --story-picture: 240px;
  color-scheme: light;
}

@media (min-width: 600px) and (min-height: 600px) {
  :root {
    --title-text: 36px;
    --body-title-text: 40px;
    --fact-text: 19px;
    --count-text: 13px;
    --chip-text: 19px;
    --tool-text: 18px;
    --write-text: 20px;
    --tool-height: 60px;
    --big-text: 22px;
    --big-height: 68px;
    --sample: 96px;
    --round: 52px;
    --round-pad: 12px;
    --swatch: 58px;
    --story-title-text: 32px;
    --story-text: 27px;
    --story-picture: 380px;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--background);
  color: var(--title);
  font-family: Roboto, 'Noto Sans Devanagari', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

[hidden] { display: none !important; }

.card {
  background: var(--paper);
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(62, 42, 120, 0.18);
}

.app {
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- Icons, tinted like the app's vector icons ---- */

.icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* A small round button with a picture on it */
.round {
  width: var(--round);
  height: var(--round);
  padding: var(--round-pad);
  border-radius: 50%;
  border: 1px solid var(--outline);
  background: var(--button);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.round .icon { width: 100%; height: 100%; }
.round.filled { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.round.picture { padding: 6px; }
.round.picture img { width: 100%; height: 100%; }
.round:active { filter: brightness(0.94); }

/* The arrows at the two ends of a card */
.arrow {
  width: var(--round);
  height: var(--round);
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.arrow .icon { width: 100%; height: 100%; }
.arrow:hover { background: rgba(106, 61, 232, 0.08); }

/* ---- Chips that pick a book, a topic or a part of the map ---- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 12px;
  scrollbar-width: none;
  flex: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: transparent;
  color: var(--body);
  font-size: var(--chip-text);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
@media (min-width: 600px) and (min-height: 600px) { .chip { height: 42px; } }
.chip.on { background: var(--chosen); border-color: var(--chosen); color: var(--title); }
.chip.on::before { content: '✓'; font-weight: 700; }

/* ---- Buttons ---- */

.btn {
  height: var(--big-height);
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: var(--big-text);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--on-primary);
}
.btn .icon { width: 22px; height: 22px; }
.btn:disabled { background: rgba(62, 42, 120, 0.12); color: rgba(62, 42, 120, 0.38); cursor: default; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.text { background: transparent; color: var(--primary); height: auto; padding: 10px; font-size: 15px; }
.btn.outlined { background: transparent; color: var(--primary); border-color: var(--outline); }
.btn.outlined.on { background: var(--chosen); color: var(--title); }
.btn.whatsapp { background: var(--whatsapp); color: #0B3D1F; }

/* Buttons joined in a row, one of them chosen */
.toggles {
  display: flex;
  flex: 1;
  min-width: 0;
}
.toggles > button {
  flex: 1;
  min-width: 0;
  min-height: var(--tool-height);
  padding: 4px 8px;
  border: 1px solid var(--outline);
  background: transparent;
  color: var(--primary);
  font-size: var(--tool-text);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: -1px;
}
.toggles > button:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.toggles > button:last-child { border-radius: 0 999px 999px 0; }
.toggles > button.on { background: var(--chosen); color: var(--title); }
.toggles > button .icon { width: 18px; height: 18px; }

/* ---- The top card on every screen ---- */

.title-card {
  margin: 8px 12px 0;
  padding: 6px;
  display: flex;
  align-items: center;
  flex: none;
}
.title-middle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.name-row { display: flex; align-items: center; gap: 10px; max-width: 100%; }
.name {
  font-size: var(--title-text);
  font-weight: 700;
  color: var(--title);
  margin: 0;
  overflow-wrap: anywhere;
}
.fact {
  color: var(--body);
  font-size: var(--fact-text);
  line-height: 1.3;
  margin: 2px 0 0;
  width: 100%;
  white-space: pre-line;
  overflow-y: auto;
  cursor: pointer;
}
.spoken { color: var(--spoken); }
.count { color: var(--primary); font-size: var(--count-text); }

/* ---- Colouring ---- */

.home {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "board" "bottom";
}
.home .top { grid-area: top; min-width: 0; }
.home .bottom { grid-area: bottom; min-width: 0; padding-bottom: 8px; }
.home .board-card { grid-area: board; margin: 8px 12px 0; }

/* A wide screen: the board on the left, the name card, colours and tools beside it */
@media (min-width: 600px) and (orientation: landscape) {
  .home {
    grid-template-columns: minmax(0, 1fr) min(440px, 50vw);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "board top" "board bottom";
  }
  .home .board-card { margin: 8px 0 8px 12px; }
  .home .bottom { overflow-y: auto; }
  .home .palette { flex-wrap: wrap; justify-content: center; overflow: visible; }
}

.home .title-card { touch-action: pan-y; user-select: none; }
.home .fact { height: calc(var(--fact-text) * 1.3 * 3); overflow: hidden; }

.sample {
  width: var(--sample);
  height: var(--sample);
  margin-right: 8px;
  padding: 4px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: var(--paper);
  flex: none;
  cursor: zoom-in;
}
.sample img, .sample canvas { width: 100%; height: 100%; display: block; border-radius: 8px; }

.board-card {
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.board-card canvas.surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.board-buttons {
  position: absolute;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}
.board-buttons.left { left: 8px; }
.board-buttons.right { right: 8px; }
.board-buttons.bottom-right { top: auto; bottom: 10px; right: 10px; }

.palette {
  display: flex;
  overflow-x: auto;
  padding: 6px 12px 0;
  scrollbar-width: none;
  justify-content: safe center;
}
.palette::-webkit-scrollbar { display: none; }
.swatch {
  width: var(--swatch);
  height: var(--swatch);
  margin: 6px 5px;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.33);
  padding: 0;
  transition: transform 0.12s;
}
.swatch.on { border: 4px solid var(--title); transform: scale(1.18); }

.tool-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 12px 0;
}
.tool-row .btn.text { font-size: var(--tool-text); padding: 10px; gap: 4px; }
.tool-row .btn.text .icon { width: 18px; height: 18px; }
.dot { line-height: 1; }

.action-row {
  display: flex;
  gap: 12px;
  margin: 6px 12px 0;
}
.action-row .btn { flex: 1; min-width: 0; padding: 0 12px; }
.action-row .write {
  flex: none;
  background: transparent;
  color: var(--primary);
  border-color: var(--outline);
  font-size: var(--write-text);
}
.action-row .write.on { background: var(--chosen); color: var(--title); }

/* ---- Body, maps, stories and talk ---- */

.view-card {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 8px 12px 0;
  overflow: hidden;
}
.view-card canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.page-row {
  display: flex;
  gap: 8px;
  margin: 6px 12px 8px;
  flex: none;
}
.page-row .toggles > button { min-height: var(--big-height); font-size: var(--big-text); }
.body-screen .name { font-size: var(--body-title-text); }
.body-screen .fact, .world-screen .fact { height: calc(var(--fact-text) * 1.3 * 4); }
.world-screen .name { font-size: var(--story-title-text); }
.world-screen .page-row .toggles > button { min-height: 44px; font-size: var(--chip-text); }
.world-screen .chips { padding-bottom: 8px; }

.quiz { margin: 0 12px 6px; display: grid; gap: 4px 8px; grid-template-columns: 1fr 1fr; flex: none; }
.quiz .choice {
  min-height: var(--big-height);
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: transparent;
  color: var(--title);
  font-size: var(--chip-text);
  font-weight: 500;
  padding: 4px 6px;
  line-height: 1.15;
}
.quiz .choice.right { background: #43A047; border-color: #43A047; color: #fff; }
.quiz .choice.wrong { background: #E53935; border-color: #E53935; color: #fff; }
.quiz .stars-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.quiz .stars { font-size: var(--big-text); font-weight: 700; color: var(--title); }

.story-scroll, .talk-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 16px;
}
.story-picture {
  display: block;
  width: 100%;
  max-width: calc(var(--story-picture) * 200 / 130);
  max-height: var(--story-picture);
  margin: 0 auto 12px;
  object-fit: contain;
}
.story-text {
  font-size: var(--story-text);
  line-height: 1.5;
  color: var(--title);
  white-space: pre-wrap;
  max-width: 900px;
  margin: 0 auto;
}
.story-text .line { cursor: pointer; border-radius: 4px; }
.story-text .line.now { background: #FFE08A; }
.story-buttons { display: flex; gap: 12px; margin: 8px 12px; flex: none; }
.story-buttons .btn { flex: 1; }

.talk-help { color: var(--body); font-size: var(--count-text); }
.bubble-row { display: flex; align-items: flex-start; gap: 4px; padding: 6px 0; }
.bubble-row.mine { justify-content: flex-end; }
.bubble-row .face { font-size: 30px; line-height: 1; padding: 2px; }
.bubble-column { display: flex; flex-direction: column; max-width: 70%; }
.bubble-row.mine .bubble-column { align-items: flex-end; }
.bubble {
  padding: 8px 14px 10px;
  border-radius: 18px;
  cursor: pointer;
  border: 3px solid transparent;
}
.bubble.now { border-color: var(--primary); }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--primary); }
.bubble .words { font-size: 18px; color: var(--title); }
.your-turn { font-size: 15px; font-weight: 700; color: #E65100; padding: 6px 4px 0 0; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.35; } }
.practise { font-size: 18px; font-weight: 700; color: var(--primary); padding: 22px 4px 2px; }
.sentence {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--outline);
  border-radius: 14px;
  background: var(--button);
  color: var(--title);
  font-size: 18px;
  text-align: left;
}
.sentence .icon { color: var(--primary); }

/* ---- Dialogs and messages ---- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 60, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.dialog {
  background: var(--paper);
  border-radius: 28px;
  padding: 24px 24px 12px;
  width: min(440px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.dialog h2 { margin: 0 0 12px; font-size: 24px; font-weight: 400; color: var(--title); }
.dialog p { margin: 0 0 12px; color: var(--body); font-size: 15px; line-height: 1.4; }
.dialog .buttons { display: flex; justify-content: flex-end; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.dialog .buttons .btn { height: 40px; font-size: 15px; padding: 0 14px; background: transparent; color: var(--primary); }
.dialog .buttons .left { margin-right: auto; }
.dialog input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 12px;
  margin: 6px 0;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: #fff;
  color: var(--title);
}
.dialog .error { color: #B3261E; font-size: 13px; min-height: 16px; }
.dialog img.big { width: 100%; border-radius: 12px; display: block; }

.faces { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.face-item {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 84px;
  flex: none;
  font-size: 15px;
  color: var(--title);
}
.face-item img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.face-item span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 8px; cursor: pointer; color: var(--body); }
.photo-pick img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }

.account-menu .who { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.account-menu .who img { width: 48px; height: 48px; border-radius: 50%; }
.round.account { padding: 0; overflow: hidden; font-weight: 700; font-size: 18px; color: var(--primary); }
.round.account img { width: 100%; height: 100%; object-fit: cover; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: min(560px, calc(100% - 32px));
  background: #322F37;
  color: #F5EFF7;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Sign in ---- */

.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: min(420px, 100%);
  padding: 28px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}
.login-logo { width: 112px; height: 112px; margin: 0 auto 8px; }
.login h1 { margin: 0; font-size: 32px; color: var(--title); }
.login-lead { color: var(--body); margin: 6px 0 22px; font-size: 16px; line-height: 1.4; }
.btn.google { background: #fff; color: #1F1F1F; border-color: var(--outline); font-size: 17px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--body); font-size: 14px; margin: 20px 0 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--outline); }
.phone-form { display: flex; flex-direction: column; gap: 10px; }
.phone-row { display: flex; align-items: stretch; border: 1px solid var(--outline); border-radius: 12px; background: #fff; overflow: hidden; }
.phone-row .country { display: flex; align-items: center; padding: 0 12px; background: var(--button); color: var(--title); font-weight: 500; font-size: 17px; border-right: 1px solid var(--outline); }
.phone-row input, .code-input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 14px 12px;
  font: inherit;
  font-size: 18px;
  color: var(--title);
  background: #fff;
  outline: none;
}
.code-input { border: 1px solid var(--outline); border-radius: 12px; text-align: center; letter-spacing: 6px; }
.code-sent { margin: 0; color: var(--body); font-size: 15px; }
.login-error { color: #B3261E; min-height: 20px; margin: 12px 0 0; font-size: 14px; }
.login-small { color: var(--body); font-size: 12px; margin: 8px 0 0; }
.login-small a { color: var(--primary); }

/* ---- School lessons ---- */

.lessons-screen .kicker { color: var(--primary); font-size: var(--count-text); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.lessons-screen .kicker:empty { display: none; }
.lessons-screen .standards { justify-content: safe center; }
.lesson-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 16px; }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.lesson-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--button);
  text-align: left;
  box-shadow: 0 1px 3px rgba(62, 42, 120, 0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(62, 42, 120, 0.22); }
.lesson-card img { width: 100%; aspect-ratio: 800 / 520; border-radius: 12px; display: block; margin-bottom: 6px; }
.lesson-card .subject { color: var(--body); font-size: 13px; font-weight: 500; padding: 0 4px; }
.lesson-card strong { color: var(--title); font-size: 19px; padding: 0 4px; }

.lesson { max-width: 1240px; margin: 0 auto; }
/* the picture stays in view while she reads, so the part she talks about can be seen lighting up */
.lesson-side { position: sticky; top: -16px; z-index: 1; margin-top: -16px; padding: 16px 0 6px; background: var(--paper); }
.lesson-art svg { display: block; width: 100%; height: auto; border-radius: 16px; box-shadow: 0 2px 8px rgba(62, 42, 120, 0.2); }
.lesson-art [data-part] { transition: opacity 0.35s, filter 0.35s; cursor: pointer; }
.lesson-art [data-part].dim { opacity: 0.25; }
.lesson-art [data-part].focus { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 10px rgba(255, 193, 7, 0.95)); }
@media (min-width: 900px) {
  .lesson { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: start; }
}

.lesson-help { color: var(--body); font-size: var(--count-text); margin: 12px 4px 4px; }
.lesson-text { list-style: none; margin: 0; padding: 0; font-size: calc(var(--story-text) * 0.92); line-height: 1.45; color: var(--title); }
.lesson-text li { padding: 6px 10px; border-radius: 10px; cursor: pointer; scroll-margin: 12px; }
.lesson-text li:hover { background: rgba(106, 61, 232, 0.07); }
.lesson-text li.now { background: #FFE08A; }

.lesson-quiz { margin: 16px 0 8px; padding: 16px; border-radius: 18px; background: #fff; box-shadow: 0 1px 3px rgba(62, 42, 120, 0.18); scroll-margin: 12px; }
.quiz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quiz-head h2 { margin: 0; font-size: var(--big-text); color: var(--primary); }
.quiz-head span { color: var(--body); font-size: var(--count-text); }
.quiz-question { font-size: calc(var(--story-text) * 0.92); font-weight: 500; margin: 10px 0 12px; color: var(--title); }
.quiz-choices { display: grid; gap: 8px; }
.lesson-quiz .choice {
  min-height: var(--tool-height);
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: transparent;
  color: var(--title);
  font-size: var(--chip-text);
  font-weight: 500;
  padding: 6px 16px;
}
.lesson-quiz .choice:disabled { cursor: default; }
.lesson-quiz .choice.right { background: #43A047; border-color: #43A047; color: #fff; }
.lesson-quiz .choice.wrong { background: #E53935; border-color: #E53935; color: #fff; }
.quiz-result { min-height: 1.4em; font-size: var(--chip-text); color: var(--title); margin: 12px 0 8px; }
.quiz-stars { font-size: 40px; letter-spacing: 6px; margin: 12px 0 0; color: #FFB300; }
.lesson-quiz .btn { width: 100%; }

/* A lesson told as a conversation between the teacher and a student */
.lesson-text.talk li { margin: 6px 0; padding: 8px 14px 10px; border-radius: 16px; background: #fff; max-width: 88%; }
.lesson-text.talk li.child { margin-left: auto; background: #FCE4EC; }
.lesson-text.talk li.now { background: #FFE08A; }
.lesson-text .who { display: block; font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.lesson-text li.child .who { color: #AD1457; }

/* What she tells about the part of the picture that was tapped */
.lesson-detail { margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; background: #FFF8E1; border-left: 5px solid #FFB300; color: var(--title); font-size: calc(var(--story-text) * 0.8); line-height: 1.4; }

/* ---- Question papers ---- */

.papers-screen .standards, .papers-screen .subjects { justify-content: safe center; padding-bottom: 0; }
.papers-screen .title-card .account { margin-left: 4px; }
.papers-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 12px 16px 24px; }
.papers-tools { display: flex; flex-wrap: wrap; gap: 8px; max-width: 980px; margin: 0 auto 8px; }
.papers-tools .btn { height: 44px; font-size: 16px; padding: 0 16px; }
.papers-search {
  flex: 1 1 200px; min-width: 0; height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--outline); background: #fff; color: var(--title); font: inherit; font-size: 16px;
}
.papers-list { list-style: none; margin: 0 auto; padding: 0; max-width: 980px; }
.papers-topic { margin: 16px 4px 6px; color: var(--primary); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.papers-empty { padding: 32px; text-align: center; color: var(--body); }
.papers-q { margin: 6px 0; border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(62, 42, 120, 0.15); border: 2px solid transparent; }
.papers-q.on { border-color: var(--primary); background: #F6F2FF; }
.papers-q label { display: flex; gap: 12px; padding: 12px 14px; cursor: pointer; }
.papers-q input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 2px 0 0; accent-color: var(--primary); }
.papers-q-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.papers-kind { color: var(--body); font-size: 12px; font-weight: 500; }
.papers-text { color: var(--title); font-size: 17px; line-height: 1.35; }
.papers-choices, .papers-pairs { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--body); font-size: 15px; }
.papers-pic { font-size: 34px; line-height: 1.2; letter-spacing: 0.06em; white-space: pre-wrap; }
img.emoji { width: 1.15em; height: 1.15em; margin: 0 0.04em; vertical-align: -0.22em; }
.papers-choices img.emoji, .papers-pairs img.emoji { width: 1.6em; height: 1.6em; vertical-align: middle; }
.papers-credit { max-width: 980px; margin: 16px auto 0; color: var(--body); font-size: 12px; text-align: center; }
.papers-credit a { color: inherit; }
.papers-answer { color: #2E7D32; font-size: 14px; font-weight: 500; }
.papers-mine { display: flex; justify-content: flex-end; gap: 4px; padding: 0 8px 6px; }
.papers-mine .btn { font-size: 14px; padding: 6px 10px; }
.papers-mine .icon { width: 18px; height: 18px; }
.papers-bar { display: flex; align-items: center; gap: 8px; margin: 8px 12px; flex: none; }
.papers-chosen { flex: 1; min-width: 0; color: var(--body); font-size: 14px; }
.papers-bar .make { height: 48px; font-size: 17px; }

.papers-form { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 76vw); }
.papers-row { display: flex; align-items: center; gap: 10px; }
.papers-row > span:first-child { flex: 1; }
.papers-row small { color: var(--body); }
.papers-row input[type=number] { width: 72px; }
.papers-row.two > * { flex: 1; min-width: 0; }
.papers-row.pair input { flex: 1; min-width: 0; }
.papers-row.choice .choice-text { flex: 1; min-width: 0; }
.papers-row input[type=radio] { width: 20px; height: 20px; accent-color: #2E7D32; }
.papers-field { display: flex; flex-direction: column; gap: 4px; }
.papers-field .label { color: var(--body); font-size: 13px; font-weight: 500; }
.papers-form input[type=text], .papers-form input[type=number], .papers-form textarea, .papers-form select {
  font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--outline); border-radius: 10px; background: #fff; color: var(--title);
}
.papers-form textarea { resize: vertical; }
.papers-hint { margin: 0; color: var(--body); font-size: 13px; line-height: 1.4; }
.papers-total { margin: 4px 0 0; font-weight: 700; color: var(--title); }
.dialog .content:has(.papers-form) { max-height: 60vh; overflow-y: auto; }

/* The printed paper: only questions, on A4 */
.paper { display: none; }
@page { size: A4; margin: 14mm 14mm 16mm; }
@media print {
  html, body { height: auto; background: #fff; overflow: visible; }
  body > :not(#paper) { display: none !important; }
  .paper { display: block; color: #000; font-family: Roboto, Arial, sans-serif; font-size: 12pt; line-height: 1.45; }
  .paper header { text-align: center; border-bottom: 1.5pt solid #000; padding-bottom: 6pt; margin-bottom: 8pt; }
  .paper h1 { margin: 0; font-size: 18pt; text-transform: uppercase; letter-spacing: 0.03em; }
  .paper h2 { margin: 2pt 0 6pt; font-size: 14pt; font-weight: 500; }
  .paper .meta { display: flex; justify-content: space-between; font-weight: 500; }
  .paper .student { display: flex; gap: 16pt; margin-top: 8pt; text-align: left; }
  .paper .student span { display: flex; flex: 1; }
  .paper .student span:first-child { flex: 3; }
  .paper .meta .gap { display: inline-block; width: 18pt; }
  .paper .student i { flex: 1; border-bottom: 1pt solid #000; margin-left: 4pt; }
  .paper .instructions { font-style: italic; margin: 0 0 6pt; font-size: 11pt; }
  .paper section { margin-top: 10pt; }
  .paper h3 { display: flex; justify-content: space-between; gap: 12pt; margin: 0 0 4pt; font-size: 12.5pt; break-after: avoid; }
  .paper ol { margin: 0; padding-left: 22pt; }
  .paper .q { margin: 0 0 6pt; break-inside: avoid; }
  .paper .choices { display: flex; flex-wrap: wrap; gap: 0 22pt; }
  .paper .choices span { white-space: nowrap; }
  .paper .blank { display: inline-block; width: 70pt; border-bottom: 1pt solid #000; }
  .paper .line-answer { display: inline-block; width: 120pt; border-bottom: 1pt solid #000; margin-left: 6pt; }
  .paper .box { white-space: nowrap; }
  .paper .write-lines span { display: block; height: 22pt; border-bottom: 0.75pt solid #777; }
  .paper .match table { display: inline-table; vertical-align: top; border-collapse: collapse; width: 85%; }
  .paper .match td { padding: 2pt 0; vertical-align: top; }
  .paper .match td.dots { width: 30%; }
  .paper .q.pic .picture { font-size: 26pt; line-height: 1.25; letter-spacing: 0.08em; margin: 0 0 2pt; white-space: pre-wrap; }
  .paper img.emoji { width: 1.6em; height: 1.6em; vertical-align: middle; }
  .paper .q.pic .picture img.emoji { width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
  .paper .match img.emoji { width: 1.8em; height: 1.8em; }
  .paper .choices.emoji { align-items: center; gap: 0 30pt; }
  .paper .choices.emoji b { font-size: 26pt; font-weight: normal; line-height: 1.25; vertical-align: middle; }
  .paper .end { text-align: center; margin-top: 16pt; font-weight: 500; }
}

/* ---- Powered by ---- */
.powered { display: block; text-align: center; color: var(--body); font-size: 12px; text-decoration: none; padding: 2px 0 4px; opacity: 0.85; }
.powered:hover { color: var(--primary); text-decoration: underline; }
.login .powered { margin-top: 12px; }
