
  .ctp-widget{
    --bg-1:#EFEDE6;
    --bg-2:#E4E7E1;
    --surface:#FFFFFF;
    --surface-soft:#F7F5F0;
    --text:#26251F;
    --text-muted:#6E6B62;
    --border:#E1DDD1;
    --primary:#3E6F68;
    --primary-dark:#2A4E49;
    --primary-soft:#DCEAE6;
    --accent:#8C6FA0;
    --excellent-bg:#BFE3B6;
    --excellent-text:#204A24;
    --good-bg:#B7DDEC;
    --good-text:#1D4557;
    --medium-bg:#F3CE9C;
    --medium-text:#5C3B0E;
    --low-bg:#F3B9C4;
    --low-text:#5C1B29;
    --critical-bg:#DE4B4B;
    --critical-text:#FFFFFF;
    --blood-red:#C40012;
    --radius-lg:20px;
    --radius-md:14px;
    --radius-sm:10px;
    --shadow: 0 10px 30px -12px rgba(38,37,31,0.18);
    --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    display:block;
    font-family: var(--font-body);
    color:var(--text);
    background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing:antialiased;
  }

  .ctp-widget *{box-sizing:border-box;}

  @media (prefers-reduced-motion: reduce){
    .ctp-widget *{ animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; }
  }

  #app{
    max-width:720px;
    margin:0 auto;
    padding:32px 20px 64px;
    display:flex;
    flex-direction:column;
  }

  .brand{
    text-align:center;
    margin-bottom:28px;
  }
  .brand h1{
    font-family:var(--font-display);
    font-weight:600;
    font-size:clamp(24px,4.5vw,34px);
    color:var(--primary-dark);
    margin:0 0 4px;
    letter-spacing:0.2px;
  }
  .brand .eyebrow{
    font-size:12px;
    letter-spacing:2.5px;
    text-transform:uppercase;
    color:var(--text-muted);
    font-weight:600;
  }
  .reset-link{
    appearance:none; border:none; background:none; cursor:pointer;
    font-family:var(--font-body); font-size:12px; color:var(--text-muted);
    text-decoration:underline; text-underline-offset:3px;
    padding:6px 4px; margin-top:6px;
  }
  .reset-link:hover{ color:var(--primary-dark); }

  .card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow);
    padding:32px 28px;
    animation:cardIn 0.45s cubic-bezier(.22,1,.36,1);
  }
  @keyframes cardIn{
    from{opacity:0; transform:translateY(14px);}
    to{opacity:1; transform:translateY(0);}
  }

  .screen{ display:none; flex:1; flex-direction:column; }
  .screen.active{ display:flex; }

  .ctp-loading-card{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:20px;
    padding:56px 28px;
  }
  .ctp-spinner{
    width:44px; height:44px;
    border-radius:50%;
    border:4px solid var(--border);
    border-top-color:var(--primary);
    animation:ctpSpin 0.8s linear infinite;
  }
  @keyframes ctpSpin{ to{ transform:rotate(360deg); } }

  .intro-list{
    list-style:none;
    margin:20px 0 28px;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:14px;
  }
  .intro-list li{
    display:flex;
    gap:12px;
    align-items:flex-start;
    font-size:15.5px;
    line-height:1.55;
    color:var(--text);
  }
  .intro-list .dot{
    flex:0 0 auto;
    width:8px;height:8px;border-radius:50%;
    background:var(--primary);
    margin-top:8px;
  }
  .intro-note{
    font-size:13.5px;
    color:var(--text-muted);
    border-top:1px solid var(--border);
    padding-top:16px;
    margin-top:4px;
    line-height:1.5;
  }

  .btn{
    appearance:none;
    border:none;
    cursor:pointer;
    font-family:var(--font-body);
    font-size:15.5px;
    font-weight:600;
    padding:14px 26px;
    border-radius:999px;
    background:var(--primary);
    color:#fff;
    transition:transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-shadow:0 8px 20px -8px rgba(42,78,73,0.55);
  }
  .btn:hover{ background:var(--primary-dark); transform:translateY(-1px); box-shadow:0 10px 24px -8px rgba(42,78,73,0.6); }
  .btn:active{ transform:translateY(0px) scale(0.98); }
  .btn.secondary{
    background:transparent;
    color:var(--primary-dark);
    box-shadow:none;
    border:1.5px solid var(--primary);
  }
  .btn.secondary:hover{ background:var(--primary-soft); }
  .btn-row{ margin-top:8px; display:flex; justify-content:center; }
  .btn.danger{ background:var(--critical-bg); box-shadow:0 8px 20px -8px rgba(222,75,75,0.55); }
  .btn.danger:hover{ background:#c23c3c; }

  .persona-tag{
    display:inline-block;
    font-size:12px;
    letter-spacing:1.5px;
    font-weight:700;
    color:var(--primary-dark);
    background:var(--primary-soft);
    padding:5px 12px;
    border-radius:999px;
    margin-bottom:14px;
    text-transform:capitalize;
  }

  .message-text{
    font-size:16px;
    line-height:1.65;
    color:var(--text);
    margin:0 0 22px;
  }

  /* progress */
  .test-reminder{
    background:var(--primary-soft);
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    padding:14px 16px;
    font-size:15px;
    line-height:1.6;
    color:var(--text);
    margin-bottom:20px;
  }
  .test-reminder strong{ color:var(--primary-dark); }
  .test-reminder br{ display:block; margin-bottom:6px; }

  .progress-wrap{ margin-bottom:22px; }
  .progress-meta{
    display:flex; justify-content:space-between; align-items:baseline;
    font-size:12.5px; color:var(--text-muted); margin-bottom:8px;
    letter-spacing:0.3px;
  }
  .progress-meta .test-label{ font-weight:700; color:var(--primary-dark); }
  .progress-track{
    height:6px; width:100%; background:var(--border); border-radius:999px; overflow:hidden;
  }
  .progress-fill{
    height:100%; background:linear-gradient(90deg, var(--primary), var(--accent));
    border-radius:999px; transition:width 0.35s ease;
  }

  .question-wrap{
    animation:qFade 0.32s cubic-bezier(.22,1,.36,1);
  }
  @keyframes qFade{
    from{opacity:0; transform:translateX(10px);}
    to{opacity:1; transform:translateX(0);}
  }
  .question-text{
    font-family:var(--font-display);
    font-size:clamp(18px,3.6vw,21px);
    line-height:1.55;
    color:var(--text);
    margin:0 0 28px;
  }

  .scale-row{
    display:flex; flex-wrap:wrap; gap:9px; justify-content:center; margin-bottom:14px;
  }
  .scale-btn{
    appearance:none; cursor:pointer;
    width:46px; height:46px; border-radius:50%;
    border:1.5px solid #bfe0f2;
    background:linear-gradient(120deg, #eaf6ff, #bfe3f7, #dff3ff, #a9d8ee, #eaf6ff);
    background-size:300% 300%;
    animation:scaleShimmer 5s ease-in-out infinite;
    color:#1c4a5e;
    font-family:var(--font-body); font-weight:700; font-size:15px;
    display:flex; align-items:center; justify-content:center;
    transition:transform 0.15s ease, background 0.25s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  }
  @keyframes scaleShimmer{
    0%{ background-position:0% 50%; }
    50%{ background-position:100% 50%; }
    100%{ background-position:0% 50%; }
  }
  .scale-btn:hover{
    animation-play-state:paused;
    background:linear-gradient(120deg, #d5edfb, #93c9e6);
    background-size:100% 100%;
    transform:translateY(-3px) scale(1.06);
    border-color:var(--primary);
    box-shadow:0 8px 16px -8px rgba(42,78,73,0.4);
  }
  .scale-btn.selected{
    background:var(--primary); color:#fff; border-color:var(--primary-dark);
    animation:pop 0.28s ease;
    transform:scale(1.1);
  }
  .scale-btn.selected:hover{
    background:var(--primary-dark);
    animation:none;
    transform:translateY(-3px) scale(1.12);
  }
  @keyframes pop{
    0%{ transform:scale(0.85); }
    60%{ transform:scale(1.16); }
    100%{ transform:scale(1.1); }
  }
  .scale-caption{
    display:flex; justify-content:space-between;
    font-size:11.5px; color:var(--text-muted); padding:0 4px;
  }

  @media (max-width:480px){
    .scale-btn{ width:40px; height:40px; font-size:13.5px; }
    .scale-row{ gap:7px; }
    .card{ padding:24px 18px; }
  }

  /* results */
  .section-title{
    font-family:var(--font-display);
    font-size:20px;
    color:var(--primary-dark);
    margin:34px 0 14px;
  }
  .section-title:first-of-type{ margin-top:6px; }

  .stats-list{
    list-style:none;
    margin:10px 0 0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:0;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    overflow:hidden;
  }
  .stats-list li{
    background:var(--surface-soft);
    padding:16px 20px;
    border-bottom:1px solid var(--border);
    display:flex;
    flex-wrap:wrap;
    align-items:baseline;
    justify-content:space-between;
    gap:4px 16px;
    animation:cardIn 0.4s ease;
  }
  .stats-list li:last-child{ border-bottom:none; }
  .stats-list .stat-value{
    font-family:var(--font-display);
    font-size:26px;
    color:var(--primary-dark);
    font-variant-numeric:tabular-nums;
    order:2;
  }
  .stats-list .stat-label{ font-size:14px; font-weight:700; color:var(--text); order:1; flex:1 1 auto; min-width:180px; }
  .stats-list .stat-desc{ font-size:12.5px; color:var(--text-muted); margin-top:2px; line-height:1.45; order:3; flex-basis:100%; }

  .table-wrap{
    overflow-x:auto;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    margin-top:8px;
  }
  table.results-table{
    width:100%;
    border-collapse:collapse;
    font-size:13.5px;
    min-width:520px;
  }
  table.results-table thead th{
    text-align:center;
    background:var(--surface-soft);
    color:var(--text-muted);
    font-size:11.5px;
    letter-spacing:0.6px;
    padding:12px 14px;
    border-bottom:1px solid var(--border);
    position:sticky; top:0;
    font-weight:600;
    text-transform:none;
  }
  table.results-table td{
    padding:11px 14px;
    border-bottom:1px solid var(--border);
    vertical-align:middle;
  }
  table.results-table tr:last-child td{ border-bottom:none; }
  .need-name{ font-weight:600; }
  .z-badge{
    display:inline-flex; align-items:center; justify-content:center;
    width:21px; height:21px; border-radius:50%;
    background:#F2994A; color:#fff; font-size:11px; font-weight:800;
    margin-left:6px; vertical-align:middle;
    font-variant-numeric:tabular-nums;
    box-shadow:0 0 0 1px rgba(255,255,255,0.6) inset;
  }
  .db-flag{
    display:inline-block; margin-left:6px; font-size:11px;
    background:var(--critical-bg); color:#fff; padding:2px 7px; border-radius:6px;
    letter-spacing:0.5px; vertical-align:middle; font-weight:800;
    box-shadow:0 0 0 1px #fff inset;
  }
  .pct-cell{
    font-weight:700; text-align:center; border-radius:8px;
    padding:6px 8px; font-variant-numeric:tabular-nums;
  }
  .pct-excellent{ background:var(--excellent-bg); color:var(--excellent-text); }
  .pct-good{ background:var(--good-bg); color:var(--good-text); }
  .pct-medium{ background:var(--medium-bg); color:var(--medium-text); }
  .pct-low{ background:var(--low-bg); color:var(--low-text); }
  .pct-critical{ background:var(--critical-bg); color:var(--critical-text); }

  /* критические строки таблицы — выделены ярко-красным цветом "как кровь" по всей строке,
     расположены в самом низу таблицы (см. сортировку строк в renderResults) */
  tr.critical-row td{ background:var(--blood-red) !important; color:#fff; }
  tr.critical-row .pct-cell{ background:var(--blood-red) !important; color:#fff; }
  tr.critical-row .need-name{ color:#fff; }

  .legend{
    display:flex; flex-wrap:wrap; gap:14px; margin-top:14px; font-size:12.5px; color:var(--text-muted);
  }
  .legend span{ display:inline-flex; align-items:center; gap:6px; }
  .legend i{ width:12px;height:12px;border-radius:4px;display:inline-block; }
  .legend-note{
    flex-basis:100%;
    margin-top:2px;
    font-size:12px;
    color:var(--text-muted);
  }

  .subsection-title{
    font-size:13px;
    font-weight:700;
    letter-spacing:0.8px;
    text-transform:uppercase;
    color:var(--text-muted);
    margin:22px 0 12px;
  }
  .subsection-title:first-of-type{ margin-top:12px; }

  .critical-block{
    border:1.5px solid var(--blood-red);
    background:#FDF1F1;
    border-radius:var(--radius-md);
    padding:16px 18px;
    margin-bottom:12px;
  }
  .critical-block h4{ margin:0 0 8px; color:var(--blood-red); font-size:15.5px; }
  .critical-block p{ margin:0 0 10px; font-size:13.5px; color:var(--text); line-height:1.55; }
  .critical-block p:last-child{ margin-bottom:0; }

  .rec-list{ display:flex; flex-direction:column; gap:12px; margin-top:0; }
  .rec-item{
    background:var(--surface-soft);
    border:1px solid var(--border);
    border-left:4px solid var(--accent);
    border-radius:var(--radius-sm);
    padding:14px 16px;
    font-size:14px; line-height:1.55;
  }
  .rec-item h4{ margin:0 0 8px; color:var(--primary-dark); font-size:15px; }
  .rec-item p{ margin:0 0 10px; }
  .rec-item p:last-child{ margin-bottom:0; }

  .disclaimer{
    margin-top:36px;
    font-size:12.5px;
    color:var(--text-muted);
    border-top:1px solid var(--border);
    padding-top:16px;
    line-height:1.6;
  }

  .fade-enter{ animation:cardIn 0.4s ease; }

  .copyright{
    text-align:center;
    font-size:11px;
    color:var(--text-muted);
    margin-top:24px;
    padding-top:12px;
    border-top:1px solid var(--border);
  }

  @media (max-width:480px){
    .card{ padding:20px 14px; }
    .stats-list .stat-value{ font-size:22px; }
    .stats-list .stat-label{ font-size:13px; min-width:140px; }
    table.results-table{ font-size:12px; min-width:400px; }
    table.results-table thead th{ font-size:10.5px; padding:8px 8px; }
    table.results-table td{ padding:8px 8px; }
    .pct-cell{ padding:4px 4px; }
    .brand h1{ font-size:clamp(20px,4vw,28px); }
  }

  @media (max-width:380px){
    .card{ padding:16px 10px; }
    table.results-table{ font-size:11px; min-width:320px; }
    .scale-btn{ width:34px; height:34px; font-size:12px; }
    .scale-row{ gap:5px; }
    .stats-list .stat-value{ font-size:18px; }
    .stats-list .stat-label{ font-size:11.5px; min-width:100px; }
    .stats-list li{ padding:12px 14px; }
    .btn{ font-size:14px; padding:12px 18px; }
  }
