:root{
  --bg: #0b0f14;

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);

  --line: rgba(255,255,255,.12);

  --accent: #7cf7ff;
  --danger: #ff4d6d;

  --radius: 18px;

  /* Telegram */
  --tg: #229ED9;
  --tgHover: #1c8cc3;

  /* Damage highlights */
  --hp: #7CFF9B;
  --ml: #ff7aa2;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 800px at 50% 0%, rgba(124,247,255,.10), transparent 60%),
    radial-gradient(900px 600px at 10% 40%, rgba(255,77,109,.08), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
}

.app{ width: min(1100px, 100%); }

/* ========= Neon sign ========= */
.neonHeader{
  display:flex;
  justify-content:center;
  margin: 6px 0 18px;
}

.neonSign{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 18px 28px;
  border-radius: 22px;
  border: 4px solid rgba(124,247,255,.85);
  background: #070b10;
  box-shadow:
    0 0 6px rgba(124,247,255,.35),
    0 0 18px rgba(124,247,255,.30),
    0 0 42px rgba(124,247,255,.22),
    inset 0 0 18px rgba(124,247,255,.20);
  user-select:none;
  animation: neonFlicker 6.2s infinite;
}

.neonText{
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 900;
  letter-spacing: 2px;
  color: #eaffff;
  text-shadow:
    0 0 6px rgba(124,247,255,.55),
    0 0 18px rgba(124,247,255,.42),
    0 0 40px rgba(124,247,255,.28);
  -webkit-text-stroke: 1px rgba(124,247,255,.35);
}

@keyframes neonFlicker{
  0%, 100% { opacity: 1; filter: saturate(1.08); }
  6% { opacity: .95; }
  7% { opacity: .60; }
  8% { opacity: 1; }
  54% { opacity: .92; }
  55% { opacity: .70; }
  56% { opacity: 1; }
}

/* ========= Cards / layout ========= */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.05));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  overflow:hidden;
}

.top-screen{ padding: 18px; }

.row{
  display:flex;
  gap: 18px;
  align-items:center;
  justify-content:center;
  flex-wrap: wrap;
}

.vs{
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 1px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.25);
  text-shadow: 0 0 12px rgba(255,255,255,.25);
}

.avatarWrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 10px;
  min-width: 220px;
}

.avatar{
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow:hidden;
  border: 2px solid rgba(124,247,255,.35);
  box-shadow: 0 0 24px rgba(124,247,255,.12);
  background: rgba(0,0,0,.25);
  display:flex;
  align-items:center;
  justify-content:center;
}
.avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name{
  font-weight: 700;
  color: var(--muted);
}

/* ========= Buttons ========= */
.btn{
  cursor:pointer;
  border: 1px solid rgba(124,247,255,.28);
  background: rgba(124,247,255,.12);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: .2px;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, filter .15s ease;
  user-select:none;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
}

.btn:hover{
  background: rgba(124,247,255,.16);
  border-color: rgba(124,247,255,.45);
}
.btn:active{ transform: translateY(1px); }

.btn.secondary{
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
}

.btn[disabled]{ opacity:.55; cursor:not-allowed; }

/* Telegram button */
.btn.tg{
  background: var(--tg);
  border-color: var(--tg);
  color: #fff;
  box-shadow: 0 0 18px rgba(34,158,217,.25);
}
.btn.tg:hover{
  background: var(--tgHover);
  border-color: var(--tgHover);
  filter: brightness(1.02);
}
.tgIcon{
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Start block */
.startBlock{
  display:flex;
  flex-direction:column;
  gap: 12px;
  align-items:center;
  margin-top: 12px;
}

.startButtons{
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content:center;
  flex-wrap: wrap;
}

.hint{
  color: var(--muted);
  font-size: 13px;
  text-align:center;
  max-width: 820px;
}

/* ========= Battle screen ========= */
.battle{
  display:none;
  margin-top: 14px;
}

.battleGrid{
  display:grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 14px;
  padding: 14px;
}

.panel{
  background: rgba(0,0,0,.22);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.unit{
  display:flex;
  flex-direction:column;
  gap: 10px;
  align-items: center;
}

.unit .bigAvatar{
  width: 300px;
  height: 300px;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  justify-content:center;
}
.unit .bigAvatar img{
  width:100%;
  height:100%;
  object-fit: cover;
}

.bar{
  width: 100%;
  max-width: 300px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  overflow:hidden;
  position:relative;
}
.bar > .fill{
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(124,247,255,.65), rgba(124,247,255,.25));
  transition: width .25s ease;
}
.bar.danger > .fill{
  background: linear-gradient(90deg, rgba(255,77,109,.70), rgba(255,77,109,.25));
}

.barLabel{
  font-size: 13px;
  color: var(--muted);
  display:flex;
  justify-content:space-between;
  width: 100%;
  max-width: 300px;
}
.barLabel b{ color: rgba(255,255,255,.88); }

.actions{
  width:100%;
  display:flex;
  flex-direction:column;
  gap: 10px;
  align-items: stretch;
}

.attackList{
  display:flex;
  flex-direction:column;
  gap: 8px;
  width:100%;
}

.attackItem{
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  display:flex;
  gap: 10px;
  align-items:flex-start;
  cursor:pointer;
}
.attackItem:hover{
  border-color: rgba(124,247,255,.30);
  background: rgba(124,247,255,.07);
}
.attackItem input{
  margin-top: 3px;
  cursor:pointer;
}
.attackMeta{
  display:flex;
  flex-direction:column;
  gap: 2px;
}
.attackTitle{ font-weight: 900; }
.attackHint{
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.25;
}

.note{
  width:100%;
  max-width:300px;
  color: var(--muted);
  font-size: 13px;
  line-height:1.35;
  text-align:center;
}

/* ========= Battle Log (новая разметка) ========= */
.log{
  min-height: 420px;
  max-height: 520px;
  overflow:auto;
  padding: 12px;
}

.turn{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.turnLine{
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  margin-bottom: 10px;
  line-height: 1.35;
}

.turnLine:last-child{ margin-bottom: 0; }

.turnLine--prep,
.turnLine--gantver{
  font-weight: 800;
  letter-spacing: .1px;
  border-color: rgba(124,247,255,.18);
  background: rgba(124,247,255,.06);
}

.turnLine--gantver{
  border-color: rgba(255,122,162,.20);
  background: rgba(255,122,162,.06);
}

.turnLine--system{
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

.resultTag{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: .6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  margin-right: 10px;
}

.resultTag--ok{
  border-color: rgba(124,255,155,.35);
  background: rgba(124,255,155,.08);
}

.resultTag--fail{
  border-color: rgba(255,77,109,.35);
  background: rgba(255,77,109,.08);
}

.valueHp{
  color: var(--hp);
  font-weight: 900;
  text-shadow: 0 0 12px rgba(124,255,155,.16);
}

.valueMl{
  color: var(--ml);
  font-weight: 900;
  text-shadow: 0 0 12px rgba(255,122,162,.16);
}

/* ========= Modal (без прозрачности) ========= */
.overlay{
  display:none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 1000;
}

.modal{
  width: min(540px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.14);
  background: #0f151d;
  box-shadow: 0 20px 70px rgba(0,0,0,.65);
  overflow:hidden;
}

.modalHeader{
  padding: 16px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.modalHeader h2{
  margin: 0;
  font-size: 26px;
  letter-spacing: .5px;
}

.modalBody{
  padding: 14px 16px;
  display:flex;
  flex-direction:column;
  gap: 12px;
  align-items:center;
}
.modalImg{
  width: 100%;
  max-width: 460px;
  height: 260px;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: #0b1017;
  display:flex;
  align-items:center;
  justify-content:center;
}
.modalImg{
  height: auto;
  max-height: 70vh;
}

.modalImg img{
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.modalText{
  color: var(--muted);
  text-align:center;
}

.modalFooter{
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(255,255,255,.10);
  display:flex;
  gap: 10px;
  justify-content:center;
  flex-wrap: wrap;
}

@media (max-width: 980px){
  .battleGrid{ grid-template-columns: 1fr; }
  .log{ min-height: 260px; max-height: 360px; }
  .unit .bigAvatar{ width: 100%; max-width: 360px; height: 280px; }
  .bar, .barLabel{ max-width: 360px; }
}

@media (max-width: 767px) {
    
    .row{
        flex-direction: column;
    }
}
