:root{
  --bg:#0b0708;
  --panel:#140a0d;
  --panel2:#1b0d12;
  --text:#f3eef0;
  --muted:#c9b8bf;

  --wine:#6d1022;      /* бордовый */
  --wine2:#3f0713;
  --gold:#d6b25e;      /* золото */
  --gold2:#8b6a1e;

  --border: rgba(214,178,94,.22);
  --shadow: 0 14px 40px rgba(0,0,0,.55);
  --r: 16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(214,178,94,.12), transparent 60%),
    radial-gradient(900px 500px at 85% 0%, rgba(109,16,34,.25), transparent 55%),
    linear-gradient(180deg, var(--bg), #050304);
}

a{color:var(--gold); text-decoration:none}
a:hover{filter:brightness(1.08); text-decoration:underline}

.container{max-width:1100px; margin:0 auto; padding:28px 18px}

.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(10px);
  background: rgba(11,7,8,.72);
  border-bottom:1px solid var(--border);
}
.topbar .inner{
  max-width:1100px; margin:0 auto; padding:12px 18px;
  display:flex; gap:12px; align-items:center; justify-content:space-between
}
.brand{
  display:flex; gap:10px; align-items:center;
  font-weight:800; letter-spacing:.5px;
}
.badge{
  font-size:12px; padding:4px 10px; border-radius:999px;
  border:1px solid rgba(214,178,94,.35);
  background: linear-gradient(180deg, rgba(214,178,94,.14), rgba(109,16,34,.10));
}

.card{
  background: linear-gradient(180deg, rgba(20,10,13,.88), rgba(10,6,7,.82));
  border:1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding:18px;
}

h1,h2,h3{margin:0 0 10px 0; line-height:1.2}
h1{font-size:32px}
h2{font-size:22px; color:#f6f0da}
small,.muted{color:var(--muted)}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px; border-radius: 12px;
  border:1px solid rgba(214,178,94,.35);
  background: linear-gradient(180deg, rgba(109,16,34,.9), rgba(63,7,19,.95));
  color:var(--text);
  box-shadow: 0 10px 22px rgba(0,0,0,.45);
  cursor:pointer;
}
.btn:hover{filter:brightness(1.05)}
.btn.gold{
  background: linear-gradient(180deg, rgba(214,178,94,.95), rgba(139,106,30,.95));
  color:#1b0d12;
  border-color: rgba(214,178,94,.55);
}

.input, textarea{
  width:100%;
  padding:12px 12px;
  border-radius: 12px;
  border:1px solid rgba(214,178,94,.22);
  background: rgba(27,13,18,.65);
  color: var(--text);
  outline:none;
}
.input:focus, textarea:focus{
  border-color: rgba(214,178,94,.55);
  box-shadow: 0 0 0 4px rgba(214,178,94,.14);
}

.grid{display:grid; gap:14px}
.grid.two{grid-template-columns: 1fr 1fr}
@media (max-width:860px){ .grid.two{grid-template-columns:1fr} }

.article-content{
  margin-top:12px;
  padding-top:14px;
  border-top:1px solid rgba(214,178,94,.18);
}
.article-content pre{
  overflow:auto;
  padding:12px;
  border-radius: 12px;
  border:1px solid rgba(214,178,94,.18);
  background: rgba(0,0,0,.35);
}
.article-content code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace
}
.article-content img, .article-content video{
  max-width:100%;
  border-radius:12px;
  border:1px solid rgba(214,178,94,.18);
}

.hr{height:1px; background:rgba(214,178,94,.14); margin:14px 0}
.err{
  color:#ffb4b4;
  background: rgba(255,0,0,.08);
  border:1px solid rgba(255,180,180,.25);
  padding:10px 12px;
  border-radius:12px
}
.ok{
  color:#c8ffd6;
  background: rgba(0,255,120,.08);
  border:1px solid rgba(200,255,214,.25);
  padding:10px 12px;
  border-radius:12px
}

/* ===== Media Viewer (Wiki-like Lightbox) ===== */
.mw-overlay{
  position:fixed; inset:0; z-index:9999;
  display:none;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(6px);
}

.mw-overlay.is-open{display:block}

.mw-modal{
  position:absolute; inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}

.mw-frame{
  width:min(1200px, 96vw);
  max-height: 92vh;
  background: linear-gradient(180deg, rgba(20,10,13,.96), rgba(10,6,7,.92));
  border:1px solid rgba(214,178,94,.22);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0,0,0,.65);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.mw-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid rgba(214,178,94,.14);
}

.mw-title{
  font-weight:700;
  color: var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.mw-actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap}

.mw-btn{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(214,178,94,.35);
  background: rgba(109,16,34,.55);
  color: var(--text);
  cursor:pointer;
}
.mw-btn:hover{filter:brightness(1.06)}

.mw-body{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px;
  background: radial-gradient(900px 520px at 50% 30%, rgba(214,178,94,.08), transparent 55%);
}

.mw-img{
  max-width: 100%;
  max-height: 78vh;
  border-radius: 14px;
  border:1px solid rgba(214,178,94,.18);
  background: rgba(0,0,0,.25);
  image-rendering:auto;
}

.mw-caption{
  padding:10px 12px;
  border-top:1px solid rgba(214,178,94,.14);
  color: var(--muted);
  font-size: 13px;
}

.mw-clickable{
  cursor: zoom-in;
}

/* ===== Wiki table borders ===== */
.article-content table{
  width:100%;
  border-collapse: collapse;
  border:1px solid rgba(214,178,94,.22);
  background: rgba(0,0,0,.12);
  border-radius: 12px;
  overflow:hidden;
}

.article-content th,
.article-content td{
  border:1px solid rgba(214,178,94,.18); /* разделение ячеек */
  padding:10px 12px;
  vertical-align: top;
}

.article-content thead th{
  background: rgba(109,16,34,.28);
  color: var(--text);
}

.article-content tbody tr:nth-child(even){
  background: rgba(214,178,94,.04);
}

.article-content tbody tr:hover{
  background: rgba(214,178,94,.06);
}

/* Таблица "Список персонажей" — поверх твоих общих .article-content table */
.article-content table.cast-grid{
  table-layout: fixed;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,.10);
  border: 1px solid rgba(214,178,94,.22);
}

.article-content table.cast-grid thead th{
  background: linear-gradient(180deg, rgba(109,16,34,.35), rgba(63,7,19,.18));
  color: var(--text);
  font-weight: 800;
  letter-spacing: .2px;
}

.article-content table.cast-grid td{
  vertical-align: top;
}

.article-content table.cast-grid tbody tr:hover{
  background: rgba(214,178,94,.07);
}

/* Ячейка с фото + текст */
.article-content .cast-cell{
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* Блок для фото */
.article-content .cast-photo{
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 12px;
  border: 1px solid rgba(214,178,94,.22);
  background: linear-gradient(180deg, rgba(20,10,13,.88), rgba(10,6,7,.82));
  box-shadow: 0 10px 22px rgba(0,0,0,.35);
  overflow: hidden;
}

.article-content .cast-photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Текст */
.article-content .cast-meta{min-width:0}
.article-content .cast-actor{
  font-weight: 800;
  color: #f6f0da; /* как твой h2 */
  margin: 0 0 4px 0;
  line-height: 1.2;
}
.article-content .cast-role{
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}
.article-content .cast-role a{color: var(--gold)}

/* Чуть компактнее на мобилках */
@media (max-width: 860px){
  .article-content .cast-photo{width:46px;height:46px;flex-basis:46px}
  .article-content table.cast-grid th,
  .article-content table.cast-grid td{padding:10px}
}