:root {
  --green: #16803c;
  --green-dark: #0f5f2c;
  --green-soft: #e3f4e8;
  --ink: #14211a;
  --muted: #5b6b62;
  --line: #cfdbd3;
  --bg: #f4f8f5;
  --card: #ffffff;
  --warn: #9a5b00;
  --warn-bg: #fff3d6;
  --err: #b3261e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 520px;
  min-height: 100%;
  margin: 0 auto;
  padding: 16px 16px 56px;
  display: flex;
  flex-direction: column;
}

.loading { text-align: center; color: var(--muted); margin-top: 30vh; }

.logo { display: block; width: 170px; height: auto; margin: 0 auto 12px; flex: none; }
/* Protmūšio logotipai (iki dviejų) – vietoje numatytojo */
.logos { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 auto 12px; flex: none; width: 100%; }
.logos img { display: block; max-height: 48px; max-width: 44%; width: auto; height: auto; object-fit: contain; }

/* Registracija – kompaktiška, kad tilptų viename telefono ekrane */
.regtitle { font-size: 21px; text-align: center; margin: 0 0 12px; }
.reg input[type=text], .reg input[type=email], .reg select { font-size: 17px; padding: 11px 12px; margin-bottom: 8px; border-radius: 10px; }
.reg select.empty { color: #757575; }
.reg .row { margin-top: 4px; }
.reg .btn { min-height: 52px; padding: 10px 16px; }
.reg .error { margin: 0 0 8px; font-size: 15px; }
.small { font-size: 13px; line-height: 1.35; margin-top: 10px; }

.answer-area { width: 100%; min-height: 170px; font: inherit; font-size: 18px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); resize: vertical; }
.answer-area:focus { outline: none; border-color: var(--green); }
.counter { text-align: right; color: var(--muted); font-size: 13px; margin-top: 4px; }

h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 16px; }
.center { text-align: center; }
.grow { flex: 1; }

/* Formos laukai */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=email], select {
  width: 100%;
  font: inherit;
  font-size: 20px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}
input[type=text]:focus, input[type=email]:focus, select:focus { outline: none; border-color: var(--green); }
.error { color: var(--err); font-weight: 600; margin-top: 12px; }

/* Mygtukai */
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 14px 18px;
  border: 2px solid var(--green);
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}
.btn:active { background: var(--green-dark); }
.btn.secondary { background: var(--card); color: var(--green-dark); }
.btn.link { border: 0; background: none; color: var(--muted); font-size: 16px; font-weight: 400; text-decoration: underline; min-height: 44px; }
.row { display: flex; gap: 12px; margin-top: 16px; }
.row .btn { flex: 1; }

/* Klausimo ekranas */
.qhead { text-align: center; }
.qlabel { color: var(--muted); font-size: 18px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.qnum {
  font-size: clamp(110px, 38vw, 200px);
  line-height: 1;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  margin: 0 0 4px;
}
.qof { color: var(--muted); font-size: 16px; margin-bottom: 18px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  min-height: 92px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  font-size: 44px;
  font-weight: 800;
}
.opt[aria-pressed=true] { border-color: var(--green); background: var(--green); color: #fff; }

.multihint { text-align: center; font-weight: 700; color: var(--green-dark); background: var(--green-soft); border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; }

.answer-input { font-size: 24px !important; padding: 18px !important; }

/* Numerių juostelė */
.strip { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; }
.strip button {
  /* 38 px: aštuoni numeriai telpa vienoje eilėje 390 px pločio telefone */
  width: 38px; height: 40px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}
.strip button.done { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.strip button.cur { outline: 3px solid var(--ink); outline-offset: 1px; }

/* Suvestinė */
.bigstat { font-size: 44px; font-weight: 800; color: var(--green); text-align: center; margin: 12px 0 4px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 16px; margin: 14px 0; }
.card.warn { background: var(--warn-bg); border-color: #e6c36a; }
.tick { font-size: 84px; text-align: center; color: var(--green); line-height: 1; margin: 12vh 0 8px; }

/* Sinchronizavimo indikatorius */
.sync {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green-dark);
  border-top: 1px solid var(--line);
}
.sync.pending { background: #eef1ef; color: var(--muted); }
.sync.offline { background: var(--warn-bg); color: var(--warn); }

/* Klausimas su tekstu ar nuotrauka */
.qhead.compact .qlabel { font-size: 15px; margin-bottom: 10px; }
.qimg { display: block; max-width: 100%; max-height: 34vh; margin: 0 auto 12px; border-radius: 12px; object-fit: contain; }
/* Klausimas su nuotrauka: atsakymų raidės vienoje eilėje ir žemesnės, kad nuotrauka, tekstas ir
   mygtukai tilptų telefono ekrane be slinkimo (3 variantai – 3 stulpeliai, 4 – 4, 5–6 – dvi eilės) */
.qimg ~ .options, .qimg ~ * .options { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 10px; }
.qimg ~ .options .opt, .qimg ~ * .options .opt { min-height: 68px; font-size: 34px; border-radius: 14px; }
.qimg ~ .qtext { font-size: 19px; margin-bottom: 12px; }
.qtext { font-size: 20px; font-weight: 600; line-height: 1.35; margin: 0 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.small { font-size: 15px; }
.strip button:disabled { opacity: .75; cursor: default; }

/* Rezultatai ir klausimų peržiūra */
.resstats > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.resstats > div + div { border-top: 1px solid var(--line); }
.verdict { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; font-weight: 700; background: #eef1ef; color: var(--muted); }
.verdict.ok { background: var(--green-soft); color: var(--green-dark); }
.verdict.bad { background: #fde8e6; color: var(--err); }
.opt.static { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; cursor: default; }
.opt.static small { font-size: 13px; font-weight: 600; margin-top: 6px; }
.opt.static.ok { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.opt.static.bad { border-color: var(--err); background: #fde8e6; color: var(--err); }
.strip button.bad { background: #fde8e6; border-color: var(--err); color: var(--err); }
.reslabel { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.reslabel:not(:first-child) { margin-top: 14px; }
.resanswer { font-size: 19px; white-space: pre-wrap; overflow-wrap: anywhere; }
.resanswer.ok { color: var(--green-dark); font-weight: 700; }
/* Dar tikrinami atsakymai */
.verdict.wait, .opt.static.wait, .strip button.wait { background: var(--warn-bg); color: var(--warn); border-color: #e6c36a; }
.resstats .waitrow { color: var(--warn); }

/* Mygtukas „Atnaujinti" laukiant rezultatų */
.refresh { margin: 18px auto 0; width: 100%; max-width: 280px; }
.refresh .btn { width: 100%; }
.refresh .btn:disabled { opacity: .6; }
.refresh p { min-height: 2.8em; margin: 10px 0 0; }
