
:root{
  --brand:#2D7E8E; --ok:#2ecc71; --bad:#e74c3c;
  --glass:rgba(255,255,255,.08); --glass-2:rgba(255,255,255,.18); --text:#ffffff;
  --pill:rgba(0,0,0,.25);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--brand); color:var(--text);
  font-family:"Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  text-align:center; display:flex; flex-direction:column;
}
.wrap{ width:100%; max-width:980px; margin:0 auto; padding:10px 14px 16px;
       display:flex; flex-direction:column; align-items:center; gap:8px; }
/* Topic pill */
.topic-pill{
  display:inline-flex; align-items:center; gap:8px;
  background:var(--pill); padding:6px 10px; border-radius:999px;
  letter-spacing:.2px; margin-top:2px;
  box-shadow:0 6px 14px rgba(0,0,0,.18);
}
.topic-dot{ width:10px; height:10px; border-radius:50%; background:#fff; opacity:.9; }
/* Timer */
.timebar{ width:min(780px,96%); height:10px; background:rgba(255,255,255,.25);
          margin:6px auto 6px; border-radius:6px; overflow:hidden; }
.timebar-fill{ height:100%; width:100%;
               background:linear-gradient(90deg,#4caf50,#81c784);
               transition: width 1s linear; }
.meta{ font-size:15px; opacity:.95; margin-top:0; }
.question{ font-size:21px; margin:8px auto 6px;
           max-width:840px; padding:0 6px; line-height:1.25; }

/* Answers (3+) */
.answers{ width:100%; max-width:840px; margin:4px auto 6px;
          display:flex; flex-direction:column; align-items:center; gap:8px; }
.answer{
  width:min(840px,96%); text-align:left; border:2px solid rgba(255,255,255,.35);
  background:var(--glass); color:#fff; border-radius:12px; padding:10px 12px;
  cursor:pointer; display:flex; align-items:center; gap:10px; position:relative;
  overflow:hidden; backdrop-filter:saturate(120%) blur(0px);
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
  box-shadow:0 8px 14px rgba(0,0,0,.18);
}
.answer:hover{ transform:translateY(-1px); background:var(--glass-2); }
.answer:disabled{ opacity:.78; cursor:default; filter:grayscale(.12); }
.letter{
  width:28px; height:28px; border-radius:999px; background:rgba(255,255,255,.22);
  display:inline-flex; align-items:center; justify-content:center;
  flex:0 0 28px;
}
.answer.correct{ border-color:#7CFC9A; background:rgba(76,175,80,.18); }
.answer.wrong{   border-color:#ff867c; background:rgba(231,76,60,.16); }

/* Ranking below answers (then logo) */
.ranking{ width:100%; max-width:960px; margin:6px auto 4px; padding:6px 6px 0;
          display:flex; justify-content:center; gap:10px; flex-wrap:wrap; }
.player{ min-width:80px; max-width:96px; display:flex; flex-direction:column; align-items:center; gap:2px; }
.avatar{ width:50px; height:50px; border-radius:50%; border:2px solid #fff;
         background:transparent; object-fit:cover; transition: box-shadow .2s ease; }
.player.correct .avatar{ box-shadow:0 0 0 3px rgba(46,204,113,.95), 0 0 12px rgba(46,204,113,.85); }
.player.wrong   .avatar{ box-shadow:0 0 0 3px rgba(231,76,60,.95),  0 0 12px rgba(231,76,60,.85); }
.points{ font-size:.78em; margin-top:0; }
.nick{ font-size:.76em; opacity:.92; text-overflow:ellipsis; max-width:100%;
       overflow:hidden; white-space:nowrap; }
.avatar-wrap{ position:relative; width:50px; height:50px; }
.badge{
  position:absolute; right:-4px; bottom:-4px; width:16px; height:16px; border-radius:50%;
  display:none; align-items:center; justify-content:center; color:#fff; font-size:10px;
  border:2px solid #fff;
}
.player.correct .badge{ display:flex; background:#2ecc71; }
.player.wrong  .badge{ display:flex; background:#e74c3c; }

/* Logo under ranking */
.logo{ height:2.2cm; margin:2px auto 6px; display:block; }

/* Topic selection */
.topics-wrap{ width:100%; max-width:960px; margin:0 auto; padding:10px 14px 16px; }
.desc{
  width:min(900px,96%); margin:6px auto 12px; background:rgba(0,0,0,.28);
  padding:12px 14px; border-radius:12px; font-size:14px; line-height:1.45;
}
.topic-grid{
  display:grid; gap:12px; grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  width:min(940px,96%); margin:8px auto 0;
}
.topic-card{
  border:0; border-radius:14px; padding:16px 14px; color:#fff; text-align:left;
  cursor:pointer; letter-spacing:.2px;
  box-shadow:0 10px 18px rgba(0,0,0,.18); transition:transform .15s ease, filter .2s ease;
}
.topic-card:active{ transform:translateY(1px); filter:saturate(.95); }
.t-tutti{     background:linear-gradient(135deg,#84fab0 0%,#8fd3f4 100%); }
.t-historia{  background:linear-gradient(135deg,#ff9a9e 0%,#fecfef 100%); }
.t-geografia{ background:linear-gradient(135deg,#a1c4fd 0%,#c2e9fb 100%); }
.t-deportes{  background:linear-gradient(135deg,#f6d365 0%,#fda085 100%); }
.t-naturaleza{background:linear-gradient(135deg,#b2f7ef 0%,#a0e9ff 100%); }
.t-literatura{background:linear-gradient(135deg,#d4a5ff 0%,#fbc2eb 100%); }

/* Promo block inside game */
.promo{
  width:min(900px,96%); margin:6px auto 0; background:rgba(0,0,0,.28);
  padding:10px 12px; border-radius:12px; font-size:13px; line-height:1.35;
}
.promo .cta-row{ margin-top:0px; display:flex; gap:20px; justify-content:center; flex-wrap:wrap; }

.cta{
  appearance:none; border:0; border-radius:12px; padding:10px 14px;
  cursor:pointer; color:#fff;
  box-shadow:0 8px 16px rgba(0,0,0,.2); transition:transform .12s ease, filter .2s ease;
  margin-top:10px;
}
.cta:active{ transform:translateY(1px) }
.cta-ios{ background:linear-gradient(135deg,#4da3ff,#006bff); }
.cta-android{ background:linear-gradient(135deg,#34d399,#059669); }
.cta a{ color:#fff; text-decoration:none; }

/* Topic icons */
.topic-card { display:flex; align-items:center; gap:10px; }
.topic-icon{
  width:36px; height:36px; border-radius:8px; object-fit:cover;
  box-shadow:0 4px 10px rgba(0,0,0,.18); flex:0 0 36px;
}
.topic-title{ display:inline-block; line-height:1.1 }
.topic-icon-small{
  width:18px; height:18px; border-radius:4px; object-fit:cover;
  margin-right:6px; vertical-align:middle;
  box-shadow:0 2px 6px rgba(0,0,0,.18);
}

/* Overrides: less bold */
.answer{ font-weight: normal; }
.answer .letter{ font-weight: normal; }
.question{ font-weight: normal; }
.topic-card{ font-weight: normal; }


/* === status chip & badges (added) === */
.status-chip{
  position: fixed;
  bottom: 14px;
  left: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  pointer-events: none;
  z-index: 9000;
  opacity: .92;
  transition: transform .2s ease;
}
.status-chip.bump{ transform: scale(1.05); }

.player.me { position: relative; }
.player.me .pos-badge{
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #222;
  color: #fff;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  border: 2px solid #fff;
}

.avatar-small{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  flex: 0 0 36px;
}


/* === Animación de respuestas: entrada escalonada + sheen + pulso === */
.answers.reveal .answer{
  animation: answerIn 200ms ease-out both;
  animation-delay: calc(var(--i) * 45ms);
}
@keyframes answerIn{
  from{ transform: translateY(6px) scale(.98); opacity:0; box-shadow:0 0 0 rgba(0,0,0,0); }
  to{   transform: translateY(0)  scale(1);    opacity:1; box-shadow:0 8px 14px rgba(0,0,0,.18); }
}
.answers.reveal .answer::after{
  content:""; position:absolute; inset:-2px;
  background: linear-gradient(120deg, transparent 35%, rgba(255,255,255,.25) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: sheen 480ms ease-out 1;
  animation-delay: calc(var(--i) * 45ms + 80ms);
  pointer-events:none;
}
@keyframes sheen{ to{ transform: translateX(120%); } }
.answer.correct, .answer.wrong{ animation: pulse 140ms ease-out; }
@keyframes pulse{
  0%{   transform: scale(1.00); }
  50%{  transform: scale(1.02); }
  100%{ transform: scale(1.00); }
}


/* 4x3 ranking grid on small screens */
@media (max-width: 600px){
  .ranking{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    justify-items: center;
    align-items: start;
    max-width: 100%;
  }
  .ranking .player{
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .avatar-wrap{ width:46px; height:46px; }
  .avatar{ width:46px; height:46px; }
  .player .nick{ font-size: 11px; }
  .player .points{ font-size: 11px; }
}


@media (max-width: 600px){
  .ranking{ padding: 0 !important; margin: 0 !important; }
  .ranking .player{ margin: 0 !important; padding: 0 !important; }
  .player .nick{ margin-top: 2px !important; }
}


/* Floating close (X) button on game screen */
.game-close-btn{
  position: fixed;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 20px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  z-index: 11000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  pointer-events: auto;
}
.game-close-btn:hover{ background: rgba(0,0,0,0.5); }
.game-close-btn:active{ transform: scale(0.98); }
@media (min-width: 768px){
  .game-close-btn{ width: 40px; height: 40px; font-size: 22px; line-height: 40px; }
}
