:root {
  --bg: #0b0e14;
  --bg-2: #0f141d;
  --panel: #141a24;
  --panel-2: #1a2230;
  --panel-3: #202a3a;
  --line: #2a3445;
  --line-soft: #222b39;
  --text: #ece6da;
  --muted: #98a3b3;
  --gold: #c9a15a;
  --gold-2: #e0bd7c;
  --red: #c65d5d;
  --red-2: #e07b7b;
  --green: #6fae8a;
  --teal: #5fa7a1;
  --blue: #6f95c9;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { scrollbar-width: thin; scrollbar-color: rgba(201, 161, 90, .5) transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(201, 161, 90, .5) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(201, 161, 90, .42);
  border: 1px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(201, 161, 90, .7); }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-corner { background: transparent; }
body {
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(94, 124, 171, .16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201, 161, 90, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
::selection { background: rgba(201, 161, 90, .3); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 13px; min-height: 18px; }
.hidden { display: none !important; }

/* ---------- каркас ---------- */
#app { min-height: 100dvh; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 18px;
}
.icon-btn:hover { border-color: var(--gold); }

#screens { max-width: 1440px; margin: 0 auto; }
.screen { display: none; padding: 26px clamp(14px, 4vw, 46px) 70px; }
.screen.active { display: block; }

/* ---------- кнопки/поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  font-weight: 600; letter-spacing: .2px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: #3b4a61; background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  color: #17120a; border-color: #d5af6b;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 8px 24px rgba(201, 161, 90, .18);
}
.btn-primary:hover { background: linear-gradient(180deg, #edcc8c, #d3ab64); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red-2); border-color: rgba(198,93,93,.35); background: rgba(198,93,93,.07); }
.btn-sm { min-height: 34px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: #17120a; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
  color: var(--text);
  min-height: 42px;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,161,90,.12); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; font-size: 13px; color: #c7cfda; margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 16px; }
.field-note { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.4; }
#subclass-note { white-space: pre-line; }
.background-effect { color: #d7dde6; font-size: 13px; line-height: 1.5; margin: 6px 0 0; max-width: 640px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.inline-fields { display: block; margin-top: 12px; }
.inline-fields .field { margin: 0 0 12px; }
.field-compact { max-width: 340px; }
.tuning-row { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.tuning-row .field { margin: 0; max-width: 340px; }
.align-panel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: rgba(20,26,36,.45); }
.align-title { color: var(--gold-2); font-family: var(--serif); font-size: 16px; font-weight: 600; }
.align-row { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 14px; }
.align-result { padding-top: 4px; }
.align-name { font-family: var(--serif); font-size: 17px; color: var(--gold-2); }
.more { margin-top: 10px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.more summary:hover, .more[open] summary { color: var(--text); }
.more > :not(summary) { margin-top: 8px; }
.align-axis { margin-top: 8px; }
.align-axis label { font-size: 12px; color: #c7cfda; margin-bottom: 4px; }
.align-axis select { width: 100%; }
.align-axes { display: grid; gap: 8px; }
.align-axes select { width: 100%; }
.bonus-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.bonus-row .field { flex: 1 1 200px; margin: 0; max-width: 220px; }
.bonus-row .field:first-child { flex-basis: 240px; max-width: 260px; }
.language-pair { display: flex; flex-wrap: wrap; gap: 12px; }
.language-pair .field { flex: 1 1 300px; margin: 0 0 12px; max-width: 340px; }
.choice-note { color: var(--muted); font-size: 12.5px; line-height: 1.5; padding-top: 27px; }
.choice-panel { border: 1px solid var(--line); border-radius: 10px; background: rgba(20,26,36,.55); padding: 10px 12px; margin: 0 0 16px; max-width: 760px; }
.choice-panel-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.choice-panel-head b { color: var(--gold-2); font-size: 13px; }
.choice-panel-text { color: #d7dde6; font-size: 13px; line-height: 1.5; }
.choice-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.45; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
.group-head h3 { font-size: 17px; margin: 0; }
.choice-note-rich p { margin: 0 0 6px; }
.choice-note-rich p:last-child { margin-bottom: 0; }
.choice-note-rich b { color: var(--gold-2); font-weight: 600; }
.language-block { margin: 0 0 18px; }
.history-prompts { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.55; column-count: 2; column-gap: 28px; }
.history-prompts li { margin: 2px 0; break-inside: avoid; }
.creation-block select { max-width: 340px; }
.creation-block .input-row { justify-content: flex-start; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }

.segmented { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); margin-bottom: 10px; }
.segmented button { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 8px 10px; font-weight: 600; }
.segmented button.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.check-line { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500; margin: 8px 0; }
.check-line input { width: 17px; min-height: 17px; accent-color: var(--gold); }

/* ---------- главная ---------- */
.home-hero { max-width: 900px; padding: clamp(20px, 5vw, 64px) 0 30px; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .22em; font-size: 11.5px; font-weight: 700; margin-bottom: 16px; }
.home-hero h1 { font-size: clamp(40px, 7vw, 76px); line-height: 1.02; letter-spacing: -.02em; }
.home-hero h1 span { color: var(--gold); font-style: italic; }
.lede { max-width: 620px; color: #c0c8d4; font-size: clamp(15px, 1.6vw, 18px); margin-top: 20px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }

/* главное меню */
#screen-home.active {
  display: flex;
  justify-content: center;
  padding-top: clamp(16px, 4vh, 44px);
  overflow: hidden;
}
.main-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(440px, 100%);
}
.menu-emblem-wrap {
  position: relative;
  width: clamp(170px, 30vh, 280px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  animation: emblem-breathe 8s ease-in-out infinite;
  will-change: transform;
}
.emblem-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  --emblem-base-filter:
    drop-shadow(0 0 3px rgba(201, 161, 90, .16))
    drop-shadow(0 0 9px rgba(201, 161, 90, .08))
    drop-shadow(0 14px 30px rgba(0, 0, 0, .55));
  filter: var(--emblem-base-filter);
}
.emblem-frame { z-index: 1; }
.emblem-rotor {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
}
.d20-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}
.d20-spin {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}
.d20-body {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(35.264deg) rotateY(45deg)
             scale3d(var(--d20-scale, .8), var(--d20-scale, .8), var(--d20-scale, .8));
}
.d20-face {
  position: absolute;
  left: 0;
  top: 0;
  backface-visibility: hidden;
  will-change: transform;
}
.d20-face img {
  display: block;
  width: 100%;
  height: 100%;
}
.d20-spin {
  animation: d20-idle 80s linear infinite;
  will-change: transform;
}
@keyframes d20-idle {
  0% { transform: rotateX(0deg) rotateY(0deg); }
  100% { transform: rotateX(360deg) rotateY(-360deg); }
}
.emblem-orbits3d {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}
.orbit3d {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform-origin: 0 0;
}
.orbit3d.o1 { transform: rotateX(72deg) rotateZ(0deg); }
.orbit3d.o2 { transform: rotateX(72deg) rotateZ(64deg); }
.orbit3d.o3 { transform: rotateX(72deg) rotateZ(-64deg); }
.orbit3d.o4 { transform: rotateY(72deg) rotateZ(0deg); }
.orbit3d.o5 { transform: rotateX(52deg) rotateY(48deg) rotateZ(20deg); }
.orbit-links {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  animation: orbit-chain 40s linear infinite;
}
.o2 .orbit-links { animation-duration: 60s; }
.o3 .orbit-links { animation-duration: 80s; }
.o4 .orbit-links { animation-duration: 100s; }
.o5 .orbit-links { animation-duration: 120s; }
.orbit-link {
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 2.2px;
  margin-left: -3.5px;
  margin-top: -1.1px;
  border-radius: 999px;
  background: rgba(201, 161, 90, .62);
  box-shadow: 0 0 4px rgba(201, 161, 90, .45);
}
@keyframes orbit-chain {
  to { transform: rotate(360deg); }
}
.orbit-die {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform: translateY(calc(-1 * var(--r, 100px)));
  transform-style: preserve-3d;
}
.mini-spin {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  animation: mini-tumble 40s linear infinite;
}
.o2 .mini-spin { animation-duration: 60s; }
.o3 .mini-spin { animation-duration: 80s; }
.o4 .mini-spin { animation-duration: 100s; }
.o5 .mini-spin { animation-duration: 120s; }
.mini-die {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(35.264deg) rotateY(45deg)
             scale3d(var(--ms, .08), var(--ms, .08), var(--ms, .08));
}
.mini-face {
  position: absolute;
  left: 0;
  top: 0;
  backface-visibility: hidden;
}
.mini-face img {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(1.1);
  transform-origin: 50% 50%;
}
@keyframes mini-tumble {
  to { transform: rotateY(360deg); }
}
.spark {
  position: absolute;
  width: 50%;
  height: 3.6%;
  border-radius: 999px;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent 0%,
              rgba(241, 214, 157, .45) 20%, rgba(255, 238, 196, .92) 50%,
              rgba(241, 214, 157, .45) 80%, transparent 100%);
  filter: blur(4px) drop-shadow(0 0 8px rgba(224, 189, 124, .8));
  transform: translate(-50%, -50%) rotate(var(--a, 0deg));
  transform-origin: center;
  animation: edge-flash var(--dur, 10s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.s1 { left: 29.3%; top: 15.2%; --a: -29.5deg; }
.s2 { left: 70.7%; top: 15.2%; --a: 29.5deg; }
.s3 { left: 91.4%; top: 50%; --a: 90deg; }
.s4 { left: 70.7%; top: 84.8%; --a: 150.5deg; }
.s5 { left: 29.3%; top: 84.8%; --a: 209.5deg; }
.s6 { left: 8.6%; top: 50%; --a: 90deg; }
@keyframes edge-flash {
  0%, 100% { opacity: 0; }
  32% { opacity: .5; }
  50% { opacity: .92; }
  68% { opacity: .42; }
}
@keyframes emblem-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: clamp(48px, 12vh, 90px);
}
.menu-item {
  position: relative;
  width: 100%;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-variant: small-caps;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: center;
  overflow: hidden;
  background-color: #141b26;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.11'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(201, 161, 90, .05), rgba(0, 0, 0, .2)),
    linear-gradient(180deg, #1a2230, #131923);
  background-size: 140px 140px, auto, auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), inset 0 -1px 0 rgba(0, 0, 0, .55);
  transition: border-color .18s, color .18s, box-shadow .18s, transform .18s;
}
.menu-item::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201, 161, 90, .14);
  border-radius: 7px;
  pointer-events: none;
}
.menu-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .9;
  transition: transform .18s, opacity .18s;
}
.menu-item:hover,
.menu-item:focus-visible {
  border-color: var(--gold);
  color: var(--gold-2);
  box-shadow: 0 0 0 1px rgba(201, 161, 90, .28), 0 10px 26px rgba(201, 161, 90, .12);
  transform: translateY(-1px) scale(1.012);
  outline: none;
}
.menu-item:hover .menu-icon,
.menu-item:focus-visible .menu-icon {
  opacity: 1;
  transform: scale(1.08);
}
.menu-item::after { transition: border-color .18s; }
.menu-item:hover::after,
.menu-item:focus-visible::after { border-color: rgba(201, 161, 90, .32); }
.menu-item:active { transform: scale(.997); }
.menu-item:disabled {
  cursor: not-allowed;
  opacity: .52;
  color: var(--muted);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03), inset 0 -1px 0 rgba(0, 0, 0, .45);
  transform: none;
}
.menu-item:disabled:hover::after { border-color: rgba(201, 161, 90, .14); }
.menu-item-wrap { position: relative; width: 100%; }
.menu-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 6;
  width: max-content;
  max-width: min(320px, 88vw);
  padding: 7px 11px;
  border: 1px solid rgba(201, 161, 90, .45);
  border-radius: 8px;
  background: #1b2431;
  color: var(--gold-2);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .18s, transform .18s;
}
.menu-item-wrap.is-locked:hover .menu-tip,
.menu-item-wrap.is-locked:focus-within .menu-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.menu-campaigns { width: 100%; margin-top: 16px; }
.menu-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  opacity: .62;
}
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.panel {
  background: linear-gradient(180deg, rgba(26,34,48,.7), rgba(20,26,36,.78));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel h2 { font-size: 20px; }
.side-note { padding: 22px; }
.side-note h2 { font-size: 19px; margin-bottom: 10px; }
.steps { margin: 0; padding-left: 20px; color: #c5cedb; }
.steps li { margin: 9px 0; }
.steps b { color: var(--text); }
.campaigns { display: grid; gap: 10px; }
.campaign-card {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2);
}
.campaign-card:hover { border-color: #3a4a62; }
.campaign-card h3 { font-size: 17px; }
.campaign-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.campaign-actions { display: flex; gap: 6px; }
.empty { color: var(--muted); padding: 18px 4px; }
.demo-heroes { margin-top: 18px; }
.demo-hero {
  text-align: left; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); padding: 13px; min-height: 94px;
  transition: border-color .15s, background .15s, transform .15s;
}
.demo-hero:hover { border-color: #40516b; transform: translateY(-1px); }
.demo-hero:disabled { opacity: .55; cursor: wait; transform: none; }

/* ---------- создание ---------- */
#screen-create { max-width: 1080px; margin: 0 auto; }
.create-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.steps-line { display: flex; align-items: center; flex: 1; max-width: 300px; margin: 0 auto; }
.step-dot { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 12px; background: var(--panel); }
.step-dot.active { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 3px rgba(201,161,90,.12); }
.step-line { flex: 1; height: 1px; background: var(--line); }
.create-step { border: 0; padding: 0; margin: 0; min-width: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { font-size: 23px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card-grid.compact { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.class-card, .species-card {
  text-align: left; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); padding: 13px; min-height: 94px;
  transition: border-color .15s, background .15s, transform .15s;
}
.class-card:hover, .species-card:hover { border-color: #40516b; transform: translateY(-1px); }
.class-card.is-selected, .species-card.is-selected { border-color: var(--gold); background: linear-gradient(180deg, rgba(201,161,90,.13), rgba(20,26,36,.8)); box-shadow: 0 0 0 1px rgba(201,161,90,.35); }
.card-title { display: flex; justify-content: space-between; gap: 8px; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.card-title small { font-family: var(--sans); color: var(--gold); font-size: 11px; font-weight: 700; }
.card-desc { color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 5px; overflow-wrap: anywhere; }
.card-meta { color: #b9c3d1; font-size: 11.5px; margin-top: 6px; }
.card-title span { min-width: 0; overflow-wrap: anywhere; }
.class-card .card-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
/* Шаг «Класс»: список слева, подробности справа */
.class-layout { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.class-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.class-list .class-card { min-height: 0; padding: 13px 16px; }
.class-list .class-card .card-title { font-size: 18px; }
.class-list .class-card:hover { transform: none; }
.class-list .class-card.is-selected { box-shadow: inset 3px 0 0 var(--gold), 0 0 0 1px rgba(201,161,90,.35); }
.class-panel { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: rgba(20,26,36,.55); }
.class-panel .tuning-head { margin-bottom: 10px; }
.class-panel .field { margin-top: 10px; }
.class-panel #class-info .info-section:first-child { margin-top: 0; }
.class-hint { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0; }
.species-card { min-height: 78px; }
.species-card .card-title { justify-content: center; }
.card-grid.compact.species-grid { grid-template-columns: 1fr; gap: 8px; }
.species-grid .species-card { display: flex; align-items: center; justify-content: flex-start; text-align: left; min-height: 54px; padding: 0 16px; }
.species-grid .species-card .card-title { justify-content: flex-start; }
.tuning-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tuning-head h3 { font-size: 18px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.species-info { margin-bottom: 6px; }
.lineage-bonuses {
  display: grid; gap: 0; margin-top: 8px; padding: 9px 11px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: rgba(9,14,21,.36);
}
.lineage-bonuses-title {
  color: var(--gold-2); font-size: 10px; letter-spacing: .07em;
  text-transform: uppercase; padding-bottom: 4px;
}
.lineage-bonus {
  display: grid; grid-template-columns: minmax(115px, .75fr) minmax(0, 1.25fr);
  gap: 10px; align-items: baseline; padding: 6px 0;
  border-top: 1px solid rgba(39,51,69,.55);
}
.lineage-bonus span { color: var(--muted); font-size: 11px; line-height: 1.35; }
.lineage-bonus b { color: #dbe3ee; font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.lineage-bonus.is-wide { grid-template-columns: 1fr; gap: 2px; }
.species-lore { color: #d7dde6; font-size: 13.5px; line-height: 1.55; margin-bottom: 12px; }
.species-info .info-section { margin-top: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--gold); font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--gold-2); }
.creation-block { border: 1px solid var(--line); border-radius: 12px; padding: 15px; background: rgba(20,26,36,.55); margin: 18px 0; }
.creation-block h3 { font-size: 18px; margin-bottom: 12px; }
.wizard-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }

.ability-grid { display: grid; gap: 8px; }
.ability-row { display: grid; grid-template-columns: 74px minmax(90px, 1fr) minmax(110px, 1fr); gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.ability-row:last-child { border-bottom: 0; }
.ability-name { font-weight: 700; letter-spacing: .06em; font-size: 12.5px; color: #cbd4e0; }
.ability-row input, .ability-row select { min-height: 36px; padding: 6px 9px; }
.ability-final { color: var(--gold); font-weight: 700; text-align: center; }
.ability-final small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.ability-stepper { display: grid; grid-template-columns: 40px minmax(2.2em, 1fr) 40px; align-items: center; gap: 6px; }
.ability-step {
  min-height: 40px; padding: 0; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg-2); color: var(--text);
  font: 600 18px/1 var(--sans); cursor: pointer;
}
.ability-step:hover:not(:disabled) { border-color: rgba(201,161,90,.55); color: var(--gold-2); }
.ability-step:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ability-step:disabled { opacity: .38; cursor: default; }
.ability-stepper b { text-align: center; font: 600 17px var(--serif); color: var(--text); }
.ability-head { padding: 2px 0 4px; border-bottom: 0; }
.ability-head .ability-name, .ability-head-cell {
  color: var(--muted); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; text-align: center;
}
.ability-head .ability-name { text-align: left; }
.point-buy-meter {
  display: grid; gap: 6px; margin: 10px 0 2px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(201,161,90,.06);
}
.point-buy-meter-head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: baseline; font-size: 12px; color: var(--muted);
}
.point-buy-meter-head b { color: var(--gold); font-size: 14px; }
.point-buy-meter progress { width: 100%; height: 8px; }
.btn-trinket { display: inline-flex; align-items: center; gap: 10px; }
.trinket-die {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; border: 1px solid rgba(201,161,90,.55);
  color: var(--gold); font: 600 10px var(--sans); letter-spacing: .04em;
}
.trinket-result {
  margin-top: 10px; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(201,161,90,.10), rgba(15,20,29,.7));
}
.trinket-result-head {
  display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px;
  color: var(--muted); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase;
}
.trinket-result-head b { color: var(--gold); font-weight: 600; letter-spacing: .04em; }
.trinket-name { font: 600 19px/1.3 var(--serif); color: var(--text); }
.trinket-note { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.check-grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 9px; background: var(--bg-2); font-size: 13px; }
.check-item input { width: 16px; min-height: 16px; accent-color: var(--gold); flex: 0 0 auto; }
.check-item.is-disabled { opacity: .45; }
.check-item.is-on { border-color: rgba(201,161,90,.55); background: rgba(201,161,90,.08); }

/* Предыстория: структурная карточка «что получаешь». */
.bg-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; background: rgba(20,26,36,.55); }
.bg-card-head h4 { font-size: 17px; letter-spacing: .02em; }
.bg-card-rows { display: grid; gap: 6px; margin-top: 10px; }
.bg-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: baseline; font-size: 13px; }
.bg-row > span { color: var(--muted); }
.bg-row > b { font-weight: 600; color: #dbe3ee; }
.bg-desc { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-line; }
.bg-feat {
  margin-top: 14px; border: 1px solid #3a4658; border-radius: 10px;
  padding: 12px 14px; background: rgba(12,18,26,.55);
}
.bg-feat h5 {
  margin: 0 0 6px; color: var(--gold); font-size: 14px;
  letter-spacing: .02em;
}
.bg-feat p {
  margin: 0; color: #c3ccda; font-size: 12.5px; line-height: 1.55;
  white-space: pre-line;
}

/* Боевой стиль: описание под селектом (на широком экране — справа). */
.style-desc {
  min-height: 0; padding: 10px 12px; border: 1px solid var(--line-soft);
  border-radius: 10px; background: rgba(9,14,21,.34); color: #c7d1de;
}
.style-desc-kicker {
  color: var(--gold); font-size: 10px; letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: 5px;
}
.style-desc-rule {
  margin: 0; color: #d7dde6; font-size: 12.5px; line-height: 1.5;
  white-space: pre-line;
}
.style-desc-req {
  margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35;
}
#fighting-style-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 8px 14px; align-items: start; }
#fighting-style-field > label { grid-column: 1; }
#fighting-style-field > select { grid-column: 1; }
#fighting-style-field > .style-desc { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
.equipment-choice-columns { align-items: start; }
.equipment-grid { display: grid; gap: 7px; }
.equipment-card {
  display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 9px 10px; background: var(--bg-2); cursor: pointer;
}
.equipment-card:hover { border-color: rgba(201,161,90,.4); }
.equipment-card.is-on {
  border-color: rgba(201,161,90,.6);
  background: rgba(201,161,90,.08);
  box-shadow: inset 0 0 0 1px rgba(201,161,90,.12);
}
.equipment-card input {
  width: 16px; min-height: 16px; margin: 2px 0 0;
  accent-color: var(--gold); flex: 0 0 auto;
}
.equipment-card-body { display: grid; gap: 6px; min-width: 0; flex: 1; }
.equipment-card-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.equipment-card-head b { font-size: 13px; color: var(--text); }
.equipment-badge {
  width: 20px; height: 20px; display: inline-grid; place-items: center;
  border: 1px solid rgba(201,161,90,.45); border-radius: 6px;
  color: var(--gold); font-size: 11px; font-weight: 700;
  flex: 0 0 auto;
}
.equipment-gold { margin-left: auto; color: var(--gold); font-size: 12px; white-space: nowrap; }
.equipment-items { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.equipment-chip {
  display: inline-flex; align-items: baseline; gap: 3px;
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 2px 7px; color: #d7dde6; font-size: 11.5px;
  background: rgba(20,26,36,.55);
}
.equipment-chip b { font-weight: 500; }
.equipment-chip small { color: var(--muted); font-size: 10.5px; }
.equipment-empty { color: var(--muted); font-size: 12px; line-height: 1.45; }
.equipment-note { margin: 10px 0 0; }
.equipment-total {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: rgba(15,20,29,.55);
}
.equipment-total-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.equipment-total-head b { color: var(--gold-2); font-size: 12px; letter-spacing: .02em; }
.equipment-total-note { color: var(--muted); font-size: 11.5px; margin-top: 7px; line-height: 1.4; }
#trinket-field { grid-column: 1 / -1; }

/* Заклинания: master-detail (слева выбор, справа описание). */
.spell-picker-host { margin-top: 6px; }
.spell-picker { display: grid; gap: 7px; }
.spell-picker-hint { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.spell-list { display: grid; gap: 6px; }
.spell-item {
  border: 1px solid var(--line-soft); border-left: 3px solid var(--school-line, var(--line-soft));
  border-radius: 10px; background: var(--bg-2); overflow: hidden;
}
.spell-item:hover { border-color: var(--school-line, rgba(201,161,90,.4)); }
.spell-item.is-on {
  border-color: var(--school-line, rgba(201,161,90,.55));
  background: var(--school-soft, rgba(201,161,90,.07));
  box-shadow: 0 0 0 1px var(--school-glow, transparent);
}
.spell-item.is-disabled { opacity: .45; }
.spell-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
.spell-row > input {
  width: 16px; min-height: 16px; margin: 0;
  accent-color: var(--gold); flex: 0 0 auto;
}
.spell-row-main {
  flex: 1; min-width: 0; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; padding: 0;
  border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.spell-row-body { display: grid; gap: 2px; min-width: 0; }
.spell-row-body b { font-size: 13px; font-weight: 600; }
.spell-row-body small { color: var(--school, var(--muted)); font-size: 11.5px; }
.spell-chevron { color: var(--gold); font-size: 15px; line-height: 1; transition: transform .15s; }
.spell-row-main[aria-expanded="true"] .spell-chevron { transform: rotate(180deg); }
.spell-detail {
  border-top: 1px solid var(--line-soft);
  padding: 10px 12px 12px; background: rgba(9,14,21,.42);
}
.spell-detail-body { display: grid; gap: 9px; }
.spell-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 12px; padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}
.spell-fact { display: grid; gap: 1px; min-width: 0; }
.spell-fact span {
  color: var(--muted); font-size: 10px; letter-spacing: .05em;
  text-transform: uppercase;
}
.spell-fact b { color: #d7dde6; font-size: 12px; font-weight: 500; line-height: 1.35; }
.spell-body { display: grid; gap: 6px; }
.spell-body p { color: #cbd4e0; font-size: 12.5px; line-height: 1.52; }
.spell-upcast {
  border-left: 2px solid rgba(201,161,90,.7);
  padding: 7px 9px; background: rgba(201,161,90,.06);
  display: grid; gap: 4px;
}
.spell-upcast-title {
  color: var(--gold-2); font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase;
}
.spell-upcast p { color: #cbd4e0; font-size: 12px; line-height: 1.45; }

/* 8 школ — 8 оттенков рунической карточки */
.school-evocation    { --school: #e27a55; --school-soft: rgba(226,122,85,.11); --school-line: rgba(226,122,85,.48); --school-glow: rgba(226,122,85,.16); }
.school-transmutation { --school: #78b88a; --school-soft: rgba(120,184,138,.11); --school-line: rgba(120,184,138,.48); --school-glow: rgba(120,184,138,.16); }
.school-abjuration   { --school: #6da9d6; --school-soft: rgba(109,169,214,.11); --school-line: rgba(109,169,214,.48); --school-glow: rgba(109,169,214,.16); }
.school-conjuration  { --school: #d6aa58; --school-soft: rgba(214,170,88,.11); --school-line: rgba(214,170,88,.48); --school-glow: rgba(214,170,88,.16); }
.school-divination   { --school: #abb9cf; --school-soft: rgba(171,185,207,.11); --school-line: rgba(171,185,207,.48); --school-glow: rgba(171,185,207,.16); }
.school-enchantment  { --school: #d98bac; --school-soft: rgba(217,139,172,.11); --school-line: rgba(217,139,172,.48); --school-glow: rgba(217,139,172,.16); }
.school-illusion     { --school: #6bc9bf; --school-soft: rgba(107,201,191,.11); --school-line: rgba(107,201,191,.48); --school-glow: rgba(107,201,191,.16); }
.school-necromancy  { --school: #a882c8; --school-soft: rgba(168,130,200,.11); --school-line: rgba(168,130,200,.48); --school-glow: rgba(168,130,200,.16); }
.school-unknown      { --school: #c9a15a; --school-soft: rgba(201,161,90,.09); --school-line: rgba(201,161,90,.4); --school-glow: rgba(201,161,90,.12); }

.spell-rune-card {
  position: relative;
  margin: 0 6px 7px;
  border: 1px solid var(--school-line);
  border-radius: 11px;
  padding: 14px 15px 13px;
  background:
    radial-gradient(380px 160px at 50% -30%, var(--school-soft), transparent 70%),
    linear-gradient(145deg, rgba(20,17,30,.75), rgba(9,14,21,.65));
}
.spell-rune-card::before, .spell-rune-card::after {
  content: "✦";
  position: absolute;
  color: var(--school);
  font-size: 11px;
  opacity: .8;
}
.spell-rune-card::before { left: 7px; top: 6px; }
.spell-rune-card::after { right: 7px; bottom: 5px; }
.spell-rune-card .spell-facts {
  border-bottom-color: var(--school-line);
}
.spell-rune-card .spell-fact span { color: var(--school); }
.spell-rune-card .spell-upcast {
  border-left-color: var(--school);
  background: var(--school-soft);
}
.spell-rune-card .spell-upcast-title { color: var(--school); }
.spell-rune-card .spell-body p:first-child::first-letter {
  color: var(--school);
  font-family: var(--serif);
  font-size: 1.18em;
}

/* «Продолжить»: строка на героя. */
.continue-list { display: grid; gap: 8px; width: 100%; margin-top: 16px; }
.continue-row { display: flex; align-items: stretch; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); padding: 4px 6px 4px 0; }
.continue-row.is-renaming { align-items: center; padding: 8px; }
.continue-main { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; background: none; border: 0; color: inherit; padding: 10px 12px; cursor: pointer; font: inherit; }
.continue-main b { grid-column: 1; font-size: 15px; }
.continue-main span { grid-column: 1; color: var(--muted); font-size: 12.5px; }
.continue-main .hero-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.continue-rename { align-self: center; margin-right: 4px; }
.continue-rename-input { flex: 1; min-height: 38px; }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line-soft); padding: 5px 0; font-size: 13px; }
.summary-row span:first-child { color: var(--muted); }
.summary-row span:last-child { text-align: right; }

/* ---------- игра ---------- */
#screen-game { padding: 0; }
.game-head {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(12px, 3vw, 24px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(15,20,29,.82);
}
.game-title { flex: 1; min-width: 0; }
.game-title h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-title p { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pills {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.status-pills::-webkit-scrollbar { display: none; }
.status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 29, 43, .86);
  color: var(--text);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.status-pill i {
  font-style: normal;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.status-ico { font-size: 11px; line-height: 1; }
.status-pill b { font-weight: 600; }
.status-svg { width: 14px; height: 14px; flex: 0 0 14px; display: block; }
.status-svg.heart { fill: #e57777; }
.status-svg.shield { color: #d7dee8; }
.status-svg.star { width: 17px; height: 17px; flex-basis: 17px; fill: #f2ce88; }
.status-svg.box { color: #c9a06a; }
.status-svg.weight { color: #c9a06a; }
.status-pill.hp { border-color: rgba(229, 119, 119, .7); }
.status-pill.bare { border: 0; background: transparent; padding: 2px 4px; }
.status-pill.bare b { color: #e6eef7; }
.status-pill.temp { border-color: #6fae8a; background: rgba(111, 174, 138, .14); }
.status-pill.temp b { color: #8fd3a8; }
.status-pill.temp .status-svg.heart { fill: #8fd3a8; }
.status-pill.exh { background: #d8d2c4; border-color: #8a8375; color: #141414; }
.status-pill.exh b { color: #141414; }
.status-pill.insp { border-color: rgba(217, 179, 108, .6); gap: 4px; }
.status-pill.insp .insp-label { color: var(--gold); font-size: 10px; letter-spacing: .02em; }
.status-pill.insp.muted { opacity: .55; }
.status-pill.insp.muted .status-svg.star { fill: #c9a15a; }
.status-pill.cond .cond-ico { font-size: 10px; }
.status-pill.warn { border-color: rgba(217, 179, 108, .65); color: var(--gold); }
.status-pill b.temp { color: #8fc7e8; margin-left: 1px; }
.status-pill.muted { opacity: .62; }
.status-pill.gold { border-color: rgba(217, 179, 108, .55); color: var(--gold); }
.status-pill.gold i { color: var(--gold); }
.status-pill.warn { border-color: rgba(217, 179, 108, .55); }
.status-pill.bad { border-color: rgba(198, 93, 93, .65); color: #f0c1c1; }
.status-pill.bad i { color: #f0c1c1; }
.status-pill.cond {
  border-color: rgba(198, 93, 93, .55);
  background: rgba(198, 93, 93, .14);
  color: #f0c1c1;
}
.status-pill.conc {
  border-color: rgba(143, 199, 232, .5);
  background: rgba(143, 199, 232, .1);
  color: #bfeaf7;
}
@media (max-width: 760px) {
  .status-pills { mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent); }
}
.rules-badge { display: inline-block; margin-top: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.rules-badge.homebrew { color: var(--gold-2); border-color: rgba(201,161,90,.45); background: rgba(201,161,90,.08); }
.rules-badge.canon { color: var(--green); border-color: rgba(111,174,138,.4); background: rgba(111,174,138,.08); }
.game-hp { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.game-hp .hp-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.game-hp progress { width: 100px; }
.save-state {
  position: absolute; right: 14px; bottom: 2px;
  font-size: 9px; color: var(--muted); white-space: nowrap;
  opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.save-state.is-on { opacity: 1; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 390px); height: calc(100dvh - 60px); }
.scene-panel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line-soft); }
.chat-log { flex: 1; overflow-y: auto; padding: 18px clamp(12px, 3vw, 30px); scroll-behavior: smooth; }
.msg { max-width: 860px; margin: 0 auto 16px; display: flex; gap: 10px; }
.msg-avatar { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-family: var(--serif); font-size: 14px; border: 1px solid var(--line); }
.msg.assistant .msg-avatar { color: #17120a; background: linear-gradient(145deg, var(--gold-2), #a47b3d); border-color: #d5af6b; }
.msg.user .msg-avatar { color: #dbe6f5; background: var(--panel-3); }
.msg-body { min-width: 0; flex: 1; }
.msg-role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 3px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; color: #e4e8ee; }
.msg.user .msg-text { color: #f0e3c9; }
.msg-meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.msg-meta .warn { color: #d8a76a; }
.msg-meta .sections { color: #7f93ad; }
.msg-error { max-width: 860px; margin: 0 auto 14px; color: var(--red-2); font-size: 12.5px; }
.typing { padding: 0 clamp(12px,3vw,30px) 8px; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.typing .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: blink 1.2s infinite; }
.typing .dot:nth-child(2) { animation-delay: .18s; }
.typing .dot:nth-child(3) { animation-delay: .36s; }
.typing .think-text { margin-left: 4px; color: #c3ccda; font-variant-numeric: tabular-nums; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.typing .think-bar { flex: 1 1 40px; max-width: 180px; height: 3px; border-radius: 999px; margin-left: 4px; overflow: hidden;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 45%, transparent 90%) 0 0 / 45% 100% no-repeat;
  animation: think-slide 1.4s linear infinite; opacity: .55; }
@keyframes think-slide { 0% { background-position: -45% 0; } 100% { background-position: 145% 0; } }
.combat-strip { margin: 0 clamp(12px,3vw,24px) 6px; padding: 6px 10px; border: 1px solid var(--line-soft);
  border-radius: 8px; background: rgba(20,26,36,.55); color: #b9c4d2; font-size: 11.5px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.combat-strip-tag { color: var(--gold); font-weight: 600; }
.combat-strip-arena { color: var(--muted); font-weight: 400; }
.combat-strip-initiative { flex: 1 1 100%; display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 max(2px, env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.combat-strip-initiative::-webkit-scrollbar { display: none; }
.combat-chip { white-space: nowrap; border: 1px solid var(--line-soft); border-radius: 999px; padding: 2px 8px; color: #c7d0dc; background: rgba(13,18,26,.5); font-variant-numeric: tabular-nums; }
.combat-chip.active { color: var(--gold); border-color: var(--gold); }
.combat-chip.dead { opacity: .45; text-decoration: line-through; }
.msg-divider { text-align: center; color: var(--gold); opacity: .75; font-size: 11.5px; letter-spacing: .06em; padding: 6px 0; }
.quick-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 clamp(12px,3vw,24px) 8px; scrollbar-width: none; align-items: center; }
.quick-chips[hidden] { display: none; }
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chips .quick-hint { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 11.5px; }
.composer { display: flex; gap: 8px; padding: 10px clamp(12px,3vw,24px) max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: rgba(15,20,29,.9); }
.composer textarea { flex: 1; min-height: 48px; max-height: 160px; resize: none; }
.composer .send { width: 52px; min-height: 48px; font-size: 20px; padding: 0; }

.side-panel { min-height: 0; background: rgba(17,23,32,.72); display: flex; flex-direction: column; }
.panel-tabs { display: flex; gap: 2px; padding: 9px 9px 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.panel-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px 5px 9px; font-size: 12.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.panel-tabs button.active { color: var(--text); border-bottom-color: var(--gold); }
.panel-close { display: none; flex: 0 0 30px; font-size: 18px; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px; }
.panel-view { display: none; }
.panel-view.active { display: block; }

/* лист */
.sheet-head { margin-bottom: 14px; }
.sheet-name { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.sheet-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.hp-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 4px; font-size: 12px; color: var(--muted); }
.hp-line b { color: var(--text); font-size: 13px; }
progress { appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: #242d3b; }
progress::-webkit-progress-bar { background: #242d3b; border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #a94c4c, #d17171); border-radius: 999px; }
progress::-moz-progress-bar { background: #c65d5d; border-radius: 999px; }
progress.xp::-webkit-progress-value { background: linear-gradient(90deg, #4f75a8, #6f95c9); }
progress.xp::-moz-progress-bar { background: #6f95c9; }
progress.xp { height: 6px; }
.xp-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 5px 0 4px; }
.xp-line b { color: var(--text); }
.lvl-section { margin: 14px 0; }
.lvl-section h3 { font-size: 16px; color: var(--gold-2); margin-bottom: 6px; }
.lvl-section p { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.lvl-options { display: flex; flex-wrap: wrap; gap: 6px; }
.lvl-option { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--bg-2); font-size: 12.5px; }
.lvl-option.is-on { border-color: var(--gold); background: rgba(201,161,90,.1); }
.lvl-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lvl-actions-row select { min-height: 36px; padding: 6px 9px; }
progress.hp-mid::-webkit-progress-value { background: linear-gradient(90deg, #b07a39, #d2a25f); }
progress.hp-low::-webkit-progress-value { background: linear-gradient(90deg, #8c3d3d, #c65d5d); }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 12px 0; }
.stat { border: 1px solid var(--line-soft); border-radius: 9px; background: var(--bg-2); padding: 7px 6px; text-align: center; }
.stat b { display: block; font-size: 17px; color: var(--text); }
.stat small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.section { margin: 18px 0; }
.section h3 { font-size: 15px; margin-bottom: 8px; color: var(--gold-2); display: flex; justify-content: space-between; align-items: baseline; }
.section h3 span { color: var(--muted); font-family: var(--sans); font-size: 11px; font-weight: 500; }
.ability-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ability-card { text-align: center; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--bg-2); padding: 7px 4px; }
.ability-card .ab { font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.ability-card .score { font-size: 18px; font-weight: 700; line-height: 1.2; }
.ability-card .mod { font-size: 11px; color: var(--gold); }
.save-list, .skill-list { display: grid; gap: 3px; }
.save, .skill { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dotted var(--line-soft); }
.save:last-child, .skill:last-child { border-bottom: 0; }
.save .v, .skill .v { color: var(--text); font-weight: 600; }
.skill .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill .tags { color: var(--gold); font-size: 10px; margin-left: 4px; }
.pip-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12.5px; margin: 5px 0; }
.pip-row .label { color: #c4cdda; min-width: 110px; }
.pip { width: 13px; height: 13px; border-radius: 50%; border: 1px solid #48566c; background: transparent; display: inline-block; }
.pip.filled { background: var(--gold); border-color: var(--gold-2); box-shadow: 0 0 5px rgba(201,161,90,.35); }
.pip.blue.filled { background: var(--blue); border-color: #8aa8d6; box-shadow: none; }
.spell-name { font-size: 12.5px; padding: 2px 0; color: #d4dce8; }
.spell-name small { color: var(--muted); }
.slot-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
.slot-row .lvl { width: 22px; color: var(--muted); }
.slot { width: 12px; height: 12px; border-radius: 3px; border: 1px solid #4c5a70; }
.slot.filled { background: var(--blue); border-color: #8aa8d6; }
.action-row { border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 9px; margin-bottom: 6px; background: var(--bg-2); }
.action-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.action-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 7px; }
.action-controls select { width: auto; min-width: 130px; min-height: 34px; padding: 5px 30px 5px 9px; font-size: 13px; }
.action-controls .btn { flex: 0 0 auto; }
.conditions { display: flex; flex-wrap: wrap; gap: 5px; }
.cond { font-size: 11px; padding: 3px 7px; border-radius: 999px; border: 1px solid rgba(198,93,93,.4); color: #e4a5a5; background: rgba(198,93,93,.08); }

/* репутация (C.7.2) */
.rep-badge { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--bg-2); margin: 2px 0 8px; }
.rep-badge.fame { border-color: rgba(201,161,90,.55); }
.rep-badge.infamy { border-color: rgba(198,93,93,.55); }
.rep-badge.neutral { border-color: var(--line-soft); }
.rep-rank { font-family: var(--serif); font-size: 14px; color: var(--text); }
.rep-value { font-weight: 700; font-size: 13px; color: var(--gold); }
.rep-badge.infamy .rep-value { color: #e4a5a5; }
.rep-badge.neutral .rep-value { color: var(--muted); }
.rep-recognition { color: var(--muted); font-size: 11px; }
.rep-note { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin: 0 0 8px; }
.rep-meter-line { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.rep-meter-line b { color: var(--text); font-size: 11.5px; }
.rep-meter { flex: 1; height: 6px; border-radius: 999px; background: #242d3b; overflow: hidden; }
.rep-meter-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6f95c9, #c9a15a); }
.rep-regions { display: grid; gap: 3px; margin-top: 9px; }
.rep-region { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: baseline; font-size: 12px; padding: 3px 0; border-bottom: 1px dotted var(--line-soft); }
.rep-region:last-child { border-bottom: 0; }
.rep-region-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-region-place { color: var(--muted); font-size: 10.5px; }
.rep-region-value { font-weight: 600; color: var(--gold); }
.rep-region-value.infamy { color: #e4a5a5; }
.rep-region-value.neutral { color: var(--muted); }
.rep-history { display: grid; gap: 4px; margin-top: 8px; }
.rep-deed { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 12px; padding: 4px 0; border-bottom: 1px dotted var(--line-soft); }
.rep-deed:last-child { border-bottom: 0; }
.rep-deed-delta { font-weight: 700; color: var(--gold); }
.rep-deed-delta.infamy { color: #e4a5a5; }
.rep-deed-delta.neutral { color: var(--muted); }
.rep-deed-text { color: #d3dbe6; overflow: hidden; text-overflow: ellipsis; }
.rep-deed-echo { grid-column: 2; color: var(--muted); font-size: 10.5px; }

/* мировоззренческий путь (C.6.1) */
.path-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.path-badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--bg-2); }
.path-badge.good { border-color: rgba(111,149,201,.55); color: #b9d0ef; background: rgba(111,149,201,.08); }
.path-badge.warn { border-color: rgba(201,161,90,.55); color: #e7c17a; background: rgba(201,161,90,.08); }
.path-badge.bad { border-color: rgba(198,93,93,.55); color: #e4a5a5; background: rgba(198,93,93,.08); }
.path-badge.inspiration { border-color: rgba(201,161,90,.75); color: #f0cf8e; background: rgba(201,161,90,.14); }
.path-badge.quiet { color: var(--muted); }
.path-note { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin: 3px 0 6px; }

/* бой */
.combat-empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.combat-empty .big { font-family: var(--serif); font-size: 20px; color: var(--text); margin-bottom: 6px; }
.combat-round { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.combatant { border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 9px; margin-bottom: 6px; background: var(--bg-2); }
.combatant.active { border-color: var(--gold); background: rgba(201,161,90,.07); }
.combatant .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.combatant .num { color: var(--muted); font-size: 11px; }
.combatant progress { height: 5px; margin-top: 5px; }
.combatant .tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }

/* журнал/сумка */
.journal-entry { padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: #d3dbe6; }
.journal-entry:last-child { border-bottom: 0; }
.memory-block { margin: 10px 0; }
.memory-block h4 { font-family: var(--sans); font-size: 12px; color: var(--gold-2); margin-bottom: 4px; }
.memory-item { font-size: 12.5px; color: #cbd4e0; padding: 2px 0; }
.inventory-list { display: grid; gap: 3px; }
.item { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: baseline; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dotted var(--line-soft); }
.item:last-child { border-bottom: 0; }
.item .qty { color: var(--gold); font-weight: 600; }
.item .wt { color: var(--muted); font-size: 10.5px; }
.total-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; }
.total-line b { color: var(--text); }

/* бестиарий */
.beast-head { margin-bottom: 10px; }
.beast-title { font-family: var(--serif); font-size: 22px; color: var(--text); }
.beast-sub { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin-top: 4px; }
.beast-search { margin: 10px 0 7px; }
.beast-search input { width: 100%; }
.beast-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.beast-filters select { min-width: 0; font-size: 12px; padding: 7px; }
.beast-filters .btn { grid-column: 1 / -1; justify-self: start; }
.beast-count { color: var(--muted); font-size: 11.5px; margin: 5px 0 9px; }
.beast-card { border: 1px solid var(--line-soft); border-radius: 11px; background: var(--bg-2); padding: 10px; margin-bottom: 9px; }
.beast-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.beast-name { font-family: var(--serif); font-size: 18px; line-height: 1.15; color: var(--text); }
.beast-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.beast-cr { font-size: 10.5px; font-weight: 700; color: var(--gold-2); border: 1px solid rgba(201,161,90,.45); border-radius: 999px; padding: 2px 7px; white-space: nowrap; }
.beast-source { font-size: 9.5px; color: var(--blue); border: 1px solid rgba(111,149,201,.35); border-radius: 999px; padding: 1px 6px; white-space: nowrap; }
.beast-ref { font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.beast-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 9px 0 7px; }
.beast-stat { border: 1px solid var(--line-soft); border-radius: 7px; text-align: center; padding: 4px 2px; background: rgba(0,0,0,.12); }
.beast-stat b { display: block; color: var(--text); font-size: 13px; }
.beast-stat small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.beast-note { color: #c7d0dd; font-size: 11.5px; line-height: 1.4; margin: 5px 0; }
.beast-block { margin-top: 7px; }
.beast-label { color: var(--gold-2); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.beast-attack { font-size: 11.5px; color: #d2dae5; padding: 2px 0; border-bottom: 1px dotted var(--line-soft); }
.beast-attack:last-child { border-bottom: 0; }
.beast-ability { margin-top: 6px; color: #b9c8dc; font-size: 11px; line-height: 1.4; }
.beast-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.beast-tag { font-size: 10px; color: #c9d2df; background: rgba(90,111,140,.18); border: 1px solid rgba(120,145,175,.2); border-radius: 999px; padding: 2px 6px; }
.beast-defenses { margin-top: 7px; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.beast-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 25px 8px; }
.beast-lore-short { margin: 7px 0 0; color: #c2cbd8; font-size: 11px; line-height: 1.45; }
.beast-open { margin-top: 8px; }
.beast-detail { border: 1px solid var(--line-soft); border-radius: 11px; background: var(--bg-2); padding: 11px; }
.beast-detail-head { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; border-bottom: 1px solid var(--line-soft); padding-bottom: 9px; margin-bottom: 9px; }
.beast-detail-head .beast-badges { flex-direction: row; flex-wrap: wrap; align-items: center; }
.beast-lore { margin-bottom: 10px; }
.beast-lore p { margin: 0; color: #d2dae5; font-size: 12px; line-height: 1.5; }
.beast-statblock { margin-top: 4px; }
.beast-md { font-size: 11.5px; color: #cdd6e2; line-height: 1.45; }
.beast-md-h { font-family: var(--serif); font-size: 14px; color: var(--text); margin: 8px 0 4px; }
.beast-md-p { margin: 3px 0; }
.beast-md-li { margin: 2px 0; padding-left: 4px; }
.beast-md-table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.beast-md-table td { border: 1px solid var(--line-soft); padding: 3px 5px; font-size: 11px; text-align: center; }

/* ---------- мобильная навигация ---------- */
.mobile-nav { display: none; }

/* ---------- диалоги/тосты ---------- */
.dlg { width: min(560px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(4,6,10,.68); backdrop-filter: blur(3px); }
.dlg-inner { padding: 18px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dlg-head h2 { font-size: 22px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.dlg-actions.wrap { justify-content: flex-start; flex-wrap: wrap; }
.dlg-budget { width: min(640px, calc(100vw - 24px)); }
.info-body { max-height: 70vh; overflow: auto; }
.info-lead { color: #d7dde6; font-size: 13.5px; line-height: 1.55; margin-bottom: 14px; }
.info-section { margin-top: 14px; }
.info-section h3 { font-size: 14px; color: var(--gold-2); margin-bottom: 7px; letter-spacing: .02em; }
.info-row { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed var(--line-soft); padding: 5px 0; font-size: 13px; }
.info-row span:first-child { color: var(--muted); flex: 0 0 auto; }
.info-row span:last-child { text-align: right; overflow-wrap: anywhere; }
.info-row-stack { display: block; }
.info-row-stack > span:first-child { display: block; margin-bottom: 3px; }
.info-sub { color: var(--muted); font-size: 11.5px; margin: 0 0 6px; }
.kit-list { display: grid; gap: 6px; }
.kit-option { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg-2); padding: 7px 9px; }
.kit-option.no-letter { grid-template-columns: 1fr; }
.kit-letter { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid rgba(201,161,90,.45); border-radius: 6px; color: var(--gold); font-size: 11px; font-weight: 700; line-height: 1; }
.kit-text { font-size: 12.5px; line-height: 1.45; color: #d7dde6; overflow-wrap: anywhere; }
.info-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: #d7dde6; }
.info-choice { border: 1px solid var(--line-soft); border-radius: 9px; background: var(--bg-2); padding: 8px 10px; margin-top: 7px; }
.info-choice b { color: var(--text); font-size: 13px; }
.info-choice p { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 3px; }
.subclass-card .subclass-lore { margin-top: 6px; }
.subclass-card .subclass-lore .species-lore { margin-bottom: 6px; }
.subclass-card { padding: 10px 11px; }
.subclass-levels { margin-top: 9px; border-top: 1px dashed var(--line-soft); padding-top: 7px; }
.subclass-levels-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; color: var(--gold-2); font-size: 12px; letter-spacing: .02em; }
.subclass-levels-head::-webkit-details-marker { display: none; }
.subclass-chevron { color: var(--gold); font-size: 11px; line-height: 1; transition: transform .15s; }
.subclass-levels[open] .subclass-chevron { transform: rotate(180deg); }
.path-card { margin-top: 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-2); padding: 0 10px; }
.path-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; padding: 8px 0; color: var(--gold-2); font-size: 12px; letter-spacing: .02em; }
.path-head::-webkit-details-marker { display: none; }
.path-card[open] .subclass-chevron { transform: rotate(180deg); }
.path-body { padding-bottom: 9px; }
.path-body .info-row { font-size: 12.5px; }
.path-hint { color: var(--muted); font-size: 11.5px; margin-top: 7px; }
.align-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.align-chip { font-size: 10.5px; padding: 2px 7px; border: 1px solid var(--line-soft); border-radius: 999px; background: rgba(20,26,36,.55); color: #c7cfda; }
.domain-path { margin: 10px 0 0; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(20,26,36,.45); }
.domain-path-title { color: var(--gold-2); font-size: 12.5px; letter-spacing: .02em; }
.domain-path-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.domain-path-mode { color: var(--muted); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.domain-path-align { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.domain-path-align .align-chips { justify-content: flex-start; }
.domain-path-creed { color: #d7dde6; font-size: 12px; line-height: 1.4; margin-top: 5px; }
.domain-path-more { margin-top: 6px; }
.domain-path-body .info-row { font-size: 11.5px; }
.subclass-features { margin-top: 8px; }
.subclass-feature { border-top: 1px dashed var(--line-soft); padding-top: 7px; margin-top: 7px; }
.subclass-feature-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.subclass-feature-head .lvl { color: var(--gold); font-size: 11px; letter-spacing: .05em; white-space: nowrap; }
.subclass-feature p { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 3px; }
.subclass-feature p.sub-feature { color: #c9d2de; margin-top: 5px; }
.subclass-feature p.sub-feature b { color: var(--text); font-size: 12.5px; }
.input-row select { flex: 1; min-width: 0; }
.budget-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.budget-kicker { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; }
.budget-spent { display: block; font-family: var(--serif); font-size: 34px; line-height: 1.1; color: var(--gold-2); font-variant-numeric: tabular-nums; margin-top: 3px; }
.budget-sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.budget-badge { display: inline-block; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.budget-badge.ok { color: var(--green); border-color: rgba(111,174,138,.4); background: rgba(111,174,138,.08); }
.budget-badge.warn { color: var(--gold-2); border-color: rgba(201,161,90,.45); background: rgba(201,161,90,.09); }
.budget-badge.stop { color: var(--red-2); border-color: rgba(198,93,93,.5); background: rgba(198,93,93,.09); }
progress.budget-meter { display: block; width: 100%; height: 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; margin: 14px 0 16px; appearance: none; -webkit-appearance: none; }
progress.budget-meter::-webkit-progress-bar { background: var(--bg-2); border-radius: 999px; }
progress.budget-meter::-webkit-progress-value { background: var(--green); border-radius: 999px; }
progress.budget-meter::-moz-progress-bar { background: var(--green); border-radius: 999px; }
progress.budget-meter.warn::-webkit-progress-value { background: var(--gold); }
progress.budget-meter.warn::-moz-progress-bar { background: var(--gold); }
progress.budget-meter.stop::-webkit-progress-value { background: var(--red); }
progress.budget-meter.stop::-moz-progress-bar { background: var(--red); }
.budget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.budget-grid > div { border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(15,20,29,.6); padding: 9px 11px; }
.budget-grid span { display: block; color: var(--muted); font-size: 11px; }
.budget-grid b { display: block; color: var(--text); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.budget-note { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin-top: 12px; }
.budget-stop-note { color: var(--red-2); background: rgba(198,93,93,.08); border: 1px solid rgba(198,93,93,.35); border-radius: 9px; padding: 9px 11px; font-size: 12px; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: min(520px, calc(100vw - 30px)); background: #222b39; border: 1px solid #3a4a62; color: var(--text); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; }
.toast.bad { border-color: rgba(198,93,93,.6); color: #f0c1c1; }

/* ---------- адаптив ---------- */
@media (max-width: 1050px) {
  .home-grid { grid-template-columns: 1fr; }
  .card-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-layout { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 860px) {
  body { font-size: 14.5px; }
  .screen { padding: 18px 14px 84px; }
  #screen-game { padding: 0; }
  .home-hero { padding-top: 18px; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .class-layout { grid-template-columns: 1fr; gap: 12px; }
  .class-list { grid-template-columns: 1fr; }
  .tuning-row { grid-template-columns: 1fr; gap: 6px; }
  .align-row { grid-template-columns: 1fr; gap: 8px; }
  .choice-note { padding-top: 0; }
  .choice-panel { max-width: none; }
  .history-prompts { column-count: 1; }
  .card-grid, .card-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: 1fr; }
  .game-layout { display: block; height: calc(100dvh - 58px); }
  .scene-panel { height: calc(100% - 58px - env(safe-area-inset-bottom)); border-right: 0; }
  .side-panel {
    position: fixed; inset: 0; z-index: 60;
    background: var(--bg-2); transform: translateY(104%);
    transition: transform .22s ease; box-shadow: 0 -20px 50px rgba(0,0,0,.45);
  }
  .side-panel.open { transform: none; }
  .panel-close { display: block; }
  .panel-body { padding-bottom: 80px; }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(13,18,26,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
  }
  .mobile-nav button { flex: 1; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; }
  .mobile-nav button.active { color: var(--gold); }
  .game-hp { min-width: 0; }
  .game-hp progress { width: 64px; }
  .game-hp .hp-text { display: none; }
  .ability-row { grid-template-columns: 62px 1fr 1fr; }
  .spell-facts { grid-template-columns: 1fr; }
  .equipment-card { padding: 9px; }
  #fighting-style-field { grid-template-columns: 1fr; }
  #fighting-style-field > .style-desc { grid-column: 1; grid-row: auto; }
  .bg-row { grid-template-columns: 1fr; gap: 2px; }
  .dlg-actions { flex-wrap: wrap; }
}
@media (max-width: 520px) {

  .card-grid, .card-grid.compact { grid-template-columns: 1fr 1fr; }
  .class-card { min-height: 112px; }
  .class-list .class-card { min-height: 0; }
  .check-grid, .check-grid.small { grid-template-columns: 1fr; }
  .ability-row { grid-template-columns: 56px 1fr 1fr; gap: 6px; }
  .ability-row .ability-name { font-size: 11px; }
  .ability-stepper { grid-template-columns: 36px minmax(2em, 1fr) 36px; gap: 4px; }
  .ability-step { min-height: 38px; font-size: 17px; }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
  .home-hero h1 { font-size: 38px; }
  .panel-tabs button, .mobile-nav button { font-size: 10.5px; padding-left: 3px; padding-right: 3px; }
  .game-title h1 { font-size: 17px; }
  .game-head .save-state { display: none; }
  .budget-grid { grid-template-columns: 1fr; }
  .budget-spent { font-size: 29px; }
  .menu-emblem-wrap { width: 170px; }
  .menu-item { font-size: 17px; padding: 11px 16px; }
  .info-row { flex-direction: column; gap: 2px; }
  .info-row span:last-child { text-align: left; }
  .segmented { gap: 3px; padding: 3px; }
  .segmented button { padding: 8px 4px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .menu-emblem-wrap, .emblem-rotor, .emblem-svg, .spark, .d20-spin, .orbit-links, .mini-spin { animation: none !important; }
}
/* Full-screen 3D dice table (engine: pathfinder.family/dice). */
.dice-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  background:
    radial-gradient(120% 88% at 50% -6%, #1e2939 0%, #101722 44%, #070a10 100%);
  cursor: pointer;
  transition: opacity .24s ease;
}
.dice-screen[hidden] { display: none; }
.dice-screen.is-hiding { opacity: 0; pointer-events: none; }
.dice-select-master {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top, 0px));
  left: calc(18px + env(safe-area-inset-left, 0px));
  right: calc(18px + env(safe-area-inset-right, 0px));
  z-index: 3;
  text-align: center;
  padding: 7px 12px;
  border: 1px solid rgba(201, 161, 90, .32);
  border-radius: 10px;
  background: rgba(10, 14, 20, .82);
  color: #e7c17a;
  font: 600 11.5px/1.35 var(--sans);
}
.dice-select-master[hidden] { display: none; }
.dice-select-labels {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.dice-select-labels[hidden] { display: none; }
.dice-select-label {
  position: absolute;
  transform: translate(-50%, 0);
  color: rgba(236, 230, 218, .6);
  font: 600 10.5px/1 var(--sans);
  letter-spacing: .04em;
}
.dice-select-label.sel { color: #e7c17a; }
.dice-select-bar {
  position: absolute;
  left: calc(18px + env(safe-area-inset-left, 0px));
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(201, 161, 90, .35);
  border-radius: 14px;
  background: rgba(10, 14, 20, .9);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.dice-select-bar[hidden] { display: none; }
.dice-select-formula {
  text-align: center;
  color: #f0d49a;
  font: 600 14px/1.3 var(--sans);
}
.dice-select-formula.empty { color: var(--muted); font-weight: 400; }
.dice-select-actions { display: flex; gap: 8px; }
.dice-select-reset {
  border: 1px solid rgba(198, 93, 93, .5);
  background: rgba(198, 93, 93, .1);
  color: #efa9a9;
  border-radius: 9px;
  min-height: 44px;
  padding: 11px 16px;
  font: 600 13px/1 var(--sans);
  cursor: pointer;
}
.dice-select-roll {
  flex: 1;
  border: 1px solid rgba(231, 193, 122, .6);
  background: linear-gradient(180deg, #e7c17a, #b9893f);
  color: #17130b;
  border-radius: 9px;
  min-height: 44px;
  padding: 11px 16px;
  font: 700 14px/1 var(--sans);
  cursor: pointer;
}
.dice-select-roll:disabled { opacity: .6; }
.dice-screen-stage { position: absolute; inset: 0; touch-action: none; }
.dice-screen-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.dice-screen-top {
  position: absolute;
  left: calc(18px + env(safe-area-inset-left, 0px));
  right: calc(18px + env(safe-area-inset-right, 0px));
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.dice-screen-title {
  max-width: calc(100% - 58px);
  overflow: hidden;
  padding: 8px 14px;
  border: 1px solid rgba(201, 161, 90, .38);
  border-radius: 999px;
  background: rgba(10, 14, 20, .82);
  color: #e7c17a;
  font: 600 12px/1.2 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dice-screen-close {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(201, 161, 90, .38);
  border-radius: 50%;
  background: rgba(10, 14, 20, .82);
  color: #e7c17a;
  font: 24px/1 var(--sans);
  cursor: pointer;
}
.dice-screen-close:hover { border-color: #e7c17a; color: #fff2cf; }
.dice-summary {
  position: absolute;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  transform: translateX(-50%);
  padding: 13px 14px 12px;
  border: 1px solid rgba(201, 161, 90, .42);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 24, 34, .97), rgba(8, 11, 17, .97));
  box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
  color: var(--text);
}
.dice-summary[hidden] { display: none; }
.dice-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 18px;
}
.dice-summary-title {
  min-width: 0;
  overflow: hidden;
  color: #f0d49a;
  font: 600 11px/1.2 var(--sans);
  letter-spacing: .13em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.dice-summary-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: #e7c17a;
  font: 600 9.5px/1.2 var(--sans);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.dice-summary-status[hidden] { display: none; }
.dice-summary-status i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: dice-think 1.1s infinite;
}
.dice-summary-status i:nth-child(2) { animation-delay: .15s; }
.dice-summary-status i:nth-child(3) { animation-delay: .3s; }
.dice-summary-status span { margin-left: 2px; }
.dice-summary-status.bad { color: #e79a9a; }
.dice-summary-status.bad i { animation: none; opacity: .8; }
@keyframes dice-think {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
.dice-summary-roll {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 11px 0 9px;
}
.dice-summary-roll[hidden] { display: none; }
.dice-chip {
  min-width: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(231, 193, 122, .28);
  border-radius: 9px;
  background: rgba(231, 193, 122, .07);
  color: #f0d49a;
  font: 700 18px/1 var(--serif, Georgia, serif);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dice-chip.keep {
  border-color: #e7c17a;
  background: rgba(231, 193, 122, .18);
  box-shadow: inset 0 0 0 1px rgba(231, 193, 122, .22);
}
.dice-summary-formula {
  max-width: 100%;
  margin-left: auto;
  padding-left: 6px;
  overflow: hidden;
  color: var(--muted);
  font: 600 11px/1.2 var(--sans);
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dice-summary-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.dice-fact {
  min-width: 0;
  padding: 7px 3px 6px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  text-align: center;
}
.dice-fact span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font: 8.5px/1.15 var(--sans);
  letter-spacing: .05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.dice-fact b {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #e8ecf3;
  font: 700 14px/1.1 var(--sans);
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.dice-fact-total {
  border: 1px solid rgba(231, 193, 122, .25);
  background: rgba(231, 193, 122, .1);
}
.dice-fact-total b { color: #f0d49a; font-size: 19px; }
.dice-summary-outcome {
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: 700 11.5px/1.2 var(--sans);
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}
.dice-summary-outcome[hidden] { display: none; }
.dice-summary-outcome.ok {
  border-color: rgba(111, 174, 138, .4);
  background: rgba(111, 174, 138, .1);
  color: #9fd8b2;
}
.dice-summary-outcome.bad {
  border-color: rgba(198, 93, 93, .45);
  background: rgba(198, 93, 93, .1);
  color: #f0b1b1;
}
.dice-summary-outcome.crit {
  border-color: rgba(231, 193, 122, .6);
  background: rgba(231, 193, 122, .14);
  color: #ffe4a3;
}
.dice-summary-outcome.fumble {
  border-color: rgba(198, 93, 93, .6);
  background: rgba(198, 93, 93, .16);
  color: #ffc2c2;
}
.dice-summary-reason {
  margin-top: 7px;
  color: var(--muted);
  font: 11px/1.35 var(--sans);
  text-align: center;
}
.dice-summary-reason[hidden] { display: none; }
.dice-summary-actions { display: flex; gap: 8px; margin-top: 11px; }
.dice-summary-replay,
.dice-summary-done {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  padding: 10px 12px;
  font: 700 13px/1 var(--sans);
  cursor: pointer;
}
.dice-summary-replay {
  border: 1px solid rgba(231, 193, 122, .5);
  background: rgba(231, 193, 122, .08);
  color: #f0d49a;
}
.dice-summary-replay:hover { border-color: #e7c17a; }
.dice-summary-replay:disabled { opacity: .45; cursor: default; }
.dice-summary-done {
  border: 0;
  background: linear-gradient(180deg, #e7c17a, #b9893f);
  color: #17130b;
}
.dice-screen-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 2;
  transform: translateX(-50%);
  color: rgba(236, 230, 218, .5);
  font: 10px/1.4 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: none;
}
@media (max-width: 380px) {
  .dice-summary { width: calc(100vw - 20px); padding: 11px 11px 10px; }
  .dice-summary-title { font-size: 10px; letter-spacing: .1em; }
  .dice-chip { min-width: 31px; padding: 6px 7px; font-size: 16px; }
  .dice-fact span { font-size: 8px; letter-spacing: .03em; }
  .dice-fact b { font-size: 13px; }
  .dice-fact-total b { font-size: 17px; }
  .dice-summary-replay, .dice-summary-done { font-size: 12.5px; }
}
/* Кнопка броска в сообщении Мастера: шестиугольник с § и пунктирным кругом. */
.roll-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: #e7c17a;
}
.roll-cta-icon {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
}
.roll-cta-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(231, 193, 122, .55);
}
.roll-cta-icon svg { position: relative; z-index: 1; display: block; }
.roll-cta-text {
  font: 600 11px/1.2 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #e7c17a;
}
.roll-cta-summary {
  margin-top: 5px;
  font: 11.5px/1.4 var(--sans);
  letter-spacing: .02em;
  color: var(--muted);
}
.roll-cta:hover .roll-cta-text { color: #fff2cf; }
.roll-cta:hover .roll-cta-icon svg polygon { stroke: #fff2cf; }
.roll-cta:hover .roll-cta-icon svg text { fill: #fff2cf; }
/* Кнопка выбора кубиков рядом с полем ввода. */
.dice-quick {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(201, 161, 90, .35);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #1a2230, #0b0e14);
  color: #e7c17a;
  font: 700 21px/1 var(--serif, Georgia, serif);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}
.dice-quick::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px dashed rgba(231, 193, 122, .5);
  pointer-events: none;
}
.dice-quick:hover { color: #fff2cf; border-color: rgba(231, 193, 122, .8); }

/* ---------- A1.3: вход, Session 0, библиотека героев ---------- */
.whoami {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 600;
}
.link-btn {
  border: 0;
  background: none;
  color: var(--gold);
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--gold-2); }

.auth-wrap {
  max-width: 430px;
  margin: clamp(18px, 7vh, 80px) auto 0;
  padding: 28px clamp(18px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(520px 220px at 50% 0, rgba(201, 161, 90, .10), transparent 70%),
    rgba(20, 26, 36, .78);
  box-shadow: var(--shadow);
}
.auth-emblem {
  position: relative;
  isolation: isolate;
  width: 62px;
  height: 70px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: #17120a;
  font: 700 30px/1 var(--serif);
  background: linear-gradient(155deg, #f1d69d, #c9a15a 48%, #8f6c33);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  filter: drop-shadow(0 0 10px rgba(201, 161, 90, .35));
  text-shadow: 0 1px 0 rgba(255, 242, 207, .35);
}
.auth-title { text-align: center; font-size: 30px; margin-bottom: 8px; }
.auth-lead { text-align: center; font-size: 13.5px; margin-bottom: 20px; }
.auth-form .field { margin-bottom: 14px; }
.auth-error {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(198, 93, 93, .5);
  border-radius: 9px;
  background: rgba(198, 93, 93, .10);
  color: #f0c1c1;
  font-size: 13px;
}
.auth-alt { text-align: center; margin-top: 16px; }
.auth-note { text-align: center; margin-top: 14px; line-height: 1.5; }

.world-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.world-head-text { flex: 1; min-width: 210px; }
.world-head-text h1 { font-size: 30px; }
.world-head-text p { font-size: 13px; margin-top: 4px; }
.world-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}
.world-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  background: rgba(20, 26, 36, .62);
  min-width: 0;
}
.world-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.world-card-head h2 { font-size: 21px; }
.world-counter { color: var(--gold); font-size: 12px; font-weight: 700; white-space: nowrap; }
.world-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.world-actions-end { justify-content: flex-end; }

/* «Мастер за кулисами»: тихая волна без этапов и процентов. */
.backstage {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px
           max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(640px 360px at 50% 46%, rgba(9, 12, 18, .90), rgba(5, 8, 13, .94) 72%);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.backstage[hidden] { display: none; }
body.backstage-open { overflow: hidden; }
.backstage-panel {
  width: min(520px, 100%);
  padding: 8px;
  text-align: center;
}
.backstage-mark { color: var(--gold); font: 700 28px var(--serif); margin-bottom: 6px; }
.backstage-kicker {
  margin: 0 0 10px;
  color: var(--gold-2);
  font: 600 13px/1.4 var(--sans);
  letter-spacing: .06em;
}
.backstage-line {
  min-height: 4.4em;
  margin: 0 0 22px;
  font: 500 19px/1.48 var(--serif);
  color: var(--text);
  overflow-wrap: anywhere;
}
.backstage-meter {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.backstage-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(201, 161, 90, .35), var(--gold) 55%, var(--gold-2));
  box-shadow: inset 0 0 6px rgba(255, 236, 196, .35);
  overflow: hidden;
  transition: width 1s linear;
}
.backstage-wave {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 244, 215, .95), transparent);
  animation: backstage-flow 2.2s linear infinite;
}
@keyframes backstage-flow {
  from { left: -45%; }
  to { left: 105%; }
}
.backstage-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 2px 0;
  color: var(--gold-2);
  font-size: 11.5px;
  letter-spacing: .02em;
}
.backstage-meta #backstage-clock { color: var(--gold-2); font-weight: 600; }
.backstage.reduced .backstage-fill { transition: none; }
.backstage.reduced .backstage-wave { animation: none; left: 28%; }
@media (max-width: 520px) {
  .backstage-line { font-size: 17px; min-height: 4.8em; }
  .backstage-meta { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .backstage-fill { transition: none; }
  .backstage-wave { animation: none; left: 28%; }
}
.genre-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.genre-list { display: flex; flex-direction: column; gap: 6px; }
.genre-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(13, 18, 26, .45);
  color: #c7cfda;
  font-size: 13.5px;
}
.genre-row:hover { border-color: #3a4a62; color: var(--text); }
.genre-row.selected {
  border-color: rgba(201, 161, 90, .7);
  background: linear-gradient(180deg, rgba(201, 161, 90, .14), rgba(201, 161, 90, .05));
  color: var(--gold-2);
}
.genre-row .genre-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.genre-row .genre-role {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold-2);
  white-space: nowrap;
}
.genre-row.selected .genre-order {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  color: #17120a;
  font-size: 10.5px;
  font-weight: 800;
}
.genre-ratio {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.genre-ratio-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.genre-ratio-head b { color: var(--gold-2); font-size: 13px; }
.genre-ratio input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}
.ratio-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  color: var(--muted);
  font-size: 10px;
}
.tone-preview { min-height: 150px; }
.tone-lead {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 7px;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.3;
  color: var(--gold-2);
  margin-bottom: 6px;
}
.tone-pair { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.tone-pair b { color: var(--gold); font-weight: 600; }
.tone-plus { color: var(--muted); font-family: var(--sans); font-size: .72em; }
.tone-text { font-size: 13.5px; line-height: 1.55; margin-top: 8px; overflow-wrap: anywhere; }
.genre-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--panel);
  color: #c7cfda;
  font-size: 13px;
}
.genre-chip:hover { border-color: var(--gold); color: var(--text); }
.genre-chip.selected {
  border-color: rgba(201, 161, 90, .75);
  background: linear-gradient(180deg, rgba(201, 161, 90, .18), rgba(201, 161, 90, .07));
  color: var(--gold-2);
  font-weight: 600;
}
.genre-chip.lead {
  border-color: rgba(224, 189, 124, .9);
  box-shadow: 0 0 0 1px rgba(201, 161, 90, .18) inset;
}
.genre-chip.secondary {
  border-color: rgba(95, 167, 161, .65);
  background: linear-gradient(180deg, rgba(95, 167, 161, .14), rgba(95, 167, 161, .05));
  color: #b9e0dc;
}
.genre-role {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  opacity: .85;
  white-space: nowrap;
}
.genre-chip .genre-order {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--gold);
  color: #17120a;
  font-size: 10.5px;
  font-weight: 800;
}
.pitch-list { display: grid; gap: 10px; }
.pitch-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
  background: rgba(13, 18, 26, .5);
}
.pitch-card h3 { font-size: 18px; margin-bottom: 6px; }
.pitch-row { margin-top: 6px; font-size: 13px; line-height: 1.45; }
.pitch-row b { color: var(--gold-2); font-weight: 600; }
.pitch-card .btn { margin-top: 11px; }
.world-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.world-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(13, 18, 26, .45);
  min-width: 0;
}
.world-item h3 { font-size: 17px; overflow-wrap: anywhere; }
.world-item .muted { font-size: 12px; margin-top: 3px; }
.world-item .world-actions { margin-top: 10px; justify-content: flex-start; }
.briefing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.briefing-block {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 11px 12px;
  background: rgba(13, 18, 26, .38);
  min-width: 0;
}
.briefing-block h3 { font-size: 15px; color: var(--gold-2); margin-bottom: 6px; }
.briefing-block ul { margin: 0; padding-left: 17px; }
.briefing-block li { font-size: 13px; line-height: 1.45; margin-bottom: 3px; overflow-wrap: anywhere; }
.briefing-block p { font-size: 13px; line-height: 1.45; }
.briefing-wide { grid-column: 1 / -1; }
.briefing-tag {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 11px;
  color: #c7cfda;
}
.heroes-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: start;
}
.hero-list { display: grid; gap: 9px; }
.hero-item {
  display: flex;
  gap: 11px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: rgba(13, 18, 26, .45);
  cursor: pointer;
  min-width: 0;
}
.hero-item:hover { border-color: #3a4a62; }
.hero-item.current { border-color: rgba(201, 161, 90, .7); background: rgba(201, 161, 90, .07); }
.hero-portrait {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(201, 161, 90, .45);
  background: radial-gradient(circle at 35% 25%, #243044, #0d121a);
  color: var(--gold-2);
  font: 700 20px/1 var(--serif);
}
.hero-item-body { min-width: 0; flex: 1; }
.hero-item-body b { display: block; font-family: var(--serif); font-size: 17px; overflow-wrap: anywhere; }
.hero-item-body span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.hero-status.alive { color: var(--green); border-color: rgba(111, 174, 138, .45); }
.hero-status.dead { color: var(--red-2); border-color: rgba(198, 93, 93, .5); }
.hero-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.hero-fact {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(13, 18, 26, .4);
}
.hero-fact span { display: block; color: var(--muted); font-size: 11px; }
.hero-fact b { display: block; margin-top: 2px; font-size: 15px; overflow-wrap: anywhere; }
.hero-section { margin-top: 14px; }
.hero-section h3 { font-size: 16px; color: var(--gold-2); margin-bottom: 7px; }
.hero-history { display: grid; gap: 8px; }
.episode-card {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px 11px;
  background: rgba(13, 18, 26, .38);
}
.episode-card b { font-family: var(--serif); font-size: 16px; }
.episode-card .episode-facts { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.episode-card .episode-text { font-size: 12.5px; margin-top: 5px; line-height: 1.45; }
.penalty-note {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(198, 93, 93, .45);
  border-radius: 9px;
  background: rgba(198, 93, 93, .08);
  color: #f0c1c1;
  font-size: 12.5px;
  line-height: 1.45;
}
.rules-badge.penalty {
  color: var(--red-2);
  border-color: rgba(198, 93, 93, .5);
  background: rgba(198, 93, 93, .08);
}
.settings-account {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13, 18, 26, .45);
  font-size: 13px;
}
.settings-account b { color: var(--gold-2); }
.book-note { font-size: 13px; line-height: 1.45; margin-top: 5px; overflow-wrap: anywhere; }
.book-list { margin: 4px 0 0; padding-left: 18px; }
.book-list li { font-size: 13px; line-height: 1.45; margin-bottom: 3px; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .world-grid, .heroes-layout { grid-template-columns: 1fr; }
  .world-list { grid-template-columns: 1fr; }
  .briefing-grid { grid-template-columns: 1fr; }
  .world-head-text h1 { font-size: 25px; }
  .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .whoami { display: none; }
}
@media (max-width: 520px) {
  .auth-wrap { margin-top: 8px; padding: 22px 16px; }
  .auth-title { font-size: 25px; }
  .world-card { padding: 13px; }
  .tone-lead { font-size: 18px; line-height: 1.35; gap: 3px 6px; }
  .world-actions .btn { flex: 1 1 auto; }
  .hero-facts { grid-template-columns: 1fr 1fr; }
  .hero-item { align-items: flex-start; }
}

/* Нижняя шторка бросков (Shadow DOM из dice_sheet.js) */
#dice-sheet-host {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: block;
  pointer-events: none;
}
/* Меню: мягкие грани без острых кромок; цвет — из шторки, § — золотой */
.d20-face img, .mini-face img { filter: blur(.25px); }
/* Кубики меню: beveled-геометрия шторки, свет/масштаб/скорость — меню */
.d20-spin { animation: none !important; }
#d20-body { transform: none !important; }
.menu-d20-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  transform: translate(-50%, -50%);
}
.mini-spin { animation: none !important; }
.menu-mini-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

/* ---------- gold bug: report button ---------- */
.icon-btn-report {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(217, 179, 108, .25);
}
.bug-icon { display: block; width: 26px; height: 26px; }
.bug-icon .bug-shell {
  fill: url(#bug-gold);
  stroke: #e7c17a;
  stroke-width: 1.4;
  transition: fill .12s ease, stroke .12s ease, filter .12s ease;
}
.bug-icon .bug-spot { fill: #5a3f18; }
.bug-icon .bug-head {
  fill: #8a6a34;
  stroke: #e7c17a;
  stroke-width: 1.1;
  transition: fill .12s ease, stroke .12s ease;
}
.bug-icon .bug-legs { stroke: #e7c17a; }
.bug-icon .bug-split { stroke: #7a5a24; }
.bug-icon .bug-antenna { stroke: #8a6528; stroke-width: 3.2; transition: stroke .12s ease; }
.bug-icon .bug-antenna-light { stroke: #f4d894; stroke-width: 1.1; transition: stroke .12s ease; }
.bug-icon .bug-tip-glow { fill: #f4d894; opacity: .35; transition: opacity .12s ease; }
.bug-icon .bug-tip { fill: #f4d894; transition: fill .12s ease; }
.icon-btn-report:hover { border-color: var(--gold); }
.icon-btn-report:hover .bug-shell {
  fill: #e7c17a;
  stroke: #fff3cf;
  filter: drop-shadow(0 0 4px rgba(244, 216, 148, .65));
}
.icon-btn-report:hover .bug-head { fill: #e7c17a; stroke: #fff3cf; }
.icon-btn-report:hover .bug-tip-glow { opacity: .85; }
.icon-btn-report:hover .bug-tip { fill: #fff3cf; }
.icon-btn-report:hover .bug-antenna-light { stroke: #ffe9b0; }
.icon-btn-report:active { transform: scale(.95); }
.icon-btn-report:active .bug-shell { fill: #a97f3a; stroke: #d8b268; filter: none; }
.icon-btn-report:active .bug-head { fill: #a97f3a; stroke: #d8b268; }
.icon-btn-report:active .bug-tip-glow { opacity: .15; }
.icon-btn-report:active .bug-tip { fill: #d8b268; }

/* ---------- report sheet (bottom drawer) ---------- */
.dlg-report {
  width: min(620px, calc(100vw - 20px));
  max-height: 92dvh;
  margin: auto auto 0;
  border-radius: 18px 18px 0 0;
}
.dlg-report[open] { animation: report-up .18s ease-out; }
@keyframes report-up {
  from { transform: translateY(18px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}
.report-inner { max-height: 92dvh; overflow-y: auto; }
.report-lead { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.report-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.report-chip {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}
.report-chip:hover { border-color: #3b4a61; }
.report-chip.active {
  border-color: var(--gold);
  background: rgba(201, 161, 90, .14);
  color: var(--gold-2);
  font-weight: 700;
}
.report-counter { margin: -6px 0 10px; text-align: right; color: var(--muted); font-size: 11px; }
.report-check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 14px; }
.report-check input { width: 18px; height: 18px; }
.report-shot {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, .015);
}
.report-shot-note { margin: 0 0 8px; font-size: 12.5px; color: #c9d2df; }
.report-shot-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.report-shot-row .btn { cursor: pointer; }
.report-hint { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.report-shot-status { margin: 6px 0 0; color: var(--gold-2); font-size: 11.5px; }
.report-preview { margin-top: 10px; }
.report-preview img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.report-error { margin: 0 0 10px; color: #f0c1c1; font-size: 13px; }
.report-thanks { margin: 8px 0 4px; font-size: 18px; color: var(--gold-2); font-weight: 700; }
#report-text { width: 100%; resize: vertical; min-height: 92px; }
@media (max-width: 640px) {
  .dlg-report {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
  }
}

