:root{
  --bg1:#f7f7ff;
  --card: rgba(255,255,255,.88);
  --border: rgba(15,23,42,.10);
  --text:#0b1220;
  --muted:#5b6474;

  --accent:#7c3aed;
  --accent2:#d946ef;
  --badgeBg:#111827;
  --badgeText:#fff;
  --ring: rgba(124,58,237,.15);

  --shadow: 0 18px 45px rgba(0,0,0,.08);
  --radius: 22px;
}

*{box-sizing:border-box}

html,body{
  height:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  font-family:"Barlow",system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  color:var(--text);
  background: linear-gradient(180deg, var(--bg1), #fff 40%, #f3f4f6);
}

body.modal-open{
  overflow:hidden;
}

/* =========================================================
   TYPO
========================================================= */
.display{
  font-family:"Barlow Condensed","Barlow",system-ui,sans-serif;
  font-weight:700;
  letter-spacing:-.02em;
  margin:0;
  font-size:clamp(40px, 5vw, 64px);
  line-height:.95;
}

.h2{
  margin:0 0 14px 0;
  font-size:22px;
  font-weight:700;
}

.muted{color:var(--muted)}
strong{font-weight:700}

/* =========================================================
   LAYOUT
========================================================= */
.wrap{
  width:min(1100px, 92vw);
  margin:36px auto 60px;
  display:flex;
  flex-direction:column;
  gap:18px;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  backdrop-filter:blur(16px);
  padding:22px;
}

/* =========================================================
   HERO + LOGO
========================================================= */
.hero{padding:26px}

.brand{
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* Wrapper transparent */
.brand-logo-wrap{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:fit-content;
  padding:0;
  background:transparent;
  border:none;
  box-shadow:none;
}

.brand-logo{
  display:block;
  width:auto;
  height:84px;
  object-fit:contain;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.12));
}

.brand-sub{
  margin:0;
  font-size:16px;
}

.hero-title{
  margin-top:18px;
}

@media (max-width:680px){
  .brand-logo{height:66px}
}

/* =========================================================
   FORM
========================================================= */
.form-card .grid2{margin-top:10px}

.grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

@media (max-width:820px){
  .grid2{grid-template-columns:1fr}
}

.field label{
  display:block;
  font-weight:700;
  font-size:14px;
  margin:0 0 8px;
}

.field input{
  width:100%;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid rgba(15,23,42,.18);
  outline:none;
  font-size:16px;
  background:#fff;
}

.field input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 6px var(--ring);
}

/* =========================================================
   STICKYBAR
========================================================= */
.stickybar{
  position:sticky;
  top:12px;
  z-index:60;
  margin:0 0 14px;
  border-radius:18px;
  background:rgba(255,255,255,.86);
  border:1px solid rgba(15,23,42,.10);
  box-shadow:0 14px 34px rgba(0,0,0,.10);
  backdrop-filter:blur(14px);
  overflow:hidden;
}

.stickybar-inner{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:14px 16px;
}

.stickybar-title{
  font-weight:900;
  font-size:18px;
}

.stickybar-pill{
  border:1px solid rgba(15,23,42,.12);
  background:#fff;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:14px;
  white-space:nowrap;
}

.stickybar-progress{
  height:8px;
  background:rgba(15,23,42,.10);
}

.stickybar-progress-bar{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, var(--accent), var(--accent2));
  transition:width .25s ease;
}

@media (max-width:680px){
  .stickybar-title{font-size:15px}
}

/* =========================================================
   QUESTIONS
========================================================= */
.questions{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.q{
  border:1px solid rgba(15,23,42,.10);
  background:#fff;
  border-radius:20px;
  padding:14px;
  box-shadow:0 10px 24px rgba(0,0,0,.06);
}

.q-title{
  display:flex;
  gap:10px;
  align-items:flex-start;
  font-weight:700;
  margin:0 0 12px;
}

.q-num{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:28px;
  padding:0 8px;
  border-radius:999px;
  background:#111827;
  color:#fff;
  font-size:13px;
}

.q-options{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

@media (max-width:680px){
  .q-options{grid-template-columns:1fr}
}

.opt{
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid rgba(15,23,42,.12);
  border-radius:16px;
  padding:10px 12px;
  cursor:pointer;
  user-select:none;
  transition:all .15s ease;
  background:#fff;
}

.opt:hover{
  border-color:rgba(15,23,42,.25);
  background:rgba(0,0,0,.02);
}

.opt input{
  accent-color:var(--accent);
}

.opt.selected{
  border-color:var(--accent);
  box-shadow:0 0 0 6px var(--ring);
  background:color-mix(in srgb, var(--accent) 8%, white);
}

/* =========================================================
   ACTIONS
========================================================= */
.actions{
  display:flex;
  gap:12px;
  margin-top:16px;
  flex-wrap:wrap;
}

.btn{
  border:1px solid rgba(15,23,42,.14);
  background:#fff;
  padding:12px 16px;
  border-radius:16px;
  font-weight:800;
  cursor:pointer;
}

.btn.primary{
  border:none;
  color:#fff;
  background:linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow:0 10px 30px rgba(0,0,0,.12);
}

.btn:disabled{
  opacity:.55;
  cursor:not-allowed;
}

/* =========================================================
   SCORE BLOCKS
========================================================= */
.score{
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.80);
  border-radius:18px;
  padding:14px;
  min-width:220px;
  text-align:center;
  backdrop-filter:blur(10px);
}

.score-k{
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
  color:var(--muted);
}

.score-v{
  font-size:42px;
  font-weight:900;
  line-height:1;
  margin-top:6px;
}

.score-dominant{
  min-width:min(560px, 100%);
  background:linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 40%, white),
    color-mix(in srgb, var(--accent2) 28%, white)
  );
  border:1px solid color-mix(in srgb, var(--accent) 58%, rgba(15,23,42,.10));
  box-shadow:
    0 20px 46px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.45);
}

.score-dominant .score-k{
  color:color-mix(in srgb, var(--accent) 76%, #243044);
}

.score-dominant .score-v{
  font-size:60px;
}

.score-note{
  margin-top:10px;
  font-size:14px;
  color:var(--muted);
  line-height:1.45;
}

/* =========================================================
   BACKGROUND BLOBS
========================================================= */
.bg-blobs{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-3;
}

.blob{
  position:absolute;
  border-radius:999px;
  filter:blur(55px);
  opacity:.5;
}

.blob-a{
  width:320px;
  height:320px;
  left:-80px;
  top:-100px;
  background:rgba(124,58,237,.25);
}

.blob-b{
  width:360px;
  height:360px;
  right:-120px;
  top:20%;
  background:rgba(217,70,239,.18);
}

.blob-c{
  width:420px;
  height:420px;
  left:20%;
  bottom:-160px;
  background:rgba(59,130,246,.16);
}

/* =========================================================
   PAGE BACKGROUND
========================================================= */
.page-bg{
  position:fixed;
  inset:0;
  z-index:-2;
  pointer-events:none;
  overflow:hidden;
  opacity:0;
  transition:opacity .35s ease;
}

.page-bg.show{opacity:1}

.page-bg img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:right center;
  opacity:.46;
  -webkit-mask-image:linear-gradient(to bottom, #000 0%, #000 66%, transparent 92%);
  mask-image:linear-gradient(to bottom, #000 0%, #000 66%, transparent 92%);
  transform:scale(1.32) translateX(10%) translateY(-3%);
  filter:saturate(170%) contrast(125%) blur(1px);
  mix-blend-mode:multiply;
}

.page-bg::after{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(
    circle at 18% 18%,
    rgba(255,255,255,.10) 0%,
    rgba(255,255,255,.55) 42%,
    rgba(255,255,255,.72) 100%
  );
}

/* =========================================================
   MODAL
========================================================= */
.modal{
  position:fixed;
  inset:0;
  z-index:200;
  display:none;
}

.modal.show{display:block}

.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(2,6,23,.56);
  backdrop-filter:blur(6px);
}

.modal-shell{
  position:absolute;
  inset:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:24px;
  scrollbar-gutter:stable;
}

.modal-shell::-webkit-scrollbar{
  width:10px;
}
.modal-shell::-webkit-scrollbar-track{
  background:transparent;
}
.modal-shell::-webkit-scrollbar-thumb{
  background:rgba(15,23,42,.18);
  border-radius:999px;
}

.modal-dialog{
  position:relative;
  width:min(900px, calc(100vw - 48px));
  margin:0 auto;
  border-radius:22px;
  border:1px solid rgba(255,255,255,.25);
  box-shadow:0 30px 90px rgba(0,0,0,.35);
  padding:18px;
  overflow:hidden;
  background:rgba(255,255,255,.76);
  backdrop-filter:blur(14px);
  isolation:isolate;
}

.modal-dialog::before{
  content:"";
  position:absolute;
  inset:0;
  background-image:var(--modalFaceUrl);
  background-size:cover;
  background-position:center right;
  background-repeat:no-repeat;
  opacity:.92;
  filter:saturate(160%) contrast(112%);
  transform:scale(1.02);
  z-index:0;
}

.modal-dialog::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.30) 100%),
    radial-gradient(circle at 24% 18%, rgba(255,255,255,.16) 0%, rgba(255,255,255,.48) 52%, rgba(255,255,255,.68) 100%);
  z-index:1;
}

.modal-content{
  position:relative;
  z-index:2;
}

@media (max-width:680px){
  .modal-shell{
    padding:12px;
  }

  .modal-dialog{
    width:calc(100vw - 24px);
    padding:14px;
    border-radius:18px;
  }
}

/* =========================================================
   MODAL CLOSE
========================================================= */
.modal-close{
  position:absolute;
  top:18px;
  right:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  width:54px;
  height:54px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.14);
  background:rgba(255,255,255,.98);
  color:#0b1220;
  cursor:pointer;
  font-weight:900;
  font-size:26px;
  box-shadow:0 12px 26px rgba(0,0,0,.18);
  z-index:5;
}

.modal-close:hover{
  transform:scale(1.03);
}

/* =========================================================
   MODAL HEADER
========================================================= */
.modal-header{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px 10px 0;
  margin-top:4px;
}

.modal-logo-wrap{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  background:transparent;
  border:none;
  box-shadow:none;
  backdrop-filter:none;
}

.modal-logo{
  height:96px;
  width:auto;
  display:block;
  object-fit:contain;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,.14));
}

.modal-title{
  margin:18px 0 20px;
  text-align:center;
  font-family:"Barlow Condensed","Barlow",system-ui,sans-serif;
  font-weight:700;
  font-size:48px;
  line-height:1;
  color:#0b1220;
  text-shadow:0 1px 0 rgba(255,255,255,.45);
}

/* =========================================================
   DOMINANT PHRASE / DETAIL BLOCK
========================================================= */
.modal-dominant-wrap{
  display:flex;
  justify-content:center;
  margin:0 0 16px;
}

.modal-dominant-phrase{
  max-width:820px;
  margin:0 auto 18px;
  text-align:left;
  padding:18px 20px;
  border-radius:20px;
  background:color-mix(in srgb, var(--accent) 14%, rgba(255,255,255,.90));
  border:1px solid color-mix(in srgb, var(--accent) 28%, rgba(15,23,42,.10));
  box-shadow:0 12px 28px rgba(0,0,0,.08);
  backdrop-filter:blur(10px);
  color:#1f2937;
}

.rich-result .result-intro{
  margin:0 0 14px;
  font-size:17px;
  line-height:1.6;
}

.rich-result .result-section{
  margin-top:16px;
}

.rich-result .result-section h3{
  margin:0 0 8px;
  font-size:16px;
  font-weight:800;
  color:#0b1220;
}

.rich-result ul{
  margin:0;
  padding-left:20px;
}

.rich-result li{
  margin:0 0 8px;
  line-height:1.55;
}

.rich-result .result-conclusion{
  margin:16px 0 0;
  font-size:16px;
  line-height:1.6;
  font-weight:500;
}

/* =========================================================
   MODAL SCORES
========================================================= */
.modal-other{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

@media (max-width:820px){
  .modal-other{
    grid-template-columns:1fr;
  }

  .modal-logo{
    height:78px;
  }

  .modal-title{
    font-size:40px;
  }

  .score-dominant .score-v{
    font-size:52px;
  }

  .modal-dominant-phrase{
    padding:14px 16px;
  }

  .rich-result .result-intro,
  .rich-result .result-conclusion{
    font-size:16px;
  }
}

.modal-actions{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:18px;
}