/* Viktorinų administravimo sąsaja */
:root {
  --green: #12803a; --green-600: #0e6a30; --green-700: #0b5727;
  --green-50: #ecf7ef; --green-100: #d6eedd;
  --ink: #10231a; --ink-2: #33473c; --muted: #64766b;
  --line: #e0e8e3; --line-2: #cdd9d1; --bg: #f2f5f3; --card: #fff;
  --err: #b42318; --err-50: #fdecea; --err-line: #f6c7c1;
  --warn: #8a5300; --warn-50: #fff6de; --warn-line: #f0d58c;
  --blue: #1d4ed8; --blue-50: #e8eefc;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 35, 26, .05), 0 6px 20px rgba(16, 35, 26, .05);
  --focus: 0 0 0 3px rgba(18, 128, 58, .22);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-600); text-underline-offset: 2px; }
a:hover { color: var(--green-700); }
h1 { font-size: 28px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; margin: 0 0 18px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 32px 0 12px; }
h2.flush { margin: 0 0 8px; }
p { margin: 0 0 12px; }
code { background: #eef3f0; border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink-2); }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--err); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Viršutinė juosta ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topin { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { display: block; height: 36px; width: auto; }
.brand span { font-weight: 700; font-size: 14px; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line-2); }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.top nav a:hover { background: #eef3f0; }
.top nav a.on { background: var(--green-50); color: var(--green-700); }
.logout { display: flex; align-items: center; gap: 12px; margin: 0; }
.who { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---------- Išdėstymas ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
main.guest { padding-top: 0; }
.narrow { max-width: 440px; margin: 0 auto; }
.narrow h1 { font-size: 24px; }
.login { padding-top: 12vh; text-align: center; }
.login form { text-align: left; }
.loginlogo { display: block; margin: 0 auto 22px; height: 110px; width: auto; }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.headrow h1, .headrow h2 { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 18px; box-shadow: var(--shadow); }
.card.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.card.row label { flex: 1 1 200px; margin: 0; }
.card > :last-child { margin-bottom: 0; }
.linkrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.linkrow > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Formos ---------- */
label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px; min-height: 40px;
  font: inherit; font-size: 15px; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
select { padding-right: 32px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: #9aa9a0; }
input:hover, select:hover, textarea:hover { border-color: #b5c5ba; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: var(--focus); }
textarea { resize: vertical; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 9px 18px;
  border: 1px solid var(--green); border-radius: var(--radius-sm); background: var(--green); color: #fff;
  font: inherit; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 2px rgba(11, 87, 39, .25); transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn:hover { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); box-shadow: 0 1px 1px rgba(16, 35, 26, .04); }
.btn.ghost:hover { background: var(--green-50); border-color: var(--green-100); color: var(--green-700); }
.btn.danger { background: var(--err); border-color: var(--err); box-shadow: 0 1px 2px rgba(180, 35, 24, .3); }
.btn.danger:hover { background: #8f1c13; border-color: #8f1c13; }
form.inline { display: inline; }

/* ---------- Pranešimai ir žymos ---------- */
.flash { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; background: var(--green-50); border: 1px solid var(--green-100); color: var(--green-700); font-weight: 600; }
.flash::before { content: "✓"; font-weight: 800; }
.flash.err { background: var(--err-50); border-color: var(--err-line); color: var(--err); }
.flash.err::before { content: "!"; }
.flash code { font-size: 15px; font-weight: 700; user-select: all; background: #fff; }
.note { background: var(--warn-50); border: 1px solid var(--warn-line); color: var(--warn); border-radius: var(--radius-sm); padding: 11px 16px; font-size: 14px; }
.note a { color: inherit; font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #edf1ee; color: #51635a; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.open { background: var(--green-50); color: var(--green-700); }
.badge.closed { background: var(--err-50); color: var(--err); }
.badge.graded { background: var(--blue-50); color: var(--blue); }
.hint { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: var(--warn-50); border: 1px solid var(--warn-line); color: var(--warn); font-size: 12px; font-weight: 600; }

/* ---------- Lentelės ---------- */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { background: #f7faf8; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfb; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
tr.off td { color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
td.actions form, td.actions a { margin-left: 6px; }
table.dense th, table.dense td { padding: 8px 10px; font-size: 13px; }
/* Plati dalyvių lentelė: nespaudžiama į ekraną, o slenka horizontaliai; atsakymai – vienoje eilutėje */
table.dense { width: max-content; min-width: 100%; }
table.dense td { white-space: nowrap; }
table.dense td:nth-child(5), table.dense td:nth-child(6) { white-space: normal; min-width: 150px; max-width: 240px; }
td.ans { text-align: center; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
table.dense th.num { text-align: center; }
td.rank { font-weight: 800; font-size: 16px; color: var(--green); }
tfoot th { background: #f7faf8; border-top: 1px solid var(--line-2); border-bottom: 0; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); }
section.card table { margin-top: 8px; }
section.card th, section.card td { padding-left: 0; }
section.card thead th { background: none; }
section.card tbody tr:hover td { background: none; }

/* ---------- Viktorinos antraštė ir skirtukai ---------- */
.quizhead { margin-bottom: 22px; }
.back { display: inline-block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--green-700); }
.titlerow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.titlerow h1 { margin: 0; }
.tabs { display: inline-flex; gap: 2px; padding: 4px; background: #e6ece8; border-radius: 12px; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 8px 16px; border-radius: 9px; text-decoration: none; font-weight: 650; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .5); }
.tabs a.on { background: #fff; color: var(--green-700); box-shadow: 0 1px 3px rgba(16, 35, 26, .12); }

/* ---------- Dalyvio nuorodos kortelė ---------- */
.share {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 22px 24px; margin-bottom: 18px;
  border: 1px solid var(--green-100); border-radius: var(--radius); box-shadow: var(--shadow);
  background: linear-gradient(120deg, #ffffff 0%, #f1f9f3 55%, #e3f3e8 100%);
}
.share-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.share-link { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--green-700); text-decoration: none; overflow-wrap: anywhere; }
.share-link:hover { text-decoration: underline; }
.share-state { flex: none; }
.share-state .btn { min-height: 46px; padding: 10px 22px; font-size: 15px; }
.qrbox { display: flex; align-items: center; gap: 14px; flex: none; }
.qrbox svg { width: 104px; height: 104px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; flex: none; }
.qrbtns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Klausimų redaktorius ---------- */
.titlefield { max-width: 560px; }
.qtable th, .qtable td { padding: 10px 14px; }
.qtable td { vertical-align: top; }
.qtable select, .qtable input, .qtable textarea { margin: 0; }
.qtable th:nth-child(1), .qtable td:nth-child(1) { width: 64px; text-align: center; }
.qtable td.qtypecell { width: 230px; min-width: 200px; }
.qtable td.qcontent { width: 300px; min-width: 240px; }
.qtable td.qoptcell { width: 100px; }
.qtable td.qpointscell { width: 100px; }
.qtable td.qtypecell, .qtable td.qoptcell { line-height: 40px; color: var(--ink-2); }
.qtable td.qtypecell select, .qtable td.qoptcell input { line-height: 1.5; }
.qtable .letter { width: 130px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.qtable .letter::placeholder { text-transform: none; font-weight: 400; letter-spacing: 0; }
.qtable .points, .qtable input[type=number] { width: 84px; }
.qtable textarea { min-height: 76px; }
.qtable td.qcontent textarea { min-height: 60px; width: 100%; }
.qimgrow { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.qimgrow img { display: block; max-width: 96px; max-height: 64px; border-radius: 6px; border: 1px solid var(--line); }
.filelabel { display: block; margin: 8px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.filelabel input[type=file] { display: block; width: 100%; margin-top: 4px; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: 13px; }
label.check input { width: auto; margin: 0; }
label.optcheck { font-size: 15px; margin: 4px 0 16px; }
.qno {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; margin-top: 3px;
  border-radius: 10px; background: var(--green-50); color: var(--green-700); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
}
h2 .qno { margin: 0 6px 0 0; vertical-align: middle; }
td.qno { display: table-cell; background: none; border-radius: 0; height: auto; font-size: 16px; color: var(--green); }
.qtable td.qno { padding-top: 18px; }
td.qno, th.num:first-child { width: 72px; text-align: center; }
.qrow[data-type=text] .only-choice, .qrow[data-type=essay] .only-choice,
.qrow:not([data-type=text]) .only-text, .qrow:not([data-type=essay]) .only-essay,
.qrow:not([data-type=multi]) .only-multi { display: none; }
.only-multi, .only-essay { display: block; margin-top: 6px; max-width: 460px; font-size: 13px; line-height: 1.4; }
.qrow[data-type=essay] .only-essay { margin-top: 10px; }
.rowbtns { display: flex; gap: 8px; margin-bottom: 14px; }
.savebar {
  position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 12px 16px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(16, 35, 26, .14);
}
.dangerzone { margin-top: 36px; }
.card.dangerzone { border-color: var(--err-line); max-width: 540px; box-shadow: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }

/* ---------- Peržiūra ---------- */
details { margin-top: 14px; }
summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
summary:hover { color: var(--ink); }
.essay { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.essay label { flex: none; width: 130px; margin: 0; }
.essaytext { flex: 1; overflow-wrap: anywhere; background: #f7faf8; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; line-height: 1.55; }
.scoreform { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin: 0; }
.scoreform input { width: 84px; margin: 0; }

/* ---------- Eiga ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .v { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .l { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat.main { background: linear-gradient(135deg, var(--green) 0%, #1a9a49 100%); border-color: var(--green); color: #fff; }
.stat.main .l { color: rgba(255, 255, 255, .85); }
.qbars { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.qbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.qbar .h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.qbar .h b { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 9px; background: var(--green-50); color: var(--green-700); font-size: 15px; }
.bar { height: 8px; background: #e8eeea; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #2bb35c); border-radius: 99px; transition: width .4s ease; }
.dist { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dist span { padding: 2px 8px; border-radius: 7px; background: #f2f6f3; font-weight: 600; }
.dist b { color: var(--ink); margin-left: 2px; }

@media (max-width: 760px) {
  .topin { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px 16px; }
  .brand span, .who { display: none; }
  main { padding: 20px 16px 72px; }
  h1 { font-size: 24px; }
  .share { padding: 18px; }
  .share-link { font-size: 17px; }
}

/* ---------- Protmūšio logotipai ---------- */
.logoform h2 { margin: 0 0 4px; font-size: 16px; }
.logoslots { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0; }
.logoslot { flex: 1 1 240px; border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px; }
.logoslot > span { display: block; font-weight: 600; margin-bottom: 8px; }
.logoslot img { display: block; max-height: 56px; max-width: 100%; margin: 0 0 8px; }
.logoslot input[type=file] { display: block; width: 100%; font-size: 13px; }
.logoslot label.check { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-weight: 400; }
.logoslot label.check input { width: auto; margin: 0; }
