:root {
    --opo-primary: #3157d5;
    --opo-primary-dark: #203da8;
    --opo-ink: #17213a;
    --opo-muted: #667085;
    --opo-line: #e3e8f2;
    --opo-soft: #f5f7ff;
}

/* Panel de progreso y gamificación */
.opo-dashboard { padding-bottom: 2rem; }
.opo-welcome { display:flex; align-items:center; justify-content:space-between; gap:2rem; }
.opo-level { width:min(320px,100%); padding:1rem 1.2rem; background:#fff; border-radius:16px; box-shadow:0 8px 30px rgba(27,39,70,.08); }
.opo-level>span { display:block; margin-bottom:.5rem; font-weight:800; }
.opo-level .progress { height:8px; margin-bottom:.4rem; }
.opo-kpi { height:100%; padding:1.25rem; background:#fff; border:1px solid #edf0f6; border-radius:18px; box-shadow:0 8px 26px rgba(27,39,70,.06); }
.opo-kpi span,.opo-kpi small,.opo-kpi strong { display:block; }
.opo-kpi span { color:#667085; font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.opo-kpi strong { margin:.45rem 0 .1rem; color:#17213a; font-size:1.8rem; }
.opo-kpi small { color:#98a2b3; }
.opo-chart { position:relative; height:300px; }
.opo-empty-chart { display:grid; place-items:center; min-height:300px; color:#98a2b3; background:#f8f9fc; border-radius:14px; }
.opo-donut-wrap { display:grid; place-items:center; padding:1.5rem 0; }
.opo-donut { display:grid; place-items:center; align-content:center; width:160px; height:160px; border-radius:50%; background:conic-gradient(#20bf6b 0 var(--ok),#ff5a67 var(--ok) var(--bad),#d8dee9 var(--bad) 100%); position:relative; }
.opo-donut:after { position:absolute; inset:18px; background:#fff; border-radius:50%; content:""; }
.opo-donut span,.opo-donut small { position:relative; z-index:1; }
.opo-donut span { font-size:1.65rem; font-weight:800; }
.opo-donut small { color:#98a2b3; }
.opo-legend { display:grid; gap:.55rem; }
.opo-legend span { display:flex; align-items:center; gap:.5rem; color:#667085; }
.opo-legend b { margin-left:auto; color:#17213a; }
.opo-legend i { width:9px; height:9px; border-radius:50%; }
.opo-legend .ok { background:#20bf6b; }
.opo-legend .bad { background:#ff5a67; }
.opo-legend .blank { background:#d8dee9; }
.opo-ranking { display:grid; gap:.5rem; }
.opo-rank-row { display:flex; align-items:center; gap:.75rem; padding:.7rem .75rem; border-radius:12px; }
.opo-rank-row:nth-child(-n+3) { background:#fff9e8; }
.opo-rank-row.is-me { background:#eeeefe; outline:1px solid #c9c7ff; }
.opo-position { width:32px; text-align:center; font-weight:800; }
.opo-rank-name { display:flex; flex:1; flex-direction:column; min-width:0; }
.opo-rank-name small { color:#98a2b3; }
@media(max-width:767px) {
    .opo-welcome { align-items:flex-start; flex-direction:column; }
    .opo-level { width:100%; }
    .opo-chart { height:240px; }
}

html {
    scroll-behavior: smooth;
}

.brand-title {
    font-weight: 700;
}

.home-wrap {
    max-width: 1240px;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.home-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4.5rem);
    color: var(--opo-ink);
    background:
        radial-gradient(circle at 90% 10%, rgba(80, 116, 238, .22), transparent 38%),
        linear-gradient(135deg, #f8faff 0%, #edf2ff 100%);
    border: 1px solid #dce4ff;
    border-radius: 1.5rem;
}

.hero-kicker,
.section-kicker {
    display: block;
    margin-bottom: .65rem;
    color: var(--opo-primary);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.home-hero h1 {
    max-width: 760px;
    margin-bottom: 1rem;
    font-size: clamp(2.25rem, 5vw, 4.25rem);
    line-height: 1.04;
    letter-spacing: -.045em;
}

.hero-copy {
    max-width: 700px;
    margin-bottom: 1.6rem;
    color: #48536a;
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.7;
}

.hero-note {
    margin: 1rem 0 0;
    color: var(--opo-muted);
    font-size: .9rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}

.stat-card {
    padding: 1.4rem;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 1rem;
    box-shadow: 0 16px 35px rgba(43, 62, 130, .09);
}

.stat-card-wide {
    grid-column: 1 / -1;
}

.stat-card strong {
    display: block;
    color: var(--opo-primary-dark);
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    line-height: 1;
}

.stat-card span {
    display: block;
    margin-top: .45rem;
    color: var(--opo-muted);
    font-size: .85rem;
}

.benefits-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.25rem 0 4rem;
}

.benefits-row > div {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--opo-line);
    border-radius: 1rem;
}

.benefits-row p {
    margin: 0;
    color: var(--opo-muted);
    font-size: .88rem;
    line-height: 1.45;
}

.benefits-row strong {
    color: var(--opo-ink);
}

.benefit-icon {
    display: grid;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    color: var(--opo-primary);
    background: var(--opo-soft);
    border-radius: .75rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.tests-section {
    scroll-margin-top: 6rem;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-heading h2,
.home-cta h2 {
    margin: 0 0 .45rem;
    color: var(--opo-ink);
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    letter-spacing: -.025em;
}

.section-heading p,
.home-cta p {
    margin: 0;
    color: var(--opo-muted);
}

.law-grid {
    display: grid;
    gap: .9rem;
}

.law-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--opo-line);
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(31, 48, 94, .04);
    transition: transform .2s ease, box-shadow .2s ease;
}

.law-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(31, 48, 94, .08);
}

.law-card-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
}

.law-card-main,
.law-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.law-card-main strong,
.law-card-main small {
    display: block;
}

.law-card-main strong {
    color: var(--opo-ink);
    font-size: 1rem;
}

.law-card-main small {
    max-width: 720px;
    margin-top: .2rem;
    color: var(--opo-muted);
    line-height: 1.4;
}

.law-initials {
    display: grid;
    flex: 0 0 3rem;
    width: 3rem;
    height: 3rem;
    overflow: hidden;
    place-items: center;
    padding: .3rem;
    color: var(--opo-primary-dark);
    background: var(--opo-soft);
    border-radius: .8rem;
    font-size: .7rem;
    font-weight: 700;
    text-align: center;
}

.test-count {
    white-space: nowrap;
    padding: .35rem .7rem;
    color: var(--opo-primary-dark);
    background: var(--opo-soft);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

.chevron {
    font-size: 1.3rem;
    transition: transform .2s ease;
}

.law-card-toggle:not(.collapsed) .chevron {
    transform: rotate(180deg);
}

.law-tests {
    padding: 0 1.25rem 1.1rem 5.25rem;
}

.test-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 0;
    color: inherit;
    border-top: 1px solid var(--opo-line);
    text-decoration: none;
}

.test-row strong,
.test-row small {
    display: block;
}

.test-row strong {
    color: var(--opo-ink);
}

.test-row small {
    margin-top: .18rem;
    color: var(--opo-muted);
}

.test-action {
    white-space: nowrap;
    color: var(--opo-primary);
    font-weight: 700;
}

.no-tests {
    margin: 0;
    padding-top: 1rem;
    color: var(--opo-muted);
    border-top: 1px solid var(--opo-line);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    background: var(--opo-soft);
    border-radius: 1rem;
}

.home-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 4rem;
    padding: clamp(1.75rem, 4vw, 3rem);
    color: #fff;
    background: linear-gradient(135deg, var(--opo-primary-dark), var(--opo-primary));
    border-radius: 1.25rem;
}

.home-cta .section-kicker,
.home-cta h2,
.home-cta p {
    color: #fff;
}

@media (max-width: 767.98px) {
    .home-wrap {
        padding-top: 1rem;
    }

    .home-hero {
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .benefits-row {
        grid-template-columns: 1fr;
        margin-bottom: 3rem;
    }

    .law-card-toggle,
    .test-row,
    .home-cta {
        align-items: flex-start;
    }

    .law-card-meta {
        gap: .4rem;
    }

    .law-tests {
        padding-left: 1.25rem;
    }

    .test-row,
    .home-cta {
        flex-direction: column;
    }

    .home-cta .btn {
        width: 100%;
    }
}

/* Añadir al final de css/oposiciones.css. No sustituir el archivo completo. */
/* solo layout, sin tocar estilos de Nifty */
  #testNifty .test-scroll{
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    padding-right: 10px;
  }
  #testNifty .opt{
    cursor:pointer;
    user-select:none;
  }
  #testNifty .opt .lbl{
    font-weight:800;
    min-width:26px;
    text-transform:uppercase;
  }

#testNifty .test-progress { height: 10px; }
#testNifty #bar { width: 0%; }
#testNifty .test-articulo-texto { white-space: pre-line; }
/* Añadir al final de css/oposiciones.css. No sustituir el archivo completo. */
/* solo layout, sin tocar estilos de Nifty */
  #testNifty .test-scroll{
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    padding-right: 10px;
  }
  #testNifty .opt{
    cursor:pointer;
    user-select:none;
  }
  #testNifty .opt .lbl{
    font-weight:800;
    min-width:26px;
    text-transform:uppercase;
  }

#testNifty .test-progress { height: 10px; }
#testNifty #bar { width: 0%; }
#testNifty .test-articulo-texto { white-space: pre-line; }

#testNifty .pregunta-votos { display: flex; justify-content: flex-start; gap: .5rem; }
#testNifty .btn-voto { display: inline-flex; align-items: center; gap: .3rem; }
#testNifty .btn-voto[aria-pressed="true"] { background: #e8efff; border-color: #365bb5; color: #183b86; }
#testNifty .voto-contador[hidden] { display: none; }
/* Votos alineados a la derecha */
#testNifty .pregunta-votos {
  justify-content: flex-end;
  gap: 16px;
}

/* Solo icono y número, sin apariencia de botón */
#testNifty .pregunta-votos .btn-voto {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  min-width: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
}

#testNifty .pregunta-votos .btn-voto:hover {
  background: transparent;
  opacity: .7;
}

#testNifty .pregunta-votos .btn-voto[aria-pressed="true"] {
  background: transparent;
  color: #365bb5;
  box-shadow: none;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 5px;
}

#testNifty .pregunta-votos .btn-voto:focus-visible {
  outline: 2px solid #365bb5;
  outline-offset: 3px;
}

#testNifty .pregunta-votos .btn-voto:disabled {
  opacity: .5;
  cursor: wait;
}

#testNifty .voto-contador[hidden] {
  display: none;
}