/* ==========================================================
   ТЕСТО — DESIGN SYSTEM v4 (restyle pass)
   Тёмный/светлый режим, стеклянные карточки, градиентный
   акцент, мягкие анимации. Имена переменных и классов
   сохранены — меняется только визуальный язык.
   ========================================================== */

/* ==========================================================
   ТЕСТО — DESIGN SYSTEM v4 (restyle pass)
   Тёмный/светлый режим (data-theme) + акцентный стиль
   (data-accent, "purple" по умолчанию, "sunset" — прежний
   тёплый градиент). Имена переменных и классов сохранены —
   меняется только визуальный язык.
   ========================================================== */

:root{
  --font-display: 'Fraunces', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --yes: #45b881;
  --mid-yes: #7fcf9e;
  --mid: #9a94a8;
  --no-mid: #e8935c;
  --no: #ef5d6a;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --ease: cubic-bezier(.22,1,.36,1);
  --ease-soft: cubic-bezier(.4,0,.2,1);
}

/* ---- акцентный стиль: фиолетовый (по умолчанию) ---- */
:root, [data-accent="purple"]{
  --gold: #9d7bff;
  --gold-2: #e879f9;
  --gold-ink: #171029;
  --gold-grad: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 55%, #e879f9 100%);
}

/* ---- акцентный стиль: закатный (прежний тёплый градиент) ---- */
[data-accent="sunset"]{
  --gold: #e8a23a;
  --gold-2: #f0578a;
  --gold-ink: #1c1406;
  --gold-grad: linear-gradient(135deg, #f2b544 0%, #ee7a4c 55%, #f0578a 100%);
}

[data-theme="dark"]{
  --bg: #0f1119;
  --bg-deep: #0a0b11;
  --surface: rgba(255,255,255,0.045);
  --surface-2: rgba(255,255,255,0.08);
  --surface-solid: #1a1d29;
  --text: #f3f1ec;
  --text-muted: #9b9fb3;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.15);
  --shadow: 0 24px 60px rgba(0,0,0,0.45);
  --shadow-sm: 0 8px 24px rgba(0,0,0,0.3);
  --overlay: rgba(6,7,12,0.68);
  --glass-blur: blur(18px);

  /* карточка-картотека черт характера — тёмная в тёмной теме */
  --card: #232741;
  --card-edge: #323659;
  --card-input-bg: rgba(255,255,255,0.06);
  --ink: #f2f0fb;
  --ink-soft: #a7a4c2;
}

[data-theme="light"]{
  --bg: #f2f1f6;
  --bg-deep: #e7e5ee;
  --surface: rgba(20,16,35,0.04);
  --surface-2: rgba(20,16,35,0.07);
  --surface-solid: #ffffff;
  --text: #201e29;
  --text-muted: #6b6775;
  --line: rgba(20,16,35,0.09);
  --line-strong: rgba(20,16,35,0.16);
  --shadow: 0 22px 50px rgba(20,16,35,0.14);
  --shadow-sm: 0 8px 20px rgba(20,16,35,0.09);
  --overlay: rgba(20,16,35,0.35);
  --glass-blur: blur(16px);

  /* карточка-картотека черт характера — тёплая "бумажная" в светлой теме,
     нарочно отличается от нейтрального фона страницы выше */
  --card: #f7f0e2;
  --card-edge: #e9dcc4;
  --card-input-bg: #ffffff;
  --ink: #2a2118;
  --ink-soft: #6f6353;
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  transition: background-color .3s var(--ease-soft), color .3s var(--ease-soft);
  -webkit-font-smoothing: antialiased;
}

/* декоративные плавающие пятна на фоне — чисто CSS, без JS */
body::before, body::after{
  content: "";
  position: fixed;
  z-index: 0;
  width: 46vw;
  height: 46vw;
  max-width: 640px;
  max-height: 640px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .28;
  pointer-events: none;
  animation: drift 22s ease-in-out infinite alternate;
}
body::before{
  top: -14vw; left: -10vw;
  background: radial-gradient(circle, var(--gold), transparent 70%);
}
body::after{
  bottom: -18vw; right: -12vw;
  background: radial-gradient(circle, var(--gold-2), transparent 70%);
  animation-delay: -9s;
}
@keyframes drift{
  0%{ transform: translate(0,0) scale(1); }
  100%{ transform: translate(4vw, 3vw) scale(1.12); }
}

.app-shell{ position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

a{ color: inherit; text-decoration: none; }
input, textarea, select{ font-family: var(--font-body); }
::selection{ background: var(--gold); color: var(--gold-ink); }
::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-thumb{ background: var(--line-strong); border-radius: 99px; }
::-webkit-scrollbar-track{ background: transparent; }

.hidden{ display: none !important; }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ==========================================================
   UNIVERSAL BUTTON RESET
   Ничего в проекте не должно выглядеть как голый серый
   квадрат — любой <button> получает базовый вид отсюда,
   классы ниже его переопределяют под конкретный контекст.
   ========================================================== */

button{
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  transition: transform .15s var(--ease), background .18s var(--ease-soft),
              border-color .18s var(--ease-soft), box-shadow .18s var(--ease-soft),
              color .18s var(--ease-soft), opacity .15s ease;
}
button:hover{ border-color: var(--gold); transform: translateY(-1px); }
button:active{ transform: translateY(0) scale(.97); }
button:disabled{ opacity: .45; cursor: not-allowed; transform: none; }
button:focus-visible{ outline: 2px solid var(--gold); outline-offset: 2px; }

/* ==========================================================
   TOP NAVIGATION
   ========================================================== */

.topnav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 20px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-deep) 78%, transparent);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topnav .brand{
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 200%;
  animation: brand-shimmer 6s ease infinite;
}
.topnav .brand span{ -webkit-text-fill-color: initial; color: var(--gold); font-style: normal; display:inline-block; animation: brand-spin 8s linear infinite; }
@keyframes brand-shimmer{ 0%,100%{ background-position: 0% 50%; } 50%{ background-position: 100% 50%; } }
@keyframes brand-spin{ from{ transform: rotate(0); } to{ transform: rotate(360deg); } }

.topnav .nav-links{ display:flex; gap: 4px; flex-wrap: wrap; position: relative; }

.topnav .nav-links a{
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  transition: background .18s var(--ease-soft), color .18s var(--ease-soft), transform .15s var(--ease);
  white-space: nowrap;
  position: relative;
}
.topnav .nav-links a:hover{ color: var(--text); background: var(--surface); transform: translateY(-1px); }
.topnav .nav-links a.active{
  color: var(--gold-ink);
  background: var(--gold-grad);
  font-weight: 600;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--gold) 45%, transparent);
}

.topnav .nav-right{ display:flex; align-items:center; gap: 10px; }

.nav-user{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--line);
}

.icon-btn{
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
}
.icon-btn:hover{ background: var(--surface-2); box-shadow: var(--shadow-sm); }

.nav-toggle{
  display:none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 19px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

@media (max-width: 860px){
  .topnav .nav-links{
    display:none;
    position:absolute;
    top: 100%;
    left:0; right:0;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--line);
    padding: 10px 16px 16px;
    flex-direction: column;
    animation: dropdown-in .2s var(--ease);
  }
  .topnav .nav-links.open{ display:flex; }
  .topnav .nav-links a{ padding: 13px 14px; }
  .nav-toggle{ display:block; }
}
@keyframes dropdown-in{ from{ opacity:0; transform: translateY(-8px); } to{ opacity:1; transform: translateY(0); } }

/* ==========================================================
   LAYOUT / VIEW CONTAINER
   ========================================================== */

#view{
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 20px 90px;
  animation: view-in .45s var(--ease);
}
@keyframes view-in{ from{ opacity:0; transform: translateY(14px); } to{ opacity:1; transform: translateY(0); } }

.view-header{ margin-bottom: 30px; }
.view-header .eyebrow{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.view-header h1{
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(28px, 4.4vw, 40px);
  margin: 8px 0 6px;
}
.view-header p{ color: var(--text-muted); font-size: 15px; max-width: 640px; margin: 0; }

.section-title{
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 23px;
  margin: 38px 0 16px;
}
.section-title:first-child{ margin-top: 0; }

/* ==========================================================
   TOASTS
   ========================================================== */

#toasts{
  position: fixed; top: 18px; right: 18px; z-index: 999;
  display:flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast{
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--gold);
  color: var(--text);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toast-in .35s var(--ease);
}
.toast.error{ border-left-color: var(--no); }
.toast.success{ border-left-color: var(--yes); }
@keyframes toast-in{ from{ opacity:0; transform: translateX(24px) scale(.96); } to{ opacity:1; transform: translateX(0) scale(1); } }

/* ==========================================================
   AUTH SCREEN
   ========================================================== */

.auth-screen{ min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 24px; position: relative; z-index: 1; }
.auth-wrap{ width: 100%; max-width: 960px; display:grid; grid-template-columns: 1.1fr 1fr; gap: 46px; align-items:center; }
@media (max-width: 780px){ .auth-wrap{ grid-template-columns: 1fr; gap: 26px; } }

.auth-intro{ animation: fade-up .5s var(--ease); }
.auth-intro .eyebrow{ font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.auth-intro h1{
  font-family: var(--font-display); font-style: italic; font-weight: 700;
  font-size: clamp(36px, 6.4vw, 58px); margin: 12px 0 14px; line-height: 1.03;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-intro p{ color: var(--text-muted); font-size: 16.5px; max-width: 430px; line-height: 1.6; }

.auth-card{
  background: var(--surface-solid);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow);
  animation: fade-up .5s var(--ease) .08s backwards;
}
@keyframes fade-up{ from{ opacity:0; transform: translateY(18px); } to{ opacity:1; transform: translateY(0); } }

.auth-tabs{ display:flex; gap: 6px; margin-bottom: 24px; background: var(--surface); padding: 5px; border-radius: var(--radius-pill); border: 1px solid var(--line); }
.auth-tabs button{
  flex:1; border:none; background: transparent; color: var(--text-muted);
  padding: 11px 12px; border-radius: var(--radius-pill); font-weight: 600; font-size: 14px;
}
.auth-tabs button:hover{ color: var(--text); transform: none; }
.auth-tabs button.active{ background: var(--gold-grad); color: var(--gold-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--gold) 40%, transparent); }

.field{ margin-bottom: 17px; }
.field label{
  display:block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 7px;
}
.field input, .field textarea{
  width: 100%; padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--bg-deep); color: var(--text); font-size: 15px;
  transition: border-color .18s var(--ease-soft), box-shadow .18s var(--ease-soft), background .18s ease;
}
.field input:focus, .field textarea:focus{
  outline: none; border-color: var(--gold); background: var(--surface-solid);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 24%, transparent);
}
.field-error{ color: var(--no); font-size: 13px; margin-top: 6px; }

/* auth card sits on a light card, buttons inside need dark-on-light text automatically via .field being outside card now — auth-card itself is dark surface-solid so default input styling above applies fine */

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: 13px 26px; font-weight: 600; font-size: 14.5px;
  position: relative; overflow: hidden;
}
.btn::after{
  content:""; position:absolute; inset:0; border-radius: inherit;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.35) 45%, transparent 60%);
  transform: translateX(-120%); transition: transform .5s var(--ease);
}
.btn:hover::after{ transform: translateX(120%); }
.btn:hover{ transform: translateY(-2px); }
.btn:active{ transform: translateY(0) scale(.98); }
.btn:disabled{ opacity: .5; cursor: default; transform:none; }
.btn:disabled::after{ display:none; }

.btn-primary{ background: var(--gold-grad); color: var(--gold-ink); width: 100%; box-shadow: 0 10px 26px color-mix(in srgb, var(--gold) 42%, transparent); border-color: transparent; }
.btn-primary:hover:not(:disabled){ box-shadow: 0 14px 32px color-mix(in srgb, var(--gold) 52%, transparent); }

.btn-ghost{ background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled){ background: var(--surface-2); border-color: var(--gold); }

.btn-danger{ background: linear-gradient(135deg, #ef5d6a, #d43f57); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(239,93,106,.3); }
.btn-danger:hover:not(:disabled){ box-shadow: 0 12px 26px rgba(239,93,106,.4); }

.btn-sm{ padding: 9px 16px; font-size: 13px; }

.auth-form-note{ margin-top: 16px; font-size: 13px; color: var(--text-muted); text-align:center; }

/* ==========================================================
   CARDS / GRID
   ========================================================== */

.card-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }

.panel{ background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px; backdrop-filter: var(--glass-blur); }

.stat-row{ display:grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat-box{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 20px; text-align:center; backdrop-filter: var(--glass-blur);
  transition: transform .2s var(--ease), border-color .2s var(--ease-soft);
}
.stat-box:hover{ transform: translateY(-3px); border-color: var(--line-strong); }
.stat-box .num{ font-family: var(--font-display); font-size: 32px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-box .lbl{ font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-top:5px; }

.test-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  display:flex; flex-direction: column; gap: 11px;
  opacity: 0; transform: translateY(14px);
  animation: card-in .5s var(--ease) forwards;
  transition: transform .25s var(--ease), border-color .25s var(--ease-soft), box-shadow .25s var(--ease-soft);
  backdrop-filter: var(--glass-blur);
  position: relative;
}
.test-card::before{
  content:""; position:absolute; inset:0; border-radius: inherit; padding: 1px;
  background: var(--gold-grad); opacity: 0; transition: opacity .25s var(--ease-soft);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.test-card:hover{ transform: translateY(-6px); box-shadow: var(--shadow); }
.test-card:hover::before{ opacity: 1; }
@keyframes card-in{ to{ opacity:1; transform: translateY(0); } }
.card-grid .test-card:nth-child(1){ animation-delay: .02s; }
.card-grid .test-card:nth-child(2){ animation-delay: .06s; }
.card-grid .test-card:nth-child(3){ animation-delay: .1s; }
.card-grid .test-card:nth-child(4){ animation-delay: .14s; }
.card-grid .test-card:nth-child(5){ animation-delay: .18s; }
.card-grid .test-card:nth-child(6){ animation-delay: .22s; }

.test-card h3{ font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 20px; margin: 0; }
.test-card p{ color: var(--text-muted); font-size: 14px; margin: 0; flex: 1; line-height:1.5; }
.test-card .meta{ font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); display:flex; gap: 12px; flex-wrap:wrap; align-items:center; }
.test-card .actions{ display:flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.empty-state{ text-align:center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; animation: fade-up .4s var(--ease); }
.empty-state .big{ font-family: var(--font-display); font-style: italic; font-size: 23px; color: var(--text); margin-bottom: 8px; }

.loading-state{ text-align:center; padding: 70px 20px; color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; }
.loading-dot{ display:inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin: 0 3px; animation: dot-bounce 1s infinite ease-in-out; }
.loading-dot:nth-child(2){ animation-delay: .15s; }
.loading-dot:nth-child(3){ animation-delay: .3s; }
@keyframes dot-bounce{ 0%,80%,100%{ transform: scale(.6); opacity:.5; } 40%{ transform: scale(1); opacity:1; } }

.search-row{ display:flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-row input{
  flex:1; min-width: 220px; padding: 13px 18px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search-row input:focus{ outline:none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 20%, transparent); }
.search-row select{
  padding: 13px 16px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 14px;
}

.filter-tabs{ display:flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tabs button{
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-muted);
  padding: 9px 17px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500;
}
.filter-tabs button.active{ background: var(--gold-grad); color: var(--gold-ink); border-color: transparent; font-weight: 600; box-shadow: 0 6px 16px color-mix(in srgb, var(--gold) 40%, transparent); }

.tag-filter-row{ display:flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }
.tag-filter-row button{
  border: 1.5px solid var(--line-strong); background: transparent; color: var(--text-muted);
  padding: 6px 13px; border-radius: var(--radius-pill); font-size: 12px; font-family: var(--font-mono);
}
.tag-filter-row button.active{ background: var(--surface-2); color: var(--gold); border-color: var(--gold); }

/* ==========================================================
   FORMS  (create/edit test, settings, profile)
   ========================================================== */

.form-panel{ background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 28px; max-width: 760px; backdrop-filter: var(--glass-blur); }
.form-panel .field label{ color: var(--text-muted); }
.form-panel .field input, .form-panel .field textarea{ background: var(--bg-deep); color: var(--text); border: 1.5px solid var(--line-strong); }
.form-panel textarea{ resize: vertical; min-height: 90px; }

.trait-editor-list{ display:flex; flex-direction: column; gap: 10px; margin: 14px 0 18px; }
.trait-editor-item{
  background: var(--card); color: var(--ink); border-radius: var(--radius-sm);
  padding: 14px 16px; display:grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items:start;
}
.trait-editor-item .drag-handle{ font-family: var(--font-mono); color: var(--ink-soft); cursor: grab; user-select:none; padding-top: 6px; }
.trait-editor-item .trait-fields{ display:flex; flex-direction: column; gap: 8px; }
.trait-editor-item input, .trait-editor-item textarea{ width:100%; padding: 9px 12px; border-radius: 7px; border: 1px solid var(--card-edge); font-size: 14px; background: var(--card-input-bg); color: var(--ink); }
.trait-editor-item textarea{ min-height: 54px; resize: vertical; }
.trait-editor-item .trait-actions{ display:flex; flex-direction: column; gap: 6px; }
.trait-editor-item .trait-actions button{ border:none; background: var(--card-edge); color: var(--ink); border-radius: var(--radius-sm); width: 30px; height: 30px; font-size: 14px; }
.trait-editor-item .trait-actions button:hover{ background: var(--no); color:#fff; }

.add-trait-btn{ border: 1.5px dashed var(--line-strong); background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); padding: 13px; width: 100%; font-size: 14px; }
.add-trait-btn:hover{ background: var(--surface-2); color: var(--text); border-color: var(--gold); }

.form-actions{ display:flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* ==========================================================
   TOGGLE (theme / visibility)
   ========================================================== */

.toggle-row{ display:flex; align-items:center; justify-content:space-between; padding: 18px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child{ border-bottom:none; }
.toggle-row .label{ font-size: 15px; }
.toggle-row .sub{ font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.switch{ position: relative; width: 54px; height: 30px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line-strong); cursor:pointer; flex-shrink:0; transition: background .2s ease; }
.switch .knob{ position:absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold-grad); transition: left .25s var(--ease); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.switch.on{ background: color-mix(in srgb, var(--gold) 32%, transparent); }
.switch.on .knob{ left: 26px; }

/* ==========================================================
   ACCENT PICKER  (стиль оформления в настройках)
   ========================================================== */

.accent-picker{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px){ .accent-picker{ grid-template-columns: 1fr; } }

.accent-option{
  display:flex; flex-direction: column; align-items:flex-start; gap: 6px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-md);
  padding: 16px 18px; cursor: pointer;
  transition: border-color .18s var(--ease-soft), transform .15s var(--ease), background .18s var(--ease-soft);
}
.accent-option:hover{ transform: translateY(-2px); }
.accent-option.active{ border-color: var(--gold); background: var(--surface-2); box-shadow: 0 8px 22px rgba(0,0,0,.12); }

.accent-swatch{ width: 100%; height: 34px; border-radius: 10px; margin-bottom: 4px; }
.accent-swatch-purple{ background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 55%, #e879f9 100%); }
.accent-swatch-sunset{ background: linear-gradient(135deg, #f2b544 0%, #ee7a4c 55%, #f0578a 100%); }

.accent-name{ font-weight: 600; font-size: 14.5px; }
.accent-sub{ font-size: 12.5px; color: var(--text-muted); }

/* ==========================================================
   TABLES  (admin, results)
   ========================================================== */

.table-wrap{ overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); backdrop-filter: var(--glass-blur); }
table.data-table{ width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.data-table th{
  text-align:left; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
table.data-table td{ padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:last-child td{ border-bottom:none; }
table.data-table tr{ transition: background .15s ease; }
table.data-table tr:hover td{ background: var(--surface-2); }

.pill{ display:inline-block; font-family: var(--font-mono); font-size: 11px; padding: 5px 11px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); }
.pill.role-admin{ background: var(--gold-grad); color: var(--gold-ink); border-color: transparent; font-weight:600; }
.pill.role-user{ color: var(--text-muted); }
.self-role-note{ font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); padding: 6px 10px; }

.admin-tabs{ display:flex; gap: 7px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-tabs button{
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-muted);
  padding: 10px 17px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
}
.admin-tabs button.active{ background: var(--gold-grad); color: var(--gold-ink); border-color: transparent; box-shadow: 0 6px 16px color-mix(in srgb, var(--gold) 40%, transparent); }

.table-actions{ display:flex; gap:6px; flex-wrap:wrap; }
.table-actions button{ border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 12px; }
.table-actions button:hover{ background: var(--line-strong); }
.table-actions button.danger{ border-color: rgba(239,93,106,.4); color: var(--no); }
.table-actions button.danger:hover{ background: var(--no); color:#fff; border-color: transparent; }

/* ==========================================================
   MODAL / CONFIRM
   ========================================================== */

.modal-backdrop{
  position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(6px);
  display:flex; align-items:center; justify-content:center; z-index: 200; padding: 20px;
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in{ from{ opacity:0; } to{ opacity:1; } }
.modal-box{
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  padding: 26px; max-width: 420px; width:100%; box-shadow: var(--shadow);
  animation: modal-in .3s var(--ease);
}
@keyframes modal-in{ from{ opacity:0; transform: scale(.92) translateY(10px); } to{ opacity:1; transform: scale(1) translateY(0); } }
.modal-box h3{ font-family: var(--font-display); font-style: italic; margin: 0 0 10px; font-size: 21px; }
.modal-box p{ color: var(--text-muted); font-size: 14px; margin: 0 0 22px; }
.modal-actions{ display:flex; gap:10px; justify-content:flex-end; }

/* ==========================================================
   QUIZ ENGINE — карточка-картотека (черты характера)
   ========================================================== */

.quiz-wrap{ width:100%; max-width: 580px; margin: 0 auto; }

.quiz-meta{ text-align:center; margin-bottom: 24px; }
.quiz-meta .eyebrow{ font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.quiz-meta h1{ font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: clamp(26px, 4.5vw, 36px); margin: 8px 0 4px; }
.quiz-meta p{ color: var(--text-muted); font-size: 15px; max-width: 460px; margin: 6px auto 0; line-height: 1.55; }

.progress-row{ display:flex; justify-content:space-between; align-items:center; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-bottom: 10px; padding: 0 4px; }
.progress-track{ height:4px; background: var(--line-strong); border-radius: 4px; margin: 0 0 28px; overflow:hidden; }
.progress-fill{ height:100%; background: var(--gold-grad); width:0%; border-radius: 4px; transition: width .5s var(--ease); position: relative; overflow: hidden; }
.progress-fill::after{ content:""; position:absolute; inset:0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: shimmer 1.8s linear infinite; }
@keyframes shimmer{ from{ transform: translateX(-100%);} to{ transform: translateX(100%);} }

.quiz-stage{ position: relative; min-height: 460px; }

.stack-deco{ position:absolute; inset:0; border-radius: var(--radius-lg); background: var(--card-edge); transform: translateY(14px) scale(0.96); box-shadow: var(--shadow-sm); }
.stack-deco.two{ transform: translateY(24px) scale(0.92); opacity: 0.55; }

.quiz-card{
  position:absolute; inset:0; border-radius: var(--radius-lg); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); padding: 32px 28px 28px; display:flex; flex-direction:column;
  transition: opacity .3s var(--ease-soft), transform .3s var(--ease-soft);
}
.quiz-card.leaving{ opacity: 0; transform: translateX(-30px) rotate(-2deg); }

.quiz-card .index-no{ font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em; }
.quiz-card-inner{ flex:1; display:flex; flex-direction:column; }

.ask-label{ font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-top: 14px; }
.trait-name{ font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(32px, 7vw, 40px); line-height: 1.1; margin: 8px 0 16px; }

.reveal-btn{
  align-self:flex-start; background: transparent; border: 1.5px solid var(--ink); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; font-weight: 500; padding: 10px 20px; border-radius: 999px;
}
.reveal-btn:hover{ background: var(--ink); color: var(--card); border-color: var(--ink); }
.quiz-card.flipped .reveal-btn{ display:none; }

.card-desc{ font-size: 17px; line-height: 1.6; color: var(--ink); margin: 0; max-height: 0; opacity: 0; overflow: hidden; transition: max-height .4s var(--ease), opacity .3s ease, margin .3s ease; }
.quiz-card.flipped .card-desc{ max-height: 260px; opacity: 1; margin-top: 14px; overflow-y: auto; }
.desc-example{ display:inline-block; font-style: italic; color: var(--ink-soft); font-size: 15px; }

.quiz-spacer{ flex:1; }

.quiz-answers{ display:flex; flex-wrap: nowrap; gap: 7px; margin-top: 14px; }
.quiz-answers button{
  flex: 1 1 0; min-width: 0; display:flex; align-items:center; justify-content:center; text-align:center;
  font-family: var(--font-mono); font-size: 14px; padding: 18px 6px; min-height: 64px; border-radius: 12px;
  border: none; color: #fff; line-height: 1.3; font-weight: 600;
}
.quiz-answers button:hover{ transform: translateY(-3px) scale(1.02); }
.quiz-answers button:disabled{ opacity:.5; transform:none; }
.btn-no{ background: linear-gradient(160deg, var(--no), #c94656); box-shadow: 0 6px 16px rgba(239,93,106,.25); }
.btn-no-mid{ background: linear-gradient(160deg, var(--no-mid), #d47a3f); box-shadow: 0 6px 16px rgba(232,147,92,.25); }
.btn-mid{ background: linear-gradient(160deg, var(--mid), #7d768c); box-shadow: 0 6px 16px rgba(154,148,168,.22); }
.btn-mid-yes{ background: linear-gradient(160deg, var(--mid-yes), #52a875); box-shadow: 0 6px 16px rgba(127,207,158,.25); }
.btn-yes{ background: linear-gradient(160deg, var(--yes), #2f9463); box-shadow: 0 6px 16px rgba(69,184,129,.28); }

.quiz-hint{ text-align:center; font-size: 13px; color: var(--text-muted); margin-top: 48px; font-family: var(--font-mono); }

@media (max-width: 420px){
  .quiz-stage{ min-height: 480px; }
  .quiz-answers{ gap: 4px; }
  .quiz-answers button{ font-size: 12px; padding: 15px 3px; min-height: 58px; }
}

/* ==========================================================
   RESULTS SCREEN — общие блоки (черты)
   ========================================================== */

.results-screen{ width:100%; max-width: 640px; margin: 0 auto; }
.results-screen h2{ font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 29px; text-align:center; margin-bottom: 4px; }
.results-screen .sub{ text-align:center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

.tally{ display:flex; flex-wrap: wrap; gap:10px; justify-content:center; margin-bottom: 30px; }
.tally div{ flex: 1 1 100px; max-width: 120px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px 8px; text-align:center; backdrop-filter: var(--glass-blur); }
.tally .num{ font-family: var(--font-display); font-size: 28px; }
.tally .lbl{ font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-top:4px; }
.tally .yes .num{ color: var(--yes); }
.tally .mid-yes .num{ color: var(--mid-yes); }
.tally .mid .num{ color: var(--mid); }
.tally .no-mid .num{ color: var(--no-mid); }
.tally .no .num{ color: var(--no); }

.result-group{ margin-bottom: 24px; }
.result-group h3{ font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.result-group.yes h3{ color: var(--yes); }
.result-group.mid-yes h3{ color: var(--mid-yes); }
.result-group.mid h3{ color: var(--mid); }
.result-group.no-mid h3{ color: var(--no-mid); }
.result-group.no h3{ color: var(--no); }

.chips{ display:flex; flex-wrap:wrap; gap:8px; max-width:100%; }
.chip{ background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 15px; font-size: 14px; transition: transform .15s var(--ease); }
.chip:hover{ transform: translateY(-2px); }
.empty-note{ font-size:13px; color: var(--text-muted); font-style:italic; }

.results-actions{ display:flex; justify-content:center; gap: 10px; margin-top: 32px; flex-wrap: wrap; }

/* ==========================================================
   TYPE SELECTOR
   ========================================================== */

.type-selector{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
@media (max-width: 560px){ .type-selector{ grid-template-columns: 1fr; } }

.type-option{
  display:flex; gap: 12px; align-items:flex-start; border: 1.5px solid var(--line-strong);
  background: var(--bg-deep); border-radius: var(--radius-md); padding: 17px 18px; cursor: pointer;
  transition: border-color .2s var(--ease-soft), background .2s var(--ease-soft), transform .15s var(--ease);
}
.type-option:hover{ border-color: var(--gold); transform: translateY(-2px); }
.type-option.active{ border-color: var(--gold); background: var(--surface-2); box-shadow: 0 8px 22px color-mix(in srgb, var(--gold) 20%, transparent); }
.type-option input{
  appearance: none; -webkit-appearance: none;
  margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--line-strong);
  background: transparent; position: relative; outline: none;
  transition: border-color .18s var(--ease-soft);
}
.type-option input:checked{ border-color: var(--gold); }
.type-option input:checked::after{
  content:""; position:absolute; inset: 3px; border-radius: 50%;
  background: var(--gold-grad);
}
.type-option input:focus-visible{ outline: 2px solid var(--gold); outline-offset: 2px; }
.type-option .type-title{ font-weight: 600; font-size: 15px; }
.type-option .type-sub{ font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height:1.45; }

/* ==========================================================
   TAGS
   ========================================================== */

.tags-field{ margin: 20px 0 24px; }
.tags-field > label{ display:block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 9px; }

.tag-pool{ display:flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tag-pool-item{ border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-muted); border-radius: var(--radius-pill); padding: 7px 15px; font-size: 13px; }
.tag-pool-item:hover{ border-color: var(--gold); color: var(--text); }
.tag-pool-item.selected{ background: var(--gold-grad); color: var(--gold-ink); border-color: transparent; font-weight: 600; }

.tag-selected-row{ display:flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; min-height: 0; }
.tag-chip{ display:inline-flex; align-items:center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 6px 8px 6px 15px; font-size: 13px; }
.tag-chip button{ border:none; background: none; color: var(--text-muted); width: 19px; height: 19px; border-radius: 50%; font-size: 12px; line-height: 1; padding:0; display:flex; align-items:center; justify-content:center; }
.tag-chip button:hover{ background: var(--no); color: #fff; border-color: transparent; }

.tag-add-row{ display:flex; gap: 8px; }
.tag-add-row input{ flex:1; padding: 10px 14px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--bg-deep); color: var(--text); font-size: 13px; }
.tag-add-row button{ border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--text); width: 38px; border-radius: var(--radius-pill); font-size: 16px; padding: 0; }
.tag-add-row button:hover{ background: var(--gold-grad); color: var(--gold-ink); border-color: transparent; }

.test-tags-row{ display:flex; flex-wrap: wrap; gap: 6px; }
.tag-badge{ font-family: var(--font-mono); font-size: 11.5px; color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); padding: 3px 9px; border-radius: var(--radius-pill); }

.mock-badge{ display:inline-block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--text-muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-pill); padding: 3px 9px; }

/* ==========================================================
   TYPE BADGES
   ========================================================== */

.type-badge{ display:inline-block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; padding: 4px 11px; border-radius: var(--radius-pill); border: 1px solid transparent; white-space: nowrap; }
.type-badge.k-traits{ background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }
.type-badge.k-custom{ background: rgba(127,207,158,.16); color: var(--mid-yes); }
.type-badge.k-quiz{ background: rgba(232,147,92,.18); color: var(--no-mid); }

/* ==========================================================
   CARD STATS ROW (просмотры / реакции / избранное)
   ========================================================== */

.card-stats-row{ display:flex; align-items:center; gap: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.card-stats-row .stat-item{ display:flex; align-items:center; gap: 4px; }

.reaction-btn{
  display:inline-flex; align-items:center; gap: 4px; border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--text-muted); border-radius: var(--radius-pill); padding: 6px 11px; font-size: 12px; font-family: var(--font-mono);
}
.reaction-btn:hover{ border-color: var(--gold); }
.reaction-btn.like.active{ background: linear-gradient(135deg, var(--yes), #2f9463); color:#fff; border-color:transparent; }
.reaction-btn.dislike.active{ background: linear-gradient(135deg, var(--no), #c94656); color:#fff; border-color:transparent; }

.fav-btn{ border: none; background: none; color: var(--text-muted); font-size: 19px; line-height: 1; padding: 2px 4px; transition: transform .2s var(--ease), color .2s ease; }
.fav-btn:hover{ transform: scale(1.2) rotate(-8deg); color: var(--gold); border-color: transparent; }
.fav-btn.active{ color: var(--gold); animation: pop .3s var(--ease); }
@keyframes pop{ 0%{ transform: scale(1);} 40%{ transform: scale(1.35);} 100%{ transform: scale(1);} }

/* ==========================================================
   QUESTION IMAGE (редактор + прохождение + результат)
   ========================================================== */

.q-image-wrap{ text-align: center; margin: 14px 0; }
.q-image-wrap img{ max-width: 100%; max-height: 300px; object-fit: contain; border-radius: var(--radius-md); display: inline-block; }

.image-preview-wrap{ margin-bottom: 12px; position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.image-preview-wrap img{ width: 100%; max-height: 220px; object-fit: contain; display:block; }
.image-preview-wrap .remove-image-btn, .image-preview-wrap .range-remove-image{ position:absolute; top: 8px; right: 8px; background: rgba(10,10,15,.75); color: #fff; border: none; border-radius: var(--radius-pill); padding: 7px 13px; font-size: 12px; }

/* ==========================================================
   DESCRIPTION REVEAL
   ========================================================== */

.desc-reveal-btn{ background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--text-muted); font-size: 13px; padding: 8px 16px; border-radius: var(--radius-pill); margin: 4px 0 12px; }
.desc-reveal-btn:hover{ border-color: var(--gold); color: var(--text); }
.desc-reveal-block{ font-size: 14px; color: var(--text-muted); line-height: 1.55; margin: 0 0 14px; padding: 14px 16px; background: var(--bg-deep); border-radius: var(--radius-sm); animation: fade-up .25s var(--ease); }

/* ==========================================================
   QUESTION EDITOR (custom / quiz)
   ========================================================== */

.question-editor-list{ display:flex; flex-direction: column; gap: 18px; margin: 14px 0 18px; }
.question-card{ background: var(--bg-deep); border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); padding: 20px; transition: border-color .2s ease; }
.question-card:hover{ border-color: var(--line); }

.question-card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.question-card-head .q-title{ font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.question-card-head .q-actions{ display:flex; gap: 6px; }
.question-card-head .q-actions button{ border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); width: 32px; height: 32px; padding: 0; font-size: 14px; }
.question-card-head .q-actions button:hover{ background: var(--surface-2); border-color: var(--gold); }
.question-card-head .q-actions button.danger{ border-color: rgba(239,93,106,.35); color: var(--no); }
.question-card-head .q-actions button.danger:hover{ background: var(--no); color:#fff; border-color: transparent; }

.image-dropzone{
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 26px; text-align:center;
  color: var(--text-muted); font-size: 13px; cursor: pointer; margin-bottom: 12px; transition: border-color .2s ease, background .2s ease;
}
.image-dropzone:hover{ border-color: var(--gold); background: var(--surface); }
.image-dropzone .dz-icon{ font-size: 24px; display:block; margin-bottom: 7px; }

.question-text-input{ width: 100%; padding: 12px 15px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 15px; margin-bottom: 12px; }
.question-desc-input{ transition: border-color .18s ease; }
.question-text-input:focus, .question-desc-input:focus{ outline:none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent); }

.option-list{ display:flex; flex-direction: column; gap: 9px; margin-bottom: 10px; }
.option-row{
  display:flex; align-items:center; gap: 9px; border: 1.5px solid transparent; border-radius: var(--radius-sm);
  padding: 4px; transition: border-color .2s var(--ease-soft), background .2s var(--ease-soft);
}
.option-row .opt-index{ font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); width: 18px; flex-shrink:0; padding-left: 4px; }
.option-row input{ flex:1; padding: 10px 13px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; }
.option-row input:focus{ outline:none; border-color: var(--gold); }
.option-row button{ border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-muted); width: 30px; height: 30px; border-radius: 8px; font-size: 13px; padding: 0; flex-shrink:0; }
.option-row button:hover{ background: var(--no); color:#fff; border-color: transparent; }

/* правильный ответ — заметная обводка вокруг всей строки */
.option-row.correct-mode.is-correct{
  border-color: var(--yes);
  background: rgba(69,184,129,.1);
  box-shadow: 0 0 0 3px rgba(69,184,129,.12);
}
.option-row .correct-check{ display:flex; align-items:center; gap: 6px; font-size: 11.5px; font-family: var(--font-mono); color: var(--text-muted); flex-shrink:0; cursor:pointer; user-select:none; padding: 0 4px; }
.option-row.is-correct .correct-check{ color: var(--yes); font-weight: 600; }
.option-row .correct-check input{ accent-color: var(--yes); width: 15px; height: 15px; }

.options-counter{ font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-bottom: 9px; }

.add-option-btn{ border: 1.5px dashed var(--line-strong); background: transparent; color: var(--text-muted); border-radius: 8px; padding: 9px; width: 100%; font-size: 13px; }
.add-option-btn:hover{ background: var(--surface); color: var(--text); border-color: var(--gold); }

.add-question-btn{ border: 1.5px dashed var(--line-strong); background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); padding: 15px; width: 100%; font-size: 14px; }
.add-question-btn:hover{ background: var(--surface-2); color: var(--text); border-color: var(--gold); }

/* ==========================================================
   TRAIT POOL PICKER
   ========================================================== */

.trait-pool-notice{ background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }
.trait-pool-search{ width: 100%; padding: 12px 16px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--bg-deep); color: var(--text); font-size: 14px; margin-bottom: 14px; }
.trait-pool-search:focus{ outline:none; border-color: var(--gold); }

.trait-pool-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 22px; max-height: 380px; overflow-y: auto; padding: 3px; }
.trait-pool-card{ border: 1.5px solid var(--line-strong); background: var(--bg-deep); border-radius: var(--radius-sm); padding: 13px 15px; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .15s ease; }
.trait-pool-card:hover{ border-color: var(--gold); transform: translateY(-2px); }
.trait-pool-card.selected{ border-color: var(--gold); background: var(--surface-2); box-shadow: 0 6px 16px color-mix(in srgb, var(--gold) 20%, transparent); }
.trait-pool-card .tp-name{ font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.trait-pool-card .tp-desc{ font-size: 12.5px; color: var(--text-muted); line-height:1.4; }

.trait-selected-list{ display:flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.trait-selected-item{ display:flex; align-items:center; gap: 10px; background: var(--card); color: var(--ink); border-radius: var(--radius-sm); padding: 11px 15px; }
.trait-selected-item .tsi-name{ flex:1; font-weight: 600; font-size: 14px; }
.trait-selected-item button{ border:none; background: var(--card-edge); color: var(--ink); border-radius: 7px; width: 27px; height: 27px; font-size: 12px; padding: 0; }
.trait-selected-item button:hover{ background: var(--no); color:#fff; }

/* ==========================================================
   RESULT RANGES EDITOR
   ========================================================== */

.range-editor-list{ display:flex; flex-direction: column; gap: 14px; margin: 12px 0 18px; }
.range-editor-item{ background: var(--bg-deep); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 16px 18px; }
.range-editor-item .range-minmax{ display:flex; gap: 10px; margin-bottom: 11px; }
.range-editor-item .range-minmax input{ width: 92px; padding: 9px 11px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 13px; }
.range-editor-item input[type="text"], .range-editor-item textarea{ width: 100%; padding: 10px 13px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; margin-bottom: 9px; }
.range-editor-item .range-remove{ border: 1px solid rgba(239,93,106,.35); background: var(--surface); color: var(--no); border-radius: 8px; padding: 6px 12px; font-size: 12px; }
.range-editor-item .range-remove:hover{ background: var(--no); color:#fff; border-color: transparent; }

/* ==========================================================
   RUNNER — обычный тест / правильные ответы
   ========================================================== */

.runner-wrap{ width: 100%; max-width: 580px; margin: 0 auto; }

.runner-question-card{ background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); backdrop-filter: var(--glass-blur); animation: fade-up .35s var(--ease); }
.runner-question-body{ padding: 28px; }
.runner-question-body h2{ font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 23px; margin: 0 0 18px; line-height: 1.35; }

.runner-options{ display:flex; flex-direction: column; gap: 10px; }
.runner-option{
  display:flex; align-items:center; gap: 12px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md);
  padding: 15px 17px; cursor: pointer; transition: border-color .18s var(--ease-soft), background .18s var(--ease-soft), transform .15s var(--ease);
}
.runner-option:hover{ border-color: var(--gold); transform: translateX(3px); }
.runner-option.selected{ border-color: var(--gold); background: var(--surface-2); box-shadow: 0 6px 18px color-mix(in srgb, var(--gold) 20%, transparent); }
.runner-option .dot{ width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink:0; position: relative; transition: border-color .18s ease; }
.runner-option.selected .dot{ border-color: var(--gold); }
.runner-option.selected .dot::after{ content:""; position:absolute; inset: 3px; border-radius: 50%; background: var(--gold-grad); animation: pop .25s var(--ease); }
.runner-option.checkbox .dot{ border-radius: 6px; }
.runner-option.checkbox.selected .dot::after{ border-radius: 3px; }
.runner-option span.opt-text{ font-size: 15px; }

.runner-nav{ display:flex; justify-content:space-between; gap: 10px; margin-top: 24px; }

/* ==========================================================
   NORMAL / QUIZ RESULTS  (вопрос → ответ)
   ========================================================== */

.qa-result-list{ display:flex; flex-direction: column; gap: 15px; }
.qa-result-item{ background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 19px 21px; backdrop-filter: var(--glass-blur); }
.qa-result-item .qa-num{ font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 7px; }
.qa-result-item .qa-question{ font-family: var(--font-display); font-style: italic; font-size: 17px; margin-bottom: 10px; }
.qa-result-item .qa-desc{ font-size: 13.5px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.qa-result-item .qa-answer{ font-size: 14px; color: var(--text); display:flex; gap: 8px; align-items:baseline; }
.qa-result-item .qa-answer .arrow{ color: var(--gold); }
.qa-result-item .qa-answer.correct{ padding:11px 14px; border:1.5px solid var(--yes); border-radius:var(--radius-sm); background: rgba(69,184,129,.08); }
.qa-result-item .qa-answer.incorrect{ padding:11px 14px; border:1.5px solid var(--no); border-radius:var(--radius-sm); background: rgba(239,93,106,.08); }
.qa-result-item .correct-mark{ font-size: 12px; font-family: var(--font-mono); margin-top: 7px; }
.qa-result-item .correct-mark.ok{ color: var(--yes); }
.qa-result-item .correct-mark.bad{ color: var(--no); }
.qa-result-item .right-answer-line{ font-size: 13px; color: var(--text-muted); margin-top: 5px; }

/* ==========================================================
   QUIZ SCORE HEADER + FINAL RANGE RESULT
   ========================================================== */

.score-header{ text-align:center; margin-bottom: 30px; }
.score-header .score-fraction{ font-family: var(--font-display); font-style: italic; font-size: 40px; }
.score-header .score-percent{ font-family: var(--font-mono); font-size: 15px; color: var(--gold); margin: 4px 0 14px; font-weight: 600; }
.score-header .progress-track{ max-width: 320px; margin: 0 auto 10px; }
.score-header .score-sub{ font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

.quiz-final-result{ max-width:760px; margin:0 auto 32px; padding:36px 30px 40px; text-align:center; border:1.5px solid var(--gold); border-radius:var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: var(--glass-blur); position: relative; overflow: hidden; }
.quiz-final-result::before{ content:""; position:absolute; inset:-40%; background: var(--gold-grad); opacity:.08; filter: blur(60px); }
.quiz-final-result .final-result-eyebrow{ position:relative; font-family:var(--font-mono); font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:var(--gold); margin-bottom:10px; }
.quiz-final-result h1{ position:relative; margin:0 0 22px; font-family:var(--font-display); font-style: italic; font-size:clamp(28px,5vw,42px); line-height:1.1; }
.final-result-image{ position:relative; width:min(100%,560px); margin:0 auto 24px; border-radius:var(--radius-md); overflow:hidden; }
.final-result-image img{ display:block; width:100%; max-height: 460px; object-fit: contain; }
.quiz-final-result>p{ position:relative; max-width:650px; margin:0 auto; color:var(--text-muted); font-size:16px; line-height:1.65; }

@media(max-width:760px){ .quiz-final-result{ padding:26px 18px 30px; } .quiz-final-result h1{ font-size:30px; } }

/* ==========================================================
   MODERATION
   ========================================================== */

.mod-pill{ font-family: var(--font-mono); font-size: 11px; padding: 5px 11px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); }
.mod-pill.included{ color: var(--yes); border-color: var(--yes); background: rgba(69,184,129,.08); }
.mod-pill.excluded{ color: var(--no); border-color: var(--no); background: rgba(239,93,106,.08); text-decoration: line-through; }

/* ==========================================================
   TEST STATISTICS  (charts, distribution toggle)
   ========================================================== */

.stats-note{ color: var(--text-muted); font-size: 13.5px; margin: -6px 0 18px; }
.stats-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.stats-panel{ background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px; backdrop-filter: var(--glass-blur); }
.stats-panel.stats-wide{ grid-column: 1 / -1; }
.stats-panel h2{ font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 19px; margin: 0 0 16px; }

.stat-bar-row{ margin-bottom: 12px; }
.stat-bar-head{ display:flex; justify-content:space-between; font-size: 13.5px; margin-bottom: 5px; }
.stat-bar-head strong{ color: var(--gold); font-weight: 700; }
.stat-bar{ height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stat-bar span{ display:block; height:100%; border-radius: inherit; background: var(--gold-grad); transition: width .6s var(--ease); }

.question-stat{ margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.question-stat:last-child{ border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.question-stat-title{ display:flex; justify-content:space-between; align-items:baseline; gap: 10px; margin-bottom: 10px; font-size: 14px; flex-wrap: wrap; }
.question-stat-title span{ font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

.trait-stat{ margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.trait-stat:last-child{ border-bottom: none; }

.stats-details-toggle{
  display:inline-flex; align-items:center; gap: 6px; margin-top: 10px; border: 1.5px solid var(--line-strong);
  background: var(--surface-2); color: var(--text-muted); padding: 7px 14px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 500;
}
.stats-details-toggle:hover{ border-color: var(--gold); color: var(--text); }
.stats-details-toggle .stats-chevron{ font-size: 13px; line-height:1; transition: transform .25s var(--ease); }
.stats-details-toggle.open{ background: var(--surface); color: var(--gold); border-color: var(--gold); }
.stats-details-toggle.open .stats-chevron{ transform: rotate(180deg); }

.trait-distribution{ max-height:0; overflow:hidden; margin:0 0 0 18px; padding-left:18px; border-left:1px solid transparent; transition:max-height .3s var(--ease),margin-top .3s var(--ease),padding-top .3s var(--ease),border-color .3s var(--ease); }
.trait-distribution.open{ max-height:700px; margin-top:12px; padding-top:12px; border-color:var(--line); }

@media(max-width:760px){ .stats-grid{ grid-template-columns:1fr; } .stats-panel.stats-wide{ grid-column:auto; } .question-stat-title{ display:block; } .question-stat-title span{ display:block; margin-top:6px; } }

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 600px){
  #view{ padding: 26px 16px 70px; }
  .topnav{ padding: 12px 18px; }
  .form-panel{ padding: 20px; }
  .runner-question-body{ padding: 20px; }
}

/* ==========================================================
   FOOTER
   ========================================================== */

.app-footer{ text-align:center; padding: 26px; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; border-top: 1px solid var(--line); }
