/* шрифт Cinzel лежит рядом (OFL) — без Google Fonts */
@font-face { font-family: 'Cinzel'; font-weight: 600 800; font-display: swap; src: url(fonts/cinzel-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cinzel'; font-weight: 600 800; font-display: swap; src: url(fonts/cinzel-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #0b0d12; --panel: #12161f; --panel2: #191e29; --line: #2a3140;
  --gold: #d4b06a; --text: #e6e1d3; --muted: #8d8a80;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.35 "Segoe UI", system-ui, sans-serif; overflow: hidden; }
#app { display: grid; grid-template-rows: 66px 1fr; height: 100vh; }
.hidden { display: none !important; }

/* верхняя панель */
#top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; padding: 6px 14px; background: #121620; border-bottom: 1px solid #3a3222; }
.score { display: grid; gap: 3px; min-width: 0; }
.score.h { text-align: right; }
.score .fname { font-family: Cinzel, Georgia, serif; font-weight: 800; letter-spacing: .03em; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score.a .fname { color: #9dbcff; } .score.h .fname { color: #ff9b90; }
.reinf { position: relative; height: 18px; background: #0a0c10; border: 1px solid #2c3342; border-radius: 3px; overflow: hidden; }
.reinf .fill { position: absolute; top: 0; bottom: 0; left: 0; background: #2f6fd6; transition: width .3s; }
.score.h .reinf .fill { left: auto; right: 0; background: #b8322a; }
.reinf .num { position: relative; display: block; text-align: center; font-weight: 700; font-size: 12px; line-height: 18px; text-shadow: 0 1px 2px #000; }
.score .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; gap: 8px; }
.score.h .meta { flex-direction: row-reverse; }
.mid { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.timer { font-family: Cinzel, Georgia, serif; font-size: 17px; color: var(--gold); }
.speed { display: flex; gap: 3px; }
.speed button { padding: 2px 8px; }
.speed button.on { border-color: var(--gold); color: var(--gold); }
.disc { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.dbar { width: 120px; height: 7px; background: #0a0c10; border: 1px solid #2c3342; border-radius: 4px; overflow: hidden; }
.dbar .fill { height: 100%; background: linear-gradient(90deg, #c0392b, #f1c40f, #2ecc71); background-size: 120px 100%; transition: width .3s; }

/* раскладка */
main { display: grid; grid-template-columns: 236px minmax(0, 1fr) 286px; min-height: 0; }
aside { background: var(--panel); overflow-y: auto; padding: 8px; min-height: 0; }
#raid { border-right: 1px solid var(--line); }
#cmd { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#cv, #gl, #ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl, #cv { cursor: crosshair; }
#ov { pointer-events: none; }
.off { display: none !important; }
.panel-title { font-family: Cinzel, Georgia, serif; font-weight: 800; color: var(--gold); display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.panel-title span { font-family: "Segoe UI", sans-serif; font-weight: 400; color: var(--muted); font-size: 11px; text-align: right; }

/* рейд-фреймы */
.grp { margin-bottom: 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel2); overflow: hidden; }
.grp.sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.gh { display: flex; gap: 6px; align-items: center; padding: 3px 6px; cursor: pointer; background: #1f2532; font-size: 12px; user-select: none; }
.gh:hover { background: #283043; }
.gn { font-weight: 800; color: var(--gold); width: 12px; }
.go { color: var(--muted); flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ur { position: relative; height: 17px; display: flex; align-items: center; gap: 4px; padding: 0 5px; font-size: 11.5px; border-top: 1px solid #0d1016; }
.ur .hp { position: absolute; top: 0; bottom: 0; left: 0; opacity: .22; transition: width .2s; }
.ur > span { position: relative; }
.ur .ri { width: 14px; text-align: center; font-size: 10px; }
.ur .nm { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.ur .st { font-size: 11px; font-weight: 700; color: #ffb347; }
.ur.dead { filter: grayscale(1); opacity: .45; }
.ur.afk .nm { text-decoration: line-through; }

/* кнопки */
button { font: inherit; color: var(--text); background: #232834; border: 1px solid #3c4252; border-radius: 4px; padding: 6px 8px; cursor: pointer; text-align: left; }
button:hover { border-color: var(--gold); }
button.hot { border-color: #7a4b1c; }
button.dim, button.broken { opacity: .45; }
button.on { border-color: var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.grid3 button { text-align: center; padding: 5px 4px; }
.sec { margin: 10px 0 4px; color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

/* чат */
#chat { flex: 1; min-height: 140px; overflow-y: auto; background: #0b0e13; border: 1px solid var(--line); border-radius: 4px; padding: 6px; font-size: 12px; }
.cl { margin: 1px 0; }
.cl .ct { color: #5e6370; font-size: 10.5px; margin-right: 2px; }
.cl.raid { color: #ff9d3b; } .cl.rw { color: #ffd23f; } .cl.sys { color: #ecd98b; } .cl.good { color: #6fe28a; }
.cl.bad { color: #ff6b5e; } .cl.whisper { color: #f39ce0; } .cl.piq { color: #3fd6c6; font-weight: 600; }

/* сцена */
#rw { position: absolute; top: 9%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#rw div { font-family: Cinzel, Georgia, serif; font-weight: 800; font-size: 21px; color: #ffd23f; text-shadow: 0 0 6px #000, 0 2px 2px #000; animation: rwfade 3.2s forwards; text-align: center; padding: 0 20px; }
#rw div.bad { color: #ff5a4a; } #rw div.good { color: #7cf29a; } #rw div.raid { color: #ff9d3b; }
@keyframes rwfade { 0% { opacity: 0; transform: scale(1.12); } 8% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#prep { position: absolute; top: 42%; width: 100%; text-align: center; font: 800 32px Cinzel, Georgia, serif; color: var(--gold); text-shadow: 0 2px 6px #000; pointer-events: none; }
#tip { position: absolute; pointer-events: none; background: rgba(8,10,14,.94); border: 1px solid #4a3f28; border-radius: 4px; padding: 6px 8px; font-size: 12px; max-width: 280px; display: none; z-index: 2; }
#tip .muted { color: var(--muted); }
#hint { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); padding: 6px 12px; border-radius: 4px; color: #ffd27a; opacity: 0; transition: opacity .3s; pointer-events: none; }
#hint.show { opacity: 1; }
#help { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.45); font-size: 11px; pointer-events: none; }

/* экраны */
#overlay { position: fixed; inset: 0; background: rgba(5,6,9,.82); display: grid; place-items: center; z-index: 10; overflow: auto; padding: 20px; }
#overlay.hidden { display: none; }
.card { width: min(760px, 100%); background: #141821; border: 1px solid #5a4a2a; border-radius: 8px; padding: 24px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.card h1 { font-family: Cinzel, Georgia, serif; font-size: 38px; margin: 0; color: var(--gold); text-align: center; letter-spacing: .03em; }
.card h1.win { color: #7cf29a; } .card h1.lose { color: #ff6b5e; }
.card .sub { text-align: center; color: #c9b88a; font-family: Cinzel, Georgia, serif; margin-bottom: 10px; }
.lead { color: #cfc8b6; line-height: 1.5; }
.opt { margin: 12px 0; }
.opt label { display: block; color: var(--muted); margin-bottom: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.seg { display: flex; gap: 4px; }
.seg button { padding: 7px 18px; }
.seg button.on { border-color: var(--gold); background: #3a3018; }
#ladder { display: grid; gap: 4px; }
.rung { display: flex; align-items: center; gap: 10px; padding: 7px 10px; }
.rung.on { border-color: var(--gold); background: #2c2614; }
.rung.locked { opacity: .5; cursor: default; }
.rung.final .rn { background: #6e1a12; }
.rn { width: 26px; height: 26px; border-radius: 50%; background: #2c3342; display: grid; place-items: center; font-weight: 800; flex: none; }
.rbody { display: grid; flex: 1; min-width: 0; }
.rname { font-weight: 700; font-size: 14px; }
.rstyle { color: var(--muted); font-size: 12px; }
.rst { color: #7cf29a; font-size: 16px; }
.big { display: block; margin: 16px auto 0; font-family: Cinzel, Georgia, serif; font-weight: 800; font-size: 19px; padding: 10px 36px; text-align: center; background: #5a4418; border-color: var(--gold); }
.howto { margin-top: 14px; color: #cfc8b6; }
.howto summary { cursor: pointer; color: var(--gold); }
.howto li { margin: 4px 0; }
.foot { margin-top: 12px; color: #6b6a64; font-size: 11px; text-align: center; }
.foot a { color: #b99a5b; }
.facts { text-align: center; color: #cfc8b6; margin: 6px 0 12px; line-height: 1.6; }
.gold { color: var(--gold); }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tabs button.on { border-color: var(--gold); }
.sbwrap { max-height: 44vh; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
table.sb { width: 100%; border-collapse: collapse; font-size: 12px; }
.sb th { position: sticky; top: 0; background: #1d2230; cursor: pointer; text-align: right; padding: 5px 6px; color: var(--gold); font-weight: 600; }
.sb td { padding: 3px 6px; text-align: right; border-bottom: 1px solid #1c2130; }
.sb th:first-child, .sb td:first-child { text-align: left; }
.sb tr.lead td { background: rgba(212,176,106,.12); }
.fa { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.btns { display: flex; gap: 8px; justify-content: center; align-items: flex-end; margin-top: 12px; }
.btns .big { margin: 0; }

@media (max-width: 1150px) { main { grid-template-columns: 200px minmax(0, 1fr) 250px; } }
@media (max-width: 820px) { main { grid-template-columns: minmax(0, 1fr); } #raid, #cmd { display: none; } }

/* v7: выбор премейда, язык, перетаскивание карты */
#stage { cursor: grab; }
#stage.grabbing { cursor: grabbing; }
.grid2 .wide { grid-column: span 2; }
button .cnt { color: #ffcf6a; font-size: 11px; margin-left: 2px; }
.langSeg { justify-content: flex-end; margin-bottom: -6px; }
.seg.small button { padding: 3px 10px; font-size: 11px; }
/* переход во вторую фан-игру — слева в строке языка, вид как у кнопок рядом */
.gameSw { margin-right: auto; padding: 3px 10px; font-size: 11px; color: var(--text); background: #232834; border: 1px solid #3c4252; border-radius: 4px; text-decoration: none; }
.gameSw:hover { border-color: var(--gold); }
.opt.vs { border: 1px solid #5a4a2a; border-radius: 6px; padding: 10px 12px; background: rgba(90,68,24,.12); }
.opt.vs > label { color: var(--gold); font-size: 13px; }
.vsNow { margin: 2px 0 8px; color: #cfc8b6; }
.vsNow b { color: var(--gold); font-family: Cinzel, Georgia, serif; font-size: 16px; }
.rcls { color: #b8b09c; font-size: 11px; }
.rcls b { color: #f5c542; letter-spacing: 1px; }
.card .muted.small { color: var(--muted); font-size: 11px; margin-top: 6px; }
.rcls b i { color: #4a4434; font-style: normal; }
.gh .gheal { margin-left: auto; color: #5aff78; font-size: 11px; font-weight: 700; }
.gh .gheal.none { color: #ff5b4f; animation: blink 1s infinite; }
.gh .gtac { font-size: 10px; }
@keyframes blink { 50% { opacity: .35; } }
.lockside { color: #ff9b90; font-weight: 600; white-space: nowrap; }
#factionSeg button:disabled { opacity: .35; cursor: not-allowed; }
