/* ==================================================
   01 · RESET / VARIABLES / BASE
================================================== */
:root{
  --bg-black:#000;
  --red:#ff3b3b;
  --txt:#000;
  --txt2:#666;
  --txt3:#999;
  --soft:#f8f8f8;
  --soft2:#f0f0f0;
  --line:#eee;
  --star:#f5b301;
}

*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

/* hidden gana a cualquier display de más abajo */
[hidden]{ display:none !important; }

body{
  background:var(--bg-black);
  color:var(--txt);
  height:100vh;
  height:100dvh;
  overflow:hidden;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}

html, body{
  -webkit-text-size-adjust: 100%;
}

button, input, textarea{
  font:inherit;
  color:inherit;
}

button{
  cursor:pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible{
  outline:3px solid var(--red);
  outline-offset:2px;
}

/* ==================================================
   APP WINDOW · CORE
================================================== */

.appWindow{
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
}

/* ---------- HEADER ---------- */

.appHeader{
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom:1px solid rgba(0,0,0,0.08);
}

.appLogo{
  background:none;
  border:none;
  padding:0;
  display:flex;
}

.appLogo[hidden]{ display:none; }

.appLogo img{
  height:32px;
  width:auto;
  display:block;
}

.appHeaderActions{
  display:flex;
  align-items:center;
  gap:14px;
  margin-left:auto; /* sin logo (portada) sigue pegado a la derecha */
}

.closeBtn{
  font-size:40px;
  line-height:1;
  background: transparent;
  border: none;
}

.closeBtn[hidden]{ display:none; }

.profileBtn{
  width:34px;
  height:34px;
  border-radius:50%;
  border:2px solid var(--txt);
  background:#fff;
  font-weight:700;
  font-size:15px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.profileBtn svg{ width:18px; height:18px; }

.profileBtn.hasProfile{
  background:var(--txt);
  color:#fff;
}

/* ---------- CONTENT ---------- */

.appContent{
  flex: 1;
  min-height: 0;
}

/* ==================================================
   RESPONSIVE DESKTOP - MOBILE CENTERED
================================================== */

@media (min-width: 768px) {
  body { background: #1a1a1a; }

  #appWindow {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 932px;
    max-height: 100dvh;
    transform: translate(-50%, -50%);
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  }
}

/* ==================================================
   PANTALLAS
================================================== */

.screen{
  height:100%;
  display:flex;
  flex-direction:column;
}

.screenBody{
  flex:1;
  overflow-y:auto;
  padding:32px 30px 30px;
}

.screenBody.center{
  display:flex;
  flex-direction:column;
  justify-content:center;
  text-align:center;
}

.screenFoot{
  flex-shrink:0;
  padding:16px 30px calc(20px + env(safe-area-inset-bottom));
  border-top:1px solid var(--soft2);
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.logo{
  width:180px;
  height:auto;
  display:block;
  margin:0 auto 20px;
}

h2{
  font-size:26px;
  font-weight:700;
  line-height:1.3;
  margin:0 auto 16px;
  max-width:350px;
}

.lead{
  font-size:14px;
  color:var(--txt3);
  line-height:1.6;
  max-width:400px;
  margin:0 auto;
}

.lead a{ color:inherit; }

.fine{
  font-size:12px;
  color:var(--txt3);
  line-height:1.5;
  text-align:center;
}

.sectionTitle{
  font-size:13px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--txt2);
  margin:28px 0 12px;
}

/* ---------- BOTONES ---------- */

.btn{
  width:100%;
  padding:18px;
  border-radius:14px;
  border:none;
  font-size:17px;
  font-weight:700;
  background:var(--soft2);
}

.btnPrimary{
  background:var(--red);
  color:#fff;
  box-shadow:0 4px 12px rgba(255,59,59,0.3);
}

.btnOutline{
  background:#fff;
  border:2px solid var(--txt);
}

.btnText{
  background:transparent;
  color:var(--txt3);
  font-weight:500;
  font-size:15px;
  padding:4px;
}

/* ---------- PESTAÑAS ---------- */

.tabs{
  display:flex;
  gap:12px;
  justify-content:center;
  margin-bottom:20px;
}

.tab{
  padding:10px 24px;
  background:var(--soft2);
  color:var(--txt2);
  border:none;
  border-radius:20px;
  font-size:14px;
  font-weight:600;
}

.tab[aria-current="page"]{
  background:var(--red);
  color:#fff;
  font-weight:700;
}

/* ---------- PROBLEMAS ---------- */

.problemGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.problem{
  padding:22px 12px;
  min-height:124px;
  background:var(--soft);
  border:none;
  border-radius:18px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  font-size:15px;
  font-weight:600;
  line-height:1.3;
  transition:background .2s, color .2s, transform .1s;
}

.problem:active{ transform:scale(.97); }

.problem svg{ width:44px; height:44px; }

.problem[aria-pressed="true"]{
  background:var(--red);
  color:#fff;
  font-weight:700;
}

.problemGrid.shake{ animation:shake .4s; }

@keyframes shake{
  20%,60%{ transform:translateX(-6px); }
  40%,80%{ transform:translateX(6px); }
}

/* ---------- INTERRUPTORES ---------- */

.toggles{
  display:flex;
  gap:12px;
}

.toggle{
  flex:1;
  padding:14px 10px;
  background:var(--soft2);
  border:none;
  border-radius:14px;
  font-size:15px;
  font-weight:600;
  line-height:1.3;
}

.toggle[aria-pressed="true"]{
  background:var(--red);
  color:#fff;
}

/* ---------- FORMULARIOS ---------- */

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:14px;
  text-align:left;
}

.field label{
  font-size:14px;
  font-weight:600;
}

.field label small{
  font-weight:400;
  color:var(--txt3);
}

.field input,
.field textarea{
  width:100%;
  padding:14px;
  border:1px solid #ddd;
  border-radius:12px;
  background:#fff;
  font-size:16px;
}

.field textarea{
  min-height:88px;
  resize:vertical;
}

.fieldRow{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.cuando{
  font-size:14px;
  color:var(--txt2);
  margin:-4px 0 14px;
  display:flex;
  align-items:center;
  gap:10px;
}

.cuando .btnText{
  width:auto;
  padding:0;
  font-size:14px;
  font-weight:600;
  color:var(--txt);
  text-decoration:underline;
  border:none;
  background:none;
}

.cuando[hidden]{ display:none; }

.note{
  background:var(--soft);
  border-radius:14px;
  padding:14px 16px;
  font-size:13px;
  line-height:1.5;
  color:var(--txt2);
  margin-bottom:22px;
  text-align:left;
}

/* ---------- ESTADO ---------- */

.bikeImg{
  width:180px;
  height:auto;
  display:block;
  margin:0 auto 12px;
}

.resumen{
  min-height:120px;
}

.resumen .lead{ margin-bottom:20px; }

.valorar{
  text-align:left;
}

.segRow{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}

.segRow > span{
  width:64px;
  font-weight:600;
  font-size:15px;
}

.seg{
  flex:1;
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  background:var(--soft2);
  border-radius:12px;
  padding:3px;
}

.seg button{
  border:none;
  background:transparent;
  border-radius:9px;
  padding:9px 4px;
  font-size:14px;
  font-weight:600;
  color:var(--txt2);
}

.seg button[aria-pressed="true"]{ color:#fff; }
.seg button[aria-pressed="true"][data-v="1"]{ background:#f44336; }
.seg button[aria-pressed="true"][data-v="2"]{ background:#e0a800; }
.seg button[aria-pressed="true"][data-v="3"]{ background:#4caf50; }

.turnstileBox{
  display:flex;
  justify-content:center;
  margin-top:16px;
  min-height:0;
}

/* ---------- CAMPO CON BOTÓN (QR, UBICACIÓN) ---------- */

.inputBtn{
  display:flex;
  gap:8px;
}

.inputBtn input{ min-width:0; }

.iconBtn{
  flex-shrink:0;
  width:50px;
  border:1px solid #ddd;
  border-radius:12px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
}

.iconBtn svg{ width:24px; height:24px; }

.iconBtn:disabled{ opacity:.4; }

/* ---------- ESCÁNER QR ---------- */

.scanner{
  position:fixed;
  inset:0;
  z-index:5000;
  background:#000;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}

.scanner video{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
}

.scannerMarco{
  position:relative;
  width:min(70vw, 260px);
  aspect-ratio:1;
  border:3px solid #fff;
  border-radius:24px;
  box-shadow:0 0 0 100vmax rgba(0,0,0,.55);
}

.scannerTexto{
  position:relative;
  color:#fff;
  font-weight:600;
  margin-top:24px;
  text-align:center;
  padding:0 30px;
}

.scannerCerrar{
  position:absolute;
  top:calc(16px + env(safe-area-inset-top));
  right:16px;
  font-size:40px;
  line-height:1;
  color:#fff;
  background:none;
  border:none;
}

.scannerManual{
  position:relative;
  margin:20px 24px 0;
  padding:12px 18px;
  border:1px solid #fff;
  border-radius:12px;
  color:#fff;
  background:#222;
  font-size:16px;
}

.biciAyuda{
  color:var(--txt2);
  font-size:13px;
  line-height:1.45;
}

.numeroBiciDialog{
  width:calc(100% - 32px);
  max-width:420px;
  max-height:calc(100dvh - 32px);
  margin:auto;
  padding:24px;
  border:0;
  border-radius:24px;
  color:var(--txt);
  background:#fff;
  overflow-y:auto;
}

.numeroBiciDialog::backdrop{ background:rgba(0,0,0,.65); }
.numeroBiciFoto{
  position:relative;
  width:180px;
  height:180px;
  margin:0 auto 24px;
  border-radius:50%;
  overflow:hidden;
  background:#eee;
}
.numeroBiciFoto img{
  position:absolute;
  width:280%;
  max-width:none;
  height:auto;
  left:-75%;
  top:-129%;
}
.numeroBiciDialog h2{ font-size:26px; line-height:1.15; text-align:center; }
.numeroBiciDialog p{ margin:12px 0 24px; font-size:15px; line-height:1.45; color:var(--txt2); text-align:center; }

.stars{
  position:relative;
  display:inline-block;
  font-size:40px;
  line-height:1;
  letter-spacing:6px;
  color:#ccc;
}

.starsFill{
  position:absolute;
  inset:0 auto 0 0;
  overflow:hidden;
  white-space:nowrap;
  color:var(--star);
}

.ratingValue{
  font-size:20px;
  font-weight:700;
  margin:8px 0 4px;
}

.component{
  display:flex;
  align-items:center;
  gap:14px;
  padding:16px 18px;
  background:var(--soft);
  border-radius:14px;
  margin-bottom:12px;
  text-align:left;
}

.component svg{ width:34px; height:34px; flex-shrink:0; }

.component strong{ display:block; font-size:17px; }

.component span{ font-size:14px; color:var(--txt2); }

.bars{ display:flex; gap:3px; margin-left:auto; }

.bars i{
  width:14px;
  height:22px;
  border-radius:3px;
  background:#e0e0e0;
}

/* ---------- POR QUÉ ---------- */

.porQue{
  margin-top:26px;
  text-align:left;
  font-size:14px;
  line-height:1.6;
  color:var(--txt2);
}

.porQue p{ margin-bottom:12px; }

.porQue strong{ color:var(--txt); }

.porQueEntrada{
  font-size:18px;
  font-weight:700;
  line-height:1.35;
  color:var(--txt);
}

.porQueFin{
  padding-top:12px;
  border-top:1px solid var(--line);
  font-weight:600;
  color:var(--txt);
}

.fuente{
  font-size:12px;
  color:var(--txt3);
}

.fuente a{ color:inherit; }

/* ---------- ENCUESTA DEL SERVICIO ---------- */

.encuesta{
  margin-top:28px;
  padding-top:22px;
  border-top:1px solid var(--line);
}

.encuesta h3{
  font-size:17px;
  font-weight:700;
  line-height:1.35;
  margin-bottom:14px;
  max-width:330px;
  margin-left:auto;
  margin-right:auto;
}

.encuesta .voteRow{ margin-bottom:8px; }

.btnEncuesta{
  max-width:260px;
  margin:6px auto 10px;
  padding:13px;
  font-size:15px;
  background:var(--txt);
  color:#fff;
}

.btnEncuesta:disabled{
  background:var(--soft2);
  color:var(--txt3);
  cursor:default;
}

/* ---------- RESEÑAS ---------- */

.resena{
  padding:12px 0;
  border-top:1px solid var(--line);
  text-align:left;
}

.resenaCab{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
  color:var(--txt2);
}

.resenaCab .cuando{ margin-left:auto; }

.avatar{
  flex-shrink:0;
  width:30px;
  height:30px;
  border-radius:50%;
  background:var(--txt);
  color:#fff;
  font-size:14px;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
}

.avatar.anonimo{
  background:var(--soft2);
  color:var(--txt3);
}

.avatar svg{ width:16px; height:16px; }

.resena .tags{ margin-left:40px; }

.stars.small{
  font-size:18px;
  letter-spacing:2px;
}

.tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
}

.tag{
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
}

.tag.t1{ background:#ffe5e3; color:#b3261e; }
.tag.t2{ background:#fff3cd; color:#7a5b00; }
.tag.t3{ background:#e4f5e6; color:#1e6b2a; }

.voteRow{
  display:flex;
  justify-content:center;
  gap:4px;
}

.voteStar{
  background:none;
  border:none;
  font-size:40px;
  line-height:1;
  padding:2px;
  color:#ccc;
  transition:transform .15s;
}

.voteStar.on{ color:var(--star); }
.voteStar:active{ transform:scale(1.2); }

/* ---------- ANIMACIÓN DE ENTRADA ---------- */

.wtfStagger{
  opacity:0;
  transform:translateY(24px);
  animation:wtfStaggerIn 0.5s ease forwards;
  animation-delay:calc(var(--i, 0) * 0.06s);
}

@keyframes wtfStaggerIn{
  to{ opacity:1; transform:translateY(0); }
}

@media (prefers-reduced-motion: reduce){
  .wtfStagger{ animation:none; opacity:1; transform:none; }
  .problemGrid.shake{ animation:none; }
}

/* ---------- AVISOS ---------- */

.toast{
  position:fixed;
  bottom:120px;
  left:50%;
  transform:translate(-50%, 12px);
  background:#111;
  color:#fff;
  padding:14px 22px;
  border-radius:12px;
  font-weight:600;
  box-shadow:0 10px 30px rgba(0,0,0,0.5);
  z-index:9999;
  max-width:calc(100% - 32px);
  text-align:center;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s, transform .25s;
}

.toast.show{
  opacity:1;
  transform:translate(-50%, 0);
}
