/* =========================================================
   BRsys Arcade - Responsive / Mobile + Desktop Polish
   Path: /arcade/css/mobile.css
   ========================================================= */

/* Base mobile app */
@media (max-width: 679px) {
  :root {
    --bottom-nav-height: 72px;
  }

  body {
    overflow-x: hidden;
  }

  .app-shell {
    padding: 10px 10px calc(var(--bottom-nav-height) + 14px);
  }

  .page-title {
    margin-top: 4px;
  }

  h1 {
    font-size: clamp(1.55rem, 9vw, 2.25rem);
  }

  h2 {
    font-size: clamp(1.05rem, 6vw, 1.45rem);
  }

  p {
    font-size: .82rem;
  }

  .game-home-screen {
    gap: 10px;
    padding-bottom: 8px;
  }

  .game-home-topbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .game-resource-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-stat-pill {
    min-width: 0;
    padding: 6px 7px;
  }

  .game-stat-pill small {
    font-size: .52rem;
  }

  .game-stat-pill strong {
    font-size: .72rem;
  }

  .game-character-stage {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .character-portrait {
    width: min(190px, 58vw);
    height: 190px;
    margin: 0 auto;
  }

  .character-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .character-info h1 {
    font-size: 1.25rem;
  }

  .character-info p {
    font-size: .75rem;
  }

  .character-actions {
    grid-template-columns: 1fr 1fr;
  }

  .character-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .quick-access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-access-card {
    min-height: 58px;
    padding: 10px;
  }

  .game-skill-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .game-skill-mini {
    min-height: 82px;
    padding: 8px 4px;
  }

  .game-skill-mini-img {
    width: 34px;
    height: 34px;
  }

  .game-skill-mini strong {
    font-size: .58rem;
  }

  .game-skill-mini small {
    font-size: .5rem;
  }

  .game-daily-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .game-daily-card {
    padding: 11px;
  }

  .game-daily-card h2 {
    font-size: .98rem;
  }

  .game-carousel {
    grid-auto-columns: minmax(178px, 72vw);
  }

  .games-grid.full {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 96px;
    padding: 11px;
  }

  .game-art-img {
    width: 54px;
    height: 54px;
    border-radius: 15px;
  }

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

  .avatar-card {
    min-height: 150px;
  }

  .avatar-frame,
  .profile-avatar-card-img,
  .avatar-art {
    max-width: 68px;
    max-height: 68px;
  }

  .profile-avatar-img {
    max-height: 210px;
  }

  .inventory-hero,
  .garage-hero,
  .workshop-hero,
  .achievements-hero,
  .profile-hero {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .inventory-equipped-grid,
  .inventory-material-grid,
  .inventory-catalog-row,
  .garage-vehicle-grid,
  .workshop-research-grid,
  .achievements-grid,
  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .inventory-item-img,
  .inventory-catalog-img,
  .garage-vehicle-img,
  .workshop-research-card img,
  .achievement-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
  }

  .inventory-equipped-card,
  .inventory-catalog-card,
  .garage-vehicle-card,
  .workshop-research-card,
  .achievement-card {
    overflow: hidden;
  }

  .bottom-nav {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
    height: var(--bottom-nav-height);
    padding: 7px;
    border-radius: 22px;
  }

  .bottom-nav a {
    font-size: .58rem;
  }

  .nav-icon,
  .bottom-nav a::before {
    width: 17px;
    height: 17px;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: calc(var(--bottom-nav-height) + 18px);
  }
}

/* Muito estreito */
@media (max-width: 380px) {
  .app-shell {
    padding-inline: 8px;
  }

  .game-profile-chip strong {
    font-size: .74rem;
  }

  .game-profile-chip small {
    font-size: .56rem;
  }

  .character-portrait {
    width: 158px;
    height: 158px;
  }

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

  .game-skill-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav a {
    font-size: 0;
  }

  .bottom-nav a .nav-icon,
  .bottom-nav a::before {
    margin: auto;
  }
}

/* Tablets */
@media (min-width: 680px) {
  .app-shell {
    padding-inline: 20px;
  }

  .game-character-stage {
    grid-template-columns: 220px 1fr;
  }

  .character-stats-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .game-daily-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .avatar-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reward-grid,
  .inventory-material-grid,
  .profile-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Desktop */
@media (min-width: 980px) {
  :root {
    --bottom-nav-height: 76px;
  }

  body {
    overflow-y: auto;
  }

  .app-shell {
    max-width: 1180px;
    padding: 18px 16px 104px;
  }

  .game-home-screen {
    display: grid;
    gap: 14px;
  }

  .game-home-topbar {
    grid-template-columns: 1fr auto;
  }

  .game-character-stage {
    grid-template-columns: 260px 1fr 220px;
    align-items: center;
    min-height: 260px;
    max-height: 320px;
    overflow: hidden;
  }

  .character-portrait {
    width: 240px;
    height: 240px;
  }

  .character-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .character-info h1 {
    font-size: 1.7rem;
  }

  .character-info p {
    font-size: .86rem;
  }

  .character-stats-grid {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-access-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .game-skill-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .game-skill-mini {
    min-height: 92px;
  }

  .game-skill-mini-img {
    width: 44px;
    height: 44px;
  }

  .game-daily-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-carousel {
    grid-auto-columns: 240px;
  }

  .games-grid.full {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .game-card {
    min-height: 180px;
  }

  .game-art-img {
    width: 70px;
    height: 70px;
  }

  .avatar-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .reward-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .inventory-hero,
  .garage-hero,
  .workshop-hero,
  .achievements-hero,
  .profile-hero {
    display: grid;
    grid-template-columns: 1fr 220px;
    align-items: center;
    gap: 16px;
    max-height: 320px;
    overflow: hidden;
  }

  .inventory-equipped-grid,
  .inventory-catalog-row,
  .garage-vehicle-grid,
  .workshop-research-grid,
  .achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .inventory-item-img,
  .inventory-catalog-img,
  .garage-vehicle-img {
    width: 82px;
    height: 82px;
    object-fit: contain;
  }

  .profile-avatar-img {
    max-height: 260px;
    object-fit: contain;
  }

  .bottom-nav {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 16px;
    width: min(720px, calc(100% - 32px));
    transform: translateX(-50%);
  }

  .toast {
    right: auto;
    left: 50%;
    width: min(460px, calc(100% - 28px));
    transform: translateX(-50%);
    bottom: calc(var(--bottom-nav-height) + 22px);
  }
}

/* Desktop largo */
@media (min-width: 1280px) {
  .app-shell {
    max-width: 1120px;
  }

  .character-portrait {
    width: 230px;
    height: 230px;
  }
}

/* Fullscreen do jogo */
body.is-zq-playing {
  overflow: hidden !important;
}

body.is-zq-playing .bottom-nav {
  display: none !important;
}

/* =========================================================
   BRsys Arcade - Fine Polish Fixes
   ========================================================= */

/* Evita corte estranho no personagem da home */
.character-spotlight {
  min-height: 250px;
  overflow: visible;
}

.character-portrait {
  overflow: visible !important;
}

.character-portrait-img {
  transform: translateY(4px);
}

/* Botões com contraste melhor */
.btn-primary,
.btn-secondary,
.icon-button,
button {
  color: #f7fbff !important;
  font-weight: 900;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
}

.btn-primary {
  color: #03110c !important;
  text-shadow: none;
}

.character-actions .btn-primary,
.character-actions .btn-secondary {
  min-height: 42px;
  font-size: .82rem;
}

/* Inputs do perfil com cara de jogo */
.profile-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(57,255,136,.28);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(5,10,20,.72);
  outline: none;
}

.profile-form input:focus {
  border-color: rgba(57,255,136,.75);
  box-shadow: 0 0 0 3px rgba(57,255,136,.12);
}

.profile-form {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 10px;
  align-items: end;
}

.profile-form label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: .78rem;
  font-weight: 800;
}

/* Ranking da home menor */
.ranking-list.compact {
  display: grid;
  gap: 8px;
}

.ranking-list.compact .ranking-row {
  min-height: 58px;
  grid-template-columns: 38px 42px 1fr auto;
  padding: 9px 10px;
  overflow: hidden;
}

.ranking-avatar-img {
  width: 38px !important;
  height: 38px !important;
  border-radius: 12px;
  object-fit: cover !important;
}

.ranking-list.compact .ranking-row strong {
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-list.compact .ranking-row em {
  font-size: .78rem;
}

/* Evita imagens gigantes no ranking e perfil */
.ranking-screen img,
.profile-screen img {
  max-height: 260px;
  object-fit: contain;
}

/* Ajuste desktop */
@media (min-width: 980px) {
  .game-character-stage {
    min-height: 250px;
    max-height: 290px;
  }

  .character-spotlight {
    min-height: 240px;
  }

  .character-portrait {
    width: 235px;
    height: 235px;
  }

  .profile-hero {
    min-height: 300px;
    max-height: 360px;
    overflow: hidden;
  }

  .profile-avatar-stage {
    max-height: 300px;
    overflow: hidden;
  }

  .profile-avatar-img {
    max-height: 300px !important;
    object-fit: contain;
  }
}

/* Ajuste mobile */
@media (max-width: 679px) {
  .profile-form {
    grid-template-columns: 1fr;
  }

  .character-spotlight {
    min-height: 185px;
  }

  .ranking-list.compact .ranking-row {
    grid-template-columns: 30px 34px 1fr auto;
  }

  .ranking-avatar-img {
    width: 34px !important;
    height: 34px !important;
  }
}
