/* =====================================================
   VARIÁVEIS E RESET
   ===================================================== */

:root{
  --bg: #f4f7f1;
  --card-bg: #ffffff;
  --accent: #4caf50;
  --accent-dark: #388e3c;
  --accent-strong: #7cb342;
  --muted: #666;
  --danger: #d32f2f;
  --shadow: 0 0 20px rgba(0,0,0,.1);
  --radius: 12px;
  --input-radius: 8px;
  --font-family: Arial, Helvetica, sans-serif;
  --xp-max: 5000;
}

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

html, body{
  height: 100%;
  background: var(--bg);
  color: #222;
}

/* regra global para imagens (mantida) */
img{
  max-width: 100%;
  display: block;
  height: auto;
}

/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */

.painel{
  width: 100%;
  max-width: 1200px;
  margin: 24px auto;
  background: var(--card-bg);
  min-height: 700px;
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* Topo: perfil + ação (sair) */
.topo{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:18px;
}

.topo-left{ display:flex; align-items:center; gap:12px; }
.topo-right{ display:flex; align-items:center; gap:12px; }

/* Botão sair */
.sair{
  background: var(--danger);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight:600;
}
.sair:hover{ background:#b71c1c; }

/* Cards */
.card{
  background: #f7f7f7;
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 18px;
}
.card h2{ margin-bottom:12px; }

/* Check-in buttons */
.humor-form{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.humor-form button{
  background:#fff;
  border:1px solid #ddd;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  transition:transform .12s, box-shadow .12s;
}
.humor-form button:hover{ transform:translateY(-3px); box-shadow:0 8px 20px rgba(0,0,0,.06); }

/* Mensagens */
.erro{ background:#ffebee; color:#c62828; padding:10px; border-radius:8px; margin-bottom:12px; }
.sucesso{ background:#e8f5e9; color:#2e7d32; padding:12px; border-radius:8px; }

/* =====================================================
   PERFIL, AVATAR E XP
   ===================================================== */

.perfil{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}

.avatar{
  width:80px;
  height:80px;
  border-radius:50%;
  object-fit:cover;
  border:4px solid rgba(124,179,66,0.12);
  box-shadow:0 6px 18px rgba(0,0,0,0.08);
  flex-shrink:0;
}

.dados{
  flex:1 1 auto;
  min-width:0;
}

.nickname{
  font-size:1.15rem;
  font-weight:700;
  color:#2e7d32;
  margin-bottom:8px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* XP */
.xp-bar-container{
  width:100%;
  max-width:360px;
}

.xp-bar{
  width:100%;
  height:18px;
  background:#e6e6e6;
  border-radius:999px;
  overflow:hidden;
  position:relative;
}

.xp-progress{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, #8bc34a, #4caf50);
  transition: width 700ms cubic-bezier(.2,.9,.2,1);
  border-radius:999px;
  box-shadow:0 6px 18px rgba(76,175,80,0.12) inset;
}

.xp-text{
  margin-top:8px;
  font-size:0.95rem;
  color:var(--muted);
}

/* =====================================================
   VIEWPORT / WORLD / TREE (SEM ALTERAÇÕES LÓGICAS)
   ===================================================== */

#viewport{
  width: 100%;
  height: 600px;
  overflow: hidden;
  position: relative;
  border: 3px solid var(--accent-strong);
  border-radius: 15px;
  background: #87ceeb;
  cursor: grab;
}

#viewport:active{
  cursor: grabbing;
}

#world{
  width: 5000px;
  height: 5000px;
  position: absolute;
  background: #7ac74f;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 32px 32px;
}

.tree{
  position: absolute;
  font-size: 40px;
  line-height: 1;
  user-select: none;
  transform: translate(-50%,-50%);
  filter: drop-shadow(2px 3px 3px rgba(0,0,0,.25));
}

.tree:hover{
  transform: translate(-50%,-50%) scale(1.15);
}

/* =====================================================
   RESPONSIVO
   ===================================================== */

@media (max-width: 900px){
  .painel{ padding:16px; }
  #viewport{ height:480px; }
}

@media (max-width: 600px){
  .topo{ flex-direction:column; align-items:flex-start; gap:12px; }
  .avatar{ width:64px; height:64px; }
  #viewport{ height:40vh; }
}
