*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a1024;
  --brand-soft: rgba(15, 23, 55, 0.55);
  --accent: #5b9cf6;
  --accent-dim: rgba(91, 156, 246, 0.14);
  --accent-glow: rgba(91, 156, 246, 0.4);
  --text: #eaf0ff;
  --text-muted: #9db0d4;
  --text-dim: #5b6b8c;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.3);
  --radius: 18px;
  --radius-sm: 10px;

  --on-accent: #07101f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-border: rgba(255, 255, 255, 0.1);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --surface-strong-border: rgba(255, 255, 255, 0.14);
  --track: rgba(255, 255, 255, 0.1);
  --desc: rgba(234, 240, 255, 0.72);
  --desc-strong: rgba(234, 240, 255, 0.85);
  --logo-filter: brightness(0) invert(1) drop-shadow(0 4px 24px rgba(91, 156, 246, 0.25));
  --hero-grad-a: #ffffff;
  --hero-grad-b: #b0ccff;
  /* Landscape / desktop background; portrait override below */
  --bg-image: url('assets/fonas_2560x1440.png');
}

@media (orientation: portrait) {
  :root {
    --bg-image: url('assets/fonas_1080x1920.png');
  }
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fixed full-viewport background image (swaps by orientation via --bg-image) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-image) center center / cover no-repeat;
}


/* ── CANVAS ── */
#canvas-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

/* ── LAYOUT ── */
#app {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 20px 64px;
}

/* Logo: top-left bar that occupies its own height so content sits below it */
#hero-logo-wrap {
  position: relative;
  z-index: 5;
  padding: 0;
}

.hero-logo {
  width: min(480px, 80vw);
  height: auto;
  display: block;
  filter: var(--logo-filter);
  cursor: pointer;
  transition: opacity 0.18s;
}

.hero-logo:hover {
  opacity: 0.8;
}

/* Centered content column */
#content {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  #app {
    padding: 32px 16px 52px;
  }

  .hero-logo {
    width: min(360px, 80vw);
  }
}

@media (max-width: 480px) {
  #app {
    padding: 24px 10px 48px;
  }

  .hero-logo {
    width: 60vw;
  }

  /* Let the stat chips shrink evenly instead of forcing overflow */
  .intro-stats {
    gap: 10px;
  }

  .stat-chip {
    flex: 1;
    min-width: 0;
    padding: 12px 10px;
  }
}

/* Desktop: overlay the logo so #app fills the full viewport and the
   card centers in the true middle (navbar height included in the calc) */
@media (min-width: 769px) {
  body {
    position: relative;
  }

  #hero-logo-wrap {
    position: absolute;
    top: 0;
    left: 0;
  }
}

/* ── HERO ── */
.hero {
  text-align: center;
  margin-bottom: 36px;
}

.hero.hidden {
  display: none;
}

.hero h1 {
  font-size: clamp(1.3rem, 6.5vw, 2.9rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  overflow-wrap: break-word;
  background: linear-gradient(140deg, var(--hero-grad-a) 25%, var(--hero-grad-b) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── CARD ── */
.card {
  background: var(--brand-soft);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 38px 42px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

@media (max-width: 560px) {
  .card {
    padding: 26px 18px;
  }
}

@media (max-width: 380px) {
  .card {
    padding: 20px 14px;
    border-radius: 14px;
  }
}

.card.anim-in {
  animation: slideIn 0.38s cubic-bezier(.22, .68, 0, 1.2) forwards;
}

.card.anim-out {
  animation: slideOut 0.22s ease forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: none;
  }

  to {
    opacity: 0;
    transform: translateX(-24px);
  }
}

/* ── INTRO ── */
.intro-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 28px;
  text-align: center;
}

.intro-stats {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 22px;
  background: rgba(91, 156, 246, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 76px;
}

.stat-chip .val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-chip .lbl {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.btn-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  padding: 15px 28px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 22px var(--accent-glow);
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-start:active {
  transform: none;
}

/* ── PROGRESS ── */
.progress-wrap {
  margin-bottom: 26px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.07em;
}

.progress-pct {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--track);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a0c8ff);
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 0 8px rgba(91, 156, 246, 0.5);
}

/* ── STEP DOTS ── */
.step-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 22px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s, width 0.3s, border-radius 0.3s;
}

.dot.done {
  background: rgba(91, 156, 246, 0.4);
}

.dot.active {
  background: var(--accent);
  width: 20px;
  border-radius: 4px;
}

/* ── QUESTION ── */
.q-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.q-num {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.q-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.q-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 16px;
  overflow-wrap: break-word;
}

.q-hint {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.83rem;
  line-height: 1.8;
  color: #a9c7ff;
  white-space: pre-line;
  background: rgba(91, 156, 246, 0.08);
  border: 1px solid rgba(91, 156, 246, 0.22);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin-bottom: 20px;
}

/* ── OPTIONS ── */
.options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 13px 16px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.18s;
}

.opt:hover {
  background: rgba(91, 156, 246, 0.08);
  border-color: rgba(91, 156, 246, 0.35);
  transform: translateX(4px);
}

.opt.selected {
  background: rgba(91, 156, 246, 0.14);
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 0 0 1px rgba(91, 156, 246, 0.18);
}

.opt-letter {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--surface-strong);
  border: 1px solid var(--surface-strong-border);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.opt.selected .opt-letter {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* ── RESULT ── */
.result-top {
  text-align: center;
  margin-bottom: 28px;
}

.result-emoji {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 10px;
}

.result-emoji img {
  width: 7.2rem;
  height: 7.2rem;
  object-fit: contain;
}

.result-top p {
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 800;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.rcard {
  border-radius: 14px;
  padding: 22px;
  border: 1px solid;
  position: relative;
  overflow: hidden;
  color: var(--rc);
}

.rcard::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.05;
}

.rcard.MATEMATIKA {
  border-color: rgba(99, 102, 241, .35);
  background: rgba(99, 102, 241, .15);
  --rc: #c7d2fe;
}

.rcard.PROGRAMAVIMAS {
  border-color: rgba(6, 182, 212, .35);
  background: rgba(6, 182, 212, .15);
  --rc: #7dd3fc;
}

.rcard.DUOMENYS {
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .15);
  --rc: #86efac;
}

.rcard.SISTEMOS {
  border-color: rgba(245, 158, 11, .35);
  background: rgba(245, 158, 11, .15);
  --rc: #fdba74;
}

.rcard.MOKYMAS {
  border-color: rgba(236, 72, 153, .35);
  background: rgba(236, 72, 153, .15);
  --rc: #f9a8d4;
}

.rcard.SAUGUMAS {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .15);
  --rc: #fca5a5;
}

.rcard-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.rcard-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.rcard-icon img {
  width: 5.2rem;
  height: 5.2rem;
  object-fit: contain;
  display: block;
}

.rcard-info {
  flex: 1;
  min-width: 0;
}

.rcard-cat {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rc);
  margin-bottom: 3px;
}

.rcard-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.rcard-desc {
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--desc);
  margin-bottom: 14px;
}

.rcard-programs-intro {
  font-size: 0.86rem;
  line-height: 1.65;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.rcard-program-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .rcard-program-blocks {
    grid-template-columns: 1fr;
  }
}

.prog-block {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 12px 14px;
}

.prog-block-lbl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rc);
  margin-bottom: 10px;
  opacity: 0.9;
}

.prog-block-ico {
  width: 4.6rem;
  height: 4.6rem;
  object-fit: contain;
  flex-shrink: 0;
}

.rcard-program {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--desc-strong);
  line-height: 1.4;
  margin-bottom: 5px;
}

.rcard-program:last-child {
  margin-bottom: 0;
}

a.rcard-program {
  color: var(--rc);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--rc) 45%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s, text-decoration-color 0.15s;
}

a.rcard-program:hover {
  color: var(--rc);
  text-decoration-color: var(--rc);
}

a.rcard-program::after {
  content: '';
  width: 0.85em;
  height: 0.85em;
  flex-shrink: 0;
  margin-left: 5px;
  align-self: center;
  background: url('assets/chain-link-icon.png') center / contain no-repeat;
  /* chain-link-icon.png is grey artwork — force it to render white */
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.rcard-program::before {
  content: '→';
  color: var(--rc);
  flex-shrink: 0;
  margin-top: 1px;
}


/* ── RESTART ── */
.btn-restart {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  color: var(--text-muted);
  font-size: 0.87rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-restart:hover {
  background: rgba(91, 156, 246, 0.07);
  color: var(--text);
  border-color: var(--border-strong);
}


/* ── BACK ── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  background: transparent;
  border: none;
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.18s, transform 0.18s;
}

.btn-back:hover {
  color: var(--accent);
  transform: translateX(-2px);
}

.btn-back:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}


/* ── UTIL ── */
.hidden {
  display: none !important;
}