:root{
  --bg1:#0b1020;
  --bg2:#0f172a;
  --card:#0b1224cc;
  --border:#1f2a44;
  --text:#e8eefc;
  --muted:#aab6d6;
  --accent:#4b62ff;
  --accent2:#22c55e;
  --danger:#ef4444;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 18px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  min-height:100vh;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(75,98,255,.18), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(34,197,94,.12), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

.container{
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 18px 60px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hidden{ display:none !important; }

h1,h2,h3{ margin:0; }
p{ margin:0; }

.muted{ color:var(--muted); }

/* Buttons */
.btn{
  appearance:none;
  border: 1px solid transparent;
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
  cursor:pointer;
  transition: transform .06s ease, border-color .15s ease, background .15s ease;
}
.btn:hover{ border-color: rgba(75,98,255,.6); background: rgba(255,255,255,.09); }
.btn:active{ transform: translateY(1px); }

.btn.primary{
  background: linear-gradient(135deg, rgba(75,98,255,.95), rgba(75,98,255,.55));
  border-color: rgba(75,98,255,.6);
}
.btn.primary:hover{ border-color: rgba(75,98,255,.95); }

.btn.ghost{
  background: transparent;
  border-color: rgba(255,255,255,.12);
}

.btn.danger{
  border-color: rgba(239,68,68,.45);
}
.btn.danger:hover{
  border-color: rgba(239,68,68,.85);
}

/* Start screen layout */
.hero{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  padding: 22px;
  align-items: stretch;
}
@media (max-width: 820px){
  .hero{ grid-template-columns: 1fr; }
}

.hero-left{ padding: 18px; }

.hero-title{
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-sub{
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 62ch;
}

.hero-actions{
  display:flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.badges{
  display:flex;
  gap:10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.badge{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Badge като бутон – Start test */
.badge-action{
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(135deg, rgba(75,98,255,.95), rgba(75,98,255,.55));
  border-color: rgba(75,98,255,.6);
  transition: transform .06s ease, border-color .15s ease, background .15s ease;
}

.badge-action:hover{
  border-color: rgba(75,98,255,.95);
  background: linear-gradient(135deg, rgba(75,98,255,1), rgba(75,98,255,.6));
}

.badge-action:active{
  transform: translateY(1px);
}

.hero-right{
  padding: 18px;
  border-left: 1px solid rgba(255,255,255,.08);
}
@media (max-width: 820px){
  .hero-right{ border-left: none; border-top: 1px solid rgba(255,255,255,.08); }
}

/* Info card – Wikipedia panel */
.info-card{
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-title{
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  text-transform: lowercase;
}

.wiki-preview{
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}

.wiki-preview:hover{
  border-color: rgba(75,98,255,.6);
  background: rgba(255,255,255,.08);
}

.wiki-image{
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #fff;
  color: #000;
  font-weight: 900;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wiki-text{
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}

.wiki-text strong{
  color: var(--text);
}

.created-by{
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* Quiz */
.quiz{ padding: 22px; }

.topbar{
  display:flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.progress{
  height: 10px;
  width: min(420px, 100%);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  overflow:hidden;
}

.progress > div{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(75,98,255,.9), rgba(34,197,94,.65));
}

/* New quiz layout (5 questions per page) */
.question-list{
  display: grid;
  gap: 12px;
  margin-top: 10px;
  min-height: 120px; /* визуално да не изглежда празно */
}

.q-card{
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 14px;
}

.q-text{
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.q-options{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 860px){
  .q-options{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.opt-btn{
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
  transition: border-color .15s ease, transform .06s ease, background .15s ease;
}

.opt-btn:hover{
  border-color: rgba(75,98,255,.8);
  background: rgba(255,255,255,.08);
}

.opt-btn:active{ transform: translateY(1px); }

.opt-btn.selected{
  border-color: rgba(34,197,94,.85);
  background: rgba(34,197,94,.12);
}

.quiz-nav{
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Result (обединено) */
.result{
  padding: 22px;
  display: flex;
  flex-direction: column;
}

/* KPI cards */
.kpi-card{
  margin-top: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.kpi-title{
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.kpi-value{
  font-size: 42px;
  font-weight: 900;
  margin: 10px 0 6px;
}

.kpi-label{
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

/* Canvas + list */
.canvas-wrap{
  display:grid;
  gap: 14px;
  align-items: start;
  grid-template-columns: 420px 1fr;
  margin-top: 14px;
}
@media (max-width: 920px){
  .canvas-wrap{ grid-template-columns: 1fr; }
}

canvas{
  width: 100%;
  max-width: 420px;
  height: auto;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
}

.party-list{
  list-style:none;
  padding:0;
  margin:0;
  display:grid;
  gap: 10px;
}

.party-item{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 12px;
}

.party-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.party-logo{
  width:28px;
  height:28px;
  border-radius:8px;
  overflow:hidden;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.85);
  font-weight: 800;
}

.party-logo img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.party-name-link{
  font-weight: 750;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.party-name-link:hover{
  text-decoration: underline;
}

.party-pct{
  min-width: 46px;
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

/* You are */
.you-are{
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  text-align: center;
}

.you-are-title{
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
}

.you-are-text{
  font-size: 16px;
  color: var(--muted);
  line-height: 1.4;
}

/* Result footer */
.result-footer{
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-footer-left{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.result-footer-right{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Feedback panel */
.feedback-panel{
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}

.feedback-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.feedback-title{
  font-weight: 800;
  font-size: 16px;
}

.feedback-text{
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding: 12px;
  resize: vertical;
  outline: none;
}

.feedback-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.feedback-status{
  color: var(--muted);
  font-size: 13px;
}