:root {
  --bg: #0f0b14;
  --bg2: #16111f;
  --panel: #1d1626;
  --gold: #d4af6a;
  --gold-dim: #9d8453;
  --text: #e9e2f2;
  --muted: #a49ac0;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(0, 0, 0, .42);
  --op-accent: var(--gold);
  --topbar-bg: rgba(15, 11, 20, .92);
  --read-scale: 1;
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Cormorant Garamond", "Georgia", serif;
  --font-it: "Lora", "Georgia", serif;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5efe3;
  --bg2: #ece2cf;
  --panel: #fbf7ee;
  --gold: #9c7438;
  --gold-dim: #80653c;
  --text: #2a2018;
  --muted: #7a6a58;
  --shadow: 0 4px 18px rgba(90, 70, 40, .18);
  --topbar-bg: rgba(245, 239, 227, .92);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 560px at 82% -12%, rgba(212, 175, 106, .07), transparent 60%),
    radial-gradient(850px 480px at 8% 112%, rgba(212, 175, 106, .05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

button, a, [role="button"] { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

h1, h2, h3 { font-family: var(--font-serif); }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ── Top bar ───────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 175, 106, .16);
}

/* ── Progress bar ──────────────────────── */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--gold);
  z-index: 50;
  transition: width .1s linear;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--gold);
}

.brand-mark { font-size: 1.5rem; }

.icon-btn {
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .22);
  color: var(--text);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn:active { transform: scale(.94); }

.top-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.fsbtn { font-size: .86rem; font-weight: 700; }

/* ── Search bar ────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg2);
  border-bottom: 1px solid rgba(212, 175, 106, .12);
}
.search-bar input {
  flex: 1;
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .22);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}
.search-bar input:focus { border-color: var(--gold); }

/* ── Layout ────────────────────────────── */
.layout { display: flex; min-height: calc(100vh - 61px); }

.sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 16px;
  background: var(--bg2);
  border-right: 1px solid rgba(212, 175, 106, .1);
  position: sticky;
  top: 61px;
  height: calc(100vh - 61px);
  overflow-y: auto;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(10, 6, 14, .55);
  backdrop-filter: blur(2px);
}
.sidebar h2 {
  font-family: var(--font-ui);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
  margin: 8px 4px 10px;
}
.act-item { margin-bottom: 14px; }
.act-item > button {
  width: 100%;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(212, 175, 106, .16);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .95rem;
  transition: border-color .15s ease, color .15s ease;
}
.act-item > button:hover { border-color: var(--gold-dim); }
.act-item.active > button { border-color: var(--gold); color: var(--gold); }
.scene-list { padding: 6px 0 0 6px; display: flex; flex-direction: column; gap: 4px; }
.scene-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .9rem;
  transition: background .15s ease, color .15s ease;
}
.scene-btn:hover { color: var(--text); background: var(--panel); }
.scene-btn.active { color: var(--gold); background: rgba(212, 175, 106, .08); }
.scene-btn.has-role { color: var(--gold-dim); font-weight: 600; }

/* ── Content ───────────────────────────── */
.content { flex: 1; min-width: 0; padding: 20px 24px 80px; max-width: 920px; }

.hidden { display: none !important; }

.hero h1 { margin: 14px 0 6px; font-size: 2.6rem; font-weight: 700; color: var(--gold); }
.subtitle { color: var(--muted); margin: 0 0 26px; font-size: 1.05rem; }

.meta { color: var(--muted); font-size: .95rem; }

.op-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.op-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  background: linear-gradient(160deg, var(--panel), var(--bg2) 70%);
  border: 1px solid rgba(212, 175, 106, .22);
  border-radius: var(--radius);
  text-align: left;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.op-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--op-accent);
  opacity: .85;
  z-index: 2;
}
.op-card .op-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.op-card .op-body { padding: 14px 18px 18px; }
.op-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
}
html[data-theme="light"] .op-card:hover { box-shadow: 0 10px 26px rgba(90, 70, 40, .22); }
.op-card h3 { margin: 0 0 4px; color: var(--gold); font-size: 1.55rem; font-weight: 700; position: relative; }
.op-card p { margin: 0; color: var(--muted); font-size: .9rem; position: relative; }
.result-card { padding: 14px 16px; }

.opera-head h1 { margin: 6px 0 2px; color: var(--op-accent); font-size: 2.4rem; font-weight: 700; }

.opera-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.back-btn {
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .22);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: .88rem;
  transition: border-color .15s ease, color .15s ease;
}
.back-btn:hover { border-color: var(--gold); color: var(--gold); }
.cast-toggle {
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .22);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: .88rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cast-toggle:hover { border-color: var(--gold); color: var(--gold); }
.cast-toggle.active { background: rgba(212, 175, 106, .14); border-color: var(--gold); color: var(--gold); }

.cast-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.cast-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid rgba(212, 175, 106, .18);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease;
}
.cast-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.cast-card.cast-chorus { border-color: rgba(212, 175, 106, .4); }
.cast-name { font-size: 1.05rem; font-family: var(--font-serif); font-weight: 600; }
.cast-name .who-it { color: var(--gold); }
.cast-name .who-ru { color: var(--text); }
.cast-role { color: var(--muted); font-size: .88rem; font-style: italic; }
.cast-count { color: var(--gold-dim); font-size: .82rem; }

.scene-tag {
  color: var(--gold-dim);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 16px 0 2px;
  font-family: var(--font-ui);
}

.seg { display: inline-flex; gap: 2px; margin: 12px 0; background: var(--panel); padding: 3px; border-radius: 10px; border: 1px solid rgba(212, 175, 106, .16); }
.seg-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .9rem;
  transition: background .15s ease, color .15s ease;
}
.seg-btn.active { background: var(--gold); color: #1a120b; font-weight: 600; }

.act-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.act-tab {
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .16);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: .9rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.act-tab:hover { border-color: var(--gold-dim); }
.act-tab.active { background: rgba(212, 175, 106, .12); border-color: var(--gold); color: var(--gold); }

.scene-title { color: var(--gold); font-size: 1.45rem; font-weight: 700; margin: 22px 0 8px; font-style: italic; }
.scene-plain { color: var(--muted); margin: 28px 0 10px; font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; }

.line {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(212, 175, 106, .08);
  align-items: baseline;
  border-radius: 10px;
  transition: background .2s ease;
}
.line:hover { background: rgba(212, 175, 106, .035); }
.line.playing { background: rgba(212, 175, 106, .09); }
.line.playing .it { color: var(--gold); }

.line .who {
  color: var(--gold-dim);
  font-size: calc(.68rem * var(--read-scale));
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .1em;
  justify-self: start;
  max-width: 100%;
  min-width: 0;
  background: rgba(212, 175, 106, .06);
  border: 1px solid rgba(212, 175, 106, .16);
  border-radius: 999px;
  padding: 3px 10px;
  overflow-wrap: anywhere;
}
.line .who-it { color: var(--gold); font-weight: 600; }
.line .who-sep { color: var(--muted); }
.line .who-ru { color: var(--muted); text-transform: none; }
.badge {
  display: inline-block;
  margin-left: .45em;
  padding: .05em .5em;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 999px;
  vertical-align: .12em;
}
.chorus-tag { color: var(--gold-dim); border: 1px solid rgba(212, 175, 106, .3); }
.ens-tag { color: #9ecbff; border: 1px solid rgba(158, 203, 255, .4); }
.offstage-tag { color: #ffd2a1; border: 1px solid rgba(255, 210, 161, .4); }
.line .it { font-family: var(--font-it); font-weight: 500; font-size: calc(1.15rem * var(--read-scale)); line-height: 1.5; overflow-wrap: break-word; }
.line .ru { color: var(--muted); font-size: calc(.95rem * var(--read-scale)); margin-top: 3px; overflow-wrap: break-word; }
.line.matched { background: rgba(212, 175, 106, .09); border-radius: 8px; }
.line.matched .it { color: var(--gold); }

/* ── Кнопка воспроизведения ────────────── */
.play-wrap { display: inline-flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .24);
  color: var(--gold);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.play-btn:hover { border-color: var(--gold); background: rgba(212, 175, 106, .08); }
.play-ico { font-size: .7rem; }
.play-label { font-size: .78rem; }
.eq { display: none; gap: 2px; align-items: flex-end; height: 12px; }
.eq i {
  width: 3px;
  height: 100%;
  background: currentColor;
  border-radius: 2px;
  animation: eqbar .9s ease-in-out infinite;
}
.eq i:nth-child(2) { animation-delay: .18s; }
.eq i:nth-child(3) { animation-delay: .36s; }
@keyframes eqbar {
  0%, 100% { height: 30%; }
  50% { height: 100%; }
}
.play-btn.playing { background: rgba(212, 175, 106, .14); border-color: var(--gold); }
.play-btn.playing .eq { display: inline-flex; }
.play-btn.playing .play-ico, .play-btn.playing .play-label { display: none; }
.play-btn.paused { background: rgba(212, 175, 106, .05); border-color: var(--gold-dim); }
.play-btn.paused .eq { display: none; }
.play-btn.paused .play-ico, .play-btn.paused .play-label { display: inline; }
.speed-sel {
  background: var(--panel);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 106, .24);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .75rem;
  cursor: pointer;
}
.speed-sel:hover { border-color: var(--gold); }

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 61px;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
    width: 280px;
    height: calc(100vh - 61px);
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; }
  .sidebar-backdrop.hidden { display: none; }
  .line { grid-template-columns: 1fr; gap: 4px; padding: 14px 8px; }
  .line .who { font-size: calc(.7rem * var(--read-scale)); padding: 4px 12px; }
  .content { padding: 12px 12px 80px; }
  .bottom-pad { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .op-list { grid-template-columns: 1fr; }
  .opera-head h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 1.8rem; }
  .opera-tools { flex-wrap: wrap; gap: 6px; }
  .opera-tools .back-btn,
  .opera-tools .cast-toggle { padding: 8px 14px; font-size: .9rem; min-height: 44px; }
  .act-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .act-tabs::-webkit-scrollbar { display: none; }
  .act-tab { white-space: nowrap; flex-shrink: 0; padding: 10px 18px; font-size: .92rem; min-height: 44px; }
  .scene-title { font-size: 1.25rem; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .seg-btn { padding: 10px 16px; min-height: 44px; font-size: .92rem; }
  .topbar { padding: 8px 10px; gap: 6px; }
  .brand { font-size: 1.1rem; }
  .know-btn { width: 44px; height: 44px; font-size: 1.2rem; }
  .cast-list { grid-template-columns: 1fr; }
  .cast-card { padding: 14px 16px; min-height: 60px; }
  .cast-card-row .cast-card { border-radius: var(--radius) 0 0 var(--radius); }
  .cast-add-btn { min-width: 48px; min-height: 60px; font-size: 1.3rem; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-card { max-width: 100%; border-radius: 18px 18px 6px 6px; padding: 20px 16px; }
  .modal-card-wide { max-width: 100%; }
  .role-list { max-height: 50vh; }
  .role-opt { padding: 14px 16px; min-height: 52px; font-size: 1rem; }
  .play-btn { min-height: 44px; padding: 8px 16px; }
  .myrole-card { padding: 14px 12px; min-height: 52px; }
  .myrole-remove { font-size: 1.3rem; padding: 8px; }
  .role-bar { gap: 8px; }
  .role-bar-track { width: 100px; }
  .rd-acts { max-height: 60vh; }
  .search-bar { padding: 8px 10px; }
  .search-bar input { padding: 12px 14px; font-size: 1rem; min-height: 44px; }
}

@media (max-width: 380px) {
  .topbar { padding: 6px 8px; }
  .brand { font-size: 1rem; }
  .content { padding: 10px 8px 80px; }
  .line { padding: 12px 6px; }
  .scene-title { font-size: 1.1rem; }
  .act-tab { padding: 8px 14px; font-size: .84rem; }
  .opera-head h1 { font-size: 1.5rem; }
}

@media (hover: none) and (pointer: coarse) {
  .op-card:hover { transform: none; box-shadow: var(--shadow); }
  .op-card:active { transform: scale(.97); border-color: var(--gold); }
  .cast-card:hover { transform: none; }
  .cast-card:active { border-color: var(--gold); }
  .op-card:active .op-card h3 { color: var(--gold); }
  .line:active { background: rgba(212, 175, 106, .05); }
  .scene-btn:active, .act-item > button:active { background: var(--panel); }
}

/* ── Toast ─────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--gold);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  z-index: 50;
  box-shadow: var(--shadow);
  font-family: var(--font-ui);
}

/* ── Доступность: отключаем анимации ───── */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Разучивание роли ──────────────────── */
.role-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.role-bar.hidden { display: none; }

.learn-btn {
  background: linear-gradient(135deg, rgba(212, 175, 106, .16), rgba(212, 175, 106, .05));
  border: 1px solid rgba(212, 175, 106, .35);
  color: var(--gold);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: .88rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.learn-btn:hover { border-color: var(--gold); background: rgba(212, 175, 106, .22); }
.learn-btn.ghost { background: none; border-color: rgba(212, 175, 106, .22); color: var(--muted); }
.learn-btn.ghost:hover { color: var(--gold); border-color: var(--gold-dim); }

.role-tag { color: var(--gold); font-weight: 700; font-family: var(--font-serif); font-size: 1.05rem; }
.role-progress-text { color: var(--muted); font-size: .88rem; font-family: var(--font-ui); }
.role-bar-track {
  width: 140px; height: 6px;
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .16);
  border-radius: 999px; overflow: hidden;
}
#role-bar-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width .3s ease;
}

/* ── Модалка выбора роли ───────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 6, 14, .66);
  backdrop-filter: blur(4px);
  padding: 16px;
}
.modal-card {
  width: 100%; max-width: 380px;
  background: var(--bg2);
  border: 1px solid rgba(212, 175, 106, .3);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 6px; color: var(--gold); font-family: var(--font-serif); font-size: 1.2rem; }
.role-list {
  display: flex; flex-direction: column; gap: 6px;
  margin: 12px 0 14px; max-height: 44vh; overflow-y: auto;
}
.role-opt {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .95rem;
  text-align: left;
  transition: border-color .15s ease, color .15s ease;
}
.role-opt:hover { border-color: var(--gold); color: var(--gold); }
.role-opt .cnt { color: var(--muted); font-size: .82rem; }
.role-opt .who-it { color: var(--gold); }
.role-opt .who-ru { color: var(--text); }

/* ── Реплики в режиме роли ─────────────── */
.line.mine {
  border-left: 3px solid var(--op-accent);
  background: linear-gradient(90deg, rgba(199, 155, 85, .1), transparent 70%);
  border-radius: 10px;
}
.line.mine .who { border-color: var(--op-accent); }
.line.other { opacity: .4; }

.know-btn {
  display: inline-block;
  margin-left: auto;
  margin-top: 6px;
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid rgba(212, 175, 106, .35);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.know-btn:hover { border-color: var(--gold); color: var(--gold); }
.know-btn.known { background: var(--op-accent); border-color: var(--op-accent); color: #1a120b; }
html[data-theme="light"] .know-btn.known { color: #fff; }

/* ── Streak ────────────────────────────── */
.streak-display { font-size: .92rem; color: #f0a040; font-family: var(--font-ui); }

/* ── Мои роли ───────────────────────────── */
.myroles-panel { margin-bottom: 28px; }
.myroles-panel .meta { margin: 8px 0; }
.myrole-card {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, var(--panel), var(--bg2));
  border: 1px solid rgba(212, 175, 106, .22);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: left; color: var(--text);
  margin-bottom: 8px;
  transition: border-color .15s ease, transform .15s ease;
}
.myrole-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.myrole-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.myrole-op { color: var(--muted); font-size: .82rem; }
.myrole-name { color: var(--gold); font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem; }
.myrole-pct { color: var(--gold-dim); font-size: .88rem; margin-left: auto; }
.myrole-track { width: 100%; height: 4px; }
.myrole-track span { display: block; height: 100%; border-radius: 999px; background: var(--op-accent); transition: width .3s ease; }
.myrole-remove {
  background: none; border: none; color: var(--muted); font-size: 1.1rem; padding: 4px;
  transition: color .15s ease;
}
.myrole-remove:hover { color: #e0456a; }

/* ── Карточки в модалке Мои Партии ──────── */
.myrole-modal-card {
  position: relative;
  background: linear-gradient(135deg, var(--panel), var(--bg2));
  border: 1px solid rgba(212, 175, 106, .18);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 6px;
}
.myrole-go {
  width: 100%; text-align: left; font-size: .95rem;
}
.myrole-go .myrole-op { display: block; margin-bottom: 2px; }
.myrole-go .myrole-name { font-size: 1.05rem; }
.myrole-modal-remove {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--muted); font-size: 1rem; padding: 4px;
  transition: color .15s ease;
}
.myrole-modal-remove:hover { color: #e0456a; }

/* ── ⊞ на карточках Действующие лица ───── */
.cast-card-row { display: flex; gap: 0; }
.cast-card-row .cast-card { flex: 1; border-radius: var(--radius) 0 0 var(--radius); }
.cast-add-btn {
  background: var(--panel); border: 1px solid rgba(212, 175, 106, .2);
  border-left: none; color: var(--gold-dim);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 0 12px;
  font-size: 1.1rem; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cast-add-btn:hover { border-color: var(--gold); color: var(--gold); }
.cast-add-btn.added { background: var(--gold); border-color: var(--gold); color: #1a120b; }
html[data-theme="light"] .cast-add-btn.added { color: #fff; }

/* Убрать старые стили role-opt-row */
.role-opt-row { display: none; }

/* ── Дашборд роли ───────────────────────── */
.modal-card-wide { max-width: 460px; }
.rd-title { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; margin: 6px 0 2px; color: var(--op-accent); }
.rd-opera { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }
.rd-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--panel), var(--bg2));
  border: 1px solid rgba(212, 175, 106, .18);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px;
}
.rd-streak { color: #f0a040; font-size: .9rem; }
.rd-pct { color: var(--gold); font-weight: 700; font-size: 1.2rem; margin-left: auto; }
.rd-track { width: 100%; height: 6px; }
.rd-total { width: 100%; color: var(--muted); font-size: .82rem; }
.rd-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.rd-actions .learn-btn { flex: 1; text-align: center; }
.rd-acts { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.rd-act {
  background: linear-gradient(135deg, var(--panel), var(--bg2));
  border: 1px solid rgba(212, 175, 106, .16);
  border-radius: var(--radius); padding: 12px 14px;
}
.rd-act-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rd-act-title { font-family: var(--font-serif); font-weight: 600; font-size: 1rem; color: var(--text); }
.rd-act-pct { color: var(--gold-dim); font-size: .85rem; margin-left: auto; }
.rd-act-bar { width: 100%; height: 4px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.rd-act-bar span { display: block; height: 100%; background: var(--gold-dim); border-radius: 999px; transition: width .3s ease; }
.rd-act-scenes { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.rd-scene {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; transition: background .15s ease;
}
.rd-scene:hover { background: rgba(212, 175, 106, .06); }
.rd-scene.done { opacity: .5; }
.rd-scene.no-role { opacity: .35; }
.rd-scene.no-role .rd-scene-title { color: var(--muted); }
.rd-scene-title { flex: 1; font-size: .88rem; color: var(--text); }
.rd-scene-cnt { color: var(--muted); font-size: .8rem; }
.rd-scene-cnt.done { color: #63d08f; }
.rd-train {
  padding: 4px 10px; font-size: .78rem;
  background: rgba(212, 175, 106, .1); border-color: rgba(212, 175, 106, .25);
}
