/* ==========================================================================
   Present Continuous Worksheet
   Two modes:
     • Screen → colourful, interactive, dynamic feedback
     • Print  → single A4 sheet (front = worksheet, back = extension)
                pure black & white, kid-friendly, photocopy-safe
   ========================================================================== */

:root {
  --ink:       #1a1a1a;
  --paper:    #fffefb;
  --accent:   #e85a1a;     /* SEE orange from the spec screenshots */
  --accent2:  #2a6dd6;
  --good:     #1f8a4c;
  --bad:      #c0392b;
  --muted:    #6b6b6b;
  --line:     #e6e2d8;
  --hilite:   #fff3c4;
  --shadow:   0 4px 14px rgba(0,0,0,.08);

  --ff-head: "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --ff-body: "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --ff-mono: "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #f4efe7;
  color: var(--ink);
  font-family: var(--ff-body);
  -webkit-font-smoothing: antialiased;
}

.print-only { display: none !important; }

/* ========== TOOLBAR (screen only) ========== */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: .9rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.brand { font-weight: 700; font-size: 1.05rem; }
.brand .muted { font-weight: 400; color: var(--muted); font-size: .92rem; }

.progress { display: flex; align-items: center; gap: .75rem; min-width: 180px; }
.progress .score { font-variant-numeric: tabular-nums; font-weight: 700; }
.progress .bar {
  width: 160px; height: 8px; background: #eee; border-radius: 99px; overflow: hidden;
}
.progress .fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #f3a83e);
  transition: width .35s ease;
}

.actions { display: flex; gap: .5rem; }
.btn {
  font: inherit; cursor: pointer; padding: .55rem .95rem;
  border-radius: 8px; border: 1px solid transparent;
  background: #fff;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost   { border-color: var(--line); color: var(--ink); }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #c94910; }

/* ========== SHEET (A4 visual) ========== */
.sheet {
  max-width: 820px;
  margin: 24px auto 80px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 28px 34px 32px;
}

/* ========== HEADER ========== */
.ws-head { border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.ws-title {
  margin: 0 0 .25rem;
  text-align: center;
  font-size: 1.15rem;
  text-decoration: underline;
  letter-spacing: .01em;
}
.ws-instructions {
  margin: .35rem 0 0;
  font-weight: 700;
  font-size: 1.02rem;
}
.ws-name { display: flex; justify-content: space-between; gap: 2rem; font-size: .95rem; margin-top: .5rem; }

/* ========== GRID OF 9 QUESTIONS ========== */
.ws-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: 1fr;
}

.q {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: stretch;
  border: 1px solid var(--ink);
  border-top: none;
}
.q:first-child { border-top: 1px solid var(--ink); }

.q-img {
  position: relative;
  border-right: 1px solid var(--ink);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
}
.verb-img {
  width: 100%; height: 100%;
  max-width: 86px; max-height: 86px;
  object-fit: contain;
  display: block;
  filter: grayscale(1) contrast(1.05);
}

/* Big X for negative sentences — draws two crossing strokes over the image */
.neg-x {
  position: absolute; inset: 0;
  pointer-events: none;
}
.neg-x::before, .neg-x::after {
  content: "";
  position: absolute;
  left: 4%; right: 4%; top: 50%;
  height: 4px;
  background: var(--bad);
  transform-origin: center;
}
.neg-x::before { transform: rotate( 45deg); }
.neg-x::after  { transform: rotate(-45deg); }

.q-body {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .55rem;
  font-size: 1.05rem;
  line-height: 1.5;
  min-height: 70px;
}
.q-num { font-weight: 700; min-width: 1.5rem; }
.q-label {
  font-style: italic; color: var(--muted); font-size: .92rem;
  margin-right: .25rem;
}
.sentence { flex: 1 1 auto; }
.verb-hint {
  font-style: italic; color: var(--muted);
  font-size: .92rem;
  white-space: nowrap;
}

.example .sentence u { text-decoration: underline; font-weight: 700; }

/* ========== INPUT GAPS ========== */
.gap {
  font: inherit;
  font-size: 1rem;
  width: 52px;
  padding: 2px 4px;
  border: none;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  text-align: center;
  outline: none;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.gap.ving { width: 96px; }
.gap:focus { background: var(--hilite); }

.gap.ok {
  color: var(--good);
  border-bottom-color: var(--good);
  background: #e9f7ef;
  font-weight: 700;
}
.gap.bad {
  color: var(--bad);
  border-bottom-color: var(--bad);
  background: #fbe9e7;
  animation: shake .3s;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-3px); }
  75%     { transform: translateX( 3px); }
}

.feedback {
  flex-basis: 100%;
  font-size: .85rem;
  min-height: 0;
  color: var(--good);
}
.feedback.err { color: var(--bad); }

/* row celebration */
.q.solved {
  background: linear-gradient(90deg, rgba(31,138,76,.07), transparent 60%);
}

/* ========== LEGEND ========== */
.ws-legend {
  margin-top: 10px;
  text-align: center;
  font-size: .88rem;
  color: var(--muted);
}
.legend-x {
  display: inline-block;
  width: 20px; height: 14px;
  position: relative;
  border: 1px solid var(--ink);
  vertical-align: middle;
  margin: 0 2px;
}
.legend-x::before, .legend-x::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), var(--bad) 50%, transparent calc(50% + 1px));
}
.legend-x::after {
  background: linear-gradient(to top left, transparent calc(50% - 1px), var(--bad) 50%, transparent calc(50% + 1px));
}
.symbol { font-weight: 700; color: var(--ink); }

/* ========== EXTENSION (reverse side) ========== */
.extension {
  page-break-before: always;   /* back of the A4 */
  margin-top: 28px;
  padding-top: 22px;
  border-top: 2px dashed var(--ink);
}
.ext-title {
  margin: 0 0 .15rem;
  text-align: center;
  font-size: 1.25rem;
  text-decoration: underline;
}
.ext-sub {
  margin: 0 0 1rem;
  text-align: center;
  color: var(--muted);
}
.ext-block { margin: .8rem 0 1rem; }
.ext-prompt { margin: 0 0 .35rem; font-size: 1rem; }
.ext-prompt .plus, .ext-prompt .minus, .ext-prompt .q-mark {
  display: inline-block;
  width: 24px; height: 24px;
  line-height: 22px; text-align: center;
  border: 2px solid var(--ink);
  font-weight: 700;
  margin-right: .35rem;
  border-radius: 4px;
}
.ext-line {
  font-family: var(--ff-mono);
  font-size: 1.02rem;
  letter-spacing: .02em;
  padding-left: .25rem;
}
.ext-star { margin-top: 1.2rem; font-weight: 600; }
.ext-draw-box {
  height: 180px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background:
    linear-gradient(to right, #fafafa 0 1px, transparent 1px 24px) 0 0 / 24px 24px;
}

.footer { text-align: center; color: var(--muted); padding: 20px; font-size: .88rem; }

/* ========== PRINT (A4) ========== */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff; }
  .no-print   { display: none !important; }
  .print-only { display: flex !important; }

  .sheet {
    margin: 0; padding: 0;
    border: none; box-shadow: none; max-width: none;
    background: #fff;
  }

  .ws-title, .ext-title { color: #000; }

  /* Printed inputs look like regular fill-in lines with any typed answer intact */
  .gap {
    border-bottom: 1.5px solid #000;
    background: transparent !important;
    color: #000 !important;
    width: 56px;
  }
  .gap.ving { width: 110px; }
  .gap.ok, .gap.bad { font-weight: 400; animation: none; }

  .q        { border-color: #000; page-break-inside: avoid; grid-template-columns: 78px 1fr; }
  .q-body   { padding: 6px 10px; min-height: 58px; }
  .q-img    { border-right-color: #000; }
  .verb-img { max-width: 70px; max-height: 70px; }
  .neg-x::before, .neg-x::after { background: #000; height: 3px; }

  .ws-title { font-size: 1.08rem; }
  .ws-instructions { font-size: .96rem; margin-top: .25rem; }

  .verb-img {
    filter: grayscale(1) contrast(1.3);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .feedback { display: none; }    /* live feedback is meaningless on paper */

  .extension { page-break-before: always; }
}
