/* One question at a time. English source (serif, not selectable) above each box the
   translator types into. Light only, same palette as the grading viewer. */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #d2d2d7;
  --fill: #e8e8ed;
  --blue: #0071e3;
  --blue-soft: #e8f1fc;
  --green: #1a8f3c;
  --green-soft: #e6f4ea;
  --gold: #9a6c00;
  --gold-soft: #fcf3d2;
  --gold-fill: #e8b100;
  --red: #c9252d;
  --font:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --script: var(--font);
  color-scheme: light;
}
:root.hi {
  --script: 'Noto Sans Devanagari', var(--font);
}
:root.bn {
  --script: 'Noto Sans Bengali', var(--font);
}
:root.ta {
  --script: 'Noto Sans Tamil', var(--font);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  cursor: default;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.num {
  font-variant-numeric: tabular-nums;
}
.src {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  font-weight: 600;
  transition:
    background 0.15s,
    transform 0.08s,
    opacity 0.15s;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--blue);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: #0077ed;
}
.btn.primary:disabled,
.btn.primary.dim {
  opacity: 0.35;
}
.btn.ghost {
  color: var(--blue);
  padding: 0 14px;
}
.btn.ghost:hover:not(:disabled) {
  background: var(--blue-soft);
}
.btn.ghost:disabled {
  color: var(--faint);
  opacity: 0.5;
}
.btn.wide {
  width: 100%;
}
.kbd {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.7;
}

/* ---------- centred cards: sign in, intro, messages ---------- */
.center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.panel {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.06);
}
.panel h1 {
  font: 700 30px/1.2 var(--serif);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.panel .lead {
  color: var(--muted);
  margin: 0 0 24px;
}
.field {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 17px;
  margin-bottom: 12px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.field:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.msg {
  min-height: 22px;
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
.msg.err {
  color: var(--red);
}
.msg:empty {
  min-height: 0;
  margin: 0;
}
.link {
  color: var(--blue);
  font-size: 14px;
}
.link:hover {
  text-decoration: underline;
}
.rules {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  gap: 14px;
}
.rules li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.rules .ic {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--fill);
  display: grid;
  place-items: center;
  font-size: 17px;
}
.rules b {
  display: block;
  font-weight: 600;
}
.rules span {
  color: var(--muted);
  font-size: 14px;
}
.fine {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 20px;
}

/* ---------- work screen ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.top-in {
  max-width: 1200px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.task {
  font-weight: 600;
  white-space: nowrap;
}
.spacer {
  flex: 1;
}
.save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.save i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  transition: background 0.2s;
}
.save.busy i {
  background: var(--faint);
  animation: pulse 1s infinite;
}
.save.off {
  color: var(--gold);
}
.save.off i {
  background: var(--gold-fill);
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
.count {
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.count:hover {
  border-color: var(--faint);
}
.count .of {
  color: var(--faint);
  font-weight: 400;
}
.bar {
  height: 3px;
  background: var(--fill);
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  transition: width 0.4s ease;
}
.menu {
  color: var(--muted);
  font-size: 13px;
}
.menu:hover {
  color: var(--ink);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}
.item {
  animation: in 0.22s ease;
}
@keyframes in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.label {
  font-family: 'Google Sans', var(--font);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--faint);
  margin: 0 0 8px;
}
.chip {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 2px 10px;
  border-radius: 10px;
}
.chip.done {
  background: var(--green-soft);
  color: var(--green);
}
.chip.flag {
  background: var(--gold-soft);
  color: var(--gold);
}
/* Google Translate layout: English in white boxes on the left, the translation in grey boxes on the right */
#v-work {
  min-height: 100vh;
  background: #fff;
}
#v-work .top {
  background: rgba(255, 255, 255, 0.9);
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 20px;
}
.tab {
  justify-self: start;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 500;
  color: #1a73e8;
  border-bottom: 2px solid #1a73e8;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pane {
  border-radius: 8px;
  padding: 18px 24px;
  min-height: 120px;
}
.pane.in {
  background: #fff;
  border: 1px solid #dadce0;
}
.pane.out {
  background: #f0f4f9;
  border: 1px solid #f0f4f9;
  transition: border-color 0.15s;
}
.pane.out:focus-within {
  border-color: #1a73e8;
}
.pair.answer .pane {
  min-height: 200px;
}
.en-q {
  font: 700 24px/1.4 var(--serif);
  margin: 0;
  color: #1f1f1f;
}
.en-a {
  font: 400 18px/1.6 var(--serif);
  margin: 0;
  color: #1f1f1f;
}
.box {
  display: block;
  width: 100%;
  resize: none;
  overflow: hidden;
  border: 0;
  background: transparent;
  padding: 0;
  color: #1f1f1f;
}
.box:focus {
  outline: none;
}
/* Translation boxes: Google Sans for Latin; Indic letters fall through to the Noto font for the language */
#t-q,
#t-a {
  font:
    normal 400 24px/1.5 'Google Sans',
    var(--script);
}
.box::placeholder {
  color: #80868b;
  font-size: 21px;
}
.gap {
  height: 28px;
}
.unsure {
  margin-top: 28px;
}
.unsure-btn {
  font-size: 14px;
  color: var(--muted);
}
.unsure-btn:hover {
  color: var(--gold);
}
.unsure-btn.on {
  color: var(--gold);
  font-weight: 600;
}
.note {
  margin-top: 10px;
  height: 44px;
  font-size: 15px;
}

/* Done: a pill at the right end of the language row, above the translation box (like Google's "Text" chip) */
.tabs-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px 0 16px;
  border-radius: 20px;
  background: #d3e3fd;
  color: #0b57d0;
  font:
    500 16px 'Google Sans',
    var(--font);
  transition:
    background 0.15s,
    transform 0.08s,
    opacity 0.15s;
}
.pill svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.pill:hover {
  background: #c2d7fb;
}
.pill:active {
  transform: scale(0.97);
}
.pill.dim {
  opacity: 0.35;
}
.pill.ghost {
  background: #fff;
  color: #444746;
  border: 1px solid #dadce0;
}
.pill.ghost:hover:not(:disabled) {
  background: #f1f3f4;
}
.pill:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}
.pill.ghost#b-next {
  padding: 0 16px 0 20px;
}
.pill.is-done,
.pill.is-done:hover {
  background: #e6f4ea;
  color: #188038;
} /* this item is already done */
.acts {
  display: flex;
  gap: 8px;
}

/* ---------- grid of all items ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 0.15s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-head h2 {
  margin: 0;
  font-size: 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}
.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--fill);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.08s;
}
.cell:hover:not(:disabled) {
  transform: scale(1.08);
}
.cell:disabled {
  opacity: 0.4;
}
.cell.draft {
  background: var(--blue-soft);
  color: var(--blue);
}
.cell.done {
  background: var(--green);
  color: #fff;
}
.cell.cur {
  box-shadow:
    0 0 0 2px var(--card),
    0 0 0 4px var(--ink);
}
.cell.flag::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-fill);
  border: 1.5px solid var(--card);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 30;
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toast 0.2s ease;
  pointer-events: none;
}
@keyframes toast {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}
.cover {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(245, 245, 247, 0.96);
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
}
.cover p {
  color: var(--muted);
  margin: 6px 0 20px;
}
.big {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
}

@media (max-width: 760px) {
  .tabs {
    grid-template-columns: 1fr;
  }
  .tabs > .tab {
    display: none;
  }
  .pair {
    grid-template-columns: 1fr;
  }
  .pane {
    padding: 14px 16px;
    min-height: 0;
  }
  .pair.answer .pane {
    min-height: 0;
  }
  .pane.out {
    min-height: 88px;
  }
}
@media (max-width: 600px) {
  .tabs-out {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .acts .pill,
  .pill.ghost#b-next {
    height: 36px;
    padding: 0 12px;
    font-size: 15px;
    gap: 4px;
  }
  .en-q {
    font-size: 21px;
  }
  .en-a {
    font-size: 17px;
  }
  .save span {
    display: none;
  }
  .panel {
    padding: 28px 22px 24px;
  }
  .kbd {
    display: none;
  }
}
