/* The one stylesheet: the "Trail" tokens (shared with Happy and Vorbild) and every shared element. */

/* The two fonts, kept in the project (fonts/): Baloo 2 and Rubik, both under the SIL Open Font
   License. One file holds every weight used; "ext" has the rarer Latin letters. */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("fonts/baloo2-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("fonts/baloo2-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/rubik-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/rubik-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #F3F3F4;
  --ink: #141518;
  --accent: #E5A900;
  --accent-soft: #FBEFC4;
  --card: #FFFFFF;
  --past: #CED0D5;
  --muted: #6B6E76;
  --cobalt: #1A53E0;
  --orange: #D95A1E;
  --green: #1E9E54;
  --danger: #E23D2E;

  --r-card: 20px;
  --r-overlay: 16px;
  --r-control: 12px;
  --r-indicator: 8px;

  --strong: 1.5px solid var(--ink);          /* the click cue: only on things you can tap */
  --hairline: 1px solid var(--past);         /* display-only cards */

  --display: "Baloo 2", system-ui, sans-serif;
  --body: "Rubik", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Page frame ---------- */

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* With room, the switch sits in the true middle of the page, the name left and the gear right.
   On a phone the middle would leave uneven gaps, so there it stands beside the gear. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 28px;
}
@media (min-width: 480px) {
  .top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; }
  .top .brand { justify-self: start; }
  .top .gear { justify-self: end; }
}

.brand {
  margin-right: auto;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
}

/* Chat and Practice in one box; the yellow key lies under the page you are on. */
.slider {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 44px;
  padding: 3px;
  border: var(--strong);
  border-radius: var(--r-control);
  background: var(--card);
}

.slider-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border: var(--strong);
  border-radius: var(--r-indicator);
  background: var(--accent);
  view-transition-name: slider-thumb;
}
.slider[data-at="practice"] .slider-thumb { transform: translateX(100%); }

.slider-part {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-indicator);
}
/* Named so that, while the key slides, the names are drawn above it and not hidden under it. */
.slider-part:first-of-type { view-transition-name: slider-chat; }
.slider-part:last-of-type { view-transition-name: slider-practice; }

/* On Words and Settings neither side is the current one: a thin line keeps the two apart. */
.slider[data-at="none"] .slider-part + .slider-part::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  border-left: var(--hairline);
}

/* Words are due: a dot, and only while you are somewhere else. */
.due-dot {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 11px;
  height: 11px;
  border: var(--strong);
  border-radius: 50%;
  background: var(--accent);
}
[aria-current="page"] > .due-dot { display: none; }

/* A click loads another page: only the yellow key moves across, nothing else fades. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  :root { view-transition-name: none; }
  ::view-transition-group(slider-thumb) { animation-duration: .26s; animation-timing-function: cubic-bezier(.3, 1.35, .5, 1); }
}

.tab {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  padding: 0 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: var(--strong);
  border-radius: var(--r-control);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}

.tab[aria-current="page"] { background: var(--accent); }
.tab.gear { width: 44px; padding: 0; justify-content: center; }
.tab.gear svg { width: 20px; height: 20px; }

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
  margin: 0 0 8px;
}

.sub { color: var(--muted); margin: 0 0 24px; }

/* ---------- Keys ---------- */

.key {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.1;
  min-height: 60px;
  padding: 8px 18px;
  border: var(--strong);
  border-radius: var(--r-overlay);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  transition: transform .12s ease-out, opacity .12s ease-out;
}

.key:active { transform: scale(.96); opacity: .6; }
.key.primary { background: var(--ink); color: #fff; }
.key.wide { width: 100%; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.pill {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  min-height: 44px;
  padding: 0 16px;
  border: var(--strong);
  border-radius: var(--r-control);
  background: var(--card);
}

.pill[aria-pressed="true"] { background: var(--accent); }

/* ---------- Chat ---------- */

.chat { display: flex; flex-direction: column; gap: 14px; padding-bottom: 150px; }

.day {
  align-self: center;
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0;
}

.msg {
  max-width: 86%;
  padding: 14px 16px 16px;
  border: var(--hairline);
  border-radius: var(--r-card);
  background: var(--card);
}

.msg.friend { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: #E7E8EB; border-bottom-right-radius: 6px; }

.es {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.35;
  margin: 0;
}

/* A word you can tap. No border box: a box around every word would make a sentence
   unreadable. A column, so its meaning can sit under it and widen it; inline-flex
   keeps the WORD on the text baseline. */
.w {
  font: inherit;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 4px 3px;
  margin: 0 -4px;
  border: 0;
  border-radius: var(--r-indicator);
  background: none;
}

/* The unseen 2px keep the height the words were designed with. */
.w .t { line-height: 1.2; border-bottom: 2px solid transparent; }
.w:hover { background: #fff8dd; }
.w.revealed { background: var(--accent-soft); }

.w .g {
  display: none;
  font-family: var(--body);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.2;
  color: #6E5200;
  padding-top: 4px;
  white-space: nowrap;
}

.w.revealed .g { display: block; }
.w.revealed { margin: 0 -1px 4px; }

/* Corrected: dotted, quieter than the fill of a revealed word, and readable on it. */
.w.corrected .t { border-bottom-style: dotted; border-bottom-color: var(--muted); }

.msg.waiting .es { color: var(--muted); }

.dots span { animation: dots-pulse .9s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dots-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; } }
/* Alone in a bubble the dots are larger; line-height 0 keeps the bubble as high as a line of words. */
.msg.waiting .es > .dots { font-size: 1.5em; line-height: 0; letter-spacing: .06em; }

/* What was typed: each word as high as a word that can be tapped, so the bubble keeps its height
   when the Spanish reads the same. */
.msg.typed .es span { display: inline-block; padding: 2px 0 3px; line-height: 1.2; border-bottom: 2px solid transparent; }
.msg.settling { overflow: hidden; }

.notice {
  align-self: center;
  max-width: 86%;
  margin: 4px 0;
  font-size: 14px;
  text-align: center;
  color: var(--danger);
}

/* "New conversation": a side matter here, so small and without fill. */
.chat-end { align-self: center; margin-top: 10px; text-align: center; }
.pill.quiet { background: none; font-size: 14px; }

/* Lower than a finger needs: ::after makes what can be tapped higher. */
.small-key {
  position: relative;
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  border: var(--strong);
  border-radius: var(--r-control);
  background: none;
}
.small-key::after { content: ""; position: absolute; inset: -6px -4px; }
.small-key svg { width: 16px; height: 16px; }

/* The keys under the friend's first line: the next thing to do is the field, so they are smaller
   than a small key, and grey. */
.opener-keys { align-self: flex-start; min-width: max-content; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: -4px; }
.small-key.footnote { min-height: 30px; padding: 0 10px; gap: 5px; font-size: 13px; color: var(--muted); border-color: var(--muted); border-radius: var(--r-indicator); }
.small-key.footnote::after { inset: -7px -4px; }
.small-key.footnote svg { width: 14px; height: 14px; }
.msg.fresh { animation: fresh .22s ease-out; }
@keyframes fresh { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .msg.fresh { animation: none; } }

/* As high as its key, so the field does not move when a tip with a key gives way to one without. */
.tip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; min-height: 30px; margin-top: 10px; }
.tip .hint { margin: 0; }
/* What happens to a looked-up word takes the tip's place. */
#lookup-hint:not([hidden]) + .tip { display: none; }

.gloss {
  position: absolute;
  z-index: 10;
  width: 230px;
  padding: 14px 16px;
  background: var(--card);
  border: var(--strong);
  border-radius: var(--r-overlay);
  box-shadow: 0 10px 28px rgba(20, 21, 24, .16);
  pointer-events: none;                      /* never steals the hover from the word */
}

.gloss .word { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; }
.gloss .meaning { font-size: 18px; margin-top: 6px; }
.gloss .lemma { font-size: 14px; color: var(--muted); margin-top: 4px; }
.gloss .wrote { font-size: 14px; color: var(--muted); margin-top: 4px; }
.gloss .invite {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 10px;
  border-top: var(--hairline);
}

/* ---------- A menu: a list of keys, one under the other (issue.js, commands.js) ---------- */

.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-align: left;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  border: var(--strong);
  border-radius: var(--r-control);
  background: var(--card);
}
.menu-item.leads-on { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
/* The one the keyboard is on. */
.menu-item.active { background: var(--accent-soft); }
/* A row of two: what it is, cut off when it is long, and a grey word at its right end. */
.menu-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-detail { flex: none; font-family: var(--body); font-weight: 400; font-size: 13px; color: var(--muted); }

/* ---------- "There is an issue with…" (issue.js) ---------- */

/* A footnote to its message, so a very small grey circle. ::after makes what can be tapped 44px,
   upwards: the words of the first line stay free. */
.msg { position: relative; }
.issue-key {
  position: absolute;
  top: -9px;
  right: 20px;
  width: 18px;
  height: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--past);
  border-radius: 50%;
  background: inherit;
  color: var(--muted);
}
.issue-key:hover, .issue-key:focus-visible, .issue-key[aria-expanded="true"], .msg[aria-busy] .issue-key { border-color: var(--muted); }
.issue-key i { width: 2px; height: 2px; border-radius: 50%; background: currentColor; }
.issue-key::after { content: ""; position: absolute; inset: -22px -13px -4px; }
@media (hover: hover) {
  .issue-key { opacity: 0; transition: opacity .12s ease-out; }
  .msg:hover .issue-key, .msg:focus-within .issue-key, .msg[aria-busy] .issue-key, .msg.picking .issue-key, .issue-key[aria-expanded="true"] { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .issue-key { transition: none; } }

/* Placed by issue.js. */
.issue-menu, .issue-hint {
  position: absolute;
  margin: 0;
  padding: 0;
  inset: auto;
  width: 280px;
  max-width: calc(100vw - 16px);
  color: var(--ink);
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--r-overlay);
  box-shadow: 0 10px 28px rgba(20, 21, 24, .16);
}
.issue-menu::backdrop { background: none; }
.issue-card { padding: 14px; }
.issue-title { margin: 0 2px; font-family: var(--display); font-weight: 700; font-size: 17px; line-height: 1.2; }
.issue-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.issue-head:has(> .unseen:only-child) { margin-bottom: 0; }
.issue-back { min-height: 30px; padding: 0 9px; font-size: 20px; line-height: 1; }
/* The message in English, above the choices: something to read, so it has no box. */
.issue-english { margin: 0 2px 12px; padding-bottom: 12px; border-bottom: var(--hairline); font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.issue-english span { display: block; margin-bottom: 2px; font-size: 13px; color: var(--muted); }
.issue-form .field { width: 100%; min-height: 48px; font-size: 16px; border-radius: var(--r-control); }
.issue-menu.editing { width: 30rem; }
.issue-form textarea.field { display: block; max-height: 50vh; overflow-y: auto; }
.issue-form-line { margin: 6px 2px 0; font-size: 13px; color: var(--muted); }
.issue-form-line:empty { display: none; }
.issue-keys { display: flex; gap: 8px; margin-top: 10px; }
.issue-keys .pill { flex: 1; }

.issue-hint { z-index: 20; width: max-content; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 12px; }
.issue-hint p { margin: 0; font-size: 15px; }
.msg.picking { border-color: var(--ink); }
.msg.picking .w .t { border-bottom-color: var(--ink); }

.msg[aria-busy] { color: var(--muted); }

/* Above the next message, so Undo is not under what can be tapped of that message's key. */
.issue-note {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  max-width: 86%;
  margin: -6px 4px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
  color: var(--muted);
  scroll-margin-bottom: calc(var(--bar, 150px) + 8px);
}
.issue-note.me { align-self: flex-end; justify-content: flex-end; text-align: right; }

/* ---------- The question before something is thrown away (confirm.js), and the modal (modal.js) ---------- */

/* Both fill the screen and are their own veil. */
.confirm, .modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
  animation: veil-in .16s ease-out;
}
/* Only while open: a display set on a closed dialog would show it. */
.confirm[open], .modal[open] { display: flex; }
.confirm::backdrop, .modal::backdrop { background: none; }
html:has(.confirm[open], .modal[open]) { overflow: hidden; }

/* margin: auto centres the card and, unlike align-items, keeps the top of a very long one reachable. */
.confirm-card, .modal-card {
  width: 100%;
  max-width: 360px;
  margin: auto;
  padding: 28px 20px 20px;
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--r-overlay);
  box-shadow: 0 10px 28px rgba(20, 21, 24, .16);
  text-align: center;
  animation: card-in .16s ease-out;
}

.confirm-title { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.confirm-line { color: var(--muted); margin: 8px 0 0; overflow-wrap: anywhere; }

/* Side by side while both fit; when not, the key that does it goes on top and Cancel under it. */
.confirm-keys { display: flex; flex-wrap: wrap-reverse; gap: 10px; margin-top: 24px; }
.confirm-keys .key { flex: 1 1 120px; min-height: 52px; border-radius: var(--r-control); white-space: nowrap; }
.key.danger { background: var(--danger); color: var(--card); }

@keyframes veil-in { from { opacity: 0; } }
@keyframes card-in { from { transform: scale(.96); } }
@media (prefers-reduced-motion: reduce) { .confirm, .confirm-card, .modal, .modal-card { animation: none; } }

/* The modal darkens the page, and its card is as wide as the chat's field. */
/* The padding leaves room for the X, which sits half on the card's corner and half outside it. */
.modal { padding: 24px 20px; background: color-mix(in srgb, var(--ink) 40%, transparent); }
.modal-card { position: relative; max-width: 528px; padding: 14px; text-align: left; }
.modal-close { position: absolute; top: -18px; right: -18px; width: 36px; padding: 0; justify-content: center; font-size: 20px; line-height: 1; background: var(--card); }
/* In a modal the key the keyboard is on has the focus. */
.modal .menu-item:focus { background: var(--accent-soft); outline: none; }


.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, var(--paper) 78%, transparent);
  padding: 28px 16px 18px;
}

.composer-inner { max-width: 528px; margin: 0 auto; }

.composer-row { position: relative; display: flex; gap: 8px; }

.field {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  padding: 0 16px;
  font: inherit;
  font-size: 18px;
  color: var(--ink);
  background: var(--card);
  border: var(--strong);
  border-radius: var(--r-overlay);
}

.field::placeholder { color: var(--muted); }

.send { width: 60px; padding: 0; font-size: 24px; }

.hint { font-size: 13px; color: var(--muted); text-align: center; margin: 10px 0 0; }
.hint + .hint { margin-top: 2px; }

/* ---------- Word lookup in the message field (lookup.js) ---------- */

/* Room for the key inside the field's right end, while the key shows. */
.field.has-key { padding-right: 76px; }

/* lookup.js sets where its right edge is. */
.lookup-key {
  position: absolute;
  top: 8px;
  bottom: 8px;
  min-width: 44px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  border: var(--strong);
  border-radius: var(--r-indicator);
  background: var(--card);
  transition: transform .12s ease-out, opacity .12s ease-out;
}
.lookup-key[hidden] { display: none; }
.lookup-key svg { width: 15px; height: 15px; }
.lookup-key span { padding-top: 2px; }
.lookup-key:active { transform: scale(.96); opacity: .6; }
/* Nothing to translate: it cannot be tapped, so it loses the ink border. */
.lookup-key:disabled { border: var(--hairline); color: var(--past); cursor: default; }
.lookup-key[aria-expanded="true"] { background: var(--accent-soft); }
.lookup-key[aria-busy="true"] svg { animation: dots-pulse .9s ease-in-out infinite; }

/* lookup.js sets its left edge, its width and its font size. */
.lookup-marks {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
}
.lookup-mark {
  position: absolute;
  top: calc(50% + .66em);
  height: 3px;
  background: var(--accent);
}
.lookup-mark.fresh { animation: lookup-fresh .7s ease-out; }
@keyframes lookup-fresh {
  from { top: calc(50% - .7em); height: 1.4em; opacity: .4; }
  60% { top: calc(50% - .7em); height: 1.4em; opacity: .4; }
}

/* The panel above the message field (lookup.js, commands.js). Its lower edge reaches a little into
   the field, over the empty strip above the text; lookup.js moves it over the word. */
.field-panel {
  position: absolute;
  z-index: 5;
  bottom: calc(100% - 12px);
  left: 0;
  max-width: 100%;
  overflow-y: auto;
  padding: 8px;
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--r-overlay);
  box-shadow: 0 10px 28px rgba(20, 21, 24, .16);
  animation: lookup-in .16s ease-out;
}
@keyframes lookup-in { from { opacity: 0; transform: translateY(6px); } }
/* As wide as the field and its send key, and clear of the field: for a list. */
.field-panel.wide { width: 100%; bottom: calc(100% + 8px); }

.lookup-options { display: flex; flex-wrap: wrap; gap: 8px; }

.lookup-option {
  flex: 0 1 auto;
  min-height: 52px;
  padding: 6px 12px 7px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  border: var(--strong);
  border-radius: var(--r-control);
  background: var(--card);
  transition: transform .12s ease-out, opacity .12s ease-out;
}
.lookup-option:active { transform: scale(.96); opacity: .6; }
.lookup-option.active { background: var(--accent-soft); }
.lookup-word { font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.1; }
.lookup-gloss { font-size: 13px; line-height: 1.25; color: var(--muted); }
/* The Spanish for whole sentences is running text. */
.lookup-option.long .lookup-word { font-family: var(--body); font-weight: 400; font-size: 17px; line-height: 1.35; }

.field-note {
  display: block;
  max-width: 19em;
  padding: 8px 8px;
  font-size: 14px;
  color: var(--muted);
}
.lookup-waiting { display: flex; align-items: center; min-height: 52px; padding: 0 14px; font-family: var(--display); font-weight: 700; font-size: 21px; }

#lookup-hint { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .field-panel, .lookup-mark.fresh, .lookup-key[aria-busy="true"] svg { animation: none; }
  .lookup-key, .lookup-option { transition: none; }
}

/* ---------- Practice ---------- */

/* A page of a few groups, one under the other. Two gaps tell what belongs together:
   --group between the groups, --item between the things inside one. */
.groups { --group: 28px; --item: 12px; display: flex; flex-direction: column; gap: var(--group); }
.groups h1 { margin: 0; }
.groups .sub { margin: 8px 0 0; }

.key.into { justify-content: space-between; gap: 12px; text-align: left; }
.into-text { display: flex; flex-direction: column; gap: 2px; }
.into-count { font-family: var(--body); font-weight: 400; font-size: 14px; color: var(--muted); }
.into-arrow { font-size: 26px; line-height: 1; }

/* A settings row: the whole row is the key. */
.setting-group { display: flex; flex-direction: column; gap: var(--item); }
.group-title { margin: 0; font-family: var(--body); font-weight: 500; font-size: 14px; color: var(--muted); }
.key.setting { justify-content: space-between; gap: 16px; text-align: left; min-height: 72px; }
.switch { flex: none; width: 52px; height: 30px; padding: 3px; display: flex; border: var(--strong); border-radius: var(--r-card); background: var(--paper); }
.switch i { width: 21px; height: 21px; border-radius: 50%; background: var(--ink); transition: transform .12s ease-out; }
.setting[aria-checked="true"] .switch { background: var(--accent); }
.setting[aria-checked="true"] .switch i { transform: translateX(22px); }
@media (prefers-reduced-motion: reduce) { .switch i { transition: none; } }

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

.login-form { display: flex; flex-direction: column; gap: var(--item); }
.login-form .field { flex: none; }
.login-note { margin: 0; font-size: 14px; color: var(--muted); }
.sent-to { overflow-wrap: anywhere; }
.another { align-self: flex-start; }

.round-top { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.progress { flex: 1; }
.progress .bar { height: 6px; border-radius: var(--r-indicator); background: var(--past); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-indicator); transition: width .2s ease-out; }
@media (prefers-reduced-motion: reduce) { .progress .bar i { transition: none; } }

/* The level and the points made in it (drawLevel in round.js): beside the session's bar, and large
   in the bubble at a session's end. */
.level { flex: 0 0 30%; display: flex; align-items: center; gap: 8px; }
.level[hidden] { display: none; }
.level-number { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; min-width: 1ch; text-align: center; }
.level .bar { flex: 1; height: 12px; border-radius: var(--r-indicator); background: var(--card); border: var(--hairline); overflow: hidden; }
.level .bar i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-indicator); transition: width .25s ease-out; }
.level .bar i.jump { transition: none; }
.level.level-up .level-number { animation: level-pop .5s ease-out; }
.level.level-up .bar { animation: level-glow 1s ease-out; }
@keyframes level-pop { 40% { transform: scale(1.5); } }
@keyframes level-glow { from { background: var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) {
  .level .bar i { transition: none; }
  .level.level-up .level-number, .level.level-up .bar { animation: none; }
}
.level-summary { margin: 14px 0 14px; min-width: 12em; }
.level-summary .level { gap: 12px; }
.level-summary .level-number { font-size: 44px; }
.level-summary .level .bar { height: 16px; background: var(--paper); }
.level-gained { margin: 6px 0 0; font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.2; }

.card {
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--r-card);
  padding: 32px 22px;
  text-align: center;
  margin-bottom: 16px;
}

.card .en { color: var(--muted); margin: 0 0 14px; }

/* --bar is as high as the bar at the bottom (set by answer.js), so the last message ends above it. */
.solo { padding-bottom: calc(var(--bar, 190px) + 8px); outline: none; }
/* scroll-margin: the fixed bar must not cover what is scrolled into sight. */
.solo .said, .solo .result { scroll-margin: 12px 0 calc(var(--bar, 190px) + 4px); }

/* The room under it keeps what can be tapped of it clear of the issue key on the message below. */
.earlier-key { align-self: center; margin: -8px 0 24px; }
/* The messages before the card: the chat's bubbles without their fill, in smaller grey type,
   so the card's own messages stay the ones to read. */
.msg.earlier { padding: 9px 14px 10px; background: none; color: var(--muted); }
.msg.earlier .es { font-size: 18px; }
.msg.earlier .issue-key { background: var(--paper); }

/* A sentence stored without its chat: nobody's bubble, so no tail. */
.msg.alone { align-self: flex-start; }

/* A box of its own, so a long meaning wraps in close lines; .nb around the gap would otherwise
   keep it on one line. */
.blank {
  display: inline-block;
  min-width: 3.4em;
  max-width: 100%;
  padding: .14em 8px 0;
  line-height: 1;
  text-align: center;
  white-space: normal;
  background: var(--accent-soft);
  border-bottom: 3px solid var(--ink);
  border-radius: var(--r-indicator) var(--r-indicator) 0 0;
}

.blank-meaning {
  display: inline-block;
  font-family: var(--body);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
}

.blank.waits { background: none; border-bottom: 2px solid var(--past); color: var(--muted); }
.blank.waits.empty { border-bottom-color: var(--muted); }

/* No line under it: with one it reads as a gap to fill in. As wide for every word. */
.covered { display: inline-block; padding: 0 .5em; font-size: .6em; line-height: 1.5; letter-spacing: .15em; vertical-align: middle; color: var(--muted); background: var(--past); border-radius: var(--r-indicator); }

.blank.whole { display: block; padding: 10px 12px 8px; text-align: left; }
.blank.whole .blank-meaning { font-size: 17px; line-height: 1.35; }

.part-english { display: block; margin-top: 4px; font-family: var(--body); font-weight: 400; font-size: 16px; line-height: 1.35; color: var(--muted); }

.target { background: var(--accent-soft); border-radius: var(--r-indicator); padding: 0 6px; }

.unseen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.msg.note { padding: 10px 16px 11px; }
.note p { margin: 0; }

.result .outcome-head { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.2; display: flex; align-items: center; gap: 10px; }
.sign {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1;
  color: #fff;
}
.sign.good { background: var(--green); }
.sign.meh { background: var(--accent); color: var(--ink); }
.sign.again { background: var(--danger); }

/* Each difference has a mark besides its colour: struck through, an ink line under the right word,
   an accent underlined on both sides. */
.result .outcome-head ~ .es { margin-top: 8px; overflow-wrap: anywhere; }
.off { text-decoration: line-through var(--danger) 2px; }
.fix { text-decoration: underline var(--ink) 3px; text-underline-offset: 5px; }
.accent-off, .accent-fix { text-decoration: underline var(--accent) 3px; text-underline-offset: 5px; }
/* Around a word that can be tapped the line sits on the word itself: an underline does not reach
   into its box. */
.fix .w .t { border-bottom: 3px solid var(--ink); }
.accent-fix .w .t { border-bottom: 3px solid var(--accent); }
.word-fix .off, .word-fix .accent-off { margin-right: 12px; color: var(--muted); }
.result-note { margin: 8px 0 0; font-size: 16px; }
.result-note.quiet { font-size: 14px; color: var(--muted); }

.bar-note { margin: 0 0 10px; }

/* The key that goes on takes the row; a side matter beside it stays small. */
.after-keys { display: flex; align-items: center; gap: 10px; }
.after-keys .key.wide { flex: 1; width: auto; }
.after-keys .pill { flex: none; white-space: nowrap; }

/* The send key stays at the growing field's last line. */
.composer-row.grows { align-items: flex-end; }
textarea.field { padding: 17px 16px; line-height: 1.35; resize: none; overflow: hidden; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; outline: none; }
.options .key { overflow-wrap: anywhere; }
.options .key:disabled { opacity: .4; cursor: default; }
.options .key.picked:disabled { opacity: 1; }
.waiting-line { min-height: 128px; margin: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }

[hidden] { display: none !important; }

/* ---------- Words ---------- */

.list {
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--r-card);
  margin-top: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2px 12px;
  padding: 16px 18px;
  border-top: var(--hairline);
}

.row:first-child { border-top: 0; }

.row .word { font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.1; }
.row .meaning { grid-column: 1; }
.row .sentence { grid-column: 1 / -1; font-size: 14px; color: var(--muted); margin-top: 4px; }

.status {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--past); }
.status.due::before { background: var(--accent); }
.status.learning::before { background: var(--cobalt); }
.status.known::before { background: var(--green); }

.row .remove { grid-row: 1 / span 2; grid-column: 3; align-self: center; min-width: 44px; padding: 0; font-size: 20px; line-height: 1; }

/* The backup: a side matter, so small and without fill. */
.backup { margin-top: 32px; }
.backup-keys { display: flex; justify-content: center; gap: 8px; }

@media (max-width: 420px) {
  h1 { font-size: 38px; }
  .es { font-size: 22px; }
  .slider-part { padding: 0 11px; font-size: 15px; }
}

/* Keeps a word and the punctuation touching it on one line. */
.nb { white-space: nowrap; }
