:root{
  --bg: #07090a;
  --panel: #0b0f12;
  --fg: #e6eef6;
  --muted: #9aa6b2;
  --accent: #0b74de;
  --success: #3bd671;
  --danger: #ff6b4a;
  --maze-size: 480px; /* change this to adjust canvas square size */
}
*{box-sizing:border-box}
html,body{height:100%; overflow:hidden;}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background:linear-gradient(180deg,#050606 0%, #0b0f12 100%);
  color:var(--fg);
  -webkit-user-select:none; user-select:none;
  -webkit-touch-callout:none;
  overscroll-behavior-y: contain; /* prevent pull-to-refresh */
}
a{color:var(--accent)}
/* Starfield background canvas: fixed behind the app */
#starfield{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  z-index:0;
  pointer-events:none;
  background: radial-gradient(ellipse at center, rgba(10,12,14,0.6) 0%, rgba(5,6,7,0.9) 70%);
}
.app{
  max-width:1100px;
  margin:0 auto;
  padding:20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position:relative;
  z-index:1;
}
.topbar{display:flex;align-items:center;justify-content:center;gap:12px;margin-bottom:10px}
.topbar h1{font-weight:600;margin:0;color:var(--fg);text-align:center}

.app h1 {line-height: 20px;}
/* Estadísticas debajo del título */
.stats{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  margin:25px 0 18px 0;
}
.stat{display:flex;flex-direction:column;align-items:center;min-width:64px}
.stat-label{font-size:12px;color:var(--muted);margin-bottom:4px}
.stat-value{font-size:18px;font-weight:600;color:var(--fg)}
.pause-btn{
  background:transparent;border:1px solid rgba(255,255,255,0.04);padding:8px;border-radius:8px;color:var(--fg);cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;
}
.pause-btn[aria-pressed="true"]{ background:linear-gradient(90deg, rgba(255,255,255,0.02), rgba(11,116,222,0.04)); border-color:rgba(11,116,222,0.12);}

/* ensure each control shares available space evenly */
.controls > *{flex:1 1 auto;min-width:80px;text-align:center; margin-top:20px;}

/* labels keep input next to text and centered within their flex slot */
.controls label{display:inline-flex;align-items:center;justify-content:center;gap:8px;cursor:default}

/* make selects a reasonable fixed width while allowing shrink on small screens */
.controls select{width:92px;max-width:40%;padding:6px;border-radius:6px;border:1px solid rgba(255,255,255,0.04);background:transparent;color:var(--fg);appearance:none;-webkit-appearance:none;}

/* New: selectors block sits above the button row and is spaced vertically */
.controls .selectors{
  display:flex;
  gap:12px;
  justify-content:center;
  align-items:center;
  margin-bottom:12px; /* vertical separation from the button row */
  width:100%;
}

.controls .selectors label{ flex:0 1 auto; min-width:120px; }
/* keep buttons centered inside their flex slot */
.controls button{display:inline-block;margin:0 auto}

/* simple switch style */
.switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;user-select:none}
.switch input{display:none}
.switch-track{
  display:inline-flex;align-items:center;justify-content:center;
  padding:6px 10px;border-radius:20px;border:1px solid rgba(255,255,255,0.06);
  background:transparent;color:var(--muted);font-size:14px;
  min-width:110px;text-align:center;
}
.switch input:checked + .switch-track{
  background:linear-gradient(90deg, rgba(11,116,222,0.14), rgba(59,214,113,0.06));
  color:var(--fg);border-color:rgba(11,116,222,0.24);
}

button{padding:8px 10px;border:1px solid rgba(255,255,255,0.06);background:transparent;color:var(--fg);border-radius:8px;cursor:pointer}
button:active{transform:translateY(1px)}
.content{display:flex;gap:28px;align-items:flex-start;justify-content:center}
canvas{
  background: transparent;
  border:1px solid rgba(255,255,255,0.04);
  display:block;
  touch-action:none;
  width:var(--maze-size);
  height:calc(var(--maze-size) + 80px);
  margin-bottom:14px;
}
.legend{color:var(--muted);font-size:13px;line-height:1.4}
.footer{margin-top:35px;color:var(--muted);font-size:13px;text-align:center}
.footer a{color:#ffffff;text-decoration:underline}
/* modal */
.modal.hidden{display:none}
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(2,4,6,0.65);z-index:9999}
.modal-panel{background:var(--panel);padding:16px;border-radius:12px;min-width:260px;max-width:90%;box-shadow:0 8px 30px rgba(0,0,0,0.6);border:1px solid rgba(255,255,255,0.03)}
.modal-actions{display:flex;justify-content:flex-end;margin-top:12px;gap:10px}
.modal button{background:var(--accent);border:none;padding:8px 12px;border-radius:8px;color:white}
/* style cancel button inside modal to be muted / neutral */
.modal-actions #modal-cancel{ background:transparent;color:var(--muted);border:1px solid rgba(255,255,255,0.04) }

/* nueva fila de botones: ocupar ancho completo y repartir espacio entre los tres controles */
.button-row{
  display:flex;
  gap:10px;
  width:100%;
  align-items:center;
  justify-content:space-between;
  margin-top:8px;
}
.button-row > *{ flex:1 1 0; min-width:0; text-align:center; }

/* asegurar que el switch y botones tengan apariencia consistente al ocupar todo el ancho */
.button-row .switch-track{ min-width:0; padding:8px 10px; }
.button-row button{ padding:8px 10px; }

/* responsive */
@media (max-width:700px){
  .content{flex-direction:column;align-items:center}
  .controls{gap:6px}
  /* responsive: use viewport-relative maze size on small screens */
  :root{ --maze-size: 92vw; }
  canvas{width:92vw;height:auto}
}

/* hide install button by default */
.hidden{display:none}