/* ===== MENU ===== */
#menu{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);

  width: min(92vw, 420px);
  max-height: min(82vh, 760px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  padding: 15px;

  /* 🎮 FUNDO MEDIEVAL */
  background: linear-gradient(180deg, rgba(40,25,10,0.95), rgba(10,5,0,0.95));

  /* 🛡️ BORDA DOURADA */
  border: 2px solid #c8a85d;
  border-radius: 16px;

  /* ✨ SOMBRA */
  box-shadow:
    0 0 20px rgba(0,0,0,0.8),
    0 0 10px rgba(200,168,93,0.2),
    inset 0 0 15px rgba(0,0,0,0.9);

  display: none;
  flex-direction: column;
  gap: 10px;

  color: #f5e6c8;

  /* fica acima dos botões do jogo (#attack/#magic/#inv/#openMenu usam z-index 60) */
  z-index: 5000;
  opacity: 0;
  transition: all 0.25s ease;
}

#menu.show{
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);

  box-shadow:
    0 0 25px rgba(200,168,93,0.3),
    inset 0 0 12px rgba(0,0,0,0.9);
}

#menu h2{
  text-align: center;
  margin: 0;
  color: #e0c070;
  text-shadow:
    0 0 6px rgba(255,215,0,0.4),
    0 0 2px black;
}

/* ===== STATS ===== */
#stats{
  background: rgba(0,0,0,0.6);
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid rgba(200,168,93,0.2);
}

#stats p{
  margin: 4px 0;
}

/* ===== BOTÕES ===== */
.menuBtns{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menuBtns button{
  width: 100%;
  padding: 10px;

  border: 1px solid #5a3b1a;
  border-radius: 10px;

  background: linear-gradient(180deg, #3a2a12, #1a1208);

  color: #f5e6c8;
  font-size: 14px;

  cursor: pointer;

  box-shadow:
    inset 0 0 6px rgba(0,0,0,0.8),
    0 0 5px rgba(0,0,0,0.5);
}

.menuBtns button:active{
  background: #2a1a0a;
}

/* ===== MENU DE GRÁFICOS ===== */
#graphicsMenu{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  z-index: 9999;

  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.g-card{
  background: linear-gradient(180deg, #1a1208, #000);
  padding: 16px;
  border-radius: 12px;
  width: min(92vw, 360px);
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #f5e6c8;
  box-sizing: border-box;
  margin: auto 0;

  border: 1px solid #c8a85d;
}

.g-card h2{
  text-align: center;
  margin: 0 0 4px 0;
  color: #e0c070;
}

.g-card select,
.g-card button{
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
}

.g-card button{
  background: linear-gradient(180deg, #3a2a12, #1a1208);
  color: #f5e6c8;
  cursor: pointer;
}

/* 📱 RETRATO */
@media (orientation: portrait){
  #menu{
    width: min(92vw, 420px);
  }

  .g-card{
    width: min(92vw, 360px);
  }
}

/* 📺 PAISAGEM */
@media (orientation: landscape){
  #menu{
    width: min(72vw, 500px);
  }

  .g-card{
    width: min(72vw, 420px);
    max-width: 420px;
  }
}

/* TELAS BAIXAS */
@media (max-height: 500px){
  #menu{
    max-height: 88vh;
  }

  .g-card{
    width: min(92vw, 420px);
  }
}
/* ===== BUILD / PONTOS ===== */
.stat-build-panel{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.22);
}

.stat-build-head{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-build-head > div{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(200,168,93,.26);
  border-radius: 10px;
  background: rgba(0,0,0,.35);
}

.stat-build-head span{
  color: #ffe08a;
  font-weight: 800;
}

.stat-build-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.stat-build-row{
  display: grid;
  grid-template-columns: minmax(88px, 1fr) 34px 42px 34px 34px;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(200,168,93,.22);
  border-radius: 10px;
  background: rgba(10,5,0,.42);
}

.stat-build-row b{
  display: block;
  color: #f6d783;
  font-size: 13px;
  line-height: 1.1;
}

.stat-build-row small{
  color: #d9c7a3;
  font-size: 10px;
  line-height: 1.1;
}

.stat-build-row > span{
  text-align: center;
  font-weight: 800;
  color: #fff1b8;
}

.stat-build-row > small[id$="PendingText"]{
  min-width: 34px;
  text-align: center;
  color: #7cff9c;
  font-weight: 800;
}

.stat-build-row button,
.stat-build-actions button{
  min-height: 32px;
  border: 1px solid #7b5724;
  border-radius: 9px;
  background: linear-gradient(180deg, #4a3516, #1c1207);
  color: #ffe8af;
  font-weight: 800;
  box-shadow: inset 0 0 5px rgba(0,0,0,.75);
}

.stat-build-row button:disabled,
.stat-build-actions button:disabled{
  opacity: .45;
}

.stat-build-actions{
  display: flex;
  margin-top: 9px;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-build-actions button{
  flex: 1 1 120px;
  padding: 9px;
}

.stat-build-help{
  display: block;
  margin-top: 8px;
  color: #d8c9a7;
  font-size: 11px;
  line-height: 1.3;
}

/* 📺 MENU EM PAISAGEM */
@media (orientation: landscape){
  #menu{
    width: min(94vw, 860px);
    max-height: min(88vh, 520px);
    padding: 12px;
    gap: 8px;
  }

  #menu h2{
    font-size: 18px;
    margin-bottom: 2px;
  }

  #stats{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    font-size: 13px;
    padding: 9px;
  }

  #stats > p{
    margin: 0;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,.045);
  }

  #statPointsPanel{
    grid-column: 1 / -1;
  }

  .stat-build-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-build-row{
    grid-template-columns: minmax(86px, 1fr) 32px 38px 32px 32px;
    padding: 6px;
  }

  .menuBtns{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .menuBtns button{
    padding: 8px;
    font-size: 13px;
  }
}

@media (orientation: landscape) and (max-height: 430px){
  #menu{
    max-height: 94vh;
    padding: 9px;
  }

  #stats{
    font-size: 12px;
    gap: 5px 7px;
  }

  .stat-build-row{
    min-height: 30px;
  }

  .stat-build-row button,
  .stat-build-actions button{
    min-height: 28px;
  }

  .stat-build-help{
    display: none;
  }
}

/* ===== STATUS PRINCIPAL MODERNO ===== */
.legacy-stat-hidden{
  display: none !important;
}

.status-overview-panel{
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid rgba(200,168,93,.28);
  border-radius: 12px;
  background: rgba(0,0,0,.28);
}

.status-overview-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #ffe08a;
  font-weight: 800;
  font-size: 13px;
}

.status-overview-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.status-cell{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 9px;
  background: rgba(0,0,0,.32);
  box-sizing: border-box;
}

.status-cell b{
  color: #f5e6c8;
  font-size: 12px;
  white-space: nowrap;
}

.status-cell span{
  color: #ffe08a;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

@media (orientation: landscape){
  .status-overview-grid{
    grid-template-columns: 1fr 1fr;
  }

  .status-cell{
    min-height: 24px;
    padding: 5px 8px;
  }
}

/* ===== AJUSTE VISUAL COMPACTO - referência chat.css ===== */
#menu{
  font-family: Arial, sans-serif;
  font-size: 12px;
  line-height: 1.15;
  background: linear-gradient(180deg, rgba(35,22,10,.94), rgba(8,5,2,.95));
  border-color: rgba(210,170,90,.72);
  box-shadow:
    0 0 22px rgba(0,0,0,.82),
    0 0 12px rgba(210,170,90,.18),
    inset 0 0 18px rgba(0,0,0,.88);
  backdrop-filter: blur(8px);
}

#menu h2{
  font-size: 18px;
  letter-spacing: .3px;
}

#stats{
  font-size: 12px;
  background: rgba(0,0,0,.42);
  border-color: rgba(210,170,90,.22);
}

#stats p{
  font-size: 12px;
  line-height: 1.15;
}

.status-overview-panel{
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(0,0,0,.34);
  border-color: rgba(210,170,90,.24);
}

.status-overview-head{
  font-size: 12px;
  margin-bottom: 6px;
}

.status-overview-grid{
  gap: 5px;
}

.status-cell{
  min-height: 24px;
  padding: 5px 7px;
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}

.status-cell b,
.status-cell span{
  font-size: 11px;
}

.stat-build-panel{
  margin-top: 8px;
  padding-top: 8px;
}

.stat-build-head{
  gap: 6px;
  margin-bottom: 6px;
}

.stat-build-head > div{
  padding: 6px 7px;
  border-radius: 9px;
  font-size: 11px;
}

.stat-build-row{
  padding: 6px;
  gap: 5px;
  border-radius: 9px;
  background: rgba(0,0,0,.32);
}

.stat-build-row b{
  font-size: 12px;
}

.stat-build-row small{
  font-size: 9px;
}

.stat-build-row > span,
.stat-build-row > small[id$="PendingText"]{
  font-size: 12px;
}

.stat-build-row button,
.stat-build-actions button{
  min-height: 28px;
  border-radius: 8px;
  font-size: 12px;
}

.stat-build-actions{
  margin-top: 7px;
  gap: 6px;
}

.stat-build-actions button{
  padding: 7px;
}

.stat-build-help{
  font-size: 10px;
  line-height: 1.2;
  margin-top: 6px;
}

.menuBtns{
  gap: 6px;
}

.menuBtns button{
  padding: 8px;
  font-size: 12px;
  border-radius: 9px;
}

@media (orientation: landscape){
  #menu{
    width: min(92vw, 820px);
    max-height: min(88vh, 500px);
    padding: 10px;
    gap: 7px;
  }

  #menu h2{
    font-size: 17px;
  }

  #stats{
    font-size: 11px;
    gap: 5px 7px;
    padding: 8px;
  }

  #stats > p{
    padding: 5px 7px;
    border-radius: 7px;
  }

  .status-cell{
    min-height: 22px;
    padding: 4px 7px;
  }

  .stat-build-row{
    grid-template-columns: minmax(82px, 1fr) 30px 34px 30px 30px;
    min-height: 34px;
  }

  .menuBtns button{
    padding: 7px;
    font-size: 12px;
  }
}

@media (orientation: portrait){
  #menu{
    font-size: 12px;
    padding: 12px;
  }

  .status-cell b,
  .status-cell span{
    font-size: 11px;
  }
}
