:root {
  --red: #c81324;
  --red-dark: #8f0d19;
  --red-darker: #650914;
  --orange: #ff6a13;
  --orange-light: #ffb066;
  --ink: #201d1d;
  --ink-soft: #504a4a;
  --paper: #fffaf7;
  --card: #ffffff;
  --line: #ecdfd9;
  --gray-50: #faf7f5;
  --gray-100: #f1ebe7;
  --green: #1f7a3d;
  --green-bg: #e7f5ec;
  --green-line: #b9e2c6;
  --danger: #c81324;
  --danger-bg: #fdeceb;
  --danger-line: #f3c2be;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(101, 9, 20, 0.08), 0 1px 3px rgba(101, 9, 20, 0.08);
  --shadow-lg: 0 12px 32px rgba(101, 9, 20, 0.16);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--red); }

.topbar {
  background: linear-gradient(120deg, var(--red) 0%, var(--red-dark) 65%, var(--red-darker) 100%);
  color: #fff;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .badge {
  height: 42px;
  padding: 5px 10px;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.topbar .badge img {
  height: 100%;
  width: auto;
  display: block;
}

.topbar h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: .2px;
}

.topbar .sub {
  font-size: .78rem;
  opacity: .88;
  margin-top: 2px;
}

.topbar-accent {
  height: 4px;
  background: linear-gradient(90deg, var(--orange), var(--orange-light), var(--orange));
}

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 16px 90px;
}

main.wide { max-width: 1080px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.card h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: var(--red-darker);
}

.lead {
  color: var(--ink-soft);
  line-height: 1.5;
}

label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin: 14px 0 6px;
  color: var(--ink-soft);
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--gray-50);
  color: var(--ink);
  transition: border-color .15s, background .15s;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--orange);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .15s ease, opacity .15s;
  background: linear-gradient(120deg, var(--orange), #ff8a3d);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 106, 19, 0.35);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn.btn-block { width: 100%; }
.btn.btn-secondary {
  background: #fff;
  color: var(--red);
  border: 1.5px solid var(--red);
  box-shadow: none;
}
.btn.btn-dark {
  background: linear-gradient(120deg, var(--red), var(--red-dark));
  box-shadow: 0 6px 18px rgba(200, 19, 36, 0.3);
}
.btn.btn-sm { padding: 9px 16px; font-size: .85rem; }

.alert {
  padding: 13px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: .92rem;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--red-darker); }
.alert-success { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.alert-info { background: #fff4ea; border-color: #ffd9ae; color: #9a4c00; }

.progress-wrap {
  position: sticky;
  top: 68px;
  z-index: 15;
  background: var(--paper);
  padding: 10px 0 4px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--gray-100);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--red));
  border-radius: 999px;
  transition: width .2s ease;
  width: 0%;
}
.progress-label {
  font-size: .78rem;
  color: var(--ink-soft);
  margin-top: 6px;
  text-align: right;
}

.qcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  scroll-margin-top: 130px;
}
.qcard.unanswered-flag { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 106, 19, 0.15); }

.qnum {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.qtext { font-weight: 600; margin: 0 0 12px; line-height: 1.4; }

.qimg { max-width: 260px; width: 100%; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0 14px; display: block; }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--gray-50);
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--orange-light); }
.opt input { margin-top: 3px; accent-color: var(--red); width: 18px; height: 18px; flex-shrink: 0; }
.opt .opt-letter { font-weight: 700; color: var(--red); margin-right: 2px; }
.opt.selected { border-color: var(--red); background: #fff4f2; }

.opt.review-correct { border-color: var(--green-line); background: var(--green-bg); }
.opt.review-wrong { border-color: var(--danger-line); background: var(--danger-bg); }
.opt.review-plain { opacity: .75; }
.tag-inline { font-size: .72rem; font-weight: 700; margin-left: auto; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.tag-inline.ok { background: var(--green); color: #fff; }
.tag-inline.bad { background: var(--danger); color: #fff; }

.sticky-bar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(0deg, var(--paper) 60%, rgba(255,250,247,0));
  padding: 16px 0 10px;
  margin-top: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}
.stat-box {
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--line);
}
.stat-box .num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-box .label { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }
.stat-box.ok { background: var(--green-bg); border-color: var(--green-line); }
.stat-box.ok .num { color: var(--green); }
.stat-box.bad { background: var(--danger-bg); border-color: var(--danger-line); }
.stat-box.bad .num { color: var(--danger); }

.score-circle {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  margin: 6px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: conic-gradient(var(--red) calc(var(--pct) * 1%), var(--gray-100) 0);
  position: relative;
}
.score-circle::before {
  content: "";
  position: absolute;
  inset: 10px;
  background: var(--card);
  border-radius: 50%;
}
.score-circle .val { position: relative; font-size: 1.7rem; font-weight: 800; color: var(--red-darker); }
.score-circle .of { position: relative; font-size: .72rem; color: var(--ink-soft); }

footer.site-footer {
  text-align: center;
  font-size: .74rem;
  color: var(--ink-soft);
  padding: 18px;
}

.powered-by {
  margin-top: 8px;
}

.powered-by a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .74rem;
  opacity: .85;
  transition: opacity .12s;
}

.powered-by a:hover {
  opacity: 1;
  color: var(--red);
}

.powered-logo {
  height: 20px;
  width: auto;
  display: block;
  border-radius: 4px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  background: #fff;
}
table.data-table th, table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
table.data-table th {
  background: var(--gray-50);
  color: var(--ink-soft);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.data-table tr:hover td { background: #fff8f5; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-scroll table.data-table { border: none; }
.table-scroll .table-scroll { border: none; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--danger-bg); color: var(--danger); }
.pill.gray { background: var(--gray-100); color: var(--ink-soft); }

.code-box {
  font-family: "Consolas", monospace;
  font-size: 1.4rem;
  letter-spacing: .12em;
  font-weight: 700;
  background: var(--gray-50);
  border: 1.5px dashed var(--orange);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  color: var(--red-darker);
  user-select: all;
}

.link-box {
  background: var(--gray-50);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: "Consolas", monospace;
  font-size: .85rem;
  word-break: break-all;
}

.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-nav a {
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  color: var(--red-darker);
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
}
.admin-nav a.active, .admin-nav a:hover { background: var(--red); color: #fff; border-color: var(--red); }

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--ink-soft); font-size: .85rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .topbar h1 { font-size: .95rem; }
  main { padding: 16px 12px 90px; }
  .card { padding: 16px; }
}

/* ===== Strona zajawkowa (landing page) ===== */

html { scroll-behavior: smooth; }
body.lp-body { background: var(--paper); }

.lp-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.lp-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lp-nav-logo { height: 32px; width: auto; display: block; }

.lp-hero {
  background:
    radial-gradient(circle at 15% -10%, rgba(255, 106, 19, .35), transparent 55%),
    linear-gradient(160deg, #2b0509 0%, var(--red-darker) 45%, var(--red-dark) 100%);
  color: #fff;
  padding: 64px 20px 56px;
  text-align: center;
}
.lp-hero-inner { max-width: 720px; margin: 0 auto; }
.lp-kicker {
  display: inline-block;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .3);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.lp-hero h1 {
  font-size: 2.15rem;
  line-height: 1.22;
  margin: 0 0 16px;
  font-weight: 800;
}
.lp-hero-lead {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: .92;
  margin: 0 auto 28px;
  max-width: 620px;
}
.lp-cta-row { margin-bottom: 26px; }
.btn.btn-lg { padding: 16px 34px; font-size: 1.08rem; }
.lp-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  justify-content: center;
  font-size: .82rem;
  opacity: .92;
}

.lp-section { padding: 56px 20px; }
.lp-section-alt { background: var(--gray-50); }
.lp-section-inner { max-width: 1080px; margin: 0 auto; }
.lp-h2 {
  text-align: center;
  font-size: 1.55rem;
  color: var(--red-darker);
  margin: 0 0 36px;
}

.lp-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.lp-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.lp-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--orange), var(--red));
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
}
.lp-step h3 { font-size: 1rem; margin: 0 0 8px; color: var(--red-darker); }
.lp-step p { font-size: .86rem; color: var(--ink-soft); margin: 0; line-height: 1.5; }

.lp-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.lp-feature {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
}
.lp-feature-icon { font-size: 1.6rem; margin-bottom: 10px; }
.lp-feature h3 { font-size: .98rem; margin: 0 0 8px; color: var(--red-darker); }
.lp-feature p { font-size: .85rem; color: var(--ink-soft); margin: 0; line-height: 1.5; }

.lp-about {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: center;
}
.lp-about-text p { color: var(--ink-soft); line-height: 1.6; margin-bottom: 20px; }
.lp-about-logo {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lp-about-logo img { width: 100%; height: auto; max-width: 260px; }

.lp-login-section { background: linear-gradient(180deg, var(--gray-50), var(--paper)); }
.lp-login-card { max-width: 480px; margin: 0 auto; }

.lp-admin-link { margin-top: 10px; }
.lp-admin-link a { color: var(--ink-soft); font-size: .72rem; opacity: .7; text-decoration: none; }
.lp-admin-link a:hover { opacity: 1; }

@media (max-width: 900px) {
  .lp-steps, .lp-feature-grid { grid-template-columns: repeat(2, 1fr); }
  .lp-about { grid-template-columns: 1fr; }
  .lp-about-logo { order: -1; max-width: 220px; margin: 0 auto; }
}

@media (max-width: 560px) {
  .lp-steps, .lp-feature-grid { grid-template-columns: 1fr; }
  .lp-hero h1 { font-size: 1.6rem; }
  .lp-hero { padding: 44px 16px 36px; }
  .lp-section { padding: 40px 16px; }
  .lp-h2 { font-size: 1.3rem; }
  .lp-nav-logo { height: 26px; }
}
