﻿/* ===================================================================
   RESONANCE · генератор анкеты + приёмка | legume
   В стиле списка ролей: полупрозрачная «бумага» с вогнутыми уголками и
   мягкой тенью, заголовки капителью цветом имён, знаки рас ♁ ☉ ✶ ☾.
   Цвета — переменные темы форума (--links, --text1, --text2), тёмная
   тема — класс .dark на странице. Правится свободно: скрипт только
   расставляет классы.
=================================================================== */

.rsa-panel, .rsa-modal {
  --rsa-paper:  rgba(255,255,255,.8);
  --rsa-field:  rgba(255,255,255,.75);
  --rsa-text:   var(--text1, #323232);
  --rsa-muted:  var(--text2, #7D7D7D);
  --rsa-accent: var(--links, #A2706A);
  --rsa-line:   rgba(50,50,50,.13);
  --rsa-bad:    #a33a2a;
  --rsa-shadow: rgba(110,84,60,.16);
  --rsa-shadow2: rgba(110,84,60,.12);

  font: 400 12px/1.45 var(--font, Inter), Verdana, Arial, sans-serif;
  color: var(--rsa-text);
  text-align: left;
  box-sizing: border-box;
}
.dark .rsa-panel, .dark .rsa-modal {
  --rsa-paper:  rgba(89,82,80,.86);
  --rsa-field:  rgba(255,255,255,.08);
  --rsa-text:   #f1eef0;
  --rsa-muted:  #cfc8cc;
  --rsa-accent: #E9A584;
  --rsa-line:   rgba(255,255,255,.18);
  --rsa-bad:    #f0a08f;
  --rsa-shadow: rgba(0,0,0,.25);
  --rsa-shadow2: rgba(0,0,0,.18);
}
.rsa-panel *, .rsa-modal * { box-sizing: border-box; }

/* --- панель: бумага с вогнутыми уголками и тенью по форме ---
   форма — маской на .rsa-bg::before, тень — drop-shadow на .rsa-bg
   (как у карточек списка ролей; box-shadow маска бы срезала) */
.rsa-panel {
  --cut: 14px;
  position: relative;
  isolation: isolate;
  padding: 22px 26px 20px;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rsa-bg {
  position: absolute; inset: 0; z-index: -1;
  filter: drop-shadow(0 2px 3px var(--rsa-shadow)) drop-shadow(0 10px 18px var(--rsa-shadow2));
}
.rsa-bg::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--rsa-paper);
  -webkit-mask:
    radial-gradient(circle var(--cut) at 0 0, #0000 98%, #000) top left,
    radial-gradient(circle var(--cut) at 100% 0, #0000 98%, #000) top right,
    radial-gradient(circle var(--cut) at 0 100%, #0000 98%, #000) bottom left,
    radial-gradient(circle var(--cut) at 100% 100%, #0000 98%, #000) bottom right;
  -webkit-mask-size: 51% 51%; -webkit-mask-repeat: no-repeat;
          mask:
    radial-gradient(circle var(--cut) at 0 0, #0000 98%, #000) top left,
    radial-gradient(circle var(--cut) at 100% 0, #0000 98%, #000) top right,
    radial-gradient(circle var(--cut) at 0 100%, #0000 98%, #000) bottom left,
    radial-gradient(circle var(--cut) at 100% 100%, #0000 98%, #000) bottom right;
          mask-size: 51% 51%; mask-repeat: no-repeat;
}
.rsa-bg::after {                                  /* тонкая внутренняя линия */
  /* угол линии должен лежать за вырезом: отступ × √2 > --cut (14 px) */
  content: ""; position: absolute; inset: 12px;
  border: 1px solid var(--rsa-line);
}

.rsa-head {
  text-align: center;
  font: 700 20px/1.2 var(--font2, 'Alegreya Sans SC'), var(--font, Inter), sans-serif;
  color: var(--rsa-accent);
  text-transform: lowercase;
  letter-spacing: .02em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rsa-line);
}
.rsa-head small {
  display: block;
  margin-top: 3px;
  font: 400 11px/1.4 var(--font, Inter), sans-serif;
  color: var(--rsa-muted);
  letter-spacing: 0;
}

/* подзаголовки разделов: капитель + линия до края */
.rsa-sec {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px;
  font: 500 15px/1 var(--font2, 'Alegreya Sans SC'), var(--font, Inter), sans-serif;
  color: var(--rsa-accent);
  text-transform: lowercase;
}
.rsa-sec::after { content: ""; flex: 1; height: 1px; background: var(--rsa-line); }

.rsa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 14px;
}

.rsa-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rsa-f > span { font-size: 11px; color: var(--rsa-muted); text-transform: lowercase; }
.rsa-f b { color: var(--rsa-accent); font-weight: 400; }
.rsa-f[hidden] { display: none; }

/* поля: светлая подложка, тонкая линия, акцент цветом имён при фокусе */
.rsa-panel .rsa-in, .rsa-modal .rsa-in {
  width: 100%;
  background: var(--rsa-field) !important;
  color: var(--rsa-text) !important;
  border: 1px solid var(--rsa-line) !important;
  border-radius: 3px !important;
  box-shadow: none !important;
  padding: 7px 9px !important;
  height: auto !important;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.rsa-panel textarea.rsa-in, .rsa-modal textarea.rsa-in { resize: vertical; line-height: 1.5; }
.rsa-panel .rsa-in:focus, .rsa-modal .rsa-in:focus {
  outline: none;
  border-color: var(--rsa-accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rsa-accent) 18%, transparent) !important;
}
.rsa-in::placeholder { color: var(--rsa-muted); opacity: .6; }

/* пол — пилюли-переключатели */
.rsa-radios { display: flex; gap: 6px; }
.rsa-radios label { cursor: pointer; }
.rsa-radios input, .rsa-check input { position: absolute; opacity: 0; pointer-events: none; }
.rsa-radios i, .rsa-check i {
  display: inline-block;
  font-style: normal;
  padding: 6px 14px;
  border: 1px solid var(--rsa-line);
  border-radius: 999px;
  background: var(--rsa-field);
  color: var(--rsa-muted);
  transition: all .15s;
}
.rsa-radios input:checked + i, .rsa-check input:checked + i {
  background: var(--rsa-accent);
  border-color: var(--rsa-accent);
  color: #fff;
}
.rsa-radios input:focus-visible + i, .rsa-check input:focus-visible + i { outline: 2px solid var(--rsa-accent); outline-offset: 2px; }

/* расы — карточки со знаком */
.rsa-races {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.rsa-race {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 9px 11px;
  background: var(--rsa-field);
  border: 1px solid var(--rsa-line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.rsa-race input { position: absolute; opacity: 0; pointer-events: none; }
.rsa-sign {
  grid-row: 1 / 3;
  font: normal 400 22px/1 'Segoe UI Symbol', 'Noto Sans Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', serif;
  color: var(--rsa-muted);
  width: 1.1em;
  text-align: center;
  transition: color .15s;
}
.rsa-race b {
  font: 600 15px/1.1 var(--font2, 'Alegreya Sans SC'), var(--font, Inter), sans-serif;
  color: var(--rsa-text);
  text-transform: lowercase;
}
.rsa-race small { color: var(--rsa-muted); font-size: 10px; line-height: 1.3; }
.rsa-race:hover { border-color: color-mix(in srgb, var(--rsa-accent) 50%, transparent); }
.rsa-race:has(input:checked) {
  border-color: var(--rsa-accent);
  box-shadow: inset 0 0 0 1px var(--rsa-accent);
}
.rsa-race:has(input:checked) .rsa-sign,
.rsa-race:has(input:checked) b { color: var(--rsa-accent); }

.rsa-warn { color: var(--rsa-bad); font-style: normal; font-size: 11px; }

/* твинк */
.rsa-twinkrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; }
.rsa-check { cursor: pointer; padding-bottom: 2px; }
.rsa-twinkrow .rsa-mainf { flex: 1 1 260px; }

/* кнопки */
.rsa-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 6px; padding-top: 14px;
  border-top: 1px solid var(--rsa-line);
}
.rsa-panel .rsa-btn, .rsa-modal .rsa-btn {
  background: transparent !important;
  color: var(--rsa-accent) !important;
  border: 1px solid var(--rsa-accent) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  padding: 7px 16px !important;
  font: 500 12px/1.2 var(--font, Inter), sans-serif !important;
  text-transform: lowercase;
  cursor: pointer;
  transition: all .15s;
}
.rsa-panel .rsa-btn:hover, .rsa-modal .rsa-btn:hover { background: color-mix(in srgb, var(--rsa-accent) 12%, transparent) !important; }
.rsa-panel .rsa-btn.rsa-main, .rsa-modal .rsa-btn.rsa-main {
  background: var(--rsa-accent) !important;
  color: #fff !important;
  padding: 8px 22px !important;
}
.rsa-panel .rsa-btn.rsa-main:hover, .rsa-modal .rsa-btn.rsa-main:hover { filter: brightness(1.06); }
.rsa-btn:disabled { opacity: .5; cursor: default; }
.rsa-status { color: var(--rsa-muted); font-size: 11px; }
.rsa-bad { color: var(--rsa-bad) !important; }
.rsa-note { margin: 0; font-size: 11px; color: var(--rsa-muted); }
.rsa-sub {
  margin: 6px 0 0;
  font: 500 15px/1 var(--font2, 'Alegreya Sans SC'), var(--font, Inter), sans-serif;
  color: var(--rsa-accent);
  text-transform: lowercase;
}

/* --- приёмка: кнопка в первом посте и окно --- */
.rsa-acceptbar { margin-top: 14px; }
.rsa-acceptbar .rsa-btn.rsa-main {
  background: var(--links, #A2706A) !important; color: #fff !important; border: 0 !important;
  border-radius: 999px !important; padding: 8px 20px !important;
  font: 500 12px/1.2 var(--font, Inter), sans-serif !important; cursor: pointer;
}
.rsa-accepted {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--links, #A2706A);
  color: var(--links, #A2706A);
  font: 400 11px/1.4 var(--font, Inter), Verdana, sans-serif;
}

.rsa-ov {
  position: fixed; inset: 0; z-index: 100050;
  background: rgba(30,24,20,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.rsa-modal {
  --rsa-paper: #f7f3ea;
  width: 100%;
  max-width: 640px;
  background: var(--rsa-paper);
  border-radius: 4px;
  padding: 20px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
}
.dark .rsa-modal { --rsa-paper: #4f4846; }
.rsa-mh {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rsa-line);
  font: 700 17px/1.2 var(--font2, 'Alegreya Sans SC'), var(--font, Inter), sans-serif;
  color: var(--rsa-accent);
  text-transform: lowercase;
}
.rsa-modal .rsa-x { background: none !important; border: 0 !important; box-shadow: none !important; font-size: 22px; line-height: 1; cursor: pointer; color: var(--rsa-muted); }

.rsa-lzprev {
  padding: 10px;
  border: 1px dashed var(--rsa-line);
  border-radius: 3px;
  background: var(--rsa-field);
}

/* тёмная тема: на персиковом фоне белый текст не читается */
.dark .rsa-panel .rsa-btn.rsa-main, .dark .rsa-modal .rsa-btn.rsa-main,
.dark .rsa-radios input:checked + i, .dark .rsa-check input:checked + i { color: #2b2325 !important; }

/* --- новые значения справочников: подсветка вместо окна-предупреждения --- */
.rsa-new .rsa-in { border-color: #c98a2e !important; background: rgba(255,214,140,.22) !important; }
.rsa-new > span::after { content: " · новое"; color: #b0731d; }
.dark .rsa-new > span::after { color: #f0c37a; }
.rsa-hint { font-style: normal; font-size: 10px; line-height: 1.35; color: #b0731d; }
.dark .rsa-hint { color: #f0c37a; }
.rsa-hint:empty { display: none; }
.rsa-modal .rsa-pick {
  background: none !important; border: 0 !important; box-shadow: none !important;
  padding: 0 !important; font: inherit; color: var(--rsa-accent) !important;
  text-decoration: underline dotted; cursor: pointer;
}
