:root{
  --bg:#05070b;
  --panel: rgba(10,16,22,.65);
  --panel2: rgba(10,16,22,.35);
  --neon:#00ffb3;
  --neon2:#00c7ff;
  --danger:#ff3b5c;
  --text:#d6fff4;
  --muted: rgba(214,255,244,.65);
  --shadow: 0 0 24px rgba(0,255,179,.18), 0 0 60px rgba(0,199,255,.10);
  --radius:16px;
  --radius2:22px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 600px at 50% 20%, rgba(0,255,179,.08), transparent 60%),
              radial-gradient(900px 500px at 20% 70%, rgba(0,199,255,.06), transparent 60%),
              linear-gradient(180deg, #03050a, #05070b 55%, #03050a);
  color:var(--text);
  overflow:hidden;
}

.bgGlow{
  position:fixed; inset:-40px;
  filter: blur(18px);
  opacity:.55;
  pointer-events:none;
  background:
    radial-gradient(500px 260px at 55% 40%, rgba(0,255,179,.12), transparent 65%),
    radial-gradient(420px 260px at 35% 55%, rgba(0,199,255,.10), transparent 65%);
}

.topbar{
  position:fixed; left:0; right:0; top:0;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  z-index:10;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.10));
  border-bottom: 1px solid rgba(0,255,179,.10);
}

.brand{
  font-weight:800;
  letter-spacing:2px;
  color: rgba(0,255,179,.95);
  text-shadow: 0 0 18px rgba(0,255,179,.25);
}
.brand span{color: rgba(0,199,255,.95)}
.brand em{
  font-style:normal;
  font-weight:700;
  letter-spacing:3px;
  margin-left:10px;
  color: rgba(214,255,244,.75);
}

.topRight{display:flex; gap:10px}

.pill{
  border:1px solid rgba(0,255,179,.22);
  background: rgba(0,0,0,.35);
  color: var(--text);
  padding:8px 10px;
  border-radius:999px;
  cursor:pointer;
  box-shadow: var(--shadow);
  transition:.15s transform, .15s filter;
}
.pill:hover{transform: translateY(-1px); filter: brightness(1.1)}
.pill.danger{border-color: rgba(255,59,92,.35); box-shadow: 0 0 18px rgba(255,59,92,.12)}

.wrap{
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding-top:64px;
}

.stage{
  position:relative;
  width:min(1200px, 96vw);
  height:min(720px, 86vh);
  border-radius: var(--radius2);
  border:1px solid rgba(0,255,179,.16);
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.25));
  box-shadow: 0 0 45px rgba(0,255,179,.12), 0 0 120px rgba(0,199,255,.08);
  overflow:hidden;
}

#game{
  width:100%;
  height:100%;
  display:block;
}

.hud{
  position:absolute; left:14px; right:14px; bottom:14px;
  display:grid;
  grid-template-columns: 1fr 1.2fr 0.8fr;
  gap:12px;
  pointer-events:none;
}

.panel{
  pointer-events:auto;
  border-radius: var(--radius);
  background: var(--panel);
  border:1px solid rgba(0,255,179,.14);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding:10px 12px;
}

.row{display:flex; gap:10px; flex-wrap:wrap}
.stat{
  display:flex; gap:6px; align-items:baseline;
  padding:6px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(0,255,179,.10);
}
.stat span{color: var(--muted); font-size:12px; letter-spacing:1px}
.stat b{font-size:14px; color: rgba(0,255,179,.95)}
.stat i{font-style:normal; color: rgba(214,255,244,.75)}

.log{display:flex; flex-direction:column; gap:8px}
.logTitle{
  font-weight:800;
  letter-spacing:2px;
  color: rgba(0,199,255,.9);
}
#log{
  font-size:12px;
  line-height:1.35;
  max-height:110px;
  overflow:hidden;
  color: rgba(214,255,244,.85);
}
#log .dim{color: rgba(214,255,244,.55)}

.hotbar{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
}
.slot{
  flex:1;
  cursor:pointer;
  border-radius: 14px;
  padding:10px 10px;
  border:1px solid rgba(0,255,179,.18);
  background: rgba(0,0,0,.28);
  color: rgba(214,255,244,.9);
  font-weight:800;
  letter-spacing:1px;
  box-shadow: var(--shadow);
  transition:.15s transform, .15s filter;
}
.slot:hover{transform: translateY(-1px); filter: brightness(1.1)}
.slot:active{transform: translateY(0px); filter: brightness(1.0)}

.overlay{
  position:absolute; inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: radial-gradient(900px 400px at 50% 40%, rgba(0,255,179,.10), transparent 65%),
              rgba(0,0,0,.55);
  z-index:20;
  padding:18px;
}

.card{
  width:min(760px, 92vw);
  border-radius: var(--radius2);
  background: rgba(5,10,14,.85);
  border:1px solid rgba(0,255,179,.18);
  box-shadow: 0 0 55px rgba(0,255,179,.14), 0 0 140px rgba(0,199,255,.08);
  padding:18px 18px 14px;
}

.title{
  font-size:42px;
  font-weight:900;
  letter-spacing:6px;
  text-align:center;
  color: rgba(0,255,179,.96);
  text-shadow: 0 0 30px rgba(0,255,179,.18);
}
.sub{
  margin-top:8px;
  text-align:center;
  color: rgba(214,255,244,.70);
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  margin-top:14px;
}
.tip{
  border-radius: 16px;
  border:1px solid rgba(0,199,255,.14);
  background: rgba(0,0,0,.25);
  padding:12px;
  color: rgba(214,255,244,.82);
}
.tip b{color: rgba(0,199,255,.95)}

.actions{
  margin-top:14px;
  display:flex;
  justify-content:center;
  gap:12px;
}
.btn{
  cursor:pointer;
  border-radius: 16px;
  padding:12px 16px;
  border:1px solid rgba(0,199,255,.22);
  background: rgba(0,0,0,.25);
  color: rgba(214,255,244,.88);
  font-weight:900;
  letter-spacing:2px;
  transition:.15s transform, .15s filter;
}
.btn:hover{transform: translateY(-1px); filter: brightness(1.1)}
.btn.primary{
  border-color: rgba(0,255,179,.28);
  color: rgba(0,255,179,.95);
}

.titleRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.titleSmall{
  font-weight:900;
  letter-spacing:3px;
  color: rgba(0,255,179,.92);
}
.helpText{margin-top:10px; color: rgba(214,255,244,.82); line-height:1.5}

.card.inv{width:min(860px, 94vw)}
.invGrid{
  display:grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap:12px;
  margin-top:10px;
}
.invCol{
  border-radius: 16px;
  border:1px solid rgba(0,199,255,.14);
  background: rgba(0,0,0,.25);
  padding:12px;
}
.invHead{
  font-weight:900;
  letter-spacing:2px;
  color: rgba(0,199,255,.92);
  margin-bottom:8px;
}
.invLine{color: rgba(214,255,244,.85); margin:6px 0}
.items{display:flex; flex-direction:column; gap:8px; max-height:320px; overflow:auto}
.itemBtn{
  cursor:pointer;
  text-align:left;
  border-radius: 14px;
  padding:10px 10px;
  border:1px solid rgba(0,255,179,.14);
  background: rgba(0,0,0,.22);
  color: rgba(214,255,244,.86);
  font-weight:700;
  letter-spacing:.5px;
}
.itemBtn:hover{filter: brightness(1.1)}
.itemBtn .tag{color: rgba(0,255,179,.9); font-weight:900}
.itemBtn .subtag{color: rgba(214,255,244,.65); font-weight:700}

.hint{
  margin-top:10px;
  color: rgba(214,255,244,.65);
  font-size:12px;
}

.toast{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  top:72px;
  z-index:30;
  background: rgba(0,0,0,.55);
  border:1px solid rgba(0,255,179,.20);
  color: rgba(214,255,244,.9);
  padding:10px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

/* Mobile pad */
.mobilePad{
  position:absolute;
  left:14px;
  top:84px;
  z-index:12;
  display:none;
  gap:8px;
  flex-direction:column;
  user-select:none;
}
.mobilePad .mid{display:flex; gap:8px; justify-content:center}
.mBtn{
  width:52px; height:52px;
  border-radius: 16px;
  border:1px solid rgba(0,255,179,.18);
  background: rgba(0,0,0,.30);
  color: rgba(0,255,179,.95);
  font-weight:900;
  box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 980px){
  .hud{grid-template-columns: 1fr; }
  .stage{height:min(760px, 88vh)}
  .mobilePad{display:flex;}
  .grid{grid-template-columns:1fr}
  .title{font-size:36px}
}

/* FIX overlays */
.overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* === GAME LAYOUT FIX === */

.stage {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 0;
}

/* Игровое поле */
#game {
  flex: 1;
  max-height: calc(100% - 190px); /* место под HUD */
}

/* Нижняя панель */
.hud {
  position: relative;
  margin-top: 10px;
  height: 180px;
  pointer-events: auto;
}

/* Убираем наложение */
.overlay {
  z-index: 50;
}

.mobilePad {
  bottom: 200px;
}

/* ====== HUD NOT OVERLAP + VISUAL BOOST ====== */
.overlay[hidden]{display:none !important; pointer-events:none !important; opacity:0 !important;}

/* чуть поднять HUD и сделать его компактнее */
.hud{
  grid-template-columns: 1fr 1.2fr 0.9fr;
  gap:10px;
}
@media (max-width: 980px){
  .hud{grid-template-columns:1fr}
}

/* табличка рекордов/баннер */
.toast{
  top:72px;
  max-width:min(720px, 92vw);
  text-align:center;
  font-weight:900;
  letter-spacing:1px;
}

/* маленький неоновый акцент */
.panel, .slot, .pill{
  box-shadow: 0 0 22px rgba(0,255,179,.14), 0 0 60px rgba(0,199,255,.08);
}

/* Кнопка "В меню" */
.pill.back {
  text-decoration: none;
  color: #7fffd4;
  border: 1px solid rgba(0,255,179,0.45);
  background: rgba(0,255,179,0.05);
  transition: all 0.2s ease;
}

.pill.back:hover {
  background: rgba(0,255,179,0.18);
  box-shadow: 0 0 12px rgba(0,255,179,0.6);
  transform: translateY(-1px);
}



