:root{
  --bg: #0b0b0c;
  --text: #f0f3f8;
  --muted: #9aa3b2;
  --primary: #22c55e;
  --danger: #ef4444;
  --panel: #15161a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }
html,body,#app{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}

/* ---- Screens: pilha controlada e clique apenas na ativa ---- */
.screen{
  position: fixed;
  inset: 0;
  display: none;
  pointer-events: none;  /* não captura clique quando inativa */
}
.screen.active{
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;  /* só a ativa recebe cliques */
}

/* Força ordem das telas para evitar sobreposição indesejada */
#start-screen   { z-index: 10; }
#loading-screen { z-index: 20; }
#game-screen    { z-index: 15; }
#result-screen  { z-index: 18; }

.card{
  background: var(--panel);
  padding: 24px;
  width: min(640px, 92vw);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.card h1, .card h2{ margin: 0 0 12px 0; }
.card p{ color: var(--muted); }

.btn{
  appearance: none;
  border:0;
  border-radius: 12px;
  padding: 12px 18px;
  background: var(--primary);
  color: #061006;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
}
.btn:hover{ filter: brightness(1.06); }
.btn:active{ transform: translateY(1px); }
.btn-ghost{
  background: transparent;
  color: var(--text);
  outline: 2px solid #2b2f38;
  margin-left: 8px;
}

/* Loading */
.loading-box{
  display:flex; flex-direction:column; align-items:center; gap:16px;
}
.spinner{
  width: 48px; height: 48px; border-radius:50%;
  border: 4px solid #2b2f38; border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg);} }

/* Game */
#game-screen{
  display:flex; flex-direction:column; height:100%;
}
#hud{ display:none; }
#game-screen.active #hud{
  display:inline-flex;
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  gap: 12px; padding: 6px 10px;
  background: rgba(0,0,0,.35);
  border-radius: 999px;
  font-size: 14px;
  backdrop-filter: blur(6px);
  z-index: 50;
}
#hud-acertos{ color: var(--primary); font-weight:700; }
#hud-erros{ color: var(--danger); font-weight:700; }

#stage{
  height: 100%;
  width: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  user-select:none;
  -webkit-user-select:none;
  touch-action: manipulation;
  overflow:hidden;
}

/* Exibição da foto: 80% da vertical, corte central (cover) */
#photo{
  height: 70vh;
  width: 100vw;
  object-fit: cover;
  object-position: center;
  display:block;
  opacity: 0;                 /* só aparece após onload do ELEMENTO */
  transition: opacity .2s ease;
}
#photo.ready{ opacity: 1; }

#photo.top-crop{
  object-position: top center;
}

.details summary{ cursor:pointer; }
.details ol{ text-align:left; }
.actions{ margin-top: 12px; display:flex; justify-content:center; }


#thumb-preview {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

#thumb-preview .thumb-title {
  font-size: 0.9rem;
  margin: 0 0 6px;
  opacity: 0.8;
}

#thumb-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr); /* 10 colunas */
  gap: 4px;
}

.thumb-slot {
  width: 100%;
  aspect-ratio: 1 / 1; /* quadradinho */
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.thumb-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-slot.thumb-error {
  background: #ffe6e6;
  border-color: #ff7070;
  color: #c0392b;
}

.thumb-warning {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #c0392b;
}

.hidden {
  display: none;
}

.btn-small {
  margin-top: 8px;
  padding: 4px 12px;
  font-size: 0.9rem;
}
